diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index df0453b6d3d6..f0705612d503 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -10329,27 +10329,28 @@ packages: dev: false file:projects/arm-datadog.tgz: - resolution: {integrity: sha512-Mu0ZwZaebu/4yUhSNx7kt4vWKh8U1n8nZxcdcYIJjwPJ8guiqeThOp6d3vsFTFs8j39TnIbN6zkfJH4BxoIKlw==, tarball: file:projects/arm-datadog.tgz} + resolution: {integrity: sha512-Z10P9RO6y7Li7Td8oDSx/mxgbo2jTarZoyB0dPw52L8EdHA0rGVuSl17Vrn9F9Aj7YhEVcelXJebFjwxxHVdow==, tarball: file:projects/arm-datadog.tgz} name: '@rush-temp/arm-datadog' version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 '@azure/identity': 2.0.4 '@microsoft/api-extractor': 7.22.1 - '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - '@rollup/plugin-json': 4.1.0_rollup@1.32.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + '@rollup/plugin-commonjs': 21.0.3_rollup@2.70.1 + '@rollup/plugin-json': 4.1.0_rollup@2.70.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.70.1 + '@rollup/plugin-node-resolve': 13.2.0_rollup@2.70.1 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 - rollup: 1.32.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + rollup: 2.70.1 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.70.1 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.15.4 transitivePeerDependencies: + - '@types/node' - debug - encoding - supports-color @@ -10384,7 +10385,7 @@ packages: dev: false file:projects/arm-datalake-analytics.tgz: - resolution: {integrity: sha512-k2svYF3XklL1EG3I2ychc1nfN8vpJ/Zw/qyBAYP32l5Q/GkHesow+0uczzikvpHCMOEFpX2qnDjSEFZRDil2jg==, tarball: file:projects/arm-datalake-analytics.tgz} + resolution: {integrity: sha512-+htKFj3R6NXBtF5Yb/2VVzU2c1E+9fi+7XAIsrGreH+ATnGFCYgNA5r9yhze4S6ZKvS4bOUftCzk1XmMIKpBzQ==, tarball: file:projects/arm-datalake-analytics.tgz} name: '@rush-temp/arm-datalake-analytics' version: 0.0.0 dependencies: @@ -10393,79 +10394,82 @@ packages: '@microsoft/api-extractor': 7.22.1 '@rollup/plugin-commonjs': 21.0.3_rollup@2.70.1 '@rollup/plugin-json': 4.1.0_rollup@2.70.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@2.70.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@2.70.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.70.1 + '@rollup/plugin-node-resolve': 13.2.0_rollup@2.70.1 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.70.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@2.70.1 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.70.1 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.15.4 transitivePeerDependencies: + - '@types/node' - debug - encoding - supports-color dev: false file:projects/arm-datamigration.tgz: - resolution: {integrity: sha512-CeZIZm5itafVdwULmzvL8KxfsvwTXA66FZ8TjamHR9AlN++67+SEvlgbY7yffbLfaNg/fbAu2G5w+6W4hORhxA==, tarball: file:projects/arm-datamigration.tgz} + resolution: {integrity: sha512-VWRlzlw9qHLqnlqB5qJaLAWfg4F9oqvUzmGu29UaqRBIdMV3JwlqlgbAY6BhQDigcGYySGNV5e/gnyK3yjgNog==, tarball: file:projects/arm-datamigration.tgz} name: '@rush-temp/arm-datamigration' version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 '@azure/identity': 2.0.4 '@microsoft/api-extractor': 7.22.1 - '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - '@rollup/plugin-json': 4.1.0_rollup@1.32.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + '@rollup/plugin-commonjs': 21.0.3_rollup@2.70.1 + '@rollup/plugin-json': 4.1.0_rollup@2.70.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.70.1 + '@rollup/plugin-node-resolve': 13.2.0_rollup@2.70.1 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 - rollup: 1.32.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + rollup: 2.70.1 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.70.1 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.15.4 transitivePeerDependencies: + - '@types/node' - debug - encoding - supports-color dev: false file:projects/arm-deploymentmanager.tgz: - resolution: {integrity: sha512-3qBWLOJC4MIXY97IjYjkIaozKwRv9P74Ylj6t6XAM9mQKBnFZ+hxz6vuB/dnsAnQdlSzd1ZqRmqzrnN2O7Ce+Q==, tarball: file:projects/arm-deploymentmanager.tgz} + resolution: {integrity: sha512-qEwSNomthp4lttQkfZhmZnOYCJVf4mICD3J5JU7HQb4YgV1Li8pcFOUQLT6QPlagTjRWgd1BwNocwfVazgHMBw==, tarball: file:projects/arm-deploymentmanager.tgz} name: '@rush-temp/arm-deploymentmanager' version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 '@azure/identity': 2.0.4 '@microsoft/api-extractor': 7.22.1 - '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - '@rollup/plugin-json': 4.1.0_rollup@1.32.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + '@rollup/plugin-commonjs': 21.0.3_rollup@2.70.1 + '@rollup/plugin-json': 4.1.0_rollup@2.70.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.70.1 + '@rollup/plugin-node-resolve': 13.2.0_rollup@2.70.1 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 - rollup: 1.32.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + rollup: 2.70.1 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.70.1 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.15.4 transitivePeerDependencies: + - '@types/node' - debug - encoding - supports-color dev: false file:projects/arm-desktopvirtualization.tgz: - resolution: {integrity: sha512-bSFk78nXBlqu+Qcuq3tg6k8CEOho44S20tq87GU1Kec3WrT5zv14vem7hf64j5MDdjz9cRi5YQHa9Y439T+TqA==, tarball: file:projects/arm-desktopvirtualization.tgz} + resolution: {integrity: sha512-h2UL1dyc63hoY2aeGrqAS54mZgdexrVPCx+rFnycB4d5YJHBlHwHbOrh2bA5qiTCdFQGkepbedm74t2v/5ElpQ==, tarball: file:projects/arm-desktopvirtualization.tgz} name: '@rush-temp/arm-desktopvirtualization' version: 0.0.0 dependencies: @@ -10474,45 +10478,47 @@ packages: '@microsoft/api-extractor': 7.22.1 '@rollup/plugin-commonjs': 21.0.3_rollup@2.70.1 '@rollup/plugin-json': 4.1.0_rollup@2.70.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@2.70.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@2.70.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.70.1 + '@rollup/plugin-node-resolve': 13.2.0_rollup@2.70.1 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.70.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@2.70.1 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.70.1 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.15.4 transitivePeerDependencies: + - '@types/node' - debug - encoding - supports-color dev: false file:projects/arm-deviceprovisioningservices.tgz: - resolution: {integrity: sha512-+mZUHYK1KgZzdi0Oemfac3JDyIXl7KEo+DXL/ke1sv8VPOx9M+LdFrtoe5L0wRyd63AuUQPY1BD5zCb0vSCncQ==, tarball: file:projects/arm-deviceprovisioningservices.tgz} + resolution: {integrity: sha512-b/2nLVG1BCHXMdqczl4C8sgqTEtn1zSsyxPEDS9G8aBEO8mfAtqzoTfoujkHDqBC/D5G+h0rIMs0k7otXq0smw==, tarball: file:projects/arm-deviceprovisioningservices.tgz} name: '@rush-temp/arm-deviceprovisioningservices' version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 '@azure/identity': 2.0.4 '@microsoft/api-extractor': 7.22.1 - '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - '@rollup/plugin-json': 4.1.0_rollup@1.32.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + '@rollup/plugin-commonjs': 21.0.3_rollup@2.70.1 + '@rollup/plugin-json': 4.1.0_rollup@2.70.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.70.1 + '@rollup/plugin-node-resolve': 13.2.0_rollup@2.70.1 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 - rollup: 1.32.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + rollup: 2.70.1 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.70.1 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.15.4 transitivePeerDependencies: + - '@types/node' - debug - encoding - supports-color @@ -10546,7 +10552,7 @@ packages: dev: false file:projects/arm-devtestlabs.tgz: - resolution: {integrity: sha512-+LGTok5vU7pX/LWuxG4Zk3CsnyHxloE5rY25uVVy43VkQeLHkzk7dp3eDTd8HkhjQg+lNJFnDXGAAWWnSWj6Fg==, tarball: file:projects/arm-devtestlabs.tgz} + resolution: {integrity: sha512-COMNdrasm8+80B7JVw8OCCNLLK199AkNBVNbTm9rtTaQU1mADVydelb22vsrLhRR4liihv56UrKFwMN5iKPOnQ==, tarball: file:projects/arm-devtestlabs.tgz} name: '@rush-temp/arm-devtestlabs' version: 0.0.0 dependencies: @@ -10555,18 +10561,19 @@ packages: '@microsoft/api-extractor': 7.22.1 '@rollup/plugin-commonjs': 21.0.3_rollup@2.70.1 '@rollup/plugin-json': 4.1.0_rollup@2.70.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@2.70.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@2.70.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.70.1 + '@rollup/plugin-node-resolve': 13.2.0_rollup@2.70.1 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.70.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@2.70.1 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.70.1 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.15.4 transitivePeerDependencies: + - '@types/node' - debug - encoding - supports-color diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index 4112823c416a..5f8cdfa727f5 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -10,4 +10,5 @@ https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob-cha https://github.com/Azure/azure-digital-twins/blob/private-preview/Documentation/how-to-manage-routes.md https://docs.microsoft.com/javascript/api/@azure/arm-app?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-dashboard?view=azure-node-preview +https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/udr diff --git a/sdk/datadog/arm-datadog/CHANGELOG.md b/sdk/datadog/arm-datadog/CHANGELOG.md index d6afe648749d..953f02182ed5 100644 --- a/sdk/datadog/arm-datadog/CHANGELOG.md +++ b/sdk/datadog/arm-datadog/CHANGELOG.md @@ -1,14 +1,10 @@ # Release History -## 3.0.1 (Unreleased) +## 3.0.1 (2022-04-18) -### Features Added +**features** -### Breaking Changes - -### Bugs Fixed - -### Other Changes + - bug fix ## 3.0.0 (2022-01-12) diff --git a/sdk/datadog/arm-datadog/LICENSE.txt b/sdk/datadog/arm-datadog/LICENSE.txt deleted file mode 100644 index 2d3163745319..000000000000 --- a/sdk/datadog/arm-datadog/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2021 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. diff --git a/sdk/datadog/arm-datadog/README.md b/sdk/datadog/arm-datadog/README.md index 39b1ed5a8ecd..03ef5900f4e0 100644 --- a/sdk/datadog/arm-datadog/README.md +++ b/sdk/datadog/arm-datadog/README.md @@ -16,6 +16,8 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f - [LTS versions of Node.js](https://nodejs.org/about/releases/) - 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]. @@ -49,8 +51,17 @@ For more information about how to create an Azure AD Application check out [this ```javascript const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); 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 MicrosoftDatadogClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new MicrosoftDatadogClient(credential, subscriptionId); ``` diff --git a/sdk/datadog/arm-datadog/_meta.json b/sdk/datadog/arm-datadog/_meta.json index a72152b43587..7547be0e647b 100644 --- a/sdk/datadog/arm-datadog/_meta.json +++ b/sdk/datadog/arm-datadog/_meta.json @@ -1,7 +1,8 @@ { "commit": "e6a2296d02ec6c4b2c32479198bfbcb9b16ea247", - "readme": "specification/datadog/resource-manager/readme.md", - "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/deviceprovisioningservices/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211217.1", + "readme": "specification\\datadog\\resource-manager\\readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\datadog\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20211217.1" -} + "release_tool": "@azure-tools/js-sdk-release-tools@2.2.6", + "use": "@autorest/typescript@6.0.0-alpha.19.20220408.1" +} \ No newline at end of file diff --git a/sdk/datadog/arm-datadog/api-extractor.json b/sdk/datadog/arm-datadog/api-extractor.json index 902b76208aba..5efc2e6ee162 100644 --- a/sdk/datadog/arm-datadog/api-extractor.json +++ b/sdk/datadog/arm-datadog/api-extractor.json @@ -1,18 +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" }, + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, "dtsRollup": { "enabled": true, "untrimmedFilePath": "", "publicTrimmedFilePath": "./types/arm-datadog.d.ts" }, "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } } } -} +} \ No newline at end of file diff --git a/sdk/datadog/arm-datadog/package.json b/sdk/datadog/arm-datadog/package.json index 816420e49418..a28e001744e5 100644 --- a/sdk/datadog/arm-datadog/package.json +++ b/sdk/datadog/arm-datadog/package.json @@ -11,9 +11,9 @@ "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.5.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -29,13 +29,13 @@ "types": "./types/arm-datadog.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.18.11", - "@rollup/plugin-commonjs": "11.0.2", - "@rollup/plugin-json": "^4.0.0", - "@rollup/plugin-multi-entry": "^3.0.0", - "@rollup/plugin-node-resolve": "^8.0.0", + "@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": "^1.16.3", - "rollup-plugin-sourcemaps": "^0.4.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.2.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", @@ -98,5 +98,21 @@ "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true + "//metadata": { + "constantPaths": [ + { + "path": "src/microsoftDatadogClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-datadog?view=azure-node-preview" + } } diff --git a/sdk/datadog/arm-datadog/rollup.config.js b/sdk/datadog/arm-datadog/rollup.config.js index 9be1955eb7f1..3f89d7309da5 100644 --- a/sdk/datadog/arm-datadog/rollup.config.js +++ b/sdk/datadog/arm-datadog/rollup.config.js @@ -14,62 +14,14 @@ import json from "@rollup/plugin-json"; import nodeBuiltins from "builtin-modules"; -/** - * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. - * - * NOTE: this manual configuration is only needed because OpenTelemetry uses an - * __exportStar downleveled helper function to declare its exports which confuses - * rollup's automatic discovery mechanism. - * - * @returns an object reference that can be `...`'d into your cjs() configuration. - */ -export function openTelemetryCommonJs() { - const namedExports = {}; - - for (const key of [ - "@opentelemetry/api", - "@azure/core-tracing/node_modules/@opentelemetry/api" - ]) { - namedExports[key] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "SpanStatusCode", - "getSpanContext", - "setSpanContext" - ]; - } - - const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; - - for (const version of releasedOpenTelemetryVersions) { - namedExports[ - // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. - `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` - ] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "StatusCode", - "CanonicalCode", - "getSpanContext", - "setSpanContext" - ]; - } - - return namedExports; -} - // #region Warning Handler /** - * A function that can determine whether a rollupwarning should be ignored. If + * 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 ignoreNiseSinonEvalWarnings(warning) { +function ignoreNiseSinonEval(warning) { return ( warning.code === "EVAL" && warning.id && @@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) { ); } -function ignoreChaiCircularDependencyWarnings(warning) { +function ignoreChaiCircularDependency(warning) { return ( warning.code === "CIRCULAR_DEPENDENCY" && warning.importer && warning.importer.includes("node_modules/chai") === true ); } -const warningInhibitors = [ - ignoreChaiCircularDependencyWarnings, - ignoreNiseSinonEvalWarnings -]; +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; /** * Construct a warning handler for the shared rollup configuration @@ -122,22 +71,7 @@ function makeBrowserTestConfig() { nodeResolve({ mainFields: ["module", "browser"] }), - cjs({ - namedExports: { - // Chai's strange internal architecture makes it impossible to statically - // analyze its exports. - chai: [ - "version", - "use", - "util", - "config", - "expect", - "should", - "assert" - ], - ...openTelemetryCommonJs() - } - }), + cjs(), json(), sourcemaps() //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) @@ -173,7 +107,7 @@ export function makeConfig(pkg, options) { ], output: { file: "dist/index.js", format: "cjs", sourcemap: true }, preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve(), cjs()] + plugins: [sourcemaps(), nodeResolve()] }; const config = [baseConfig]; diff --git a/sdk/datadog/arm-datadog/sample.env b/sdk/datadog/arm-datadog/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/datadog/arm-datadog/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/datadog/arm-datadog/samples-dev/marketplaceAgreementsCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..6e3d8672ac30 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsCreateOrUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create Datadog marketplace agreement in the subscription. + * + * @summary Create Datadog marketplace agreement in the subscription. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MarketplaceAgreements_Create.json + */ +async function marketplaceAgreementsCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.marketplaceAgreements.createOrUpdate(); + console.log(result); +} + +marketplaceAgreementsCreateOrUpdate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsListSample.ts b/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsListSample.ts new file mode 100644 index 000000000000..2f234c19076c --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List Datadog marketplace agreements in the subscription. + * + * @summary List Datadog marketplace agreements in the subscription. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MarketplaceAgreements_List.json + */ +async function marketplaceAgreementsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.marketplaceAgreements.list()) { + resArray.push(item); + } + console.log(resArray); +} + +marketplaceAgreementsList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsCreateSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsCreateSample.ts new file mode 100644 index 000000000000..3bb76fbaf0d6 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/monitorsCreateSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create a monitor resource. + * + * @summary Create a monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Create.json + */ +async function monitorsCreate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.beginCreateAndWait( + resourceGroupName, + monitorName + ); + console.log(result); +} + +monitorsCreate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsDeleteSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsDeleteSample.ts new file mode 100644 index 000000000000..a4cef63203f2 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/monitorsDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete a monitor resource. + * + * @summary Delete a monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Delete.json + */ +async function monitorsDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.beginDeleteAndWait( + resourceGroupName, + monitorName + ); + console.log(result); +} + +monitorsDelete().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsGetDefaultKeySample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsGetDefaultKeySample.ts new file mode 100644 index 000000000000..aa26fb425991 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/monitorsGetDefaultKeySample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the default api key. + * + * @summary Get the default api key. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_GetDefaultKey.json + */ +async function monitorsGetDefaultKey() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.getDefaultKey( + resourceGroupName, + monitorName + ); + console.log(result); +} + +monitorsGetDefaultKey().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsGetSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsGetSample.ts new file mode 100644 index 000000000000..a6eb24e4a7e2 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/monitorsGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the properties of a specific monitor resource. + * + * @summary Get the properties of a specific monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Get.json + */ +async function monitorsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.get(resourceGroupName, monitorName); + console.log(result); +} + +monitorsGet().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsListApiKeysSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsListApiKeysSample.ts new file mode 100644 index 000000000000..217f8d669805 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/monitorsListApiKeysSample.ts @@ -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. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the api keys for a given monitor resource. + * + * @summary List the api keys for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_List.json + */ +async function monitorsListApiKeys() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listApiKeys( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListApiKeys().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsListByResourceGroupSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsListByResourceGroupSample.ts new file mode 100644 index 000000000000..42ba187e66f7 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/monitorsListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all monitors under the specified resource group. + * + * @summary List all monitors under the specified resource group. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_ListByResourceGroup.json + */ +async function monitorsListByResourceGroup() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListByResourceGroup().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsListHostsSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsListHostsSample.ts new file mode 100644 index 000000000000..02a9d9e7b90a --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/monitorsListHostsSample.ts @@ -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. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the hosts for a given monitor resource. + * + * @summary List the hosts for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Hosts_List.json + */ +async function monitorsListHosts() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listHosts( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListHosts().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsListLinkedResourcesSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsListLinkedResourcesSample.ts new file mode 100644 index 000000000000..48edbb4a9974 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/monitorsListLinkedResourcesSample.ts @@ -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. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all Azure resources associated to the same Datadog organization as the target resource. + * + * @summary List all Azure resources associated to the same Datadog organization as the target resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/LinkedResources_List.json + */ +async function monitorsListLinkedResources() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listLinkedResources( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListLinkedResources().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsListMonitoredResourcesSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsListMonitoredResourcesSample.ts new file mode 100644 index 000000000000..95888e1dce9a --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/monitorsListMonitoredResourcesSample.ts @@ -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. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the resources currently being monitored by the Datadog monitor resource. + * + * @summary List the resources currently being monitored by the Datadog monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MonitoredResources_List.json + */ +async function monitorsListMonitoredResources() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listMonitoredResources( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListMonitoredResources().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsListSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsListSample.ts new file mode 100644 index 000000000000..a8906d8d7e55 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/monitorsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all monitors under the specified subscription. + * + * @summary List all monitors under the specified subscription. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_List.json + */ +async function monitorsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.list()) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsRefreshSetPasswordLinkSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsRefreshSetPasswordLinkSample.ts new file mode 100644 index 000000000000..32f3ee57f8b6 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/monitorsRefreshSetPasswordLinkSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Refresh the set password link and return a latest one. + * + * @summary Refresh the set password link and return a latest one. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/RefreshSetPassword_Get.json + */ +async function monitorsRefreshSetPasswordLink() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.refreshSetPasswordLink( + resourceGroupName, + monitorName + ); + console.log(result); +} + +monitorsRefreshSetPasswordLink().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsSetDefaultKeySample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsSetDefaultKeySample.ts new file mode 100644 index 000000000000..f7a09d8150d2 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/monitorsSetDefaultKeySample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Set the default api key. + * + * @summary Set the default api key. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_SetDefaultKey.json + */ +async function monitorsSetDefaultKey() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.setDefaultKey( + resourceGroupName, + monitorName + ); + console.log(result); +} + +monitorsSetDefaultKey().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsUpdateSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsUpdateSample.ts new file mode 100644 index 000000000000..82868fbe16cc --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/monitorsUpdateSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a monitor resource. + * + * @summary Update a monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Update.json + */ +async function monitorsUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.beginUpdateAndWait( + resourceGroupName, + monitorName + ); + console.log(result); +} + +monitorsUpdate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/operationsListSample.ts b/sdk/datadog/arm-datadog/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..0309b747a3b8 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/operationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. + * + * @summary List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Operations_List.json + */ +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..967b332ebdd1 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsCreateOrUpdateSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Configures single-sign-on for this resource. + * + * @summary Configures single-sign-on for this resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_CreateOrUpdate.json + */ +async function singleSignOnConfigurationsCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.singleSignOnConfigurations.beginCreateOrUpdateAndWait( + resourceGroupName, + monitorName, + configurationName + ); + console.log(result); +} + +singleSignOnConfigurationsCreateOrUpdate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsGetSample.ts b/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsGetSample.ts new file mode 100644 index 000000000000..7197a7b68f6f --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the datadog single sign-on resource for the given Monitor. + * + * @summary Gets the datadog single sign-on resource for the given Monitor. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_Get.json + */ +async function singleSignOnConfigurationsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.singleSignOnConfigurations.get( + resourceGroupName, + monitorName, + configurationName + ); + console.log(result); +} + +singleSignOnConfigurationsGet().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsListSample.ts b/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsListSample.ts new file mode 100644 index 000000000000..da6153cb1f3b --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsListSample.ts @@ -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. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the single sign-on configurations for a given monitor resource. + * + * @summary List the single sign-on configurations for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_List.json + */ +async function singleSignOnConfigurationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.singleSignOnConfigurations.list( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +singleSignOnConfigurationsList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/tagRulesCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples-dev/tagRulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..0aab0ea14f19 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/tagRulesCreateOrUpdateSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update a tag rule set for a given monitor resource. + * + * @summary Create or update a tag rule set for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_CreateOrUpdate.json + */ +async function tagRulesCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const ruleSetName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.tagRules.createOrUpdate( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +tagRulesCreateOrUpdate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/tagRulesGetSample.ts b/sdk/datadog/arm-datadog/samples-dev/tagRulesGetSample.ts new file mode 100644 index 000000000000..8003343111c4 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/tagRulesGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a tag rule set for a given monitor resource. + * + * @summary Get a tag rule set for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_Get.json + */ +async function tagRulesGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const ruleSetName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.tagRules.get( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +tagRulesGet().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/tagRulesListSample.ts b/sdk/datadog/arm-datadog/samples-dev/tagRulesListSample.ts new file mode 100644 index 000000000000..a8c6ca77a86e --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/tagRulesListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the tag rules for a given monitor resource. + * + * @summary List the tag rules for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_List.json + */ +async function tagRulesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tagRules.list(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +tagRulesList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/README.md b/sdk/datadog/arm-datadog/samples/v3/javascript/README.md new file mode 100644 index 000000000000..6c47a1c36329 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/README.md @@ -0,0 +1,92 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [marketplaceAgreementsCreateOrUpdateSample.js][marketplaceagreementscreateorupdatesample] | Create Datadog marketplace agreement in the subscription. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MarketplaceAgreements_Create.json | +| [marketplaceAgreementsListSample.js][marketplaceagreementslistsample] | List Datadog marketplace agreements in the subscription. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MarketplaceAgreements_List.json | +| [monitorsCreateSample.js][monitorscreatesample] | Create a monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Create.json | +| [monitorsDeleteSample.js][monitorsdeletesample] | Delete a monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Delete.json | +| [monitorsGetDefaultKeySample.js][monitorsgetdefaultkeysample] | Get the default api key. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_GetDefaultKey.json | +| [monitorsGetSample.js][monitorsgetsample] | Get the properties of a specific monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Get.json | +| [monitorsListApiKeysSample.js][monitorslistapikeyssample] | List the api keys for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_List.json | +| [monitorsListByResourceGroupSample.js][monitorslistbyresourcegroupsample] | List all monitors under the specified resource group. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_ListByResourceGroup.json | +| [monitorsListHostsSample.js][monitorslisthostssample] | List the hosts for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Hosts_List.json | +| [monitorsListLinkedResourcesSample.js][monitorslistlinkedresourcessample] | List all Azure resources associated to the same Datadog organization as the target resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/LinkedResources_List.json | +| [monitorsListMonitoredResourcesSample.js][monitorslistmonitoredresourcessample] | List the resources currently being monitored by the Datadog monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MonitoredResources_List.json | +| [monitorsListSample.js][monitorslistsample] | List all monitors under the specified subscription. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_List.json | +| [monitorsRefreshSetPasswordLinkSample.js][monitorsrefreshsetpasswordlinksample] | Refresh the set password link and return a latest one. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/RefreshSetPassword_Get.json | +| [monitorsSetDefaultKeySample.js][monitorssetdefaultkeysample] | Set the default api key. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_SetDefaultKey.json | +| [monitorsUpdateSample.js][monitorsupdatesample] | Update a monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Update.json | +| [operationsListSample.js][operationslistsample] | List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Operations_List.json | +| [singleSignOnConfigurationsCreateOrUpdateSample.js][singlesignonconfigurationscreateorupdatesample] | Configures single-sign-on for this resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_CreateOrUpdate.json | +| [singleSignOnConfigurationsGetSample.js][singlesignonconfigurationsgetsample] | Gets the datadog single sign-on resource for the given Monitor. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_Get.json | +| [singleSignOnConfigurationsListSample.js][singlesignonconfigurationslistsample] | List the single sign-on configurations for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_List.json | +| [tagRulesCreateOrUpdateSample.js][tagrulescreateorupdatesample] | Create or update a tag rule set for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_CreateOrUpdate.json | +| [tagRulesGetSample.js][tagrulesgetsample] | Get a tag rule set for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_Get.json | +| [tagRulesListSample.js][tagruleslistsample] | List the tag rules for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_List.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +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 marketplaceAgreementsCreateOrUpdateSample.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 node marketplaceAgreementsCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[marketplaceagreementscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsCreateOrUpdateSample.js +[marketplaceagreementslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsListSample.js +[monitorscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsCreateSample.js +[monitorsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsDeleteSample.js +[monitorsgetdefaultkeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetDefaultKeySample.js +[monitorsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetSample.js +[monitorslistapikeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListApiKeysSample.js +[monitorslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListByResourceGroupSample.js +[monitorslisthostssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListHostsSample.js +[monitorslistlinkedresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListLinkedResourcesSample.js +[monitorslistmonitoredresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListMonitoredResourcesSample.js +[monitorslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListSample.js +[monitorsrefreshsetpasswordlinksample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsRefreshSetPasswordLinkSample.js +[monitorssetdefaultkeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsSetDefaultKeySample.js +[monitorsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsUpdateSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/operationsListSample.js +[singlesignonconfigurationscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsCreateOrUpdateSample.js +[singlesignonconfigurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsGetSample.js +[singlesignonconfigurationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsListSample.js +[tagrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesCreateOrUpdateSample.js +[tagrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesGetSample.js +[tagruleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesListSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-datadog?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datadog/arm-datadog/README.md diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsCreateOrUpdateSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsCreateOrUpdateSample.js new file mode 100644 index 000000000000..5f2883438136 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsCreateOrUpdateSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create Datadog marketplace agreement in the subscription. + * + * @summary Create Datadog marketplace agreement in the subscription. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MarketplaceAgreements_Create.json + */ +async function marketplaceAgreementsCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.marketplaceAgreements.createOrUpdate(); + console.log(result); +} + +marketplaceAgreementsCreateOrUpdate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsListSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsListSample.js new file mode 100644 index 000000000000..e7064e05096b --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List Datadog marketplace agreements in the subscription. + * + * @summary List Datadog marketplace agreements in the subscription. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MarketplaceAgreements_List.json + */ +async function marketplaceAgreementsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.marketplaceAgreements.list()) { + resArray.push(item); + } + console.log(resArray); +} + +marketplaceAgreementsList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsCreateSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsCreateSample.js new file mode 100644 index 000000000000..92228320c9c2 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsCreateSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create a monitor resource. + * + * @summary Create a monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Create.json + */ +async function monitorsCreate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.beginCreateAndWait(resourceGroupName, monitorName); + console.log(result); +} + +monitorsCreate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsDeleteSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsDeleteSample.js new file mode 100644 index 000000000000..c6fd3c9b9a87 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsDeleteSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete a monitor resource. + * + * @summary Delete a monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Delete.json + */ +async function monitorsDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.beginDeleteAndWait(resourceGroupName, monitorName); + console.log(result); +} + +monitorsDelete().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetDefaultKeySample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetDefaultKeySample.js new file mode 100644 index 000000000000..5397d1761237 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetDefaultKeySample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get the default api key. + * + * @summary Get the default api key. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_GetDefaultKey.json + */ +async function monitorsGetDefaultKey() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.getDefaultKey(resourceGroupName, monitorName); + console.log(result); +} + +monitorsGetDefaultKey().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetSample.js new file mode 100644 index 000000000000..d746307b0a8a --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get the properties of a specific monitor resource. + * + * @summary Get the properties of a specific monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Get.json + */ +async function monitorsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.get(resourceGroupName, monitorName); + console.log(result); +} + +monitorsGet().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListApiKeysSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListApiKeysSample.js new file mode 100644 index 000000000000..6a6260fdce81 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListApiKeysSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List the api keys for a given monitor resource. + * + * @summary List the api keys for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_List.json + */ +async function monitorsListApiKeys() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listApiKeys(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListApiKeys().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListByResourceGroupSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListByResourceGroupSample.js new file mode 100644 index 000000000000..f9c0c8d63dfa --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListByResourceGroupSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List all monitors under the specified resource group. + * + * @summary List all monitors under the specified resource group. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_ListByResourceGroup.json + */ +async function monitorsListByResourceGroup() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListByResourceGroup().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListHostsSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListHostsSample.js new file mode 100644 index 000000000000..911364e1e04d --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListHostsSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List the hosts for a given monitor resource. + * + * @summary List the hosts for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Hosts_List.json + */ +async function monitorsListHosts() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listHosts(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListHosts().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListLinkedResourcesSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListLinkedResourcesSample.js new file mode 100644 index 000000000000..84cc9738c9e8 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListLinkedResourcesSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List all Azure resources associated to the same Datadog organization as the target resource. + * + * @summary List all Azure resources associated to the same Datadog organization as the target resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/LinkedResources_List.json + */ +async function monitorsListLinkedResources() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listLinkedResources(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListLinkedResources().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListMonitoredResourcesSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListMonitoredResourcesSample.js new file mode 100644 index 000000000000..4fa29bd5696f --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListMonitoredResourcesSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List the resources currently being monitored by the Datadog monitor resource. + * + * @summary List the resources currently being monitored by the Datadog monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MonitoredResources_List.json + */ +async function monitorsListMonitoredResources() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listMonitoredResources(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListMonitoredResources().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListSample.js new file mode 100644 index 000000000000..fed112755a35 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List all monitors under the specified subscription. + * + * @summary List all monitors under the specified subscription. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_List.json + */ +async function monitorsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.list()) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsRefreshSetPasswordLinkSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsRefreshSetPasswordLinkSample.js new file mode 100644 index 000000000000..a3e2f5581c56 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsRefreshSetPasswordLinkSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Refresh the set password link and return a latest one. + * + * @summary Refresh the set password link and return a latest one. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/RefreshSetPassword_Get.json + */ +async function monitorsRefreshSetPasswordLink() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.refreshSetPasswordLink(resourceGroupName, monitorName); + console.log(result); +} + +monitorsRefreshSetPasswordLink().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsSetDefaultKeySample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsSetDefaultKeySample.js new file mode 100644 index 000000000000..03997397b631 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsSetDefaultKeySample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Set the default api key. + * + * @summary Set the default api key. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_SetDefaultKey.json + */ +async function monitorsSetDefaultKey() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.setDefaultKey(resourceGroupName, monitorName); + console.log(result); +} + +monitorsSetDefaultKey().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsUpdateSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsUpdateSample.js new file mode 100644 index 000000000000..0957243b822d --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsUpdateSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update a monitor resource. + * + * @summary Update a monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Update.json + */ +async function monitorsUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.beginUpdateAndWait(resourceGroupName, monitorName); + console.log(result); +} + +monitorsUpdate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/operationsListSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/operationsListSample.js new file mode 100644 index 000000000000..f92926ffa226 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/operationsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. + * + * @summary List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Operations_List.json + */ +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/package.json b/sdk/datadog/arm-datadog/samples/v3/javascript/package.json new file mode 100644 index 000000000000..89363a175a5f --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-datadog-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/datadog/arm-datadog" + }, + "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/datadog/arm-datadog", + "dependencies": { + "@azure/arm-datadog": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/sample.env b/sdk/datadog/arm-datadog/samples/v3/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/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/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsCreateOrUpdateSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsCreateOrUpdateSample.js new file mode 100644 index 000000000000..cf09c74f0cdf --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsCreateOrUpdateSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Configures single-sign-on for this resource. + * + * @summary Configures single-sign-on for this resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_CreateOrUpdate.json + */ +async function singleSignOnConfigurationsCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.singleSignOnConfigurations.beginCreateOrUpdateAndWait( + resourceGroupName, + monitorName, + configurationName + ); + console.log(result); +} + +singleSignOnConfigurationsCreateOrUpdate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsGetSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsGetSample.js new file mode 100644 index 000000000000..c2d525d1d04c --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the datadog single sign-on resource for the given Monitor. + * + * @summary Gets the datadog single sign-on resource for the given Monitor. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_Get.json + */ +async function singleSignOnConfigurationsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.singleSignOnConfigurations.get( + resourceGroupName, + monitorName, + configurationName + ); + console.log(result); +} + +singleSignOnConfigurationsGet().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsListSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsListSample.js new file mode 100644 index 000000000000..f671fc6518b6 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List the single sign-on configurations for a given monitor resource. + * + * @summary List the single sign-on configurations for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_List.json + */ +async function singleSignOnConfigurationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.singleSignOnConfigurations.list(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +singleSignOnConfigurationsList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesCreateOrUpdateSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesCreateOrUpdateSample.js new file mode 100644 index 000000000000..367f542ff6f6 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesCreateOrUpdateSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or update a tag rule set for a given monitor resource. + * + * @summary Create or update a tag rule set for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_CreateOrUpdate.json + */ +async function tagRulesCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const ruleSetName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.tagRules.createOrUpdate(resourceGroupName, monitorName, ruleSetName); + console.log(result); +} + +tagRulesCreateOrUpdate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesGetSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesGetSample.js new file mode 100644 index 000000000000..80ef8181a326 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get a tag rule set for a given monitor resource. + * + * @summary Get a tag rule set for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_Get.json + */ +async function tagRulesGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const ruleSetName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.tagRules.get(resourceGroupName, monitorName, ruleSetName); + console.log(result); +} + +tagRulesGet().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesListSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesListSample.js new file mode 100644 index 000000000000..543bbb8b0359 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List the tag rules for a given monitor resource. + * + * @summary List the tag rules for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_List.json + */ +async function tagRulesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tagRules.list(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +tagRulesList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/README.md b/sdk/datadog/arm-datadog/samples/v3/typescript/README.md new file mode 100644 index 000000000000..cccee19fea7f --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/README.md @@ -0,0 +1,105 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [marketplaceAgreementsCreateOrUpdateSample.ts][marketplaceagreementscreateorupdatesample] | Create Datadog marketplace agreement in the subscription. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MarketplaceAgreements_Create.json | +| [marketplaceAgreementsListSample.ts][marketplaceagreementslistsample] | List Datadog marketplace agreements in the subscription. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MarketplaceAgreements_List.json | +| [monitorsCreateSample.ts][monitorscreatesample] | Create a monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Create.json | +| [monitorsDeleteSample.ts][monitorsdeletesample] | Delete a monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Delete.json | +| [monitorsGetDefaultKeySample.ts][monitorsgetdefaultkeysample] | Get the default api key. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_GetDefaultKey.json | +| [monitorsGetSample.ts][monitorsgetsample] | Get the properties of a specific monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Get.json | +| [monitorsListApiKeysSample.ts][monitorslistapikeyssample] | List the api keys for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_List.json | +| [monitorsListByResourceGroupSample.ts][monitorslistbyresourcegroupsample] | List all monitors under the specified resource group. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_ListByResourceGroup.json | +| [monitorsListHostsSample.ts][monitorslisthostssample] | List the hosts for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Hosts_List.json | +| [monitorsListLinkedResourcesSample.ts][monitorslistlinkedresourcessample] | List all Azure resources associated to the same Datadog organization as the target resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/LinkedResources_List.json | +| [monitorsListMonitoredResourcesSample.ts][monitorslistmonitoredresourcessample] | List the resources currently being monitored by the Datadog monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MonitoredResources_List.json | +| [monitorsListSample.ts][monitorslistsample] | List all monitors under the specified subscription. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_List.json | +| [monitorsRefreshSetPasswordLinkSample.ts][monitorsrefreshsetpasswordlinksample] | Refresh the set password link and return a latest one. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/RefreshSetPassword_Get.json | +| [monitorsSetDefaultKeySample.ts][monitorssetdefaultkeysample] | Set the default api key. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_SetDefaultKey.json | +| [monitorsUpdateSample.ts][monitorsupdatesample] | Update a monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Update.json | +| [operationsListSample.ts][operationslistsample] | List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Operations_List.json | +| [singleSignOnConfigurationsCreateOrUpdateSample.ts][singlesignonconfigurationscreateorupdatesample] | Configures single-sign-on for this resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_CreateOrUpdate.json | +| [singleSignOnConfigurationsGetSample.ts][singlesignonconfigurationsgetsample] | Gets the datadog single sign-on resource for the given Monitor. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_Get.json | +| [singleSignOnConfigurationsListSample.ts][singlesignonconfigurationslistsample] | List the single sign-on configurations for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_List.json | +| [tagRulesCreateOrUpdateSample.ts][tagrulescreateorupdatesample] | Create or update a tag rule set for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_CreateOrUpdate.json | +| [tagRulesGetSample.ts][tagrulesgetsample] | Get a tag rule set for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_Get.json | +| [tagRulesListSample.ts][tagruleslistsample] | List the tag rules for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_List.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +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/marketplaceAgreementsCreateOrUpdateSample.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 node dist/marketplaceAgreementsCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[marketplaceagreementscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsCreateOrUpdateSample.ts +[marketplaceagreementslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsListSample.ts +[monitorscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsCreateSample.ts +[monitorsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsDeleteSample.ts +[monitorsgetdefaultkeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetDefaultKeySample.ts +[monitorsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetSample.ts +[monitorslistapikeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListApiKeysSample.ts +[monitorslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListByResourceGroupSample.ts +[monitorslisthostssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListHostsSample.ts +[monitorslistlinkedresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListLinkedResourcesSample.ts +[monitorslistmonitoredresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListMonitoredResourcesSample.ts +[monitorslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListSample.ts +[monitorsrefreshsetpasswordlinksample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsRefreshSetPasswordLinkSample.ts +[monitorssetdefaultkeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsSetDefaultKeySample.ts +[monitorsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsUpdateSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/operationsListSample.ts +[singlesignonconfigurationscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsCreateOrUpdateSample.ts +[singlesignonconfigurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsGetSample.ts +[singlesignonconfigurationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsListSample.ts +[tagrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesCreateOrUpdateSample.ts +[tagrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesGetSample.ts +[tagruleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesListSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-datadog?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datadog/arm-datadog/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/package.json b/sdk/datadog/arm-datadog/samples/v3/typescript/package.json new file mode 100644 index 000000000000..4f6f49598476 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-datadog-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/datadog/arm-datadog" + }, + "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/datadog/arm-datadog", + "dependencies": { + "@azure/arm-datadog": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/sample.env b/sdk/datadog/arm-datadog/samples/v3/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/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/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..6e3d8672ac30 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsCreateOrUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create Datadog marketplace agreement in the subscription. + * + * @summary Create Datadog marketplace agreement in the subscription. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MarketplaceAgreements_Create.json + */ +async function marketplaceAgreementsCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.marketplaceAgreements.createOrUpdate(); + console.log(result); +} + +marketplaceAgreementsCreateOrUpdate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsListSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsListSample.ts new file mode 100644 index 000000000000..2f234c19076c --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List Datadog marketplace agreements in the subscription. + * + * @summary List Datadog marketplace agreements in the subscription. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MarketplaceAgreements_List.json + */ +async function marketplaceAgreementsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.marketplaceAgreements.list()) { + resArray.push(item); + } + console.log(resArray); +} + +marketplaceAgreementsList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsCreateSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsCreateSample.ts new file mode 100644 index 000000000000..3bb76fbaf0d6 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsCreateSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create a monitor resource. + * + * @summary Create a monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Create.json + */ +async function monitorsCreate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.beginCreateAndWait( + resourceGroupName, + monitorName + ); + console.log(result); +} + +monitorsCreate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsDeleteSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsDeleteSample.ts new file mode 100644 index 000000000000..a4cef63203f2 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete a monitor resource. + * + * @summary Delete a monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Delete.json + */ +async function monitorsDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.beginDeleteAndWait( + resourceGroupName, + monitorName + ); + console.log(result); +} + +monitorsDelete().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetDefaultKeySample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetDefaultKeySample.ts new file mode 100644 index 000000000000..aa26fb425991 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetDefaultKeySample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the default api key. + * + * @summary Get the default api key. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_GetDefaultKey.json + */ +async function monitorsGetDefaultKey() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.getDefaultKey( + resourceGroupName, + monitorName + ); + console.log(result); +} + +monitorsGetDefaultKey().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetSample.ts new file mode 100644 index 000000000000..a6eb24e4a7e2 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the properties of a specific monitor resource. + * + * @summary Get the properties of a specific monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Get.json + */ +async function monitorsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.get(resourceGroupName, monitorName); + console.log(result); +} + +monitorsGet().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListApiKeysSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListApiKeysSample.ts new file mode 100644 index 000000000000..217f8d669805 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListApiKeysSample.ts @@ -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. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the api keys for a given monitor resource. + * + * @summary List the api keys for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_List.json + */ +async function monitorsListApiKeys() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listApiKeys( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListApiKeys().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListByResourceGroupSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListByResourceGroupSample.ts new file mode 100644 index 000000000000..42ba187e66f7 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all monitors under the specified resource group. + * + * @summary List all monitors under the specified resource group. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_ListByResourceGroup.json + */ +async function monitorsListByResourceGroup() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListByResourceGroup().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListHostsSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListHostsSample.ts new file mode 100644 index 000000000000..02a9d9e7b90a --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListHostsSample.ts @@ -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. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the hosts for a given monitor resource. + * + * @summary List the hosts for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Hosts_List.json + */ +async function monitorsListHosts() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listHosts( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListHosts().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListLinkedResourcesSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListLinkedResourcesSample.ts new file mode 100644 index 000000000000..48edbb4a9974 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListLinkedResourcesSample.ts @@ -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. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all Azure resources associated to the same Datadog organization as the target resource. + * + * @summary List all Azure resources associated to the same Datadog organization as the target resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/LinkedResources_List.json + */ +async function monitorsListLinkedResources() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listLinkedResources( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListLinkedResources().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListMonitoredResourcesSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListMonitoredResourcesSample.ts new file mode 100644 index 000000000000..95888e1dce9a --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListMonitoredResourcesSample.ts @@ -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. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the resources currently being monitored by the Datadog monitor resource. + * + * @summary List the resources currently being monitored by the Datadog monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/MonitoredResources_List.json + */ +async function monitorsListMonitoredResources() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listMonitoredResources( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsListMonitoredResources().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListSample.ts new file mode 100644 index 000000000000..a8906d8d7e55 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all monitors under the specified subscription. + * + * @summary List all monitors under the specified subscription. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_List.json + */ +async function monitorsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.list()) { + resArray.push(item); + } + console.log(resArray); +} + +monitorsList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsRefreshSetPasswordLinkSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsRefreshSetPasswordLinkSample.ts new file mode 100644 index 000000000000..32f3ee57f8b6 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsRefreshSetPasswordLinkSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Refresh the set password link and return a latest one. + * + * @summary Refresh the set password link and return a latest one. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/RefreshSetPassword_Get.json + */ +async function monitorsRefreshSetPasswordLink() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.refreshSetPasswordLink( + resourceGroupName, + monitorName + ); + console.log(result); +} + +monitorsRefreshSetPasswordLink().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsSetDefaultKeySample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsSetDefaultKeySample.ts new file mode 100644 index 000000000000..f7a09d8150d2 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsSetDefaultKeySample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Set the default api key. + * + * @summary Set the default api key. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/ApiKeys_SetDefaultKey.json + */ +async function monitorsSetDefaultKey() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.setDefaultKey( + resourceGroupName, + monitorName + ); + console.log(result); +} + +monitorsSetDefaultKey().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsUpdateSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsUpdateSample.ts new file mode 100644 index 000000000000..82868fbe16cc --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsUpdateSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a monitor resource. + * + * @summary Update a monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Update.json + */ +async function monitorsUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.monitors.beginUpdateAndWait( + resourceGroupName, + monitorName + ); + console.log(result); +} + +monitorsUpdate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/operationsListSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..0309b747a3b8 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/operationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. + * + * @summary List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Operations_List.json + */ +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..967b332ebdd1 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsCreateOrUpdateSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Configures single-sign-on for this resource. + * + * @summary Configures single-sign-on for this resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_CreateOrUpdate.json + */ +async function singleSignOnConfigurationsCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.singleSignOnConfigurations.beginCreateOrUpdateAndWait( + resourceGroupName, + monitorName, + configurationName + ); + console.log(result); +} + +singleSignOnConfigurationsCreateOrUpdate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsGetSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsGetSample.ts new file mode 100644 index 000000000000..7197a7b68f6f --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the datadog single sign-on resource for the given Monitor. + * + * @summary Gets the datadog single sign-on resource for the given Monitor. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_Get.json + */ +async function singleSignOnConfigurationsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.singleSignOnConfigurations.get( + resourceGroupName, + monitorName, + configurationName + ); + console.log(result); +} + +singleSignOnConfigurationsGet().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsListSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsListSample.ts new file mode 100644 index 000000000000..da6153cb1f3b --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsListSample.ts @@ -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. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the single sign-on configurations for a given monitor resource. + * + * @summary List the single sign-on configurations for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_List.json + */ +async function singleSignOnConfigurationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.singleSignOnConfigurations.list( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +singleSignOnConfigurationsList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..0aab0ea14f19 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesCreateOrUpdateSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update a tag rule set for a given monitor resource. + * + * @summary Create or update a tag rule set for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_CreateOrUpdate.json + */ +async function tagRulesCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const ruleSetName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.tagRules.createOrUpdate( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +tagRulesCreateOrUpdate().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesGetSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesGetSample.ts new file mode 100644 index 000000000000..8003343111c4 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a tag rule set for a given monitor resource. + * + * @summary Get a tag rule set for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_Get.json + */ +async function tagRulesGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const ruleSetName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const result = await client.tagRules.get( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +tagRulesGet().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesListSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesListSample.ts new file mode 100644 index 000000000000..a8c6ca77a86e --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the tag rules for a given monitor resource. + * + * @summary List the tag rules for a given monitor resource. + * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_List.json + */ +async function tagRulesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftDatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tagRules.list(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +tagRulesList().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/tsconfig.json b/sdk/datadog/arm-datadog/samples/v3/typescript/tsconfig.json new file mode 100644 index 000000000000..416c2dd82e00 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples/v3/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "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/datadog/arm-datadog/src/microsoftDatadogClient.ts b/sdk/datadog/arm-datadog/src/microsoftDatadogClient.ts index 6127d1be83fd..83a352087e90 100644 --- a/sdk/datadog/arm-datadog/src/microsoftDatadogClient.ts +++ b/sdk/datadog/arm-datadog/src/microsoftDatadogClient.ts @@ -7,6 +7,7 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { MarketplaceAgreementsImpl, @@ -56,7 +57,7 @@ export class MicrosoftDatadogClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-datadog/3.0.0`; + const packageDetails = `azsdk-js-arm-datadog/3.0.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -71,9 +72,33 @@ export class MicrosoftDatadogClient extends coreClient.ServiceClient { userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint || "https://management.azure.com" + baseUri: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + } // Parameter assignments this.subscriptionId = subscriptionId; diff --git a/sdk/datadog/arm-datadog/src/operations/monitors.ts b/sdk/datadog/arm-datadog/src/operations/monitors.ts index 184968f67674..00901d863563 100644 --- a/sdk/datadog/arm-datadog/src/operations/monitors.ts +++ b/sdk/datadog/arm-datadog/src/operations/monitors.ts @@ -650,11 +650,13 @@ export class MonitorsImpl implements Monitors { { resourceGroupName, monitorName, options }, createOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); + await poller.poll(); + return poller; } /** @@ -736,10 +738,12 @@ export class MonitorsImpl implements Monitors { { resourceGroupName, monitorName, options }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -816,10 +820,12 @@ export class MonitorsImpl implements Monitors { { resourceGroupName, monitorName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/datadog/arm-datadog/src/operations/singleSignOnConfigurations.ts b/sdk/datadog/arm-datadog/src/operations/singleSignOnConfigurations.ts index 51ced7d31ed4..cba4c9ae3028 100644 --- a/sdk/datadog/arm-datadog/src/operations/singleSignOnConfigurations.ts +++ b/sdk/datadog/arm-datadog/src/operations/singleSignOnConfigurations.ts @@ -178,11 +178,13 @@ export class SingleSignOnConfigurationsImpl { resourceGroupName, monitorName, configurationName, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); + await poller.poll(); + return poller; } /** diff --git a/sdk/datadog/arm-datadog/tsconfig.json b/sdk/datadog/arm-datadog/tsconfig.json index 6e3251194117..e10856bd8d0b 100644 --- a/sdk/datadog/arm-datadog/tsconfig.json +++ b/sdk/datadog/arm-datadog/tsconfig.json @@ -9,11 +9,25 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true + "importHelpers": true, + "paths": { + "@azure/arm-datadog": [ + "./src/index" + ] + } }, - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "exclude": ["node_modules"] -} + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/datadog/ci.mgmt.yml b/sdk/datadog/ci.mgmt.yml index bf2e28cd4236..3beb7d94587a 100644 --- a/sdk/datadog/ci.mgmt.yml +++ b/sdk/datadog/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -9,7 +9,7 @@ trigger: paths: include: - sdk/datadog/ci.mgmt.yml - - sdk/datadog/arm-datadog/ + - sdk/datadog/arm-datadog pr: branches: include: @@ -22,12 +22,11 @@ pr: paths: include: - sdk/datadog/ci.mgmt.yml - - sdk/datadog/arm-datadog/ - + - sdk/datadog/arm-datadog extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: datadog Artifacts: - name: azure-arm-datadog - safeName: azurearmdatadog \ No newline at end of file + safeName: azurearmdatadog diff --git a/sdk/datalake-analytics/arm-datalake-analytics/CHANGELOG.md b/sdk/datalake-analytics/arm-datalake-analytics/CHANGELOG.md index c69e79445036..9c673c201646 100644 --- a/sdk/datalake-analytics/arm-datalake-analytics/CHANGELOG.md +++ b/sdk/datalake-analytics/arm-datalake-analytics/CHANGELOG.md @@ -1,18 +1,8 @@ # Release History + +## 2.0.0-beta.3 (2022-04-18) -## 2.0.0-beta.3 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 2.0.0-beta.2 (2021-12-23) - -The package of @azure/arm-datalake-analytics is using our next generation design principles since version 2.0.0-beta.2, which contains breaking changes. +The package of @azure/arm-datalake-analytics is using our next generation design principles since version 2.0.0-beta.3, which contains breaking changes. To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). diff --git a/sdk/datalake-analytics/arm-datalake-analytics/LICENSE b/sdk/datalake-analytics/arm-datalake-analytics/LICENSE index ccb63b166732..5d1d36e0af80 100644 --- a/sdk/datalake-analytics/arm-datalake-analytics/LICENSE +++ b/sdk/datalake-analytics/arm-datalake-analytics/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2021 Microsoft +Copyright (c) 2022 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 diff --git a/sdk/datalake-analytics/arm-datalake-analytics/README.md b/sdk/datalake-analytics/arm-datalake-analytics/README.md index 0cb1a7e19b69..a331884f5723 100644 --- a/sdk/datalake-analytics/arm-datalake-analytics/README.md +++ b/sdk/datalake-analytics/arm-datalake-analytics/README.md @@ -16,6 +16,8 @@ Creates an Azure Data Lake Analytics account management client. - [LTS versions of Node.js](https://nodejs.org/about/releases/) - 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]. @@ -49,8 +51,17 @@ For more information about how to create an Azure AD Application check out [this ```javascript const { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); 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 DataLakeAnalyticsAccountManagementClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); ``` diff --git a/sdk/datalake-analytics/arm-datalake-analytics/_meta.json b/sdk/datalake-analytics/arm-datalake-analytics/_meta.json index 0d530cbffd91..4dfc96f697b2 100644 --- a/sdk/datalake-analytics/arm-datalake-analytics/_meta.json +++ b/sdk/datalake-analytics/arm-datalake-analytics/_meta.json @@ -1,7 +1,8 @@ { "commit": "270ba8923ce458af2b59cd66b008355676bccd49", - "readme": "specification/datalake-analytics/resource-manager/readme.md", - "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/datalake-analytics/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211217.1", + "readme": "specification\\datalake-analytics\\resource-manager\\readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\datalake-analytics\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20211217.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.2.6", + "use": "@autorest/typescript@6.0.0-alpha.19.20220408.1" } \ No newline at end of file diff --git a/sdk/datalake-analytics/arm-datalake-analytics/api-extractor.json b/sdk/datalake-analytics/arm-datalake-analytics/api-extractor.json index 050234bc6d5b..278fee732475 100644 --- a/sdk/datalake-analytics/arm-datalake-analytics/api-extractor.json +++ b/sdk/datalake-analytics/arm-datalake-analytics/api-extractor.json @@ -1,18 +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" }, + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, "dtsRollup": { "enabled": true, "untrimmedFilePath": "", "publicTrimmedFilePath": "./types/arm-datalake-analytics.d.ts" }, "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } } } -} +} \ No newline at end of file diff --git a/sdk/datalake-analytics/arm-datalake-analytics/package.json b/sdk/datalake-analytics/arm-datalake-analytics/package.json index 46a9c62c3721..c105536b1bce 100644 --- a/sdk/datalake-analytics/arm-datalake-analytics/package.json +++ b/sdk/datalake-analytics/arm-datalake-analytics/package.json @@ -11,9 +11,9 @@ "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.5.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -30,12 +30,12 @@ "devDependencies": { "@microsoft/api-extractor": "^7.18.11", "@rollup/plugin-commonjs": "^21.0.1", - "@rollup/plugin-json": "^4.0.0", - "@rollup/plugin-multi-entry": "^3.0.0", - "@rollup/plugin-node-resolve": "^8.0.0", + "@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.0.0", - "rollup-plugin-sourcemaps": "^0.4.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.2.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", @@ -98,5 +98,21 @@ "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true -} + "//metadata": { + "constantPaths": [ + { + "path": "src/dataLakeAnalyticsAccountManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-datalake-analytics?view=azure-node-preview" + } +} \ No newline at end of file diff --git a/sdk/datalake-analytics/arm-datalake-analytics/rollup.config.js b/sdk/datalake-analytics/arm-datalake-analytics/rollup.config.js index 9be1955eb7f1..3f89d7309da5 100644 --- a/sdk/datalake-analytics/arm-datalake-analytics/rollup.config.js +++ b/sdk/datalake-analytics/arm-datalake-analytics/rollup.config.js @@ -14,62 +14,14 @@ import json from "@rollup/plugin-json"; import nodeBuiltins from "builtin-modules"; -/** - * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. - * - * NOTE: this manual configuration is only needed because OpenTelemetry uses an - * __exportStar downleveled helper function to declare its exports which confuses - * rollup's automatic discovery mechanism. - * - * @returns an object reference that can be `...`'d into your cjs() configuration. - */ -export function openTelemetryCommonJs() { - const namedExports = {}; - - for (const key of [ - "@opentelemetry/api", - "@azure/core-tracing/node_modules/@opentelemetry/api" - ]) { - namedExports[key] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "SpanStatusCode", - "getSpanContext", - "setSpanContext" - ]; - } - - const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; - - for (const version of releasedOpenTelemetryVersions) { - namedExports[ - // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. - `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` - ] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "StatusCode", - "CanonicalCode", - "getSpanContext", - "setSpanContext" - ]; - } - - return namedExports; -} - // #region Warning Handler /** - * A function that can determine whether a rollupwarning should be ignored. If + * 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 ignoreNiseSinonEvalWarnings(warning) { +function ignoreNiseSinonEval(warning) { return ( warning.code === "EVAL" && warning.id && @@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) { ); } -function ignoreChaiCircularDependencyWarnings(warning) { +function ignoreChaiCircularDependency(warning) { return ( warning.code === "CIRCULAR_DEPENDENCY" && warning.importer && warning.importer.includes("node_modules/chai") === true ); } -const warningInhibitors = [ - ignoreChaiCircularDependencyWarnings, - ignoreNiseSinonEvalWarnings -]; +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; /** * Construct a warning handler for the shared rollup configuration @@ -122,22 +71,7 @@ function makeBrowserTestConfig() { nodeResolve({ mainFields: ["module", "browser"] }), - cjs({ - namedExports: { - // Chai's strange internal architecture makes it impossible to statically - // analyze its exports. - chai: [ - "version", - "use", - "util", - "config", - "expect", - "should", - "assert" - ], - ...openTelemetryCommonJs() - } - }), + cjs(), json(), sourcemaps() //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) @@ -173,7 +107,7 @@ export function makeConfig(pkg, options) { ], output: { file: "dist/index.js", format: "cjs", sourcemap: true }, preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve(), cjs()] + plugins: [sourcemaps(), nodeResolve()] }; const config = [baseConfig]; diff --git a/sdk/datalake-analytics/arm-datalake-analytics/sample.env b/sdk/datalake-analytics/arm-datalake-analytics/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/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/datalake-analytics/arm-datalake-analytics/samples-dev/accountsCheckNameAvailabilitySample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..4a9a7ebebd97 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsCheckNameAvailabilitySample.ts @@ -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. +import { + CheckNameAvailabilityParameters, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Checks whether the specified account name is available or taken. + * + * @summary Checks whether the specified account name is available or taken. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_CheckNameAvailability.json + */ +async function checksWhetherTheSpecifiedAccountNameIsAvailableOrTaken() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const location = "EastUS2"; + const parameters: CheckNameAvailabilityParameters = { + name: "contosoadla", + type: "Microsoft.DataLakeAnalytics/accounts" + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.accounts.checkNameAvailability( + location, + parameters + ); + console.log(result); +} + +checksWhetherTheSpecifiedAccountNameIsAvailableOrTaken().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsCreateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsCreateSample.ts new file mode 100644 index 000000000000..098429c252a8 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsCreateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + CreateDataLakeAnalyticsAccountParameters, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates the specified Data Lake Analytics account. This supplies the user with computation services for Data Lake Analytics workloads. + * + * @summary Creates the specified Data Lake Analytics account. This supplies the user with computation services for Data Lake Analytics workloads. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Create.json + */ +async function createsTheSpecifiedDataLakeAnalyticsAccountThisSuppliesTheUserWithComputationServicesForDataLakeAnalyticsWorkloads() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const parameters: CreateDataLakeAnalyticsAccountParameters = { + computePolicies: [ + { + name: "test_policy", + maxDegreeOfParallelismPerJob: 1, + minPriorityPerJob: 1, + objectId: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + objectType: "User" + } + ], + dataLakeStoreAccounts: [{ name: "test_adls", suffix: "test_suffix" }], + defaultDataLakeStoreAccount: "test_adls", + firewallAllowAzureIps: "Enabled", + firewallRules: [ + { name: "test_rule", endIpAddress: "2.2.2.2", startIpAddress: "1.1.1.1" } + ], + firewallState: "Enabled", + location: "eastus2", + maxDegreeOfParallelism: 30, + maxDegreeOfParallelismPerJob: 1, + maxJobCount: 3, + minPriorityPerJob: 1, + newTier: "Consumption", + queryStoreRetention: 30, + storageAccounts: [ + { + name: "test_storage", + accessKey: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab346", + suffix: "test_suffix" + } + ], + tags: { testKey: "test_value" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.accounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +createsTheSpecifiedDataLakeAnalyticsAccountThisSuppliesTheUserWithComputationServicesForDataLakeAnalyticsWorkloads().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsDeleteSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsDeleteSample.ts new file mode 100644 index 000000000000..53943735ae0a --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsDeleteSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Begins the delete process for the Data Lake Analytics account object specified by the account name. + * + * @summary Begins the delete process for the Data Lake Analytics account object specified by the account name. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Delete.json + */ +async function beginsTheDeleteProcessForTheDataLakeAnalyticsAccountObjectSpecifiedByTheAccountName() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.accounts.beginDeleteAndWait( + resourceGroupName, + accountName + ); + console.log(result); +} + +beginsTheDeleteProcessForTheDataLakeAnalyticsAccountObjectSpecifiedByTheAccountName().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsGetSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsGetSample.ts new file mode 100644 index 000000000000..ae9af0fb5123 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets details of the specified Data Lake Analytics account. + * + * @summary Gets details of the specified Data Lake Analytics account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Get.json + */ +async function getsDetailsOfTheSpecifiedDataLakeAnalyticsAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.accounts.get(resourceGroupName, accountName); + console.log(result); +} + +getsDetailsOfTheSpecifiedDataLakeAnalyticsAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsListByResourceGroupSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsListByResourceGroupSample.ts new file mode 100644 index 000000000000..db0f3dd2edda --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsListByResourceGroupSample.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + AccountsListByResourceGroupOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the first page of Data Lake Analytics accounts, if any, within a specific resource group. This includes a link to the next page, if any. + * + * @summary Gets the first page of Data Lake Analytics accounts, if any, within a specific resource group. This includes a link to the next page, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_ListByResourceGroup.json + */ +async function getsTheFirstPageOfDataLakeAnalyticsAccountsIfAnyWithinASpecificResourceGroupThisIncludesALinkToTheNextPageIfAny() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const filter = "test_filter"; + const top = 1; + const skip = 1; + const select = "test_select"; + const orderby = "test_orderby"; + const count = false; + const options: AccountsListByResourceGroupOptionalParams = { + filter, + top, + skip, + select, + orderby, + count + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.accounts.listByResourceGroup( + resourceGroupName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheFirstPageOfDataLakeAnalyticsAccountsIfAnyWithinASpecificResourceGroupThisIncludesALinkToTheNextPageIfAny().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsListSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsListSample.ts new file mode 100644 index 000000000000..3d4b829c6078 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsListSample.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + AccountsListOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. + * + * @summary Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_List.json + */ +async function getsTheFirstPageOfDataLakeAnalyticsAccountsIfAnyWithinTheCurrentSubscriptionThisIncludesALinkToTheNextPageIfAny() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const filter = "test_filter"; + const top = 1; + const skip = 1; + const select = "test_select"; + const orderby = "test_orderby"; + const count = false; + const options: AccountsListOptionalParams = { + filter, + top, + skip, + select, + orderby, + count + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.accounts.list(options)) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheFirstPageOfDataLakeAnalyticsAccountsIfAnyWithinTheCurrentSubscriptionThisIncludesALinkToTheNextPageIfAny().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsUpdateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsUpdateSample.ts new file mode 100644 index 000000000000..f7f91715fb6f --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/accountsUpdateSample.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + UpdateDataLakeAnalyticsAccountParameters, + AccountsUpdateOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object. + * + * @summary Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Update.json + */ +async function updatesTheDataLakeAnalyticsAccountObjectSpecifiedByTheAccountNameWithTheContentsOfTheAccountObject() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const parameters: UpdateDataLakeAnalyticsAccountParameters = { + computePolicies: [ + { + name: "test_policy", + maxDegreeOfParallelismPerJob: 1, + minPriorityPerJob: 1, + objectId: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + objectType: "User" + } + ], + firewallAllowAzureIps: "Enabled", + firewallRules: [ + { name: "test_rule", endIpAddress: "2.2.2.2", startIpAddress: "1.1.1.1" } + ], + firewallState: "Enabled", + maxDegreeOfParallelism: 1, + maxDegreeOfParallelismPerJob: 1, + maxJobCount: 1, + minPriorityPerJob: 1, + newTier: "Consumption", + queryStoreRetention: 1, + tags: { testKey: "test_value" } + }; + const options: AccountsUpdateOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.accounts.beginUpdateAndWait( + resourceGroupName, + accountName, + options + ); + console.log(result); +} + +updatesTheDataLakeAnalyticsAccountObjectSpecifiedByTheAccountNameWithTheContentsOfTheAccountObject().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesCreateOrUpdateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..1bb7e26fde2e --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesCreateOrUpdateSample.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 { + CreateOrUpdateComputePolicyParameters, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates or updates the specified compute policy. During update, the compute policy with the specified name will be replaced with this new compute policy. An account supports, at most, 50 policies + * + * @summary Creates or updates the specified compute policy. During update, the compute policy with the specified name will be replaced with this new compute policy. An account supports, at most, 50 policies + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_CreateOrUpdate.json + */ +async function createsOrUpdatesTheSpecifiedComputePolicy() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const computePolicyName = "test_policy"; + const parameters: CreateOrUpdateComputePolicyParameters = { + maxDegreeOfParallelismPerJob: 10, + minPriorityPerJob: 30, + objectId: "776b9091-8916-4638-87f7-9c989a38da98", + objectType: "User" + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.computePolicies.createOrUpdate( + resourceGroupName, + accountName, + computePolicyName, + parameters + ); + console.log(result); +} + +createsOrUpdatesTheSpecifiedComputePolicy().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesDeleteSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesDeleteSample.ts new file mode 100644 index 000000000000..243691244248 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesDeleteSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the specified compute policy from the specified Data Lake Analytics account + * + * @summary Deletes the specified compute policy from the specified Data Lake Analytics account + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Delete.json + */ +async function deletesTheSpecifiedComputePolicyFromTheAdlaAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const computePolicyName = "test_policy"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.computePolicies.delete( + resourceGroupName, + accountName, + computePolicyName + ); + console.log(result); +} + +deletesTheSpecifiedComputePolicyFromTheAdlaAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesGetSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesGetSample.ts new file mode 100644 index 000000000000..6497d59656d7 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesGetSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the specified Data Lake Analytics compute policy. + * + * @summary Gets the specified Data Lake Analytics compute policy. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Get.json + */ +async function getsTheSpecifiedComputePolicy() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const computePolicyName = "test_policy"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.computePolicies.get( + resourceGroupName, + accountName, + computePolicyName + ); + console.log(result); +} + +getsTheSpecifiedComputePolicy().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesListByAccountSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesListByAccountSample.ts new file mode 100644 index 000000000000..3f40b4caecff --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesListByAccountSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics account. An account supports, at most, 50 policies + * + * @summary Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics account. An account supports, at most, 50 policies + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_ListByAccount.json + */ +async function listsTheComputePoliciesWithinTheAdlaAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.computePolicies.listByAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listsTheComputePoliciesWithinTheAdlaAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesUpdateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesUpdateSample.ts new file mode 100644 index 000000000000..15184821b934 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/computePoliciesUpdateSample.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 { + UpdateComputePolicyParameters, + ComputePoliciesUpdateOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the specified compute policy. + * + * @summary Updates the specified compute policy. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Update.json + */ +async function updatesTheSpecifiedComputePolicy() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const computePolicyName = "test_policy"; + const parameters: UpdateComputePolicyParameters = { + maxDegreeOfParallelismPerJob: 11, + minPriorityPerJob: 31 + }; + const options: ComputePoliciesUpdateOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.computePolicies.update( + resourceGroupName, + accountName, + computePolicyName, + options + ); + console.log(result); +} + +updatesTheSpecifiedComputePolicy().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/dataLakeStoreAccountsAddSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/dataLakeStoreAccountsAddSample.ts new file mode 100644 index 000000000000..e8af9efbee93 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/dataLakeStoreAccountsAddSample.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 { + AddDataLakeStoreParameters, + DataLakeStoreAccountsAddOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the specified Data Lake Analytics account to include the additional Data Lake Store account. + * + * @summary Updates the specified Data Lake Analytics account to include the additional Data Lake Store account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Add.json + */ +async function addsADataLakeStoreAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const dataLakeStoreAccountName = "test_adls_account"; + const parameters: AddDataLakeStoreParameters = { suffix: "test_suffix" }; + const options: DataLakeStoreAccountsAddOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.dataLakeStoreAccounts.add( + resourceGroupName, + accountName, + dataLakeStoreAccountName, + options + ); + console.log(result); +} + +addsADataLakeStoreAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/dataLakeStoreAccountsDeleteSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/dataLakeStoreAccountsDeleteSample.ts new file mode 100644 index 000000000000..a971ce5f6b1e --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/dataLakeStoreAccountsDeleteSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the Data Lake Analytics account specified to remove the specified Data Lake Store account. + * + * @summary Updates the Data Lake Analytics account specified to remove the specified Data Lake Store account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Delete.json + */ +async function removesTheSpecifiedDataLakeStoreAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const dataLakeStoreAccountName = "test_adls_account"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.dataLakeStoreAccounts.delete( + resourceGroupName, + accountName, + dataLakeStoreAccountName + ); + console.log(result); +} + +removesTheSpecifiedDataLakeStoreAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/dataLakeStoreAccountsGetSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/dataLakeStoreAccountsGetSample.ts new file mode 100644 index 000000000000..49901b78b865 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/dataLakeStoreAccountsGetSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the specified Data Lake Store account details in the specified Data Lake Analytics account. + * + * @summary Gets the specified Data Lake Store account details in the specified Data Lake Analytics account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Get.json + */ +async function getsTheSpecifiedDataLakeStoreAccountDetails() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1669ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const dataLakeStoreAccountName = "test_adls_account"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.dataLakeStoreAccounts.get( + resourceGroupName, + accountName, + dataLakeStoreAccountName + ); + console.log(result); +} + +getsTheSpecifiedDataLakeStoreAccountDetails().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/dataLakeStoreAccountsListByAccountSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/dataLakeStoreAccountsListByAccountSample.ts new file mode 100644 index 000000000000..5904d4dfde2c --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/dataLakeStoreAccountsListByAccountSample.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + DataLakeStoreAccountsListByAccountOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. + * + * @summary Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_ListByAccount.json + */ +async function getsTheFirstPageOfDataLakeStoreAccountsLinkedToTheSpecifiedDataLakeAnalyticsAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const filter = "test_filter"; + const top = 1; + const skip = 1; + const select = "test_select"; + const orderby = "test_orderby"; + const count = false; + const options: DataLakeStoreAccountsListByAccountOptionalParams = { + filter, + top, + skip, + select, + orderby, + count + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.dataLakeStoreAccounts.listByAccount( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheFirstPageOfDataLakeStoreAccountsLinkedToTheSpecifiedDataLakeAnalyticsAccount().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesCreateOrUpdateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..bf4fa94d918f --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesCreateOrUpdateSample.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 { + CreateOrUpdateFirewallRuleParameters, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this new firewall rule. + * + * @summary Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this new firewall rule. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_CreateOrUpdate.json + */ +async function createsOrUpdatesTheSpecifiedFirewallRule() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const firewallRuleName = "test_rule"; + const parameters: CreateOrUpdateFirewallRuleParameters = { + endIpAddress: "2.2.2.2", + startIpAddress: "1.1.1.1" + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.firewallRules.createOrUpdate( + resourceGroupName, + accountName, + firewallRuleName, + parameters + ); + console.log(result); +} + +createsOrUpdatesTheSpecifiedFirewallRule().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesDeleteSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesDeleteSample.ts new file mode 100644 index 000000000000..01d60418fcc8 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesDeleteSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the specified firewall rule from the specified Data Lake Analytics account + * + * @summary Deletes the specified firewall rule from the specified Data Lake Analytics account + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Delete.json + */ +async function deletesTheSpecifiedFirewallRule() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const firewallRuleName = "test_rule"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.firewallRules.delete( + resourceGroupName, + accountName, + firewallRuleName + ); + console.log(result); +} + +deletesTheSpecifiedFirewallRule().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesGetSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesGetSample.ts new file mode 100644 index 000000000000..0a2c934ace86 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesGetSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the specified Data Lake Analytics firewall rule. + * + * @summary Gets the specified Data Lake Analytics firewall rule. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Get.json + */ +async function getsTheSpecifiedDataLakeAnalyticsFirewallRule() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const firewallRuleName = "test_rule"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.firewallRules.get( + resourceGroupName, + accountName, + firewallRuleName + ); + console.log(result); +} + +getsTheSpecifiedDataLakeAnalyticsFirewallRule().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesListByAccountSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesListByAccountSample.ts new file mode 100644 index 000000000000..5cfce071bec7 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesListByAccountSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the Data Lake Analytics firewall rules within the specified Data Lake Analytics account. + * + * @summary Lists the Data Lake Analytics firewall rules within the specified Data Lake Analytics account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_ListByAccount.json + */ +async function listsTheDataLakeAnalyticsFirewallRules() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.firewallRules.listByAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listsTheDataLakeAnalyticsFirewallRules().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesUpdateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesUpdateSample.ts new file mode 100644 index 000000000000..eee3ccb5072c --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/firewallRulesUpdateSample.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 { + UpdateFirewallRuleParameters, + FirewallRulesUpdateOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the specified firewall rule. + * + * @summary Updates the specified firewall rule. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Update.json + */ +async function updatesTheSpecifiedFirewallRule() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const firewallRuleName = "test_rule"; + const parameters: UpdateFirewallRuleParameters = { + endIpAddress: "2.2.2.2", + startIpAddress: "1.1.1.1" + }; + const options: FirewallRulesUpdateOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.firewallRules.update( + resourceGroupName, + accountName, + firewallRuleName, + options + ); + console.log(result); +} + +updatesTheSpecifiedFirewallRule().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/locationsGetCapabilitySample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/locationsGetCapabilitySample.ts new file mode 100644 index 000000000000..0d5a03693da7 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/locationsGetCapabilitySample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets subscription-level properties and limits for Data Lake Analytics specified by resource location. + * + * @summary Gets subscription-level properties and limits for Data Lake Analytics specified by resource location. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Locations_GetCapability.json + */ +async function getsSubscriptionLevelPropertiesAndLimitsForDataLakeAnalyticsSpecifiedByResourceLocation() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const location = "EastUS2"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.locations.getCapability(location); + console.log(result); +} + +getsSubscriptionLevelPropertiesAndLimitsForDataLakeAnalyticsSpecifiedByResourceLocation().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/operationsListSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..acfe3f35e355 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/operationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the available Data Lake Analytics REST API operations. + * + * @summary Lists all of the available Data Lake Analytics REST API operations. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Operations_List.json + */ +async function listsAllOfTheAvailableDataLakeAnalyticsRestApiOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.operations.list(); + console.log(result); +} + +listsAllOfTheAvailableDataLakeAnalyticsRestApiOperations().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsAddSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsAddSample.ts new file mode 100644 index 000000000000..84e2565d647f --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsAddSample.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 { + AddStorageAccountParameters, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the specified Data Lake Analytics account to add an Azure Storage account. + * + * @summary Updates the specified Data Lake Analytics account to add an Azure Storage account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Add.json + */ +async function addsAnAzureStorageAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const parameters: AddStorageAccountParameters = { + accessKey: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab346", + suffix: "test_suffix" + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.storageAccounts.add( + resourceGroupName, + accountName, + storageAccountName, + parameters + ); + console.log(result); +} + +addsAnAzureStorageAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsDeleteSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsDeleteSample.ts new file mode 100644 index 000000000000..a3d1a415f1ec --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsDeleteSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the specified Data Lake Analytics account to remove an Azure Storage account. + * + * @summary Updates the specified Data Lake Analytics account to remove an Azure Storage account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Delete.json + */ +async function removesAnAzureStorageAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.storageAccounts.delete( + resourceGroupName, + accountName, + storageAccountName + ); + console.log(result); +} + +removesAnAzureStorageAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsGetSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsGetSample.ts new file mode 100644 index 000000000000..ce38da0b062b --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsGetSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the specified Azure Storage account linked to the given Data Lake Analytics account. + * + * @summary Gets the specified Azure Storage account linked to the given Data Lake Analytics account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Get.json + */ +async function getsTheSpecifiedAzureStorageAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.storageAccounts.get( + resourceGroupName, + accountName, + storageAccountName + ); + console.log(result); +} + +getsTheSpecifiedAzureStorageAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsGetStorageContainerSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsGetStorageContainerSample.ts new file mode 100644 index 000000000000..d4a2f9743362 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsGetStorageContainerSample.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 { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the specified Azure Storage container associated with the given Data Lake Analytics and Azure Storage accounts. + * + * @summary Gets the specified Azure Storage container associated with the given Data Lake Analytics and Azure Storage accounts. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_GetStorageContainer.json + */ +async function getsTheSpecifiedAzureStorageContainer() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const containerName = "test_container"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.storageAccounts.getStorageContainer( + resourceGroupName, + accountName, + storageAccountName, + containerName + ); + console.log(result); +} + +getsTheSpecifiedAzureStorageContainer().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsListByAccountSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsListByAccountSample.ts new file mode 100644 index 000000000000..4cf8f31299ef --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsListByAccountSample.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + StorageAccountsListByAccountOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. + * + * @summary Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListByAccount.json + */ +async function getsTheFirstPageOfAzureStorageAccountsLinkedToTheSpecifiedDataLakeAnalyticsAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const filter = "test_filter"; + const top = 1; + const skip = 1; + const select = "test_select"; + const orderby = "test_orderby"; + const count = false; + const options: StorageAccountsListByAccountOptionalParams = { + filter, + top, + skip, + select, + orderby, + count + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.storageAccounts.listByAccount( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheFirstPageOfAzureStorageAccountsLinkedToTheSpecifiedDataLakeAnalyticsAccount().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsListSasTokensSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsListSasTokensSample.ts new file mode 100644 index 000000000000..6bd40e0ae40b --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsListSasTokensSample.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 { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account and container combination. + * + * @summary Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account and container combination. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListSasTokens.json + */ +async function getsTheSasToken() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const containerName = "test_container"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.storageAccounts.listSasTokens( + resourceGroupName, + accountName, + storageAccountName, + containerName + )) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheSasToken().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsListStorageContainersSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsListStorageContainersSample.ts new file mode 100644 index 000000000000..6e1d6ee000d9 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsListStorageContainersSample.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 { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the Azure Storage containers, if any, associated with the specified Data Lake Analytics and Azure Storage account combination. The response includes a link to the next page of results, if any. + * + * @summary Lists the Azure Storage containers, if any, associated with the specified Data Lake Analytics and Azure Storage account combination. The response includes a link to the next page of results, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListStorageContainers.json + */ +async function listsTheAzureStorageContainers() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.storageAccounts.listStorageContainers( + resourceGroupName, + accountName, + storageAccountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listsTheAzureStorageContainers().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsUpdateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsUpdateSample.ts new file mode 100644 index 000000000000..f9a597a6607d --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples-dev/storageAccountsUpdateSample.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 { + UpdateStorageAccountParameters, + StorageAccountsUpdateOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the Data Lake Analytics account to replace Azure Storage blob account details, such as the access key and/or suffix. + * + * @summary Updates the Data Lake Analytics account to replace Azure Storage blob account details, such as the access key and/or suffix. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Update.json + */ +async function replacesAzureStorageBlobAccountDetails() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const parameters: UpdateStorageAccountParameters = { + accessKey: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab346", + suffix: "test_suffix" + }; + const options: StorageAccountsUpdateOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + storageAccountName, + options + ); + console.log(result); +} + +replacesAzureStorageBlobAccountDetails().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/README.md b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/README.md new file mode 100644 index 000000000000..ddfae50896fa --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/README.md @@ -0,0 +1,110 @@ +# 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** | +| ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [accountsCheckNameAvailabilitySample.js][accountschecknameavailabilitysample] | Checks whether the specified account name is available or taken. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_CheckNameAvailability.json | +| [accountsCreateSample.js][accountscreatesample] | Creates the specified Data Lake Analytics account. This supplies the user with computation services for Data Lake Analytics workloads. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Create.json | +| [accountsDeleteSample.js][accountsdeletesample] | Begins the delete process for the Data Lake Analytics account object specified by the account name. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Delete.json | +| [accountsGetSample.js][accountsgetsample] | Gets details of the specified Data Lake Analytics account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Get.json | +| [accountsListByResourceGroupSample.js][accountslistbyresourcegroupsample] | Gets the first page of Data Lake Analytics accounts, if any, within a specific resource group. This includes a link to the next page, if any. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_ListByResourceGroup.json | +| [accountsListSample.js][accountslistsample] | Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_List.json | +| [accountsUpdateSample.js][accountsupdatesample] | Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Update.json | +| [computePoliciesCreateOrUpdateSample.js][computepoliciescreateorupdatesample] | Creates or updates the specified compute policy. During update, the compute policy with the specified name will be replaced with this new compute policy. An account supports, at most, 50 policies x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_CreateOrUpdate.json | +| [computePoliciesDeleteSample.js][computepoliciesdeletesample] | Deletes the specified compute policy from the specified Data Lake Analytics account x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Delete.json | +| [computePoliciesGetSample.js][computepoliciesgetsample] | Gets the specified Data Lake Analytics compute policy. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Get.json | +| [computePoliciesListByAccountSample.js][computepolicieslistbyaccountsample] | Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics account. An account supports, at most, 50 policies x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_ListByAccount.json | +| [computePoliciesUpdateSample.js][computepoliciesupdatesample] | Updates the specified compute policy. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Update.json | +| [dataLakeStoreAccountsAddSample.js][datalakestoreaccountsaddsample] | Updates the specified Data Lake Analytics account to include the additional Data Lake Store account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Add.json | +| [dataLakeStoreAccountsDeleteSample.js][datalakestoreaccountsdeletesample] | Updates the Data Lake Analytics account specified to remove the specified Data Lake Store account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Delete.json | +| [dataLakeStoreAccountsGetSample.js][datalakestoreaccountsgetsample] | Gets the specified Data Lake Store account details in the specified Data Lake Analytics account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Get.json | +| [dataLakeStoreAccountsListByAccountSample.js][datalakestoreaccountslistbyaccountsample] | Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_ListByAccount.json | +| [firewallRulesCreateOrUpdateSample.js][firewallrulescreateorupdatesample] | Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this new firewall rule. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_CreateOrUpdate.json | +| [firewallRulesDeleteSample.js][firewallrulesdeletesample] | Deletes the specified firewall rule from the specified Data Lake Analytics account x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Delete.json | +| [firewallRulesGetSample.js][firewallrulesgetsample] | Gets the specified Data Lake Analytics firewall rule. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Get.json | +| [firewallRulesListByAccountSample.js][firewallruleslistbyaccountsample] | Lists the Data Lake Analytics firewall rules within the specified Data Lake Analytics account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_ListByAccount.json | +| [firewallRulesUpdateSample.js][firewallrulesupdatesample] | Updates the specified firewall rule. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Update.json | +| [locationsGetCapabilitySample.js][locationsgetcapabilitysample] | Gets subscription-level properties and limits for Data Lake Analytics specified by resource location. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Locations_GetCapability.json | +| [operationsListSample.js][operationslistsample] | Lists all of the available Data Lake Analytics REST API operations. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Operations_List.json | +| [storageAccountsAddSample.js][storageaccountsaddsample] | Updates the specified Data Lake Analytics account to add an Azure Storage account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Add.json | +| [storageAccountsDeleteSample.js][storageaccountsdeletesample] | Updates the specified Data Lake Analytics account to remove an Azure Storage account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Delete.json | +| [storageAccountsGetSample.js][storageaccountsgetsample] | Gets the specified Azure Storage account linked to the given Data Lake Analytics account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Get.json | +| [storageAccountsGetStorageContainerSample.js][storageaccountsgetstoragecontainersample] | Gets the specified Azure Storage container associated with the given Data Lake Analytics and Azure Storage accounts. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_GetStorageContainer.json | +| [storageAccountsListByAccountSample.js][storageaccountslistbyaccountsample] | Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListByAccount.json | +| [storageAccountsListSasTokensSample.js][storageaccountslistsastokenssample] | Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account and container combination. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListSasTokens.json | +| [storageAccountsListStorageContainersSample.js][storageaccountsliststoragecontainerssample] | Lists the Azure Storage containers, if any, associated with the specified Data Lake Analytics and Azure Storage account combination. The response includes a link to the next page of results, if any. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListStorageContainers.json | +| [storageAccountsUpdateSample.js][storageaccountsupdatesample] | Updates the Data Lake Analytics account to replace Azure Storage blob account details, such as the access key and/or suffix. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Update.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +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 accountsCheckNameAvailabilitySample.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 node accountsCheckNameAvailabilitySample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[accountschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsCheckNameAvailabilitySample.js +[accountscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsCreateSample.js +[accountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsDeleteSample.js +[accountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsGetSample.js +[accountslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsListByResourceGroupSample.js +[accountslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsListSample.js +[accountsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsUpdateSample.js +[computepoliciescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesCreateOrUpdateSample.js +[computepoliciesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesDeleteSample.js +[computepoliciesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesGetSample.js +[computepolicieslistbyaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesListByAccountSample.js +[computepoliciesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesUpdateSample.js +[datalakestoreaccountsaddsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsAddSample.js +[datalakestoreaccountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsDeleteSample.js +[datalakestoreaccountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsGetSample.js +[datalakestoreaccountslistbyaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsListByAccountSample.js +[firewallrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesCreateOrUpdateSample.js +[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesDeleteSample.js +[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesGetSample.js +[firewallruleslistbyaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesListByAccountSample.js +[firewallrulesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesUpdateSample.js +[locationsgetcapabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/locationsGetCapabilitySample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/operationsListSample.js +[storageaccountsaddsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsAddSample.js +[storageaccountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsDeleteSample.js +[storageaccountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsGetSample.js +[storageaccountsgetstoragecontainersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsGetStorageContainerSample.js +[storageaccountslistbyaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsListByAccountSample.js +[storageaccountslistsastokenssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsListSasTokensSample.js +[storageaccountsliststoragecontainerssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsListStorageContainersSample.js +[storageaccountsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsUpdateSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-datalake-analytics?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datalake-analytics/arm-datalake-analytics/README.md diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsCheckNameAvailabilitySample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsCheckNameAvailabilitySample.js new file mode 100644 index 000000000000..7e4b9f72b161 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsCheckNameAvailabilitySample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Checks whether the specified account name is available or taken. + * + * @summary Checks whether the specified account name is available or taken. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_CheckNameAvailability.json + */ +async function checksWhetherTheSpecifiedAccountNameIsAvailableOrTaken() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const location = "EastUS2"; + const parameters = { + name: "contosoadla", + type: "Microsoft.DataLakeAnalytics/accounts", + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.accounts.checkNameAvailability(location, parameters); + console.log(result); +} + +checksWhetherTheSpecifiedAccountNameIsAvailableOrTaken().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsCreateSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsCreateSample.js new file mode 100644 index 000000000000..05307ba0a65a --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsCreateSample.js @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Creates the specified Data Lake Analytics account. This supplies the user with computation services for Data Lake Analytics workloads. + * + * @summary Creates the specified Data Lake Analytics account. This supplies the user with computation services for Data Lake Analytics workloads. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Create.json + */ +async function createsTheSpecifiedDataLakeAnalyticsAccountThisSuppliesTheUserWithComputationServicesForDataLakeAnalyticsWorkloads() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const parameters = { + computePolicies: [ + { + name: "test_policy", + maxDegreeOfParallelismPerJob: 1, + minPriorityPerJob: 1, + objectId: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + objectType: "User", + }, + ], + dataLakeStoreAccounts: [{ name: "test_adls", suffix: "test_suffix" }], + defaultDataLakeStoreAccount: "test_adls", + firewallAllowAzureIps: "Enabled", + firewallRules: [{ name: "test_rule", endIpAddress: "2.2.2.2", startIpAddress: "1.1.1.1" }], + firewallState: "Enabled", + location: "eastus2", + maxDegreeOfParallelism: 30, + maxDegreeOfParallelismPerJob: 1, + maxJobCount: 3, + minPriorityPerJob: 1, + newTier: "Consumption", + queryStoreRetention: 30, + storageAccounts: [ + { + name: "test_storage", + accessKey: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab346", + suffix: "test_suffix", + }, + ], + tags: { testKey: "test_value" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.accounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +createsTheSpecifiedDataLakeAnalyticsAccountThisSuppliesTheUserWithComputationServicesForDataLakeAnalyticsWorkloads().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsDeleteSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsDeleteSample.js new file mode 100644 index 000000000000..ef427ea39f0a --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsDeleteSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Begins the delete process for the Data Lake Analytics account object specified by the account name. + * + * @summary Begins the delete process for the Data Lake Analytics account object specified by the account name. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Delete.json + */ +async function beginsTheDeleteProcessForTheDataLakeAnalyticsAccountObjectSpecifiedByTheAccountName() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.accounts.beginDeleteAndWait(resourceGroupName, accountName); + console.log(result); +} + +beginsTheDeleteProcessForTheDataLakeAnalyticsAccountObjectSpecifiedByTheAccountName().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsGetSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsGetSample.js new file mode 100644 index 000000000000..ec306edad0ef --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets details of the specified Data Lake Analytics account. + * + * @summary Gets details of the specified Data Lake Analytics account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Get.json + */ +async function getsDetailsOfTheSpecifiedDataLakeAnalyticsAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.accounts.get(resourceGroupName, accountName); + console.log(result); +} + +getsDetailsOfTheSpecifiedDataLakeAnalyticsAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsListByResourceGroupSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsListByResourceGroupSample.js new file mode 100644 index 000000000000..dba6d2338b19 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsListByResourceGroupSample.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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the first page of Data Lake Analytics accounts, if any, within a specific resource group. This includes a link to the next page, if any. + * + * @summary Gets the first page of Data Lake Analytics accounts, if any, within a specific resource group. This includes a link to the next page, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_ListByResourceGroup.json + */ +async function getsTheFirstPageOfDataLakeAnalyticsAccountsIfAnyWithinASpecificResourceGroupThisIncludesALinkToTheNextPageIfAny() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const filter = "test_filter"; + const top = 1; + const skip = 1; + const select = "test_select"; + const orderby = "test_orderby"; + const count = false; + const options = { + filter, + top, + skip, + select, + orderby, + count, + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accounts.listByResourceGroup(resourceGroupName, options)) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheFirstPageOfDataLakeAnalyticsAccountsIfAnyWithinASpecificResourceGroupThisIncludesALinkToTheNextPageIfAny().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsListSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsListSample.js new file mode 100644 index 000000000000..408db233b21e --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsListSample.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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. + * + * @summary Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_List.json + */ +async function getsTheFirstPageOfDataLakeAnalyticsAccountsIfAnyWithinTheCurrentSubscriptionThisIncludesALinkToTheNextPageIfAny() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const filter = "test_filter"; + const top = 1; + const skip = 1; + const select = "test_select"; + const orderby = "test_orderby"; + const count = false; + const options = { + filter, + top, + skip, + select, + orderby, + count, + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accounts.list(options)) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheFirstPageOfDataLakeAnalyticsAccountsIfAnyWithinTheCurrentSubscriptionThisIncludesALinkToTheNextPageIfAny().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsUpdateSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsUpdateSample.js new file mode 100644 index 000000000000..b84f3d46697a --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/accountsUpdateSample.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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object. + * + * @summary Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Update.json + */ +async function updatesTheDataLakeAnalyticsAccountObjectSpecifiedByTheAccountNameWithTheContentsOfTheAccountObject() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const parameters = { + computePolicies: [ + { + name: "test_policy", + maxDegreeOfParallelismPerJob: 1, + minPriorityPerJob: 1, + objectId: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + objectType: "User", + }, + ], + firewallAllowAzureIps: "Enabled", + firewallRules: [{ name: "test_rule", endIpAddress: "2.2.2.2", startIpAddress: "1.1.1.1" }], + firewallState: "Enabled", + maxDegreeOfParallelism: 1, + maxDegreeOfParallelismPerJob: 1, + maxJobCount: 1, + minPriorityPerJob: 1, + newTier: "Consumption", + queryStoreRetention: 1, + tags: { testKey: "test_value" }, + }; + const options = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.accounts.beginUpdateAndWait(resourceGroupName, accountName, options); + console.log(result); +} + +updatesTheDataLakeAnalyticsAccountObjectSpecifiedByTheAccountNameWithTheContentsOfTheAccountObject().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesCreateOrUpdateSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesCreateOrUpdateSample.js new file mode 100644 index 000000000000..066dcfb0aa4b --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesCreateOrUpdateSample.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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Creates or updates the specified compute policy. During update, the compute policy with the specified name will be replaced with this new compute policy. An account supports, at most, 50 policies + * + * @summary Creates or updates the specified compute policy. During update, the compute policy with the specified name will be replaced with this new compute policy. An account supports, at most, 50 policies + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_CreateOrUpdate.json + */ +async function createsOrUpdatesTheSpecifiedComputePolicy() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const computePolicyName = "test_policy"; + const parameters = { + maxDegreeOfParallelismPerJob: 10, + minPriorityPerJob: 30, + objectId: "776b9091-8916-4638-87f7-9c989a38da98", + objectType: "User", + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.computePolicies.createOrUpdate( + resourceGroupName, + accountName, + computePolicyName, + parameters + ); + console.log(result); +} + +createsOrUpdatesTheSpecifiedComputePolicy().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesDeleteSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesDeleteSample.js new file mode 100644 index 000000000000..320c1e6e84bb --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesDeleteSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes the specified compute policy from the specified Data Lake Analytics account + * + * @summary Deletes the specified compute policy from the specified Data Lake Analytics account + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Delete.json + */ +async function deletesTheSpecifiedComputePolicyFromTheAdlaAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const computePolicyName = "test_policy"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.computePolicies.delete( + resourceGroupName, + accountName, + computePolicyName + ); + console.log(result); +} + +deletesTheSpecifiedComputePolicyFromTheAdlaAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesGetSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesGetSample.js new file mode 100644 index 000000000000..d8869f545ca9 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the specified Data Lake Analytics compute policy. + * + * @summary Gets the specified Data Lake Analytics compute policy. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Get.json + */ +async function getsTheSpecifiedComputePolicy() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const computePolicyName = "test_policy"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.computePolicies.get( + resourceGroupName, + accountName, + computePolicyName + ); + console.log(result); +} + +getsTheSpecifiedComputePolicy().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesListByAccountSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesListByAccountSample.js new file mode 100644 index 000000000000..2b80deedd150 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesListByAccountSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics account. An account supports, at most, 50 policies + * + * @summary Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics account. An account supports, at most, 50 policies + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_ListByAccount.json + */ +async function listsTheComputePoliciesWithinTheAdlaAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.computePolicies.listByAccount(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +listsTheComputePoliciesWithinTheAdlaAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesUpdateSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesUpdateSample.js new file mode 100644 index 000000000000..73b91fab2691 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/computePoliciesUpdateSample.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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates the specified compute policy. + * + * @summary Updates the specified compute policy. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Update.json + */ +async function updatesTheSpecifiedComputePolicy() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const computePolicyName = "test_policy"; + const parameters = { + maxDegreeOfParallelismPerJob: 11, + minPriorityPerJob: 31, + }; + const options = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.computePolicies.update( + resourceGroupName, + accountName, + computePolicyName, + options + ); + console.log(result); +} + +updatesTheSpecifiedComputePolicy().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsAddSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsAddSample.js new file mode 100644 index 000000000000..6727d90501f8 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsAddSample.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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates the specified Data Lake Analytics account to include the additional Data Lake Store account. + * + * @summary Updates the specified Data Lake Analytics account to include the additional Data Lake Store account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Add.json + */ +async function addsADataLakeStoreAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const dataLakeStoreAccountName = "test_adls_account"; + const parameters = { suffix: "test_suffix" }; + const options = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.dataLakeStoreAccounts.add( + resourceGroupName, + accountName, + dataLakeStoreAccountName, + options + ); + console.log(result); +} + +addsADataLakeStoreAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsDeleteSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsDeleteSample.js new file mode 100644 index 000000000000..d35bb6bbf29b --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsDeleteSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates the Data Lake Analytics account specified to remove the specified Data Lake Store account. + * + * @summary Updates the Data Lake Analytics account specified to remove the specified Data Lake Store account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Delete.json + */ +async function removesTheSpecifiedDataLakeStoreAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const dataLakeStoreAccountName = "test_adls_account"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.dataLakeStoreAccounts.delete( + resourceGroupName, + accountName, + dataLakeStoreAccountName + ); + console.log(result); +} + +removesTheSpecifiedDataLakeStoreAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsGetSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsGetSample.js new file mode 100644 index 000000000000..43b8e26428e5 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the specified Data Lake Store account details in the specified Data Lake Analytics account. + * + * @summary Gets the specified Data Lake Store account details in the specified Data Lake Analytics account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Get.json + */ +async function getsTheSpecifiedDataLakeStoreAccountDetails() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1669ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const dataLakeStoreAccountName = "test_adls_account"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.dataLakeStoreAccounts.get( + resourceGroupName, + accountName, + dataLakeStoreAccountName + ); + console.log(result); +} + +getsTheSpecifiedDataLakeStoreAccountDetails().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsListByAccountSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsListByAccountSample.js new file mode 100644 index 000000000000..05911a8f3f15 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/dataLakeStoreAccountsListByAccountSample.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. + * + * @summary Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_ListByAccount.json + */ +async function getsTheFirstPageOfDataLakeStoreAccountsLinkedToTheSpecifiedDataLakeAnalyticsAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const filter = "test_filter"; + const top = 1; + const skip = 1; + const select = "test_select"; + const orderby = "test_orderby"; + const count = false; + const options = { + filter, + top, + skip, + select, + orderby, + count, + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.dataLakeStoreAccounts.listByAccount( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheFirstPageOfDataLakeStoreAccountsLinkedToTheSpecifiedDataLakeAnalyticsAccount().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesCreateOrUpdateSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesCreateOrUpdateSample.js new file mode 100644 index 000000000000..5a1469e545a0 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesCreateOrUpdateSample.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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this new firewall rule. + * + * @summary Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this new firewall rule. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_CreateOrUpdate.json + */ +async function createsOrUpdatesTheSpecifiedFirewallRule() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const firewallRuleName = "test_rule"; + const parameters = { + endIpAddress: "2.2.2.2", + startIpAddress: "1.1.1.1", + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.firewallRules.createOrUpdate( + resourceGroupName, + accountName, + firewallRuleName, + parameters + ); + console.log(result); +} + +createsOrUpdatesTheSpecifiedFirewallRule().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesDeleteSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesDeleteSample.js new file mode 100644 index 000000000000..4facc1bb385a --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesDeleteSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes the specified firewall rule from the specified Data Lake Analytics account + * + * @summary Deletes the specified firewall rule from the specified Data Lake Analytics account + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Delete.json + */ +async function deletesTheSpecifiedFirewallRule() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const firewallRuleName = "test_rule"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.firewallRules.delete( + resourceGroupName, + accountName, + firewallRuleName + ); + console.log(result); +} + +deletesTheSpecifiedFirewallRule().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesGetSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesGetSample.js new file mode 100644 index 000000000000..47e3c1bc203d --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the specified Data Lake Analytics firewall rule. + * + * @summary Gets the specified Data Lake Analytics firewall rule. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Get.json + */ +async function getsTheSpecifiedDataLakeAnalyticsFirewallRule() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const firewallRuleName = "test_rule"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.firewallRules.get(resourceGroupName, accountName, firewallRuleName); + console.log(result); +} + +getsTheSpecifiedDataLakeAnalyticsFirewallRule().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesListByAccountSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesListByAccountSample.js new file mode 100644 index 000000000000..47f35d1f709a --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesListByAccountSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists the Data Lake Analytics firewall rules within the specified Data Lake Analytics account. + * + * @summary Lists the Data Lake Analytics firewall rules within the specified Data Lake Analytics account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_ListByAccount.json + */ +async function listsTheDataLakeAnalyticsFirewallRules() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.firewallRules.listByAccount(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +listsTheDataLakeAnalyticsFirewallRules().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesUpdateSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesUpdateSample.js new file mode 100644 index 000000000000..9b4d0fc31da6 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/firewallRulesUpdateSample.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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates the specified firewall rule. + * + * @summary Updates the specified firewall rule. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Update.json + */ +async function updatesTheSpecifiedFirewallRule() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const firewallRuleName = "test_rule"; + const parameters = { + endIpAddress: "2.2.2.2", + startIpAddress: "1.1.1.1", + }; + const options = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.firewallRules.update( + resourceGroupName, + accountName, + firewallRuleName, + options + ); + console.log(result); +} + +updatesTheSpecifiedFirewallRule().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/locationsGetCapabilitySample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/locationsGetCapabilitySample.js new file mode 100644 index 000000000000..8879fa4bad7a --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/locationsGetCapabilitySample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets subscription-level properties and limits for Data Lake Analytics specified by resource location. + * + * @summary Gets subscription-level properties and limits for Data Lake Analytics specified by resource location. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Locations_GetCapability.json + */ +async function getsSubscriptionLevelPropertiesAndLimitsForDataLakeAnalyticsSpecifiedByResourceLocation() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const location = "EastUS2"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.locations.getCapability(location); + console.log(result); +} + +getsSubscriptionLevelPropertiesAndLimitsForDataLakeAnalyticsSpecifiedByResourceLocation().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/operationsListSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/operationsListSample.js new file mode 100644 index 000000000000..cc8449d504c4 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/operationsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists all of the available Data Lake Analytics REST API operations. + * + * @summary Lists all of the available Data Lake Analytics REST API operations. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Operations_List.json + */ +async function listsAllOfTheAvailableDataLakeAnalyticsRestApiOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.operations.list(); + console.log(result); +} + +listsAllOfTheAvailableDataLakeAnalyticsRestApiOperations().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/package.json b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/package.json new file mode 100644 index 000000000000..3b2292617a17 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-datalake-analytics-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/datalake-analytics/arm-datalake-analytics" + }, + "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/datalake-analytics/arm-datalake-analytics", + "dependencies": { + "@azure/arm-datalake-analytics": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/sample.env b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-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/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsAddSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsAddSample.js new file mode 100644 index 000000000000..9536551e8381 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsAddSample.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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates the specified Data Lake Analytics account to add an Azure Storage account. + * + * @summary Updates the specified Data Lake Analytics account to add an Azure Storage account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Add.json + */ +async function addsAnAzureStorageAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const parameters = { + accessKey: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab346", + suffix: "test_suffix", + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.add( + resourceGroupName, + accountName, + storageAccountName, + parameters + ); + console.log(result); +} + +addsAnAzureStorageAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsDeleteSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsDeleteSample.js new file mode 100644 index 000000000000..6cecd2375e78 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsDeleteSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates the specified Data Lake Analytics account to remove an Azure Storage account. + * + * @summary Updates the specified Data Lake Analytics account to remove an Azure Storage account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Delete.json + */ +async function removesAnAzureStorageAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.delete( + resourceGroupName, + accountName, + storageAccountName + ); + console.log(result); +} + +removesAnAzureStorageAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsGetSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsGetSample.js new file mode 100644 index 000000000000..8d9aecce8c0e --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the specified Azure Storage account linked to the given Data Lake Analytics account. + * + * @summary Gets the specified Azure Storage account linked to the given Data Lake Analytics account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Get.json + */ +async function getsTheSpecifiedAzureStorageAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.get( + resourceGroupName, + accountName, + storageAccountName + ); + console.log(result); +} + +getsTheSpecifiedAzureStorageAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsGetStorageContainerSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsGetStorageContainerSample.js new file mode 100644 index 000000000000..0506e5216165 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsGetStorageContainerSample.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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the specified Azure Storage container associated with the given Data Lake Analytics and Azure Storage accounts. + * + * @summary Gets the specified Azure Storage container associated with the given Data Lake Analytics and Azure Storage accounts. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_GetStorageContainer.json + */ +async function getsTheSpecifiedAzureStorageContainer() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const containerName = "test_container"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.getStorageContainer( + resourceGroupName, + accountName, + storageAccountName, + containerName + ); + console.log(result); +} + +getsTheSpecifiedAzureStorageContainer().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsListByAccountSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsListByAccountSample.js new file mode 100644 index 000000000000..d0ff03c8b550 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsListByAccountSample.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. + * + * @summary Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListByAccount.json + */ +async function getsTheFirstPageOfAzureStorageAccountsLinkedToTheSpecifiedDataLakeAnalyticsAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const filter = "test_filter"; + const top = 1; + const skip = 1; + const select = "test_select"; + const orderby = "test_orderby"; + const count = false; + const options = { + filter, + top, + skip, + select, + orderby, + count, + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageAccounts.listByAccount( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheFirstPageOfAzureStorageAccountsLinkedToTheSpecifiedDataLakeAnalyticsAccount().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsListSasTokensSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsListSasTokensSample.js new file mode 100644 index 000000000000..f8653ff892e4 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsListSasTokensSample.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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account and container combination. + * + * @summary Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account and container combination. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListSasTokens.json + */ +async function getsTheSasToken() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const containerName = "test_container"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageAccounts.listSasTokens( + resourceGroupName, + accountName, + storageAccountName, + containerName + )) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheSasToken().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsListStorageContainersSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsListStorageContainersSample.js new file mode 100644 index 000000000000..7fe0d5acdeed --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsListStorageContainersSample.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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists the Azure Storage containers, if any, associated with the specified Data Lake Analytics and Azure Storage account combination. The response includes a link to the next page of results, if any. + * + * @summary Lists the Azure Storage containers, if any, associated with the specified Data Lake Analytics and Azure Storage account combination. The response includes a link to the next page of results, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListStorageContainers.json + */ +async function listsTheAzureStorageContainers() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageAccounts.listStorageContainers( + resourceGroupName, + accountName, + storageAccountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listsTheAzureStorageContainers().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsUpdateSample.js b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsUpdateSample.js new file mode 100644 index 000000000000..94f32acfefa7 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/javascript/storageAccountsUpdateSample.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 { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates the Data Lake Analytics account to replace Azure Storage blob account details, such as the access key and/or suffix. + * + * @summary Updates the Data Lake Analytics account to replace Azure Storage blob account details, such as the access key and/or suffix. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Update.json + */ +async function replacesAzureStorageBlobAccountDetails() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const parameters = { + accessKey: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab346", + suffix: "test_suffix", + }; + const options = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + storageAccountName, + options + ); + console.log(result); +} + +replacesAzureStorageBlobAccountDetails().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/README.md b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/README.md new file mode 100644 index 000000000000..6e4d9615ad78 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/README.md @@ -0,0 +1,123 @@ +# 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** | +| ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [accountsCheckNameAvailabilitySample.ts][accountschecknameavailabilitysample] | Checks whether the specified account name is available or taken. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_CheckNameAvailability.json | +| [accountsCreateSample.ts][accountscreatesample] | Creates the specified Data Lake Analytics account. This supplies the user with computation services for Data Lake Analytics workloads. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Create.json | +| [accountsDeleteSample.ts][accountsdeletesample] | Begins the delete process for the Data Lake Analytics account object specified by the account name. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Delete.json | +| [accountsGetSample.ts][accountsgetsample] | Gets details of the specified Data Lake Analytics account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Get.json | +| [accountsListByResourceGroupSample.ts][accountslistbyresourcegroupsample] | Gets the first page of Data Lake Analytics accounts, if any, within a specific resource group. This includes a link to the next page, if any. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_ListByResourceGroup.json | +| [accountsListSample.ts][accountslistsample] | Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_List.json | +| [accountsUpdateSample.ts][accountsupdatesample] | Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Update.json | +| [computePoliciesCreateOrUpdateSample.ts][computepoliciescreateorupdatesample] | Creates or updates the specified compute policy. During update, the compute policy with the specified name will be replaced with this new compute policy. An account supports, at most, 50 policies x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_CreateOrUpdate.json | +| [computePoliciesDeleteSample.ts][computepoliciesdeletesample] | Deletes the specified compute policy from the specified Data Lake Analytics account x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Delete.json | +| [computePoliciesGetSample.ts][computepoliciesgetsample] | Gets the specified Data Lake Analytics compute policy. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Get.json | +| [computePoliciesListByAccountSample.ts][computepolicieslistbyaccountsample] | Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics account. An account supports, at most, 50 policies x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_ListByAccount.json | +| [computePoliciesUpdateSample.ts][computepoliciesupdatesample] | Updates the specified compute policy. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Update.json | +| [dataLakeStoreAccountsAddSample.ts][datalakestoreaccountsaddsample] | Updates the specified Data Lake Analytics account to include the additional Data Lake Store account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Add.json | +| [dataLakeStoreAccountsDeleteSample.ts][datalakestoreaccountsdeletesample] | Updates the Data Lake Analytics account specified to remove the specified Data Lake Store account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Delete.json | +| [dataLakeStoreAccountsGetSample.ts][datalakestoreaccountsgetsample] | Gets the specified Data Lake Store account details in the specified Data Lake Analytics account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Get.json | +| [dataLakeStoreAccountsListByAccountSample.ts][datalakestoreaccountslistbyaccountsample] | Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_ListByAccount.json | +| [firewallRulesCreateOrUpdateSample.ts][firewallrulescreateorupdatesample] | Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this new firewall rule. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_CreateOrUpdate.json | +| [firewallRulesDeleteSample.ts][firewallrulesdeletesample] | Deletes the specified firewall rule from the specified Data Lake Analytics account x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Delete.json | +| [firewallRulesGetSample.ts][firewallrulesgetsample] | Gets the specified Data Lake Analytics firewall rule. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Get.json | +| [firewallRulesListByAccountSample.ts][firewallruleslistbyaccountsample] | Lists the Data Lake Analytics firewall rules within the specified Data Lake Analytics account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_ListByAccount.json | +| [firewallRulesUpdateSample.ts][firewallrulesupdatesample] | Updates the specified firewall rule. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Update.json | +| [locationsGetCapabilitySample.ts][locationsgetcapabilitysample] | Gets subscription-level properties and limits for Data Lake Analytics specified by resource location. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Locations_GetCapability.json | +| [operationsListSample.ts][operationslistsample] | Lists all of the available Data Lake Analytics REST API operations. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Operations_List.json | +| [storageAccountsAddSample.ts][storageaccountsaddsample] | Updates the specified Data Lake Analytics account to add an Azure Storage account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Add.json | +| [storageAccountsDeleteSample.ts][storageaccountsdeletesample] | Updates the specified Data Lake Analytics account to remove an Azure Storage account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Delete.json | +| [storageAccountsGetSample.ts][storageaccountsgetsample] | Gets the specified Azure Storage account linked to the given Data Lake Analytics account. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Get.json | +| [storageAccountsGetStorageContainerSample.ts][storageaccountsgetstoragecontainersample] | Gets the specified Azure Storage container associated with the given Data Lake Analytics and Azure Storage accounts. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_GetStorageContainer.json | +| [storageAccountsListByAccountSample.ts][storageaccountslistbyaccountsample] | Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListByAccount.json | +| [storageAccountsListSasTokensSample.ts][storageaccountslistsastokenssample] | Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account and container combination. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListSasTokens.json | +| [storageAccountsListStorageContainersSample.ts][storageaccountsliststoragecontainerssample] | Lists the Azure Storage containers, if any, associated with the specified Data Lake Analytics and Azure Storage account combination. The response includes a link to the next page of results, if any. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListStorageContainers.json | +| [storageAccountsUpdateSample.ts][storageaccountsupdatesample] | Updates the Data Lake Analytics account to replace Azure Storage blob account details, such as the access key and/or suffix. x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Update.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +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/accountsCheckNameAvailabilitySample.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 node dist/accountsCheckNameAvailabilitySample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[accountschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsCheckNameAvailabilitySample.ts +[accountscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsCreateSample.ts +[accountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsDeleteSample.ts +[accountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsGetSample.ts +[accountslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsListByResourceGroupSample.ts +[accountslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsListSample.ts +[accountsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsUpdateSample.ts +[computepoliciescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesCreateOrUpdateSample.ts +[computepoliciesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesDeleteSample.ts +[computepoliciesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesGetSample.ts +[computepolicieslistbyaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesListByAccountSample.ts +[computepoliciesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesUpdateSample.ts +[datalakestoreaccountsaddsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsAddSample.ts +[datalakestoreaccountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsDeleteSample.ts +[datalakestoreaccountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsGetSample.ts +[datalakestoreaccountslistbyaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsListByAccountSample.ts +[firewallrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts +[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesDeleteSample.ts +[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesGetSample.ts +[firewallruleslistbyaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesListByAccountSample.ts +[firewallrulesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesUpdateSample.ts +[locationsgetcapabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/locationsGetCapabilitySample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/operationsListSample.ts +[storageaccountsaddsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsAddSample.ts +[storageaccountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsDeleteSample.ts +[storageaccountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsGetSample.ts +[storageaccountsgetstoragecontainersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsGetStorageContainerSample.ts +[storageaccountslistbyaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsListByAccountSample.ts +[storageaccountslistsastokenssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsListSasTokensSample.ts +[storageaccountsliststoragecontainerssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsListStorageContainersSample.ts +[storageaccountsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsUpdateSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-datalake-analytics?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datalake-analytics/arm-datalake-analytics/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/package.json b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/package.json new file mode 100644 index 000000000000..2368425a3831 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-datalake-analytics-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/datalake-analytics/arm-datalake-analytics" + }, + "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/datalake-analytics/arm-datalake-analytics", + "dependencies": { + "@azure/arm-datalake-analytics": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/sample.env b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-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/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsCheckNameAvailabilitySample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..4a9a7ebebd97 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsCheckNameAvailabilitySample.ts @@ -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. +import { + CheckNameAvailabilityParameters, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Checks whether the specified account name is available or taken. + * + * @summary Checks whether the specified account name is available or taken. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_CheckNameAvailability.json + */ +async function checksWhetherTheSpecifiedAccountNameIsAvailableOrTaken() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const location = "EastUS2"; + const parameters: CheckNameAvailabilityParameters = { + name: "contosoadla", + type: "Microsoft.DataLakeAnalytics/accounts" + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.accounts.checkNameAvailability( + location, + parameters + ); + console.log(result); +} + +checksWhetherTheSpecifiedAccountNameIsAvailableOrTaken().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsCreateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsCreateSample.ts new file mode 100644 index 000000000000..098429c252a8 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsCreateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + CreateDataLakeAnalyticsAccountParameters, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates the specified Data Lake Analytics account. This supplies the user with computation services for Data Lake Analytics workloads. + * + * @summary Creates the specified Data Lake Analytics account. This supplies the user with computation services for Data Lake Analytics workloads. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Create.json + */ +async function createsTheSpecifiedDataLakeAnalyticsAccountThisSuppliesTheUserWithComputationServicesForDataLakeAnalyticsWorkloads() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const parameters: CreateDataLakeAnalyticsAccountParameters = { + computePolicies: [ + { + name: "test_policy", + maxDegreeOfParallelismPerJob: 1, + minPriorityPerJob: 1, + objectId: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + objectType: "User" + } + ], + dataLakeStoreAccounts: [{ name: "test_adls", suffix: "test_suffix" }], + defaultDataLakeStoreAccount: "test_adls", + firewallAllowAzureIps: "Enabled", + firewallRules: [ + { name: "test_rule", endIpAddress: "2.2.2.2", startIpAddress: "1.1.1.1" } + ], + firewallState: "Enabled", + location: "eastus2", + maxDegreeOfParallelism: 30, + maxDegreeOfParallelismPerJob: 1, + maxJobCount: 3, + minPriorityPerJob: 1, + newTier: "Consumption", + queryStoreRetention: 30, + storageAccounts: [ + { + name: "test_storage", + accessKey: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab346", + suffix: "test_suffix" + } + ], + tags: { testKey: "test_value" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.accounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +createsTheSpecifiedDataLakeAnalyticsAccountThisSuppliesTheUserWithComputationServicesForDataLakeAnalyticsWorkloads().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsDeleteSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsDeleteSample.ts new file mode 100644 index 000000000000..53943735ae0a --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsDeleteSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Begins the delete process for the Data Lake Analytics account object specified by the account name. + * + * @summary Begins the delete process for the Data Lake Analytics account object specified by the account name. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Delete.json + */ +async function beginsTheDeleteProcessForTheDataLakeAnalyticsAccountObjectSpecifiedByTheAccountName() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.accounts.beginDeleteAndWait( + resourceGroupName, + accountName + ); + console.log(result); +} + +beginsTheDeleteProcessForTheDataLakeAnalyticsAccountObjectSpecifiedByTheAccountName().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsGetSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsGetSample.ts new file mode 100644 index 000000000000..ae9af0fb5123 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets details of the specified Data Lake Analytics account. + * + * @summary Gets details of the specified Data Lake Analytics account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Get.json + */ +async function getsDetailsOfTheSpecifiedDataLakeAnalyticsAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.accounts.get(resourceGroupName, accountName); + console.log(result); +} + +getsDetailsOfTheSpecifiedDataLakeAnalyticsAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsListByResourceGroupSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsListByResourceGroupSample.ts new file mode 100644 index 000000000000..db0f3dd2edda --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsListByResourceGroupSample.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + AccountsListByResourceGroupOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the first page of Data Lake Analytics accounts, if any, within a specific resource group. This includes a link to the next page, if any. + * + * @summary Gets the first page of Data Lake Analytics accounts, if any, within a specific resource group. This includes a link to the next page, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_ListByResourceGroup.json + */ +async function getsTheFirstPageOfDataLakeAnalyticsAccountsIfAnyWithinASpecificResourceGroupThisIncludesALinkToTheNextPageIfAny() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const filter = "test_filter"; + const top = 1; + const skip = 1; + const select = "test_select"; + const orderby = "test_orderby"; + const count = false; + const options: AccountsListByResourceGroupOptionalParams = { + filter, + top, + skip, + select, + orderby, + count + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.accounts.listByResourceGroup( + resourceGroupName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheFirstPageOfDataLakeAnalyticsAccountsIfAnyWithinASpecificResourceGroupThisIncludesALinkToTheNextPageIfAny().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsListSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsListSample.ts new file mode 100644 index 000000000000..3d4b829c6078 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsListSample.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + AccountsListOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. + * + * @summary Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_List.json + */ +async function getsTheFirstPageOfDataLakeAnalyticsAccountsIfAnyWithinTheCurrentSubscriptionThisIncludesALinkToTheNextPageIfAny() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const filter = "test_filter"; + const top = 1; + const skip = 1; + const select = "test_select"; + const orderby = "test_orderby"; + const count = false; + const options: AccountsListOptionalParams = { + filter, + top, + skip, + select, + orderby, + count + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.accounts.list(options)) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheFirstPageOfDataLakeAnalyticsAccountsIfAnyWithinTheCurrentSubscriptionThisIncludesALinkToTheNextPageIfAny().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsUpdateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsUpdateSample.ts new file mode 100644 index 000000000000..f7f91715fb6f --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/accountsUpdateSample.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + UpdateDataLakeAnalyticsAccountParameters, + AccountsUpdateOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object. + * + * @summary Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Accounts_Update.json + */ +async function updatesTheDataLakeAnalyticsAccountObjectSpecifiedByTheAccountNameWithTheContentsOfTheAccountObject() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const parameters: UpdateDataLakeAnalyticsAccountParameters = { + computePolicies: [ + { + name: "test_policy", + maxDegreeOfParallelismPerJob: 1, + minPriorityPerJob: 1, + objectId: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + objectType: "User" + } + ], + firewallAllowAzureIps: "Enabled", + firewallRules: [ + { name: "test_rule", endIpAddress: "2.2.2.2", startIpAddress: "1.1.1.1" } + ], + firewallState: "Enabled", + maxDegreeOfParallelism: 1, + maxDegreeOfParallelismPerJob: 1, + maxJobCount: 1, + minPriorityPerJob: 1, + newTier: "Consumption", + queryStoreRetention: 1, + tags: { testKey: "test_value" } + }; + const options: AccountsUpdateOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.accounts.beginUpdateAndWait( + resourceGroupName, + accountName, + options + ); + console.log(result); +} + +updatesTheDataLakeAnalyticsAccountObjectSpecifiedByTheAccountNameWithTheContentsOfTheAccountObject().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesCreateOrUpdateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..1bb7e26fde2e --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesCreateOrUpdateSample.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 { + CreateOrUpdateComputePolicyParameters, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates or updates the specified compute policy. During update, the compute policy with the specified name will be replaced with this new compute policy. An account supports, at most, 50 policies + * + * @summary Creates or updates the specified compute policy. During update, the compute policy with the specified name will be replaced with this new compute policy. An account supports, at most, 50 policies + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_CreateOrUpdate.json + */ +async function createsOrUpdatesTheSpecifiedComputePolicy() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const computePolicyName = "test_policy"; + const parameters: CreateOrUpdateComputePolicyParameters = { + maxDegreeOfParallelismPerJob: 10, + minPriorityPerJob: 30, + objectId: "776b9091-8916-4638-87f7-9c989a38da98", + objectType: "User" + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.computePolicies.createOrUpdate( + resourceGroupName, + accountName, + computePolicyName, + parameters + ); + console.log(result); +} + +createsOrUpdatesTheSpecifiedComputePolicy().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesDeleteSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesDeleteSample.ts new file mode 100644 index 000000000000..243691244248 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesDeleteSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the specified compute policy from the specified Data Lake Analytics account + * + * @summary Deletes the specified compute policy from the specified Data Lake Analytics account + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Delete.json + */ +async function deletesTheSpecifiedComputePolicyFromTheAdlaAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const computePolicyName = "test_policy"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.computePolicies.delete( + resourceGroupName, + accountName, + computePolicyName + ); + console.log(result); +} + +deletesTheSpecifiedComputePolicyFromTheAdlaAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesGetSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesGetSample.ts new file mode 100644 index 000000000000..6497d59656d7 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesGetSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the specified Data Lake Analytics compute policy. + * + * @summary Gets the specified Data Lake Analytics compute policy. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Get.json + */ +async function getsTheSpecifiedComputePolicy() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const computePolicyName = "test_policy"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.computePolicies.get( + resourceGroupName, + accountName, + computePolicyName + ); + console.log(result); +} + +getsTheSpecifiedComputePolicy().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesListByAccountSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesListByAccountSample.ts new file mode 100644 index 000000000000..3f40b4caecff --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesListByAccountSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics account. An account supports, at most, 50 policies + * + * @summary Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics account. An account supports, at most, 50 policies + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_ListByAccount.json + */ +async function listsTheComputePoliciesWithinTheAdlaAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.computePolicies.listByAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listsTheComputePoliciesWithinTheAdlaAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesUpdateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesUpdateSample.ts new file mode 100644 index 000000000000..15184821b934 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/computePoliciesUpdateSample.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 { + UpdateComputePolicyParameters, + ComputePoliciesUpdateOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the specified compute policy. + * + * @summary Updates the specified compute policy. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/ComputePolicies_Update.json + */ +async function updatesTheSpecifiedComputePolicy() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const computePolicyName = "test_policy"; + const parameters: UpdateComputePolicyParameters = { + maxDegreeOfParallelismPerJob: 11, + minPriorityPerJob: 31 + }; + const options: ComputePoliciesUpdateOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.computePolicies.update( + resourceGroupName, + accountName, + computePolicyName, + options + ); + console.log(result); +} + +updatesTheSpecifiedComputePolicy().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsAddSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsAddSample.ts new file mode 100644 index 000000000000..e8af9efbee93 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsAddSample.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 { + AddDataLakeStoreParameters, + DataLakeStoreAccountsAddOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the specified Data Lake Analytics account to include the additional Data Lake Store account. + * + * @summary Updates the specified Data Lake Analytics account to include the additional Data Lake Store account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Add.json + */ +async function addsADataLakeStoreAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const dataLakeStoreAccountName = "test_adls_account"; + const parameters: AddDataLakeStoreParameters = { suffix: "test_suffix" }; + const options: DataLakeStoreAccountsAddOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.dataLakeStoreAccounts.add( + resourceGroupName, + accountName, + dataLakeStoreAccountName, + options + ); + console.log(result); +} + +addsADataLakeStoreAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsDeleteSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsDeleteSample.ts new file mode 100644 index 000000000000..a971ce5f6b1e --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsDeleteSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the Data Lake Analytics account specified to remove the specified Data Lake Store account. + * + * @summary Updates the Data Lake Analytics account specified to remove the specified Data Lake Store account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Delete.json + */ +async function removesTheSpecifiedDataLakeStoreAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const dataLakeStoreAccountName = "test_adls_account"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.dataLakeStoreAccounts.delete( + resourceGroupName, + accountName, + dataLakeStoreAccountName + ); + console.log(result); +} + +removesTheSpecifiedDataLakeStoreAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsGetSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsGetSample.ts new file mode 100644 index 000000000000..49901b78b865 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsGetSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the specified Data Lake Store account details in the specified Data Lake Analytics account. + * + * @summary Gets the specified Data Lake Store account details in the specified Data Lake Analytics account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_Get.json + */ +async function getsTheSpecifiedDataLakeStoreAccountDetails() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1669ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const dataLakeStoreAccountName = "test_adls_account"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.dataLakeStoreAccounts.get( + resourceGroupName, + accountName, + dataLakeStoreAccountName + ); + console.log(result); +} + +getsTheSpecifiedDataLakeStoreAccountDetails().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsListByAccountSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsListByAccountSample.ts new file mode 100644 index 000000000000..5904d4dfde2c --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/dataLakeStoreAccountsListByAccountSample.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + DataLakeStoreAccountsListByAccountOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. + * + * @summary Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/DataLakeStoreAccounts_ListByAccount.json + */ +async function getsTheFirstPageOfDataLakeStoreAccountsLinkedToTheSpecifiedDataLakeAnalyticsAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const filter = "test_filter"; + const top = 1; + const skip = 1; + const select = "test_select"; + const orderby = "test_orderby"; + const count = false; + const options: DataLakeStoreAccountsListByAccountOptionalParams = { + filter, + top, + skip, + select, + orderby, + count + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.dataLakeStoreAccounts.listByAccount( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheFirstPageOfDataLakeStoreAccountsLinkedToTheSpecifiedDataLakeAnalyticsAccount().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..bf4fa94d918f --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesCreateOrUpdateSample.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 { + CreateOrUpdateFirewallRuleParameters, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this new firewall rule. + * + * @summary Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this new firewall rule. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_CreateOrUpdate.json + */ +async function createsOrUpdatesTheSpecifiedFirewallRule() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const firewallRuleName = "test_rule"; + const parameters: CreateOrUpdateFirewallRuleParameters = { + endIpAddress: "2.2.2.2", + startIpAddress: "1.1.1.1" + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.firewallRules.createOrUpdate( + resourceGroupName, + accountName, + firewallRuleName, + parameters + ); + console.log(result); +} + +createsOrUpdatesTheSpecifiedFirewallRule().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesDeleteSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesDeleteSample.ts new file mode 100644 index 000000000000..01d60418fcc8 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesDeleteSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the specified firewall rule from the specified Data Lake Analytics account + * + * @summary Deletes the specified firewall rule from the specified Data Lake Analytics account + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Delete.json + */ +async function deletesTheSpecifiedFirewallRule() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const firewallRuleName = "test_rule"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.firewallRules.delete( + resourceGroupName, + accountName, + firewallRuleName + ); + console.log(result); +} + +deletesTheSpecifiedFirewallRule().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesGetSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesGetSample.ts new file mode 100644 index 000000000000..0a2c934ace86 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesGetSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the specified Data Lake Analytics firewall rule. + * + * @summary Gets the specified Data Lake Analytics firewall rule. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Get.json + */ +async function getsTheSpecifiedDataLakeAnalyticsFirewallRule() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const firewallRuleName = "test_rule"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.firewallRules.get( + resourceGroupName, + accountName, + firewallRuleName + ); + console.log(result); +} + +getsTheSpecifiedDataLakeAnalyticsFirewallRule().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesListByAccountSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesListByAccountSample.ts new file mode 100644 index 000000000000..5cfce071bec7 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesListByAccountSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the Data Lake Analytics firewall rules within the specified Data Lake Analytics account. + * + * @summary Lists the Data Lake Analytics firewall rules within the specified Data Lake Analytics account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_ListByAccount.json + */ +async function listsTheDataLakeAnalyticsFirewallRules() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.firewallRules.listByAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listsTheDataLakeAnalyticsFirewallRules().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesUpdateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesUpdateSample.ts new file mode 100644 index 000000000000..eee3ccb5072c --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/firewallRulesUpdateSample.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 { + UpdateFirewallRuleParameters, + FirewallRulesUpdateOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the specified firewall rule. + * + * @summary Updates the specified firewall rule. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/FirewallRules_Update.json + */ +async function updatesTheSpecifiedFirewallRule() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const firewallRuleName = "test_rule"; + const parameters: UpdateFirewallRuleParameters = { + endIpAddress: "2.2.2.2", + startIpAddress: "1.1.1.1" + }; + const options: FirewallRulesUpdateOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.firewallRules.update( + resourceGroupName, + accountName, + firewallRuleName, + options + ); + console.log(result); +} + +updatesTheSpecifiedFirewallRule().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/locationsGetCapabilitySample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/locationsGetCapabilitySample.ts new file mode 100644 index 000000000000..0d5a03693da7 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/locationsGetCapabilitySample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets subscription-level properties and limits for Data Lake Analytics specified by resource location. + * + * @summary Gets subscription-level properties and limits for Data Lake Analytics specified by resource location. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Locations_GetCapability.json + */ +async function getsSubscriptionLevelPropertiesAndLimitsForDataLakeAnalyticsSpecifiedByResourceLocation() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const location = "EastUS2"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.locations.getCapability(location); + console.log(result); +} + +getsSubscriptionLevelPropertiesAndLimitsForDataLakeAnalyticsSpecifiedByResourceLocation().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/operationsListSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..acfe3f35e355 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/operationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the available Data Lake Analytics REST API operations. + * + * @summary Lists all of the available Data Lake Analytics REST API operations. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/Operations_List.json + */ +async function listsAllOfTheAvailableDataLakeAnalyticsRestApiOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.operations.list(); + console.log(result); +} + +listsAllOfTheAvailableDataLakeAnalyticsRestApiOperations().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsAddSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsAddSample.ts new file mode 100644 index 000000000000..84e2565d647f --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsAddSample.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 { + AddStorageAccountParameters, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the specified Data Lake Analytics account to add an Azure Storage account. + * + * @summary Updates the specified Data Lake Analytics account to add an Azure Storage account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Add.json + */ +async function addsAnAzureStorageAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const parameters: AddStorageAccountParameters = { + accessKey: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab346", + suffix: "test_suffix" + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.storageAccounts.add( + resourceGroupName, + accountName, + storageAccountName, + parameters + ); + console.log(result); +} + +addsAnAzureStorageAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsDeleteSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsDeleteSample.ts new file mode 100644 index 000000000000..a3d1a415f1ec --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsDeleteSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the specified Data Lake Analytics account to remove an Azure Storage account. + * + * @summary Updates the specified Data Lake Analytics account to remove an Azure Storage account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Delete.json + */ +async function removesAnAzureStorageAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.storageAccounts.delete( + resourceGroupName, + accountName, + storageAccountName + ); + console.log(result); +} + +removesAnAzureStorageAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsGetSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsGetSample.ts new file mode 100644 index 000000000000..ce38da0b062b --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsGetSample.ts @@ -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. +import { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the specified Azure Storage account linked to the given Data Lake Analytics account. + * + * @summary Gets the specified Azure Storage account linked to the given Data Lake Analytics account. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Get.json + */ +async function getsTheSpecifiedAzureStorageAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.storageAccounts.get( + resourceGroupName, + accountName, + storageAccountName + ); + console.log(result); +} + +getsTheSpecifiedAzureStorageAccount().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsGetStorageContainerSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsGetStorageContainerSample.ts new file mode 100644 index 000000000000..d4a2f9743362 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsGetStorageContainerSample.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 { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the specified Azure Storage container associated with the given Data Lake Analytics and Azure Storage accounts. + * + * @summary Gets the specified Azure Storage container associated with the given Data Lake Analytics and Azure Storage accounts. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_GetStorageContainer.json + */ +async function getsTheSpecifiedAzureStorageContainer() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const containerName = "test_container"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.storageAccounts.getStorageContainer( + resourceGroupName, + accountName, + storageAccountName, + containerName + ); + console.log(result); +} + +getsTheSpecifiedAzureStorageContainer().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsListByAccountSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsListByAccountSample.ts new file mode 100644 index 000000000000..4cf8f31299ef --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsListByAccountSample.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + StorageAccountsListByAccountOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. + * + * @summary Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListByAccount.json + */ +async function getsTheFirstPageOfAzureStorageAccountsLinkedToTheSpecifiedDataLakeAnalyticsAccount() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const filter = "test_filter"; + const top = 1; + const skip = 1; + const select = "test_select"; + const orderby = "test_orderby"; + const count = false; + const options: StorageAccountsListByAccountOptionalParams = { + filter, + top, + skip, + select, + orderby, + count + }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.storageAccounts.listByAccount( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheFirstPageOfAzureStorageAccountsLinkedToTheSpecifiedDataLakeAnalyticsAccount().catch( + console.error +); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsListSasTokensSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsListSasTokensSample.ts new file mode 100644 index 000000000000..6bd40e0ae40b --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsListSasTokensSample.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 { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account and container combination. + * + * @summary Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account and container combination. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListSasTokens.json + */ +async function getsTheSasToken() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const containerName = "test_container"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.storageAccounts.listSasTokens( + resourceGroupName, + accountName, + storageAccountName, + containerName + )) { + resArray.push(item); + } + console.log(resArray); +} + +getsTheSasToken().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsListStorageContainersSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsListStorageContainersSample.ts new file mode 100644 index 000000000000..6e1d6ee000d9 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsListStorageContainersSample.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 { DataLakeAnalyticsAccountManagementClient } from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the Azure Storage containers, if any, associated with the specified Data Lake Analytics and Azure Storage account combination. The response includes a link to the next page of results, if any. + * + * @summary Lists the Azure Storage containers, if any, associated with the specified Data Lake Analytics and Azure Storage account combination. The response includes a link to the next page of results, if any. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_ListStorageContainers.json + */ +async function listsTheAzureStorageContainers() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.storageAccounts.listStorageContainers( + resourceGroupName, + accountName, + storageAccountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listsTheAzureStorageContainers().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsUpdateSample.ts b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsUpdateSample.ts new file mode 100644 index 000000000000..f9a597a6607d --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/src/storageAccountsUpdateSample.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 { + UpdateStorageAccountParameters, + StorageAccountsUpdateOptionalParams, + DataLakeAnalyticsAccountManagementClient +} from "@azure/arm-datalake-analytics"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the Data Lake Analytics account to replace Azure Storage blob account details, such as the access key and/or suffix. + * + * @summary Updates the Data Lake Analytics account to replace Azure Storage blob account details, such as the access key and/or suffix. + * x-ms-original-file: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/preview/2019-11-01-preview/examples/StorageAccounts_Update.json + */ +async function replacesAzureStorageBlobAccountDetails() { + const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = "contosorg"; + const accountName = "contosoadla"; + const storageAccountName = "test_storage"; + const parameters: UpdateStorageAccountParameters = { + accessKey: "34adfa4f-cedf-4dc0-ba29-b6d1a69ab346", + suffix: "test_suffix" + }; + const options: StorageAccountsUpdateOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new DataLakeAnalyticsAccountManagementClient( + credential, + subscriptionId + ); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + storageAccountName, + options + ); + console.log(result); +} + +replacesAzureStorageBlobAccountDetails().catch(console.error); diff --git a/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/tsconfig.json b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..416c2dd82e00 --- /dev/null +++ b/sdk/datalake-analytics/arm-datalake-analytics/samples/v2-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "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/datalake-analytics/arm-datalake-analytics/src/dataLakeAnalyticsAccountManagementClient.ts b/sdk/datalake-analytics/arm-datalake-analytics/src/dataLakeAnalyticsAccountManagementClient.ts index 421d7223601e..233614126d71 100644 --- a/sdk/datalake-analytics/arm-datalake-analytics/src/dataLakeAnalyticsAccountManagementClient.ts +++ b/sdk/datalake-analytics/arm-datalake-analytics/src/dataLakeAnalyticsAccountManagementClient.ts @@ -7,6 +7,7 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { AccountsImpl, @@ -61,7 +62,7 @@ export class DataLakeAnalyticsAccountManagementClient extends coreClient.Service credential: credentials }; - const packageDetails = `azsdk-js-arm-datalake-analytics/2.0.0-beta.2`; + const packageDetails = `azsdk-js-arm-datalake-analytics/2.0.0-beta.3`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -76,9 +77,33 @@ export class DataLakeAnalyticsAccountManagementClient extends coreClient.Service userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint || "https://management.azure.com" + baseUri: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + } // Parameter assignments this.subscriptionId = subscriptionId; diff --git a/sdk/datalake-analytics/arm-datalake-analytics/src/operations/accounts.ts b/sdk/datalake-analytics/arm-datalake-analytics/src/operations/accounts.ts index 6cd0ceb97a0a..07080d7c5323 100644 --- a/sdk/datalake-analytics/arm-datalake-analytics/src/operations/accounts.ts +++ b/sdk/datalake-analytics/arm-datalake-analytics/src/operations/accounts.ts @@ -237,10 +237,12 @@ export class AccountsImpl implements Accounts { { resourceGroupName, accountName, parameters, options }, createOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -344,10 +346,12 @@ export class AccountsImpl implements Accounts { { resourceGroupName, accountName, options }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -425,10 +429,12 @@ export class AccountsImpl implements Accounts { { resourceGroupName, accountName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/datalake-analytics/arm-datalake-analytics/tsconfig.json b/sdk/datalake-analytics/arm-datalake-analytics/tsconfig.json index 6e3251194117..f0c3ab37c401 100644 --- a/sdk/datalake-analytics/arm-datalake-analytics/tsconfig.json +++ b/sdk/datalake-analytics/arm-datalake-analytics/tsconfig.json @@ -9,11 +9,25 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true + "importHelpers": true, + "paths": { + "@azure/arm-datalake-analytics": [ + "./src/index" + ] + } }, - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "exclude": ["node_modules"] -} + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/datalake-analytics/ci.mgmt.yml b/sdk/datalake-analytics/ci.mgmt.yml index d065b6559575..169ab96bda18 100644 --- a/sdk/datalake-analytics/ci.mgmt.yml +++ b/sdk/datalake-analytics/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -9,7 +9,7 @@ trigger: paths: include: - sdk/datalake-analytics/ci.mgmt.yml - - sdk/datalake-analytics/arm-datalake-analytics/ + - sdk/datalake-analytics/arm-datalake-analytics pr: branches: include: @@ -22,12 +22,11 @@ pr: paths: include: - sdk/datalake-analytics/ci.mgmt.yml - - sdk/datalake-analytics/arm-datalake-analytics/ - + - sdk/datalake-analytics/arm-datalake-analytics extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: datalake-analytics Artifacts: - name: azure-arm-datalake-analytics - safeName: azurearmdatalakeanalytics \ No newline at end of file + safeName: azurearmdatalakeanalytics diff --git a/sdk/datamigration/arm-datamigration/CHANGELOG.md b/sdk/datamigration/arm-datamigration/CHANGELOG.md index e4f2ddb910a9..bfe537c81d2c 100644 --- a/sdk/datamigration/arm-datamigration/CHANGELOG.md +++ b/sdk/datamigration/arm-datamigration/CHANGELOG.md @@ -1,8 +1,8 @@ # Release History -## 3.0.0-beta.1 (2022-01-18) +## 3.0.0-beta.2 (2022-04-18) -The package of @azure/arm-datamigration is using our next generation design principles since version 3.0.0-beta.1, which contains breaking changes. +The package of @azure/arm-datamigration is using our next generation design principles since version 3.0.0-beta.2, which contains breaking changes. To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). diff --git a/sdk/datamigration/arm-datamigration/LICENSE.txt b/sdk/datamigration/arm-datamigration/LICENSE.txt deleted file mode 100644 index b73b4a1293c3..000000000000 --- a/sdk/datamigration/arm-datamigration/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 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. diff --git a/sdk/datamigration/arm-datamigration/README.md b/sdk/datamigration/arm-datamigration/README.md index 3c2a9b9e3942..e7eb7f8565cf 100644 --- a/sdk/datamigration/arm-datamigration/README.md +++ b/sdk/datamigration/arm-datamigration/README.md @@ -16,6 +16,8 @@ Data Migration Client - [LTS versions of Node.js](https://nodejs.org/about/releases/) - 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]. @@ -49,8 +51,17 @@ For more information about how to create an Azure AD Application check out [this ```javascript const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); 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 DataMigrationManagementClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new DataMigrationManagementClient(credential, subscriptionId); ``` diff --git a/sdk/datamigration/arm-datamigration/_meta.json b/sdk/datamigration/arm-datamigration/_meta.json index e0620020082d..56440cedc188 100644 --- a/sdk/datamigration/arm-datamigration/_meta.json +++ b/sdk/datamigration/arm-datamigration/_meta.json @@ -1,7 +1,8 @@ { "commit": "d29e6eb4894005c52e67cb4b5ac3faf031113e7d", - "readme": "specification/datamigration/resource-manager/readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/hybridcompute/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220114.1 --generate-sample=true", + "readme": "specification\\datamigration\\resource-manager\\readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\datamigration\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20220114.1" -} + "release_tool": "@azure-tools/js-sdk-release-tools@2.2.6", + "use": "@autorest/typescript@6.0.0-alpha.19.20220408.1" +} \ No newline at end of file diff --git a/sdk/datamigration/arm-datamigration/api-extractor.json b/sdk/datamigration/arm-datamigration/api-extractor.json index a59a60147e00..1613066a4220 100644 --- a/sdk/datamigration/arm-datamigration/api-extractor.json +++ b/sdk/datamigration/arm-datamigration/api-extractor.json @@ -1,18 +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" }, + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, "dtsRollup": { "enabled": true, "untrimmedFilePath": "", "publicTrimmedFilePath": "./types/arm-datamigration.d.ts" }, "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } } } -} +} \ No newline at end of file diff --git a/sdk/datamigration/arm-datamigration/package.json b/sdk/datamigration/arm-datamigration/package.json index b7dbf00d1182..694d615a3bae 100644 --- a/sdk/datamigration/arm-datamigration/package.json +++ b/sdk/datamigration/arm-datamigration/package.json @@ -3,31 +3,39 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for DataMigrationManagementClient.", - "version": "3.0.0-beta.1", - "engines": { "node": ">=12.0.0" }, + "version": "3.0.0-beta.2", + "engines": { + "node": ">=12.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.0.0", + "@azure/core-client": "^1.5.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, - "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], "license": "MIT", "main": "./dist/index.js", "module": "./dist-esm/src/index.js", "types": "./types/arm-datamigration.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.18.11", - "@rollup/plugin-commonjs": "11.0.2", - "@rollup/plugin-json": "^4.0.0", - "@rollup/plugin-multi-entry": "^3.0.0", - "@rollup/plugin-node-resolve": "^8.0.0", + "@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": "^1.16.3", - "rollup-plugin-sourcemaps": "^0.4.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.2.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", @@ -41,7 +49,9 @@ "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" }, - "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, "files": [ "dist/**/*.js", "dist/**/*.js.map", @@ -91,7 +101,7 @@ "//metadata": { "constantPaths": [ { - "path": "src/DataMigrationManagementClient.ts", + "path": "src/dataMigrationManagementClient.ts", "prefix": "packageDetails" } ] @@ -99,8 +109,10 @@ "autoPublish": true, "//sampleConfiguration": { "productName": "", - "productSlugs": ["azure"], + "productSlugs": [ + "azure" + ], "disableDocsMs": true, "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-datamigration?view=azure-node-preview" } -} +} \ No newline at end of file diff --git a/sdk/datamigration/arm-datamigration/rollup.config.js b/sdk/datamigration/arm-datamigration/rollup.config.js index 9be1955eb7f1..3f89d7309da5 100644 --- a/sdk/datamigration/arm-datamigration/rollup.config.js +++ b/sdk/datamigration/arm-datamigration/rollup.config.js @@ -14,62 +14,14 @@ import json from "@rollup/plugin-json"; import nodeBuiltins from "builtin-modules"; -/** - * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. - * - * NOTE: this manual configuration is only needed because OpenTelemetry uses an - * __exportStar downleveled helper function to declare its exports which confuses - * rollup's automatic discovery mechanism. - * - * @returns an object reference that can be `...`'d into your cjs() configuration. - */ -export function openTelemetryCommonJs() { - const namedExports = {}; - - for (const key of [ - "@opentelemetry/api", - "@azure/core-tracing/node_modules/@opentelemetry/api" - ]) { - namedExports[key] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "SpanStatusCode", - "getSpanContext", - "setSpanContext" - ]; - } - - const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; - - for (const version of releasedOpenTelemetryVersions) { - namedExports[ - // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. - `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` - ] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "StatusCode", - "CanonicalCode", - "getSpanContext", - "setSpanContext" - ]; - } - - return namedExports; -} - // #region Warning Handler /** - * A function that can determine whether a rollupwarning should be ignored. If + * 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 ignoreNiseSinonEvalWarnings(warning) { +function ignoreNiseSinonEval(warning) { return ( warning.code === "EVAL" && warning.id && @@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) { ); } -function ignoreChaiCircularDependencyWarnings(warning) { +function ignoreChaiCircularDependency(warning) { return ( warning.code === "CIRCULAR_DEPENDENCY" && warning.importer && warning.importer.includes("node_modules/chai") === true ); } -const warningInhibitors = [ - ignoreChaiCircularDependencyWarnings, - ignoreNiseSinonEvalWarnings -]; +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; /** * Construct a warning handler for the shared rollup configuration @@ -122,22 +71,7 @@ function makeBrowserTestConfig() { nodeResolve({ mainFields: ["module", "browser"] }), - cjs({ - namedExports: { - // Chai's strange internal architecture makes it impossible to statically - // analyze its exports. - chai: [ - "version", - "use", - "util", - "config", - "expect", - "should", - "assert" - ], - ...openTelemetryCommonJs() - } - }), + cjs(), json(), sourcemaps() //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) @@ -173,7 +107,7 @@ export function makeConfig(pkg, options) { ], output: { file: "dist/index.js", format: "cjs", sourcemap: true }, preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve(), cjs()] + plugins: [sourcemaps(), nodeResolve()] }; const config = [baseConfig]; diff --git a/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlMiCancelSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlMiCancelSample.ts new file mode 100644 index 000000000000..f0896cd3a58e --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlMiCancelSample.ts @@ -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. +import { + MigrationOperationInput, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Stop migrations in progress for the database + * + * @summary Stop migrations in progress for the database + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCancelDatabaseMigration.json + */ +async function stopOngoingMigrationForTheDatabase() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const parameters: MigrationOperationInput = { + migrationOperationId: "4124fe90-d1b6-4b50-b4d9-46d02381f59a" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.beginCancelAndWait( + resourceGroupName, + managedInstanceName, + targetDbName, + parameters + ); + console.log(result); +} + +stopOngoingMigrationForTheDatabase().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlMiCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlMiCreateOrUpdateSample.ts new file mode 100644 index 000000000000..1167d7decf01 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlMiCreateOrUpdateSample.ts @@ -0,0 +1,137 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + DatabaseMigrationSqlMi, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or Update Database Migration resource. + * + * @summary Create or Update Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCreateOrUpdateDatabaseMigrationMAX.json + */ +async function createOrUpdateDatabaseMigrationResourceWithMaximumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const parameters: DatabaseMigrationSqlMi = { + properties: { + backupConfiguration: { + sourceLocation: { + fileShare: { + path: "C:aaa\bbbccc", + password: "placeholder", + username: "name" + } + }, + targetLocation: { + accountKey: "abcd", + storageAccountResourceId: "account.database.windows.net" + } + }, + kind: "SqlMi", + migrationService: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent", + offlineConfiguration: { + lastBackupName: "last_backup_file_name", + offline: true + }, + scope: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance", + sourceDatabaseName: "aaa", + sourceSqlConnection: { + authentication: "WindowsAuthentication", + dataSource: "aaa", + encryptConnection: true, + password: "placeholder", + trustServerCertificate: true, + userName: "bbb" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.beginCreateOrUpdateAndWait( + resourceGroupName, + managedInstanceName, + targetDbName, + parameters + ); + console.log(result); +} + +createOrUpdateDatabaseMigrationResourceWithMaximumParameters().catch( + console.error +); + +/** + * This sample demonstrates how to Create or Update Database Migration resource. + * + * @summary Create or Update Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCreateOrUpdateDatabaseMigrationMIN.json + */ +async function createOrUpdateDatabaseMigrationResourceWithMinimumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const parameters: DatabaseMigrationSqlMi = { + properties: { + backupConfiguration: { + sourceLocation: { + fileShare: { + path: "C:aaa\bbbccc", + password: "placeholder", + username: "name" + } + }, + targetLocation: { + accountKey: "abcd", + storageAccountResourceId: "account.database.windows.net" + } + }, + kind: "SqlMi", + migrationService: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent", + offlineConfiguration: { + lastBackupName: "last_backup_file_name", + offline: true + }, + scope: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance", + sourceDatabaseName: "aaa", + sourceSqlConnection: { + authentication: "WindowsAuthentication", + dataSource: "aaa", + encryptConnection: true, + password: "placeholder", + trustServerCertificate: true, + userName: "bbb" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.beginCreateOrUpdateAndWait( + resourceGroupName, + managedInstanceName, + targetDbName, + parameters + ); + console.log(result); +} + +createOrUpdateDatabaseMigrationResourceWithMinimumParameters().catch( + console.error +); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlMiCutoverSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlMiCutoverSample.ts new file mode 100644 index 000000000000..f23063acf40b --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlMiCutoverSample.ts @@ -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. +import { + MigrationOperationInput, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Initiate cutover for online migration in progress for the database. + * + * @summary Initiate cutover for online migration in progress for the database. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCutoverDatabaseMigration.json + */ +async function cutoverOnlineMigrationOperationForTheDatabase() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const parameters: MigrationOperationInput = { + migrationOperationId: "4124fe90-d1b6-4b50-b4d9-46d02381f59a" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.beginCutoverAndWait( + resourceGroupName, + managedInstanceName, + targetDbName, + parameters + ); + console.log(result); +} + +cutoverOnlineMigrationOperationForTheDatabase().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlMiGetSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlMiGetSample.ts new file mode 100644 index 000000000000..5a9b719885c0 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlMiGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve the Database Migration resource. + * + * @summary Retrieve the Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiGetDatabaseMigration.json + */ +async function getDatabaseMigrationResource() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.get( + resourceGroupName, + managedInstanceName, + targetDbName + ); + console.log(result); +} + +getDatabaseMigrationResource().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlVMCancelSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlVMCancelSample.ts new file mode 100644 index 000000000000..b6e9ed8d1668 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlVMCancelSample.ts @@ -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. +import { + MigrationOperationInput, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Stop ongoing migration for the database. + * + * @summary Stop ongoing migration for the database. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCancelDatabaseMigration.json + */ +async function stopOngoingMigrationForTheDatabase() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const parameters: MigrationOperationInput = { + migrationOperationId: "4124fe90-d1b6-4b50-b4d9-46d02381f59a" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.beginCancelAndWait( + resourceGroupName, + sqlVirtualMachineName, + targetDbName, + parameters + ); + console.log(result); +} + +stopOngoingMigrationForTheDatabase().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlVMCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlVMCreateOrUpdateSample.ts new file mode 100644 index 000000000000..81d4da355302 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlVMCreateOrUpdateSample.ts @@ -0,0 +1,137 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + DatabaseMigrationSqlVm, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or Update Database Migration resource. + * + * @summary Create or Update Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMAX.json + */ +async function createOrUpdateDatabaseMigrationResourceWithMaximumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const parameters: DatabaseMigrationSqlVm = { + properties: { + backupConfiguration: { + sourceLocation: { + fileShare: { + path: "C:aaa\bbbccc", + password: "placeholder", + username: "name" + } + }, + targetLocation: { + accountKey: "abcd", + storageAccountResourceId: "account.database.windows.net" + } + }, + kind: "SqlVm", + migrationService: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent", + offlineConfiguration: { + lastBackupName: "last_backup_file_name", + offline: true + }, + scope: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm", + sourceDatabaseName: "aaa", + sourceSqlConnection: { + authentication: "WindowsAuthentication", + dataSource: "aaa", + encryptConnection: true, + password: "placeholder", + trustServerCertificate: true, + userName: "bbb" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.beginCreateOrUpdateAndWait( + resourceGroupName, + sqlVirtualMachineName, + targetDbName, + parameters + ); + console.log(result); +} + +createOrUpdateDatabaseMigrationResourceWithMaximumParameters().catch( + console.error +); + +/** + * This sample demonstrates how to Create or Update Database Migration resource. + * + * @summary Create or Update Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMIN.json + */ +async function createOrUpdateDatabaseMigrationResourceWithMinimumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const parameters: DatabaseMigrationSqlVm = { + properties: { + backupConfiguration: { + sourceLocation: { + fileShare: { + path: "C:aaa\bbbccc", + password: "placeholder", + username: "name" + } + }, + targetLocation: { + accountKey: "abcd", + storageAccountResourceId: "account.database.windows.net" + } + }, + kind: "SqlVm", + migrationService: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent", + offlineConfiguration: { + lastBackupName: "last_backup_file_name", + offline: true + }, + scope: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm", + sourceDatabaseName: "aaa", + sourceSqlConnection: { + authentication: "WindowsAuthentication", + dataSource: "aaa", + encryptConnection: true, + password: "placeholder", + trustServerCertificate: true, + userName: "bbb" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.beginCreateOrUpdateAndWait( + resourceGroupName, + sqlVirtualMachineName, + targetDbName, + parameters + ); + console.log(result); +} + +createOrUpdateDatabaseMigrationResourceWithMinimumParameters().catch( + console.error +); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlVMCutoverSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlVMCutoverSample.ts new file mode 100644 index 000000000000..aa53a32f0012 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlVMCutoverSample.ts @@ -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. +import { + MigrationOperationInput, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Cutover online migration operation for the database. + * + * @summary Cutover online migration operation for the database. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCutoverDatabaseMigration.json + */ +async function cutoverOnlineMigrationOperationForTheDatabase() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const parameters: MigrationOperationInput = { + migrationOperationId: "4124fe90-d1b6-4b50-b4d9-46d02381f59a" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.beginCutoverAndWait( + resourceGroupName, + sqlVirtualMachineName, + targetDbName, + parameters + ); + console.log(result); +} + +cutoverOnlineMigrationOperationForTheDatabase().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlVMGetSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlVMGetSample.ts new file mode 100644 index 000000000000..0f8cdd63af54 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/databaseMigrationsSqlVMGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve the Database Migration resource. + * + * @summary Retrieve the Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmGetDatabaseMigration.json + */ +async function getDatabaseMigrationResource() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.get( + resourceGroupName, + sqlVirtualMachineName, + targetDbName + ); + console.log(result); +} + +getDatabaseMigrationResource().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/filesCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/filesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..6ab8542a1cba --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/filesCreateOrUpdateSample.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 { + ProjectFile, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The PUT method creates a new file or updates an existing one. + * + * @summary The PUT method creates a new file or updates an existing one. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_CreateOrUpdate.json + */ +async function filesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const parameters: ProjectFile = { + properties: { filePath: "DmsSdkFilePath/DmsSdkFile.sql" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.createOrUpdate( + groupName, + serviceName, + projectName, + fileName, + parameters + ); + console.log(result); +} + +filesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/filesDeleteSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/filesDeleteSample.ts new file mode 100644 index 000000000000..0eba77f74068 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/filesDeleteSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method deletes a file. + * + * @summary This method deletes a file. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Delete.json + */ +async function filesDelete() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.delete( + groupName, + serviceName, + projectName, + fileName + ); + console.log(result); +} + +filesDelete().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/filesGetSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/filesGetSample.ts new file mode 100644 index 000000000000..a7e23e46fa11 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/filesGetSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The files resource is a nested, proxy-only resource representing a file stored under the project resource. This method retrieves information about a file. + * + * @summary The files resource is a nested, proxy-only resource representing a file stored under the project resource. This method retrieves information about a file. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Get.json + */ +async function filesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.get( + groupName, + serviceName, + projectName, + fileName + ); + console.log(result); +} + +filesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/filesListSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/filesListSample.ts new file mode 100644 index 000000000000..fe4e5415c51f --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/filesListSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. This method returns a list of files owned by a project resource. + * + * @summary The project resource is a nested resource representing a stored migration project. This method returns a list of files owned by a project resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_List.json + */ +async function filesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.files.list( + groupName, + serviceName, + projectName + )) { + resArray.push(item); + } + console.log(resArray); +} + +filesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/filesReadSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/filesReadSample.ts new file mode 100644 index 000000000000..7377eb06e34c --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/filesReadSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method is used for requesting storage information using which contents of the file can be downloaded. + * + * @summary This method is used for requesting storage information using which contents of the file can be downloaded. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Read.json + */ +async function filesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.read( + groupName, + serviceName, + projectName, + fileName + ); + console.log(result); +} + +filesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/filesReadWriteSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/filesReadWriteSample.ts new file mode 100644 index 000000000000..0fca89fe81f8 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/filesReadWriteSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method is used for requesting information for reading and writing the file content. + * + * @summary This method is used for requesting information for reading and writing the file content. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_ReadWrite.json + */ +async function filesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.readWrite( + groupName, + serviceName, + projectName, + fileName + ); + console.log(result); +} + +filesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/filesUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/filesUpdateSample.ts new file mode 100644 index 000000000000..93e3c116a809 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/filesUpdateSample.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 { + ProjectFile, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method updates an existing file. + * + * @summary This method updates an existing file. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Update.json + */ +async function filesUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const parameters: ProjectFile = { + properties: { filePath: "DmsSdkFilePath/DmsSdkFile.sql" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.update( + groupName, + serviceName, + projectName, + fileName, + parameters + ); + console.log(result); +} + +filesUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/operationsListSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..a271ebc65436 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/operationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the available SQL Migration REST API operations. + * + * @summary Lists all of the available SQL Migration REST API operations. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListOperation.json + */ +async function listsAllOfTheAvailableSqlRestApiOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listsAllOfTheAvailableSqlRestApiOperations().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/projectsCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/projectsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..15fdc15e23c5 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/projectsCreateOrUpdateSample.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 { + Project, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one. + * + * @summary The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_CreateOrUpdate.json + */ +async function projectsCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const parameters: Project = { + location: "southcentralus", + sourcePlatform: "SQL", + targetPlatform: "SQLDB" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.projects.createOrUpdate( + groupName, + serviceName, + projectName, + parameters + ); + console.log(result); +} + +projectsCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/projectsDeleteSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/projectsDeleteSample.ts new file mode 100644 index 000000000000..bbcb08ec1d6c --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/projectsDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. The DELETE method deletes a project. + * + * @summary The project resource is a nested resource representing a stored migration project. The DELETE method deletes a project. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Delete.json + */ +async function projectsDelete() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.projects.delete( + groupName, + serviceName, + projectName + ); + console.log(result); +} + +projectsDelete().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/projectsGetSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/projectsGetSample.ts new file mode 100644 index 000000000000..6515c081f383 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/projectsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project. + * + * @summary The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Get.json + */ +async function projectsGet() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.projects.get(groupName, serviceName, projectName); + console.log(result); +} + +projectsGet().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/projectsListSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/projectsListSample.ts new file mode 100644 index 000000000000..c6d7a9e41c50 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/projectsListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. This method returns a list of projects owned by a service resource. + * + * @summary The project resource is a nested resource representing a stored migration project. This method returns a list of projects owned by a service resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_List.json + */ +async function projectsList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.projects.list(groupName, serviceName)) { + resArray.push(item); + } + console.log(resArray); +} + +projectsList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/projectsUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/projectsUpdateSample.ts new file mode 100644 index 000000000000..e23ea2253fd7 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/projectsUpdateSample.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 { + Project, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project. + * + * @summary The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Update.json + */ +async function projectsUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const parameters: Project = { + location: "southcentralus", + sourcePlatform: "SQL", + targetPlatform: "SQLDB" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.projects.update( + groupName, + serviceName, + projectName, + parameters + ); + console.log(result); +} + +projectsUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/resourceSkusListSkusSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/resourceSkusListSkusSample.ts new file mode 100644 index 000000000000..2bce65ae2393 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/resourceSkusListSkusSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The skus action returns the list of SKUs that DMS supports. + * + * @summary The skus action returns the list of SKUs that DMS supports. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ResourceSkus_ListSkus.json + */ +async function listSkus() { + const subscriptionId = "subid"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceSkus.listSkus()) { + resArray.push(item); + } + console.log(resArray); +} + +listSkus().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksCancelSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksCancelSample.ts new file mode 100644 index 000000000000..c7ac08c110c0 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksCancelSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a service task if it's currently queued or running. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a service task if it's currently queued or running. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Cancel.json + */ +async function tasksCancel() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.cancel( + groupName, + serviceName, + taskName + ); + console.log(result); +} + +tasksCancel().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksCreateOrUpdateSample.ts new file mode 100644 index 000000000000..12634978b1c7 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksCreateOrUpdateSample.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 { + ProjectTask, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new service task or updates an existing one, although since service tasks have no mutable custom properties, there is little reason to update an existing one. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new service task or updates an existing one, although since service tasks have no mutable custom properties, there is little reason to update an existing one. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_CreateOrUpdate.json + */ +async function tasksCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const parameters: ProjectTask = { + properties: { + input: { serverVersion: "NA" }, + taskType: "Service.Check.OCI" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.createOrUpdate( + groupName, + serviceName, + taskName, + parameters + ); + console.log(result); +} + +tasksCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksDeleteSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksDeleteSample.ts new file mode 100644 index 000000000000..323ac6934662 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a service task, canceling it first if it's running. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a service task, canceling it first if it's running. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Delete.json + */ +async function tasksDelete() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.delete( + groupName, + serviceName, + taskName + ); + console.log(result); +} + +tasksDelete().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksGetSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksGetSample.ts new file mode 100644 index 000000000000..4e536e285dc6 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a service task. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a service task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Get.json + */ +async function tasksGet() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.get( + groupName, + serviceName, + taskName + ); + console.log(result); +} + +tasksGet().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksListSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksListSample.ts new file mode 100644 index 000000000000..99e2a8d5226c --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service level tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service level tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_List.json + */ +async function serviceTasksList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serviceTasks.list(groupName, serviceName)) { + resArray.push(item); + } + console.log(resArray); +} + +serviceTasksList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksUpdateSample.ts new file mode 100644 index 000000000000..401fd08ee666 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/serviceTasksUpdateSample.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 { + ProjectTask, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing service task, but since service tasks have no mutable custom properties, there is little reason to do so. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing service task, but since service tasks have no mutable custom properties, there is little reason to do so. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Update.json + */ +async function tasksUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const parameters: ProjectTask = { + properties: { + input: { serverVersion: "NA" }, + taskType: "Service.Check.OCI" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.update( + groupName, + serviceName, + taskName, + parameters + ); + console.log(result); +} + +tasksUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/servicesCheckChildrenNameAvailabilitySample.ts b/sdk/datamigration/arm-datamigration/samples-dev/servicesCheckChildrenNameAvailabilitySample.ts new file mode 100644 index 000000000000..19763d837d26 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/servicesCheckChildrenNameAvailabilitySample.ts @@ -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. +import { + NameAvailabilityRequest, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method checks whether a proposed nested resource name is valid and available. + * + * @summary This method checks whether a proposed nested resource name is valid and available. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckChildrenNameAvailability.json + */ +async function servicesCheckChildrenNameAvailability() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const parameters: NameAvailabilityRequest = { name: "Task1", type: "tasks" }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.checkChildrenNameAvailability( + groupName, + serviceName, + parameters + ); + console.log(result); +} + +servicesCheckChildrenNameAvailability().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/servicesCheckNameAvailabilitySample.ts b/sdk/datamigration/arm-datamigration/samples-dev/servicesCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..7b9ffa503eed --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/servicesCheckNameAvailabilitySample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + NameAvailabilityRequest, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method checks whether a proposed top-level resource name is valid and available. + * + * @summary This method checks whether a proposed top-level resource name is valid and available. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckNameAvailability.json + */ +async function servicesCheckNameAvailability() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const location = "eastus"; + const parameters: NameAvailabilityRequest = { + name: "DmsSdkService", + type: "services" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.checkNameAvailability( + location, + parameters + ); + console.log(result); +} + +servicesCheckNameAvailability().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/servicesCheckStatusSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/servicesCheckStatusSample.ts new file mode 100644 index 000000000000..200924feb4c5 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/servicesCheckStatusSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckStatus.json + */ +async function servicesCheckStatus() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.checkStatus(groupName, serviceName); + console.log(result); +} + +servicesCheckStatus().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/servicesCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/servicesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..4c8b6af1af67 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/servicesCreateOrUpdateSample.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 { + DataMigrationService, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CreateOrUpdate.json + */ +async function servicesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const parameters: DataMigrationService = { + location: "southcentralus", + sku: { name: "Basic_1vCore" }, + virtualSubnetId: + "/subscriptions/fc04246f-04c5-437e-ac5e-206a19e7193f/resourceGroups/DmsSdkTestNetwork/providers/Microsoft.Network/virtualNetworks/DmsSdkTestNetwork/subnets/default" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginCreateOrUpdateAndWait( + groupName, + serviceName, + parameters + ); + console.log(result); +} + +servicesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/servicesDeleteSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/servicesDeleteSample.ts new file mode 100644 index 000000000000..5769ed13e7d2 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/servicesDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The DELETE method deletes a service. Any running tasks will be canceled. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The DELETE method deletes a service. Any running tasks will be canceled. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Delete.json + */ +async function servicesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginDeleteAndWait( + groupName, + serviceName + ); + console.log(result); +} + +servicesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/servicesGetSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/servicesGetSample.ts new file mode 100644 index 000000000000..10c16260c075 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/servicesGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Get.json + */ +async function servicesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.get(groupName, serviceName); + console.log(result); +} + +servicesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/servicesListByResourceGroupSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/servicesListByResourceGroupSample.ts new file mode 100644 index 000000000000..f8245db7bfa4 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/servicesListByResourceGroupSample.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group. + * + * @summary The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListByResourceGroup.json + */ +async function servicesListByResourceGroup() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.services.listByResourceGroup(groupName)) { + resArray.push(item); + } + console.log(resArray); +} + +servicesListByResourceGroup().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/servicesListSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/servicesListSample.ts new file mode 100644 index 000000000000..3340e5eec51b --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/servicesListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_List.json + */ +async function servicesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.services.list()) { + resArray.push(item); + } + console.log(resArray); +} + +servicesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/servicesListSkusSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/servicesListSkusSample.ts new file mode 100644 index 000000000000..ba0f4e29264f --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/servicesListSkusSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListSkus.json + */ +async function servicesListSkus() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.services.listSkus(groupName, serviceName)) { + resArray.push(item); + } + console.log(resArray); +} + +servicesListSkus().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/servicesStartSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/servicesStartSample.ts new file mode 100644 index 000000000000..41638c6e4a15 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/servicesStartSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Start.json + */ +async function servicesStart() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginStartAndWait( + groupName, + serviceName + ); + console.log(result); +} + +servicesStart().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/servicesStopSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/servicesStopSample.ts new file mode 100644 index 000000000000..0d8a53687a45 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/servicesStopSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Stop.json + */ +async function servicesStop() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginStopAndWait(groupName, serviceName); + console.log(result); +} + +servicesStop().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/servicesUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/servicesUpdateSample.ts new file mode 100644 index 000000000000..1606ec6b8ef8 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/servicesUpdateSample.ts @@ -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. +import { + DataMigrationService, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Update.json + */ +async function servicesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const parameters: DataMigrationService = { + location: "southcentralus", + virtualSubnetId: + "/subscriptions/fc04246f-04c5-437e-ac5e-206a19e7193f/resourceGroups/DmsSdkTestNetwork/providers/Microsoft.Network/virtualNetworks/DmsSdkTestNetwork/subnets/default" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginUpdateAndWait( + groupName, + serviceName, + parameters + ); + console.log(result); +} + +servicesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..72c62480083f --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesCreateOrUpdateSample.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + SqlMigrationService, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or Update SQL Migration Service. + * + * @summary Create or Update SQL Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMAX.json + */ +async function createOrUpdateSqlMigrationServiceWithMaximumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "testagent"; + const parameters: SqlMigrationService = { location: "northeurope" }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.beginCreateOrUpdateAndWait( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +createOrUpdateSqlMigrationServiceWithMaximumParameters().catch(console.error); + +/** + * This sample demonstrates how to Create or Update SQL Migration Service. + * + * @summary Create or Update SQL Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMIN.json + */ +async function createOrUpdateSqlMigrationServiceWithMinimumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "testagent"; + const parameters: SqlMigrationService = { location: "northeurope" }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.beginCreateOrUpdateAndWait( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +createOrUpdateSqlMigrationServiceWithMinimumParameters().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesDeleteNodeSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesDeleteNodeSample.ts new file mode 100644 index 000000000000..55edb44926ce --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesDeleteNodeSample.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 { + DeleteNode, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete the integration runtime node. + * + * @summary Delete the integration runtime node. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteIntegrationRuntimeNode.json + */ +async function deleteTheIntegrationRuntimeNode() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const parameters: DeleteNode = { + integrationRuntimeName: "IRName", + nodeName: "nodeName" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.deleteNode( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +deleteTheIntegrationRuntimeNode().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesDeleteSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesDeleteSample.ts new file mode 100644 index 000000000000..c81f2af81e1a --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete SQL Migration Service. + * + * @summary Delete SQL Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteMigrationService.json + */ +async function deleteSqlMigrationService() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.beginDeleteAndWait( + resourceGroupName, + sqlMigrationServiceName + ); + console.log(result); +} + +deleteSqlMigrationService().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesGetSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesGetSample.ts new file mode 100644 index 000000000000..995e949ced6c --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve the Migration Service. + * + * @summary Retrieve the Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMigrationService.json + */ +async function getMigrationService() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.get( + resourceGroupName, + sqlMigrationServiceName + ); + console.log(result); +} + +getMigrationService().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListAuthKeysSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListAuthKeysSample.ts new file mode 100644 index 000000000000..b72e11f80fec --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListAuthKeysSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve the List of Authentication Keys for Self Hosted Integration Runtime. + * + * @summary Retrieve the List of Authentication Keys for Self Hosted Integration Runtime. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListAuthKeysMigrationService.json + */ +async function retrieveTheListOfAuthenticationKeys() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.listAuthKeys( + resourceGroupName, + sqlMigrationServiceName + ); + console.log(result); +} + +retrieveTheListOfAuthenticationKeys().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListByResourceGroupSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListByResourceGroupSample.ts new file mode 100644 index 000000000000..8e306572a261 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve all SQL migration services in the resource group. + * + * @summary Retrieve all SQL migration services in the resource group. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListByResourceGroupMigrationService.json + */ +async function getMigrationServicesInTheResourceGroup() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sqlMigrationServices.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +getMigrationServicesInTheResourceGroup().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListBySubscriptionSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListBySubscriptionSample.ts new file mode 100644 index 000000000000..3585ce76469c --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListBySubscriptionSample.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve all SQL migration services in the subscriptions. + * + * @summary Retrieve all SQL migration services in the subscriptions. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListBySubscriptionMigrationService.json + */ +async function getServicesInTheSubscriptions() { + const subscriptionId = + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/managedInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sqlMigrationServices.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +getServicesInTheSubscriptions().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListMigrationsSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListMigrationsSample.ts new file mode 100644 index 000000000000..e91b8c63f774 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListMigrationsSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve the List of database migrations attached to the service. + * + * @summary Retrieve the List of database migrations attached to the service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListMigrationsByMigrationService.json + */ +async function listDatabaseMigrationsAttachedToTheService() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sqlMigrationServices.listMigrations( + resourceGroupName, + sqlMigrationServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listDatabaseMigrationsAttachedToTheService().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListMonitoringDataSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListMonitoringDataSample.ts new file mode 100644 index 000000000000..97aa7d0ec2b5 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesListMonitoringDataSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve the Monitoring Data. + * + * @summary Retrieve the Monitoring Data. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMonitorDataMigrationService.json + */ +async function retrieveTheMonitoringData() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.listMonitoringData( + resourceGroupName, + sqlMigrationServiceName + ); + console.log(result); +} + +retrieveTheMonitoringData().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesRegenerateAuthKeysSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesRegenerateAuthKeysSample.ts new file mode 100644 index 000000000000..932dabefc23e --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesRegenerateAuthKeysSample.ts @@ -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. +import { + RegenAuthKeys, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime. + * + * @summary Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/RegenAuthKeysMigrationService.json + */ +async function regenerateTheOfAuthenticationKeys() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const parameters: RegenAuthKeys = { keyName: "authKey1" }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.regenerateAuthKeys( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +regenerateTheOfAuthenticationKeys().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesUpdateSample.ts new file mode 100644 index 000000000000..3ccb8551d5ff --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/sqlMigrationServicesUpdateSample.ts @@ -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. +import { + SqlMigrationServiceUpdate, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update SQL Migration Service. + * + * @summary Update SQL Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/UpdateMigrationService.json + */ +async function updateSqlMigrationService() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "testagent"; + const parameters: SqlMigrationServiceUpdate = { tags: { mytag: "myval" } }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.beginUpdateAndWait( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +updateSqlMigrationService().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/tasksCancelSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/tasksCancelSample.ts new file mode 100644 index 000000000000..192b7f1b8455 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/tasksCancelSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a task if it's currently queued or running. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a task if it's currently queued or running. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Cancel.json + */ +async function tasksCancel() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.cancel( + groupName, + serviceName, + projectName, + taskName + ); + console.log(result); +} + +tasksCancel().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/tasksCommandSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/tasksCommandSample.ts new file mode 100644 index 000000000000..665fe29a95b5 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/tasksCommandSample.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 { + MigrateSyncCompleteCommandProperties, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method executes a command on a running task. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method executes a command on a running task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Command.json + */ +async function tasksCommand() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const parameters: MigrateSyncCompleteCommandProperties = { + commandType: "Migrate.Sync.Complete.Database", + input: { databaseName: "TestDatabase" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.command( + groupName, + serviceName, + projectName, + taskName, + parameters + ); + console.log(result); +} + +tasksCommand().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/tasksCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/tasksCreateOrUpdateSample.ts new file mode 100644 index 000000000000..6c12c8fbc399 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/tasksCreateOrUpdateSample.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + ProjectTask, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new task or updates an existing one, although since tasks have no mutable custom properties, there is little reason to update an existing one. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new task or updates an existing one, although since tasks have no mutable custom properties, there is little reason to update an existing one. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_CreateOrUpdate.json + */ +async function tasksCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const parameters: ProjectTask = { + properties: { + input: { + targetConnectionInfo: { + type: "SqlConnectionInfo", + authentication: "SqlAuthentication", + dataSource: "ssma-test-server.database.windows.net", + encryptConnection: true, + password: "testpassword", + trustServerCertificate: true, + userName: "testuser" + } + }, + taskType: "ConnectToTarget.SqlDb" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.createOrUpdate( + groupName, + serviceName, + projectName, + taskName, + parameters + ); + console.log(result); +} + +tasksCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/tasksDeleteSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/tasksDeleteSample.ts new file mode 100644 index 000000000000..bd09f3eebc5d --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/tasksDeleteSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a task, canceling it first if it's running. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a task, canceling it first if it's running. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Delete.json + */ +async function tasksDelete() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.delete( + groupName, + serviceName, + projectName, + taskName + ); + console.log(result); +} + +tasksDelete().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/tasksGetSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/tasksGetSample.ts new file mode 100644 index 000000000000..c7370e5aef7e --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/tasksGetSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a task. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Get.json + */ +async function tasksGet() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.get( + groupName, + serviceName, + projectName, + taskName + ); + console.log(result); +} + +tasksGet().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/tasksListSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/tasksListSample.ts new file mode 100644 index 000000000000..ef5f7ee8fe35 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/tasksListSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_List.json + */ +async function tasksList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tasks.list( + groupName, + serviceName, + projectName + )) { + resArray.push(item); + } + console.log(resArray); +} + +tasksList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/tasksUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/tasksUpdateSample.ts new file mode 100644 index 000000000000..80b1a8b70072 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/tasksUpdateSample.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + ProjectTask, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing task, but since tasks have no mutable custom properties, there is little reason to do so. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing task, but since tasks have no mutable custom properties, there is little reason to do so. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Update.json + */ +async function tasksUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const parameters: ProjectTask = { + properties: { + input: { + targetConnectionInfo: { + type: "SqlConnectionInfo", + authentication: "SqlAuthentication", + dataSource: "ssma-test-server.database.windows.net", + encryptConnection: true, + password: "testpassword", + trustServerCertificate: true, + userName: "testuser" + } + }, + taskType: "ConnectToTarget.SqlDb" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.update( + groupName, + serviceName, + projectName, + taskName, + parameters + ); + console.log(result); +} + +tasksUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples-dev/usagesListSample.ts b/sdk/datamigration/arm-datamigration/samples-dev/usagesListSample.ts new file mode 100644 index 000000000000..f963ce620ab0 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples-dev/usagesListSample.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method returns region-specific quotas and resource usage information for the Database Migration Service. + * + * @summary This method returns region-specific quotas and resource usage information for the Database Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Usages_List.json + */ +async function servicesUsages() { + const subscriptionId = "90fb80a6-0f71-4761-8f03-921e7396f3c0"; + const location = "westus"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.usages.list(location)) { + resArray.push(item); + } + console.log(resArray); +} + +servicesUsages().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/README.md b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/README.md index c9baf15da9fc..bb0da5e4c4ec 100644 --- a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/README.md +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/README.md @@ -2,54 +2,113 @@ These sample programs show how to use the JavaScript client libraries for in some common scenarios. -| **File Name** | **Description** | -| ------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [createOrUpdateDatabaseMigrationResourceWithMaximumParameters.js][createorupdatedatabasemigrationresourcewithmaximumparameters] | Create or Update Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMAX.json | -| [createOrUpdateDatabaseMigrationResourceWithMinimumParameters.js][createorupdatedatabasemigrationresourcewithminimumparameters] | Create or Update Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMIN.json | -| [createOrUpdateSqlMigrationServiceWithMaximumParameters.js][createorupdatesqlmigrationservicewithmaximumparameters] | Create or Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMAX.json | -| [createOrUpdateSqlMigrationServiceWithMinimumParameters.js][createorupdatesqlmigrationservicewithminimumparameters] | Create or Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMIN.json | -| [cutoverOnlineMigrationOperationForTheDatabase.js][cutoveronlinemigrationoperationforthedatabase] | Cutover online migration operation for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCutoverDatabaseMigration.json | -| [deleteSqlMigrationService.js][deletesqlmigrationservice] | Delete SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteMigrationService.json | -| [deleteTheIntegrationRuntimeNode.js][deletetheintegrationruntimenode] | Delete the integration runtime node. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteIntegrationRuntimeNode.json | -| [filesCreateOrUpdate.js][filescreateorupdate] | The PUT method creates a new file or updates an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_CreateOrUpdate.json | -| [filesDelete.js][filesdelete] | This method deletes a file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Delete.json | -| [filesList.js][fileslist] | This method is used for requesting information for reading and writing the file content. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_ReadWrite.json | -| [filesUpdate.js][filesupdate] | This method updates an existing file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Update.json | -| [getDatabaseMigrationResource.js][getdatabasemigrationresource] | Retrieve the Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmGetDatabaseMigration.json | -| [getMigrationService.js][getmigrationservice] | Retrieve the Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMigrationService.json | -| [getMigrationServicesInTheResourceGroup.js][getmigrationservicesintheresourcegroup] | Retrieve all SQL migration services in the resource group. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListByResourceGroupMigrationService.json | -| [getServicesInTheSubscriptions.js][getservicesinthesubscriptions] | Retrieve all SQL migration services in the subscriptions. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListBySubscriptionMigrationService.json | -| [listDatabaseMigrationsAttachedToTheService.js][listdatabasemigrationsattachedtotheservice] | Retrieve the List of database migrations attached to the service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListMigrationsByMigrationService.json | -| [listSkus.js][listskus] | The skus action returns the list of SKUs that DMS supports. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ResourceSkus_ListSkus.json | -| [listsAllOfTheAvailableSqlRestApiOperations.js][listsalloftheavailablesqlrestapioperations] | Lists all of the available SQL Migration REST API operations. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListOperation.json | -| [projectsCreateOrUpdate.js][projectscreateorupdate] | The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_CreateOrUpdate.json | -| [projectsDelete.js][projectsdelete] | The project resource is a nested resource representing a stored migration project. The DELETE method deletes a project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Delete.json | -| [projectsGet.js][projectsget] | The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Get.json | -| [projectsList.js][projectslist] | The project resource is a nested resource representing a stored migration project. This method returns a list of projects owned by a service resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_List.json | -| [projectsUpdate.js][projectsupdate] | The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Update.json | -| [regenerateTheOfAuthenticationKeys.js][regeneratetheofauthenticationkeys] | Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/RegenAuthKeysMigrationService.json | -| [retrieveTheListOfAuthenticationKeys.js][retrievethelistofauthenticationkeys] | Retrieve the List of Authentication Keys for Self Hosted Integration Runtime. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListAuthKeysMigrationService.json | -| [retrieveTheMonitoringData.js][retrievethemonitoringdata] | Retrieve the Monitoring Data. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMonitorDataMigrationService.json | -| [serviceTasksList.js][servicetaskslist] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service level tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_List.json | -| [servicesCheckChildrenNameAvailability.js][servicescheckchildrennameavailability] | This method checks whether a proposed nested resource name is valid and available. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckChildrenNameAvailability.json | -| [servicesCheckNameAvailability.js][serviceschecknameavailability] | This method checks whether a proposed top-level resource name is valid and available. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckNameAvailability.json | -| [servicesCheckStatus.js][servicescheckstatus] | The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckStatus.json | -| [servicesCreateOrUpdate.js][servicescreateorupdate] | The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Update.json | -| [servicesList.js][serviceslist] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_List.json | -| [servicesListByResourceGroup.js][serviceslistbyresourcegroup] | The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListByResourceGroup.json | -| [servicesListSkus.js][serviceslistskus] | The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListSkus.json | -| [servicesStart.js][servicesstart] | The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Start.json | -| [servicesStop.js][servicesstop] | The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Stop.json | -| [servicesUsages.js][servicesusages] | This method returns region-specific quotas and resource usage information for the Database Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Usages_List.json | -| [stopOngoingMigrationForTheDatabase.js][stopongoingmigrationforthedatabase] | Stop ongoing migration for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCancelDatabaseMigration.json | -| [tasksCancel.js][taskscancel] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a service task if it's currently queued or running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Cancel.json | -| [tasksCommand.js][taskscommand] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method executes a command on a running task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Command.json | -| [tasksCreateOrUpdate.js][taskscreateorupdate] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new service task or updates an existing one, although since service tasks have no mutable custom properties, there is little reason to update an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_CreateOrUpdate.json | -| [tasksDelete.js][tasksdelete] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a service task, canceling it first if it's running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Delete.json | -| [tasksGet.js][tasksget] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a service task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Get.json | -| [tasksList.js][taskslist] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_List.json | -| [tasksUpdate.js][tasksupdate] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing service task, but since service tasks have no mutable custom properties, there is little reason to do so. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Update.json | -| [updateSqlMigrationService.js][updatesqlmigrationservice] | Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/UpdateMigrationService.json | +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [createOrUpdateDatabaseMigrationResourceWithMaximumParameters.js][createorupdatedatabasemigrationresourcewithmaximumparameters] | Create or Update Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMAX.json | +| [createOrUpdateDatabaseMigrationResourceWithMinimumParameters.js][createorupdatedatabasemigrationresourcewithminimumparameters] | Create or Update Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMIN.json | +| [createOrUpdateSqlMigrationServiceWithMaximumParameters.js][createorupdatesqlmigrationservicewithmaximumparameters] | Create or Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMAX.json | +| [createOrUpdateSqlMigrationServiceWithMinimumParameters.js][createorupdatesqlmigrationservicewithminimumparameters] | Create or Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMIN.json | +| [cutoverOnlineMigrationOperationForTheDatabase.js][cutoveronlinemigrationoperationforthedatabase] | Cutover online migration operation for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCutoverDatabaseMigration.json | +| [databaseMigrationsSqlMiCancelSample.js][databasemigrationssqlmicancelsample] | Stop migrations in progress for the database x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCancelDatabaseMigration.json | +| [databaseMigrationsSqlMiCreateOrUpdateSample.js][databasemigrationssqlmicreateorupdatesample] | Create or Update Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCreateOrUpdateDatabaseMigrationMAX.json | +| [databaseMigrationsSqlMiCutoverSample.js][databasemigrationssqlmicutoversample] | Initiate cutover for online migration in progress for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCutoverDatabaseMigration.json | +| [databaseMigrationsSqlMiGetSample.js][databasemigrationssqlmigetsample] | Retrieve the Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiGetDatabaseMigration.json | +| [databaseMigrationsSqlVMCancelSample.js][databasemigrationssqlvmcancelsample] | Stop ongoing migration for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCancelDatabaseMigration.json | +| [databaseMigrationsSqlVMCreateOrUpdateSample.js][databasemigrationssqlvmcreateorupdatesample] | Create or Update Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMAX.json | +| [databaseMigrationsSqlVMCutoverSample.js][databasemigrationssqlvmcutoversample] | Cutover online migration operation for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCutoverDatabaseMigration.json | +| [databaseMigrationsSqlVMGetSample.js][databasemigrationssqlvmgetsample] | Retrieve the Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmGetDatabaseMigration.json | +| [deleteSqlMigrationService.js][deletesqlmigrationservice] | Delete SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteMigrationService.json | +| [deleteTheIntegrationRuntimeNode.js][deletetheintegrationruntimenode] | Delete the integration runtime node. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteIntegrationRuntimeNode.json | +| [filesCreateOrUpdate.js][filescreateorupdate] | The PUT method creates a new file or updates an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_CreateOrUpdate.json | +| [filesCreateOrUpdateSample.js][filescreateorupdatesample] | The PUT method creates a new file or updates an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_CreateOrUpdate.json | +| [filesDelete.js][filesdelete] | This method deletes a file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Delete.json | +| [filesDeleteSample.js][filesdeletesample] | This method deletes a file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Delete.json | +| [filesGetSample.js][filesgetsample] | The files resource is a nested, proxy-only resource representing a file stored under the project resource. This method retrieves information about a file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Get.json | +| [filesList.js][fileslist] | This method is used for requesting information for reading and writing the file content. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_ReadWrite.json | +| [filesListSample.js][fileslistsample] | The project resource is a nested resource representing a stored migration project. This method returns a list of files owned by a project resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_List.json | +| [filesReadSample.js][filesreadsample] | This method is used for requesting storage information using which contents of the file can be downloaded. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Read.json | +| [filesReadWriteSample.js][filesreadwritesample] | This method is used for requesting information for reading and writing the file content. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_ReadWrite.json | +| [filesUpdate.js][filesupdate] | This method updates an existing file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Update.json | +| [filesUpdateSample.js][filesupdatesample] | This method updates an existing file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Update.json | +| [getDatabaseMigrationResource.js][getdatabasemigrationresource] | Retrieve the Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmGetDatabaseMigration.json | +| [getMigrationService.js][getmigrationservice] | Retrieve the Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMigrationService.json | +| [getMigrationServicesInTheResourceGroup.js][getmigrationservicesintheresourcegroup] | Retrieve all SQL migration services in the resource group. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListByResourceGroupMigrationService.json | +| [getServicesInTheSubscriptions.js][getservicesinthesubscriptions] | Retrieve all SQL migration services in the subscriptions. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListBySubscriptionMigrationService.json | +| [listDatabaseMigrationsAttachedToTheService.js][listdatabasemigrationsattachedtotheservice] | Retrieve the List of database migrations attached to the service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListMigrationsByMigrationService.json | +| [listSkus.js][listskus] | The skus action returns the list of SKUs that DMS supports. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ResourceSkus_ListSkus.json | +| [listsAllOfTheAvailableSqlRestApiOperations.js][listsalloftheavailablesqlrestapioperations] | Lists all of the available SQL Migration REST API operations. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListOperation.json | +| [operationsListSample.js][operationslistsample] | Lists all of the available SQL Migration REST API operations. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListOperation.json | +| [projectsCreateOrUpdate.js][projectscreateorupdate] | The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_CreateOrUpdate.json | +| [projectsCreateOrUpdateSample.js][projectscreateorupdatesample] | The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_CreateOrUpdate.json | +| [projectsDelete.js][projectsdelete] | The project resource is a nested resource representing a stored migration project. The DELETE method deletes a project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Delete.json | +| [projectsDeleteSample.js][projectsdeletesample] | The project resource is a nested resource representing a stored migration project. The DELETE method deletes a project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Delete.json | +| [projectsGet.js][projectsget] | The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Get.json | +| [projectsGetSample.js][projectsgetsample] | The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Get.json | +| [projectsList.js][projectslist] | The project resource is a nested resource representing a stored migration project. This method returns a list of projects owned by a service resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_List.json | +| [projectsListSample.js][projectslistsample] | The project resource is a nested resource representing a stored migration project. This method returns a list of projects owned by a service resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_List.json | +| [projectsUpdate.js][projectsupdate] | The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Update.json | +| [projectsUpdateSample.js][projectsupdatesample] | The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Update.json | +| [regenerateTheOfAuthenticationKeys.js][regeneratetheofauthenticationkeys] | Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/RegenAuthKeysMigrationService.json | +| [resourceSkusListSkusSample.js][resourceskuslistskussample] | The skus action returns the list of SKUs that DMS supports. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ResourceSkus_ListSkus.json | +| [retrieveTheListOfAuthenticationKeys.js][retrievethelistofauthenticationkeys] | Retrieve the List of Authentication Keys for Self Hosted Integration Runtime. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListAuthKeysMigrationService.json | +| [retrieveTheMonitoringData.js][retrievethemonitoringdata] | Retrieve the Monitoring Data. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMonitorDataMigrationService.json | +| [serviceTasksCancelSample.js][servicetaskscancelsample] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a service task if it's currently queued or running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Cancel.json | +| [serviceTasksCreateOrUpdateSample.js][servicetaskscreateorupdatesample] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new service task or updates an existing one, although since service tasks have no mutable custom properties, there is little reason to update an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_CreateOrUpdate.json | +| [serviceTasksDeleteSample.js][servicetasksdeletesample] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a service task, canceling it first if it's running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Delete.json | +| [serviceTasksGetSample.js][servicetasksgetsample] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a service task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Get.json | +| [serviceTasksList.js][servicetaskslist] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service level tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_List.json | +| [serviceTasksListSample.js][servicetaskslistsample] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service level tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_List.json | +| [serviceTasksUpdateSample.js][servicetasksupdatesample] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing service task, but since service tasks have no mutable custom properties, there is little reason to do so. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Update.json | +| [servicesCheckChildrenNameAvailability.js][servicescheckchildrennameavailability] | This method checks whether a proposed nested resource name is valid and available. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckChildrenNameAvailability.json | +| [servicesCheckChildrenNameAvailabilitySample.js][servicescheckchildrennameavailabilitysample] | This method checks whether a proposed nested resource name is valid and available. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckChildrenNameAvailability.json | +| [servicesCheckNameAvailability.js][serviceschecknameavailability] | This method checks whether a proposed top-level resource name is valid and available. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckNameAvailability.json | +| [servicesCheckNameAvailabilitySample.js][serviceschecknameavailabilitysample] | This method checks whether a proposed top-level resource name is valid and available. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckNameAvailability.json | +| [servicesCheckStatus.js][servicescheckstatus] | The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckStatus.json | +| [servicesCheckStatusSample.js][servicescheckstatussample] | The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckStatus.json | +| [servicesCreateOrUpdate.js][servicescreateorupdate] | The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Update.json | +| [servicesCreateOrUpdateSample.js][servicescreateorupdatesample] | The services resource is the top-level resource that represents the Database Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CreateOrUpdate.json | +| [servicesDeleteSample.js][servicesdeletesample] | The services resource is the top-level resource that represents the Database Migration Service. The DELETE method deletes a service. Any running tasks will be canceled. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Delete.json | +| [servicesGetSample.js][servicesgetsample] | The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Get.json | +| [servicesList.js][serviceslist] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_List.json | +| [servicesListByResourceGroup.js][serviceslistbyresourcegroup] | The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListByResourceGroup.json | +| [servicesListByResourceGroupSample.js][serviceslistbyresourcegroupsample] | The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListByResourceGroup.json | +| [servicesListSample.js][serviceslistsample] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_List.json | +| [servicesListSkus.js][serviceslistskus] | The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListSkus.json | +| [servicesListSkusSample.js][serviceslistskussample] | The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListSkus.json | +| [servicesStart.js][servicesstart] | The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Start.json | +| [servicesStartSample.js][servicesstartsample] | The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Start.json | +| [servicesStop.js][servicesstop] | The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Stop.json | +| [servicesStopSample.js][servicesstopsample] | The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Stop.json | +| [servicesUpdateSample.js][servicesupdatesample] | The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Update.json | +| [servicesUsages.js][servicesusages] | This method returns region-specific quotas and resource usage information for the Database Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Usages_List.json | +| [sqlMigrationServicesCreateOrUpdateSample.js][sqlmigrationservicescreateorupdatesample] | Create or Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMAX.json | +| [sqlMigrationServicesDeleteNodeSample.js][sqlmigrationservicesdeletenodesample] | Delete the integration runtime node. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteIntegrationRuntimeNode.json | +| [sqlMigrationServicesDeleteSample.js][sqlmigrationservicesdeletesample] | Delete SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteMigrationService.json | +| [sqlMigrationServicesGetSample.js][sqlmigrationservicesgetsample] | Retrieve the Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMigrationService.json | +| [sqlMigrationServicesListAuthKeysSample.js][sqlmigrationserviceslistauthkeyssample] | Retrieve the List of Authentication Keys for Self Hosted Integration Runtime. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListAuthKeysMigrationService.json | +| [sqlMigrationServicesListByResourceGroupSample.js][sqlmigrationserviceslistbyresourcegroupsample] | Retrieve all SQL migration services in the resource group. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListByResourceGroupMigrationService.json | +| [sqlMigrationServicesListBySubscriptionSample.js][sqlmigrationserviceslistbysubscriptionsample] | Retrieve all SQL migration services in the subscriptions. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListBySubscriptionMigrationService.json | +| [sqlMigrationServicesListMigrationsSample.js][sqlmigrationserviceslistmigrationssample] | Retrieve the List of database migrations attached to the service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListMigrationsByMigrationService.json | +| [sqlMigrationServicesListMonitoringDataSample.js][sqlmigrationserviceslistmonitoringdatasample] | Retrieve the Monitoring Data. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMonitorDataMigrationService.json | +| [sqlMigrationServicesRegenerateAuthKeysSample.js][sqlmigrationservicesregenerateauthkeyssample] | Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/RegenAuthKeysMigrationService.json | +| [sqlMigrationServicesUpdateSample.js][sqlmigrationservicesupdatesample] | Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/UpdateMigrationService.json | +| [stopOngoingMigrationForTheDatabase.js][stopongoingmigrationforthedatabase] | Stop ongoing migration for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCancelDatabaseMigration.json | +| [tasksCancel.js][taskscancel] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a service task if it's currently queued or running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Cancel.json | +| [tasksCancelSample.js][taskscancelsample] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a task if it's currently queued or running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Cancel.json | +| [tasksCommand.js][taskscommand] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method executes a command on a running task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Command.json | +| [tasksCommandSample.js][taskscommandsample] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method executes a command on a running task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Command.json | +| [tasksCreateOrUpdate.js][taskscreateorupdate] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new service task or updates an existing one, although since service tasks have no mutable custom properties, there is little reason to update an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_CreateOrUpdate.json | +| [tasksCreateOrUpdateSample.js][taskscreateorupdatesample] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new task or updates an existing one, although since tasks have no mutable custom properties, there is little reason to update an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_CreateOrUpdate.json | +| [tasksDelete.js][tasksdelete] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a service task, canceling it first if it's running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Delete.json | +| [tasksDeleteSample.js][tasksdeletesample] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a task, canceling it first if it's running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Delete.json | +| [tasksGet.js][tasksget] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a service task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Get.json | +| [tasksGetSample.js][tasksgetsample] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Get.json | +| [tasksList.js][taskslist] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_List.json | +| [tasksListSample.js][taskslistsample] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_List.json | +| [tasksUpdate.js][tasksupdate] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing service task, but since service tasks have no mutable custom properties, there is little reason to do so. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Update.json | +| [tasksUpdateSample.js][tasksupdatesample] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing task, but since tasks have no mutable custom properties, there is little reason to do so. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Update.json | +| [updateSqlMigrationService.js][updatesqlmigrationservice] | Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/UpdateMigrationService.json | +| [usagesListSample.js][usageslistsample] | This method returns region-specific quotas and resource usage information for the Database Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Usages_List.json | ## Prerequisites @@ -94,12 +153,27 @@ Take a look at our [API Documentation][apiref] for more information about the AP [createorupdatesqlmigrationservicewithmaximumparameters]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/createOrUpdateSqlMigrationServiceWithMaximumParameters.js [createorupdatesqlmigrationservicewithminimumparameters]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/createOrUpdateSqlMigrationServiceWithMinimumParameters.js [cutoveronlinemigrationoperationforthedatabase]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/cutoverOnlineMigrationOperationForTheDatabase.js +[databasemigrationssqlmicancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiCancelSample.js +[databasemigrationssqlmicreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiCreateOrUpdateSample.js +[databasemigrationssqlmicutoversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiCutoverSample.js +[databasemigrationssqlmigetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiGetSample.js +[databasemigrationssqlvmcancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMCancelSample.js +[databasemigrationssqlvmcreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMCreateOrUpdateSample.js +[databasemigrationssqlvmcutoversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMCutoverSample.js +[databasemigrationssqlvmgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMGetSample.js [deletesqlmigrationservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/deleteSqlMigrationService.js [deletetheintegrationruntimenode]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/deleteTheIntegrationRuntimeNode.js [filescreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesCreateOrUpdate.js +[filescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesCreateOrUpdateSample.js [filesdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesDelete.js +[filesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesDeleteSample.js +[filesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesGetSample.js [fileslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesList.js +[fileslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesListSample.js +[filesreadsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesReadSample.js +[filesreadwritesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesReadWriteSample.js [filesupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesUpdate.js +[filesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesUpdateSample.js [getdatabasemigrationresource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/getDatabaseMigrationResource.js [getmigrationservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/getMigrationService.js [getmigrationservicesintheresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/getMigrationServicesInTheResourceGroup.js @@ -107,34 +181,78 @@ Take a look at our [API Documentation][apiref] for more information about the AP [listdatabasemigrationsattachedtotheservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/listDatabaseMigrationsAttachedToTheService.js [listskus]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/listSkus.js [listsalloftheavailablesqlrestapioperations]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/listsAllOfTheAvailableSqlRestApiOperations.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/operationsListSample.js [projectscreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsCreateOrUpdate.js +[projectscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsCreateOrUpdateSample.js [projectsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsDelete.js +[projectsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsDeleteSample.js [projectsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsGet.js +[projectsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsGetSample.js [projectslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsList.js +[projectslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsListSample.js [projectsupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsUpdate.js +[projectsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsUpdateSample.js [regeneratetheofauthenticationkeys]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/regenerateTheOfAuthenticationKeys.js +[resourceskuslistskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/resourceSkusListSkusSample.js [retrievethelistofauthenticationkeys]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/retrieveTheListOfAuthenticationKeys.js [retrievethemonitoringdata]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/retrieveTheMonitoringData.js +[servicetaskscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksCancelSample.js +[servicetaskscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksCreateOrUpdateSample.js +[servicetasksdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksDeleteSample.js +[servicetasksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksGetSample.js [servicetaskslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksList.js +[servicetaskslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksListSample.js +[servicetasksupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksUpdateSample.js [servicescheckchildrennameavailability]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckChildrenNameAvailability.js +[servicescheckchildrennameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckChildrenNameAvailabilitySample.js [serviceschecknameavailability]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckNameAvailability.js +[serviceschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckNameAvailabilitySample.js [servicescheckstatus]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckStatus.js +[servicescheckstatussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckStatusSample.js [servicescreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCreateOrUpdate.js +[servicescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCreateOrUpdateSample.js +[servicesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesDeleteSample.js +[servicesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesGetSample.js [serviceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesList.js [serviceslistbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListByResourceGroup.js +[serviceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListByResourceGroupSample.js +[serviceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListSample.js [serviceslistskus]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListSkus.js +[serviceslistskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListSkusSample.js [servicesstart]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesStart.js +[servicesstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesStartSample.js [servicesstop]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesStop.js +[servicesstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesStopSample.js +[servicesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesUpdateSample.js [servicesusages]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesUsages.js +[sqlmigrationservicescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesCreateOrUpdateSample.js +[sqlmigrationservicesdeletenodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesDeleteNodeSample.js +[sqlmigrationservicesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesDeleteSample.js +[sqlmigrationservicesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesGetSample.js +[sqlmigrationserviceslistauthkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListAuthKeysSample.js +[sqlmigrationserviceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListByResourceGroupSample.js +[sqlmigrationserviceslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListBySubscriptionSample.js +[sqlmigrationserviceslistmigrationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListMigrationsSample.js +[sqlmigrationserviceslistmonitoringdatasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListMonitoringDataSample.js +[sqlmigrationservicesregenerateauthkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesRegenerateAuthKeysSample.js +[sqlmigrationservicesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesUpdateSample.js [stopongoingmigrationforthedatabase]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/stopOngoingMigrationForTheDatabase.js [taskscancel]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCancel.js +[taskscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCancelSample.js [taskscommand]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCommand.js +[taskscommandsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCommandSample.js [taskscreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCreateOrUpdate.js +[taskscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCreateOrUpdateSample.js [tasksdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksDelete.js +[tasksdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksDeleteSample.js [tasksget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksGet.js +[tasksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksGetSample.js [taskslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksList.js +[taskslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksListSample.js [tasksupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksUpdate.js +[tasksupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksUpdateSample.js [updatesqlmigrationservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/updateSqlMigrationService.js +[usageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/usagesListSample.js [apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-datamigration?view=azure-node-preview [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datamigration/arm-datamigration/README.md diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiCancelSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiCancelSample.js new file mode 100644 index 000000000000..7e4426ffdaad --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiCancelSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Stop migrations in progress for the database + * + * @summary Stop migrations in progress for the database + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCancelDatabaseMigration.json + */ +async function stopOngoingMigrationForTheDatabase() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const parameters = { + migrationOperationId: "4124fe90-d1b6-4b50-b4d9-46d02381f59a", + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.beginCancelAndWait( + resourceGroupName, + managedInstanceName, + targetDbName, + parameters + ); + console.log(result); +} + +stopOngoingMigrationForTheDatabase().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiCreateOrUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiCreateOrUpdateSample.js new file mode 100644 index 000000000000..c3220c45f8dd --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiCreateOrUpdateSample.js @@ -0,0 +1,130 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or Update Database Migration resource. + * + * @summary Create or Update Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCreateOrUpdateDatabaseMigrationMAX.json + */ +async function createOrUpdateDatabaseMigrationResourceWithMaximumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const parameters = { + properties: { + backupConfiguration: { + sourceLocation: { + fileShare: { + path: "C:aaa\bbbccc", + password: "placeholder", + username: "name", + }, + }, + targetLocation: { + accountKey: "abcd", + storageAccountResourceId: "account.database.windows.net", + }, + }, + kind: "SqlMi", + migrationService: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent", + offlineConfiguration: { + lastBackupName: "last_backup_file_name", + offline: true, + }, + scope: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance", + sourceDatabaseName: "aaa", + sourceSqlConnection: { + authentication: "WindowsAuthentication", + dataSource: "aaa", + encryptConnection: true, + password: "placeholder", + trustServerCertificate: true, + userName: "bbb", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.beginCreateOrUpdateAndWait( + resourceGroupName, + managedInstanceName, + targetDbName, + parameters + ); + console.log(result); +} + +createOrUpdateDatabaseMigrationResourceWithMaximumParameters().catch(console.error); + +/** + * This sample demonstrates how to Create or Update Database Migration resource. + * + * @summary Create or Update Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCreateOrUpdateDatabaseMigrationMIN.json + */ +async function createOrUpdateDatabaseMigrationResourceWithMinimumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const parameters = { + properties: { + backupConfiguration: { + sourceLocation: { + fileShare: { + path: "C:aaa\bbbccc", + password: "placeholder", + username: "name", + }, + }, + targetLocation: { + accountKey: "abcd", + storageAccountResourceId: "account.database.windows.net", + }, + }, + kind: "SqlMi", + migrationService: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent", + offlineConfiguration: { + lastBackupName: "last_backup_file_name", + offline: true, + }, + scope: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance", + sourceDatabaseName: "aaa", + sourceSqlConnection: { + authentication: "WindowsAuthentication", + dataSource: "aaa", + encryptConnection: true, + password: "placeholder", + trustServerCertificate: true, + userName: "bbb", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.beginCreateOrUpdateAndWait( + resourceGroupName, + managedInstanceName, + targetDbName, + parameters + ); + console.log(result); +} + +createOrUpdateDatabaseMigrationResourceWithMinimumParameters().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiCutoverSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiCutoverSample.js new file mode 100644 index 000000000000..34ea4606b854 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiCutoverSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Initiate cutover for online migration in progress for the database. + * + * @summary Initiate cutover for online migration in progress for the database. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCutoverDatabaseMigration.json + */ +async function cutoverOnlineMigrationOperationForTheDatabase() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const parameters = { + migrationOperationId: "4124fe90-d1b6-4b50-b4d9-46d02381f59a", + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.beginCutoverAndWait( + resourceGroupName, + managedInstanceName, + targetDbName, + parameters + ); + console.log(result); +} + +cutoverOnlineMigrationOperationForTheDatabase().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiGetSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiGetSample.js new file mode 100644 index 000000000000..a59a1787fbfd --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlMiGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Retrieve the Database Migration resource. + * + * @summary Retrieve the Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiGetDatabaseMigration.json + */ +async function getDatabaseMigrationResource() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.get( + resourceGroupName, + managedInstanceName, + targetDbName + ); + console.log(result); +} + +getDatabaseMigrationResource().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMCancelSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMCancelSample.js new file mode 100644 index 000000000000..b59a8b4589b4 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMCancelSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Stop ongoing migration for the database. + * + * @summary Stop ongoing migration for the database. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCancelDatabaseMigration.json + */ +async function stopOngoingMigrationForTheDatabase() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const parameters = { + migrationOperationId: "4124fe90-d1b6-4b50-b4d9-46d02381f59a", + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.beginCancelAndWait( + resourceGroupName, + sqlVirtualMachineName, + targetDbName, + parameters + ); + console.log(result); +} + +stopOngoingMigrationForTheDatabase().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMCreateOrUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMCreateOrUpdateSample.js new file mode 100644 index 000000000000..f697015ab8eb --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMCreateOrUpdateSample.js @@ -0,0 +1,130 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or Update Database Migration resource. + * + * @summary Create or Update Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMAX.json + */ +async function createOrUpdateDatabaseMigrationResourceWithMaximumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const parameters = { + properties: { + backupConfiguration: { + sourceLocation: { + fileShare: { + path: "C:aaa\bbbccc", + password: "placeholder", + username: "name", + }, + }, + targetLocation: { + accountKey: "abcd", + storageAccountResourceId: "account.database.windows.net", + }, + }, + kind: "SqlVm", + migrationService: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent", + offlineConfiguration: { + lastBackupName: "last_backup_file_name", + offline: true, + }, + scope: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm", + sourceDatabaseName: "aaa", + sourceSqlConnection: { + authentication: "WindowsAuthentication", + dataSource: "aaa", + encryptConnection: true, + password: "placeholder", + trustServerCertificate: true, + userName: "bbb", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.beginCreateOrUpdateAndWait( + resourceGroupName, + sqlVirtualMachineName, + targetDbName, + parameters + ); + console.log(result); +} + +createOrUpdateDatabaseMigrationResourceWithMaximumParameters().catch(console.error); + +/** + * This sample demonstrates how to Create or Update Database Migration resource. + * + * @summary Create or Update Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMIN.json + */ +async function createOrUpdateDatabaseMigrationResourceWithMinimumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const parameters = { + properties: { + backupConfiguration: { + sourceLocation: { + fileShare: { + path: "C:aaa\bbbccc", + password: "placeholder", + username: "name", + }, + }, + targetLocation: { + accountKey: "abcd", + storageAccountResourceId: "account.database.windows.net", + }, + }, + kind: "SqlVm", + migrationService: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent", + offlineConfiguration: { + lastBackupName: "last_backup_file_name", + offline: true, + }, + scope: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm", + sourceDatabaseName: "aaa", + sourceSqlConnection: { + authentication: "WindowsAuthentication", + dataSource: "aaa", + encryptConnection: true, + password: "placeholder", + trustServerCertificate: true, + userName: "bbb", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.beginCreateOrUpdateAndWait( + resourceGroupName, + sqlVirtualMachineName, + targetDbName, + parameters + ); + console.log(result); +} + +createOrUpdateDatabaseMigrationResourceWithMinimumParameters().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMCutoverSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMCutoverSample.js new file mode 100644 index 000000000000..7870bab82086 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMCutoverSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Cutover online migration operation for the database. + * + * @summary Cutover online migration operation for the database. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCutoverDatabaseMigration.json + */ +async function cutoverOnlineMigrationOperationForTheDatabase() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const parameters = { + migrationOperationId: "4124fe90-d1b6-4b50-b4d9-46d02381f59a", + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.beginCutoverAndWait( + resourceGroupName, + sqlVirtualMachineName, + targetDbName, + parameters + ); + console.log(result); +} + +cutoverOnlineMigrationOperationForTheDatabase().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMGetSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMGetSample.js new file mode 100644 index 000000000000..5a74a8e7c564 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/databaseMigrationsSqlVMGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Retrieve the Database Migration resource. + * + * @summary Retrieve the Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmGetDatabaseMigration.json + */ +async function getDatabaseMigrationResource() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.get( + resourceGroupName, + sqlVirtualMachineName, + targetDbName + ); + console.log(result); +} + +getDatabaseMigrationResource().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesCreateOrUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesCreateOrUpdateSample.js new file mode 100644 index 000000000000..f3c7e59482e2 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesCreateOrUpdateSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The PUT method creates a new file or updates an existing one. + * + * @summary The PUT method creates a new file or updates an existing one. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_CreateOrUpdate.json + */ +async function filesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const parameters = { + properties: { filePath: "DmsSdkFilePath/DmsSdkFile.sql" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.createOrUpdate( + groupName, + serviceName, + projectName, + fileName, + parameters + ); + console.log(result); +} + +filesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesDeleteSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesDeleteSample.js new file mode 100644 index 000000000000..b568e8136ed2 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesDeleteSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to This method deletes a file. + * + * @summary This method deletes a file. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Delete.json + */ +async function filesDelete() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.delete(groupName, serviceName, projectName, fileName); + console.log(result); +} + +filesDelete().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesGetSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesGetSample.js new file mode 100644 index 000000000000..3a06950b03e1 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesGetSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The files resource is a nested, proxy-only resource representing a file stored under the project resource. This method retrieves information about a file. + * + * @summary The files resource is a nested, proxy-only resource representing a file stored under the project resource. This method retrieves information about a file. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Get.json + */ +async function filesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.get(groupName, serviceName, projectName, fileName); + console.log(result); +} + +filesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesListSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesListSample.js new file mode 100644 index 000000000000..2b24f6aa5a55 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. This method returns a list of files owned by a project resource. + * + * @summary The project resource is a nested resource representing a stored migration project. This method returns a list of files owned by a project resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_List.json + */ +async function filesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.files.list(groupName, serviceName, projectName)) { + resArray.push(item); + } + console.log(resArray); +} + +filesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesReadSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesReadSample.js new file mode 100644 index 000000000000..e219f7463d25 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesReadSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to This method is used for requesting storage information using which contents of the file can be downloaded. + * + * @summary This method is used for requesting storage information using which contents of the file can be downloaded. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Read.json + */ +async function filesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.read(groupName, serviceName, projectName, fileName); + console.log(result); +} + +filesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesReadWriteSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesReadWriteSample.js new file mode 100644 index 000000000000..0a9df60de27d --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesReadWriteSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to This method is used for requesting information for reading and writing the file content. + * + * @summary This method is used for requesting information for reading and writing the file content. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_ReadWrite.json + */ +async function filesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.readWrite(groupName, serviceName, projectName, fileName); + console.log(result); +} + +filesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesUpdateSample.js new file mode 100644 index 000000000000..967c9ec4777d --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/filesUpdateSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to This method updates an existing file. + * + * @summary This method updates an existing file. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Update.json + */ +async function filesUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const parameters = { + properties: { filePath: "DmsSdkFilePath/DmsSdkFile.sql" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.update( + groupName, + serviceName, + projectName, + fileName, + parameters + ); + console.log(result); +} + +filesUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/operationsListSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/operationsListSample.js new file mode 100644 index 000000000000..543c2bde7da3 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/operationsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists all of the available SQL Migration REST API operations. + * + * @summary Lists all of the available SQL Migration REST API operations. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListOperation.json + */ +async function listsAllOfTheAvailableSqlRestApiOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listsAllOfTheAvailableSqlRestApiOperations().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsCreateOrUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsCreateOrUpdateSample.js new file mode 100644 index 000000000000..cc5c5b3fa3a8 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsCreateOrUpdateSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one. + * + * @summary The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_CreateOrUpdate.json + */ +async function projectsCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const parameters = { + location: "southcentralus", + sourcePlatform: "SQL", + targetPlatform: "SQLDB", + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.projects.createOrUpdate( + groupName, + serviceName, + projectName, + parameters + ); + console.log(result); +} + +projectsCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsDeleteSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsDeleteSample.js new file mode 100644 index 000000000000..14af4328bdb4 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsDeleteSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. The DELETE method deletes a project. + * + * @summary The project resource is a nested resource representing a stored migration project. The DELETE method deletes a project. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Delete.json + */ +async function projectsDelete() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.projects.delete(groupName, serviceName, projectName); + console.log(result); +} + +projectsDelete().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsGetSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsGetSample.js new file mode 100644 index 000000000000..7c7e994e8f2d --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project. + * + * @summary The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Get.json + */ +async function projectsGet() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.projects.get(groupName, serviceName, projectName); + console.log(result); +} + +projectsGet().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsListSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsListSample.js new file mode 100644 index 000000000000..8bd55a6d2c86 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. This method returns a list of projects owned by a service resource. + * + * @summary The project resource is a nested resource representing a stored migration project. This method returns a list of projects owned by a service resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_List.json + */ +async function projectsList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.projects.list(groupName, serviceName)) { + resArray.push(item); + } + console.log(resArray); +} + +projectsList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsUpdateSample.js new file mode 100644 index 000000000000..0f7c0f8b2391 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/projectsUpdateSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project. + * + * @summary The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Update.json + */ +async function projectsUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const parameters = { + location: "southcentralus", + sourcePlatform: "SQL", + targetPlatform: "SQLDB", + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.projects.update(groupName, serviceName, projectName, parameters); + console.log(result); +} + +projectsUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/resourceSkusListSkusSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/resourceSkusListSkusSample.js new file mode 100644 index 000000000000..e4f2857268d1 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/resourceSkusListSkusSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The skus action returns the list of SKUs that DMS supports. + * + * @summary The skus action returns the list of SKUs that DMS supports. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ResourceSkus_ListSkus.json + */ +async function listSkus() { + const subscriptionId = "subid"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceSkus.listSkus()) { + resArray.push(item); + } + console.log(resArray); +} + +listSkus().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksCancelSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksCancelSample.js new file mode 100644 index 000000000000..847547c464dd --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksCancelSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a service task if it's currently queued or running. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a service task if it's currently queued or running. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Cancel.json + */ +async function tasksCancel() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.cancel(groupName, serviceName, taskName); + console.log(result); +} + +tasksCancel().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksCreateOrUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksCreateOrUpdateSample.js new file mode 100644 index 000000000000..45e18e17ba39 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksCreateOrUpdateSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new service task or updates an existing one, although since service tasks have no mutable custom properties, there is little reason to update an existing one. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new service task or updates an existing one, although since service tasks have no mutable custom properties, there is little reason to update an existing one. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_CreateOrUpdate.json + */ +async function tasksCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const parameters = { + properties: { + input: { serverVersion: "NA" }, + taskType: "Service.Check.OCI", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.createOrUpdate( + groupName, + serviceName, + taskName, + parameters + ); + console.log(result); +} + +tasksCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksDeleteSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksDeleteSample.js new file mode 100644 index 000000000000..64c3faa569a6 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksDeleteSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a service task, canceling it first if it's running. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a service task, canceling it first if it's running. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Delete.json + */ +async function tasksDelete() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.delete(groupName, serviceName, taskName); + console.log(result); +} + +tasksDelete().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksGetSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksGetSample.js new file mode 100644 index 000000000000..37a0e72fbfd2 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a service task. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a service task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Get.json + */ +async function tasksGet() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.get(groupName, serviceName, taskName); + console.log(result); +} + +tasksGet().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksListSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksListSample.js new file mode 100644 index 000000000000..2f9be02f375d --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service level tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service level tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_List.json + */ +async function serviceTasksList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serviceTasks.list(groupName, serviceName)) { + resArray.push(item); + } + console.log(resArray); +} + +serviceTasksList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksUpdateSample.js new file mode 100644 index 000000000000..912600d6b15d --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/serviceTasksUpdateSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing service task, but since service tasks have no mutable custom properties, there is little reason to do so. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing service task, but since service tasks have no mutable custom properties, there is little reason to do so. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Update.json + */ +async function tasksUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const parameters = { + properties: { + input: { serverVersion: "NA" }, + taskType: "Service.Check.OCI", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.update(groupName, serviceName, taskName, parameters); + console.log(result); +} + +tasksUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckChildrenNameAvailabilitySample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckChildrenNameAvailabilitySample.js new file mode 100644 index 000000000000..caf1a3cc355f --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckChildrenNameAvailabilitySample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to This method checks whether a proposed nested resource name is valid and available. + * + * @summary This method checks whether a proposed nested resource name is valid and available. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckChildrenNameAvailability.json + */ +async function servicesCheckChildrenNameAvailability() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const parameters = { name: "Task1", type: "tasks" }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.checkChildrenNameAvailability( + groupName, + serviceName, + parameters + ); + console.log(result); +} + +servicesCheckChildrenNameAvailability().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckNameAvailabilitySample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckNameAvailabilitySample.js new file mode 100644 index 000000000000..5f7eaefb114d --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckNameAvailabilitySample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to This method checks whether a proposed top-level resource name is valid and available. + * + * @summary This method checks whether a proposed top-level resource name is valid and available. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckNameAvailability.json + */ +async function servicesCheckNameAvailability() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const location = "eastus"; + const parameters = { + name: "DmsSdkService", + type: "services", + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.checkNameAvailability(location, parameters); + console.log(result); +} + +servicesCheckNameAvailability().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckStatusSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckStatusSample.js new file mode 100644 index 000000000000..f7202a96c866 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCheckStatusSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckStatus.json + */ +async function servicesCheckStatus() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.checkStatus(groupName, serviceName); + console.log(result); +} + +servicesCheckStatus().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCreateOrUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCreateOrUpdateSample.js new file mode 100644 index 000000000000..876d6dd2087e --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesCreateOrUpdateSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CreateOrUpdate.json + */ +async function servicesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const parameters = { + location: "southcentralus", + sku: { name: "Basic_1vCore" }, + virtualSubnetId: + "/subscriptions/fc04246f-04c5-437e-ac5e-206a19e7193f/resourceGroups/DmsSdkTestNetwork/providers/Microsoft.Network/virtualNetworks/DmsSdkTestNetwork/subnets/default", + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginCreateOrUpdateAndWait( + groupName, + serviceName, + parameters + ); + console.log(result); +} + +servicesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesDeleteSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesDeleteSample.js new file mode 100644 index 000000000000..3f4c28c9472f --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesDeleteSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The DELETE method deletes a service. Any running tasks will be canceled. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The DELETE method deletes a service. Any running tasks will be canceled. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Delete.json + */ +async function servicesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginDeleteAndWait(groupName, serviceName); + console.log(result); +} + +servicesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesGetSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesGetSample.js new file mode 100644 index 000000000000..3613c02a6d00 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Get.json + */ +async function servicesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.get(groupName, serviceName); + console.log(result); +} + +servicesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListByResourceGroupSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListByResourceGroupSample.js new file mode 100644 index 000000000000..56f09ef044cf --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListByResourceGroupSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group. + * + * @summary The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListByResourceGroup.json + */ +async function servicesListByResourceGroup() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.services.listByResourceGroup(groupName)) { + resArray.push(item); + } + console.log(resArray); +} + +servicesListByResourceGroup().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListSample.js new file mode 100644 index 000000000000..3d66119adf0f --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_List.json + */ +async function servicesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.services.list()) { + resArray.push(item); + } + console.log(resArray); +} + +servicesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListSkusSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListSkusSample.js new file mode 100644 index 000000000000..f958bea5f113 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesListSkusSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListSkus.json + */ +async function servicesListSkus() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.services.listSkus(groupName, serviceName)) { + resArray.push(item); + } + console.log(resArray); +} + +servicesListSkus().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesStartSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesStartSample.js new file mode 100644 index 000000000000..40efc72a1d1f --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesStartSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Start.json + */ +async function servicesStart() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginStartAndWait(groupName, serviceName); + console.log(result); +} + +servicesStart().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesStopSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesStopSample.js new file mode 100644 index 000000000000..9232ccc59037 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesStopSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Stop.json + */ +async function servicesStop() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginStopAndWait(groupName, serviceName); + console.log(result); +} + +servicesStop().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesUpdateSample.js new file mode 100644 index 000000000000..29500ba3df79 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/servicesUpdateSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Update.json + */ +async function servicesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const parameters = { + location: "southcentralus", + virtualSubnetId: + "/subscriptions/fc04246f-04c5-437e-ac5e-206a19e7193f/resourceGroups/DmsSdkTestNetwork/providers/Microsoft.Network/virtualNetworks/DmsSdkTestNetwork/subnets/default", + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginUpdateAndWait(groupName, serviceName, parameters); + console.log(result); +} + +servicesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesCreateOrUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesCreateOrUpdateSample.js new file mode 100644 index 000000000000..ef55db79fa95 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesCreateOrUpdateSample.js @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or Update SQL Migration Service. + * + * @summary Create or Update SQL Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMAX.json + */ +async function createOrUpdateSqlMigrationServiceWithMaximumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "testagent"; + const parameters = { location: "northeurope" }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.beginCreateOrUpdateAndWait( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +createOrUpdateSqlMigrationServiceWithMaximumParameters().catch(console.error); + +/** + * This sample demonstrates how to Create or Update SQL Migration Service. + * + * @summary Create or Update SQL Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMIN.json + */ +async function createOrUpdateSqlMigrationServiceWithMinimumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "testagent"; + const parameters = { location: "northeurope" }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.beginCreateOrUpdateAndWait( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +createOrUpdateSqlMigrationServiceWithMinimumParameters().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesDeleteNodeSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesDeleteNodeSample.js new file mode 100644 index 000000000000..4672902a42dc --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesDeleteNodeSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete the integration runtime node. + * + * @summary Delete the integration runtime node. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteIntegrationRuntimeNode.json + */ +async function deleteTheIntegrationRuntimeNode() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const parameters = { + integrationRuntimeName: "IRName", + nodeName: "nodeName", + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.deleteNode( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +deleteTheIntegrationRuntimeNode().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesDeleteSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesDeleteSample.js new file mode 100644 index 000000000000..44a4b7ff8dcf --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesDeleteSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete SQL Migration Service. + * + * @summary Delete SQL Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteMigrationService.json + */ +async function deleteSqlMigrationService() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.beginDeleteAndWait( + resourceGroupName, + sqlMigrationServiceName + ); + console.log(result); +} + +deleteSqlMigrationService().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesGetSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesGetSample.js new file mode 100644 index 000000000000..8a4d7f5133dc --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Retrieve the Migration Service. + * + * @summary Retrieve the Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMigrationService.json + */ +async function getMigrationService() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.get(resourceGroupName, sqlMigrationServiceName); + console.log(result); +} + +getMigrationService().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListAuthKeysSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListAuthKeysSample.js new file mode 100644 index 000000000000..9334951ebd02 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListAuthKeysSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Retrieve the List of Authentication Keys for Self Hosted Integration Runtime. + * + * @summary Retrieve the List of Authentication Keys for Self Hosted Integration Runtime. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListAuthKeysMigrationService.json + */ +async function retrieveTheListOfAuthenticationKeys() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.listAuthKeys( + resourceGroupName, + sqlMigrationServiceName + ); + console.log(result); +} + +retrieveTheListOfAuthenticationKeys().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListByResourceGroupSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListByResourceGroupSample.js new file mode 100644 index 000000000000..ceddef9f6757 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListByResourceGroupSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Retrieve all SQL migration services in the resource group. + * + * @summary Retrieve all SQL migration services in the resource group. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListByResourceGroupMigrationService.json + */ +async function getMigrationServicesInTheResourceGroup() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sqlMigrationServices.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +getMigrationServicesInTheResourceGroup().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListBySubscriptionSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListBySubscriptionSample.js new file mode 100644 index 000000000000..5cb40a1082da --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListBySubscriptionSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Retrieve all SQL migration services in the subscriptions. + * + * @summary Retrieve all SQL migration services in the subscriptions. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListBySubscriptionMigrationService.json + */ +async function getServicesInTheSubscriptions() { + const subscriptionId = + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/managedInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sqlMigrationServices.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +getServicesInTheSubscriptions().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListMigrationsSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListMigrationsSample.js new file mode 100644 index 000000000000..2eecc2727fb0 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListMigrationsSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Retrieve the List of database migrations attached to the service. + * + * @summary Retrieve the List of database migrations attached to the service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListMigrationsByMigrationService.json + */ +async function listDatabaseMigrationsAttachedToTheService() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sqlMigrationServices.listMigrations( + resourceGroupName, + sqlMigrationServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listDatabaseMigrationsAttachedToTheService().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListMonitoringDataSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListMonitoringDataSample.js new file mode 100644 index 000000000000..b9c51ed6b599 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesListMonitoringDataSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Retrieve the Monitoring Data. + * + * @summary Retrieve the Monitoring Data. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMonitorDataMigrationService.json + */ +async function retrieveTheMonitoringData() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.listMonitoringData( + resourceGroupName, + sqlMigrationServiceName + ); + console.log(result); +} + +retrieveTheMonitoringData().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesRegenerateAuthKeysSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesRegenerateAuthKeysSample.js new file mode 100644 index 000000000000..6e9c27e98d91 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesRegenerateAuthKeysSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime. + * + * @summary Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/RegenAuthKeysMigrationService.json + */ +async function regenerateTheOfAuthenticationKeys() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const parameters = { keyName: "authKey1" }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.regenerateAuthKeys( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +regenerateTheOfAuthenticationKeys().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesUpdateSample.js new file mode 100644 index 000000000000..b54dfd41828e --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/sqlMigrationServicesUpdateSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update SQL Migration Service. + * + * @summary Update SQL Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/UpdateMigrationService.json + */ +async function updateSqlMigrationService() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "testagent"; + const parameters = { tags: { mytag: "myval" } }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.beginUpdateAndWait( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +updateSqlMigrationService().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCancelSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCancelSample.js new file mode 100644 index 000000000000..ce89fa3e8e78 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCancelSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a task if it's currently queued or running. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a task if it's currently queued or running. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Cancel.json + */ +async function tasksCancel() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.cancel(groupName, serviceName, projectName, taskName); + console.log(result); +} + +tasksCancel().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCommandSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCommandSample.js new file mode 100644 index 000000000000..3ce0b76f53cd --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCommandSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method executes a command on a running task. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method executes a command on a running task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Command.json + */ +async function tasksCommand() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const parameters = { + commandType: "Migrate.Sync.Complete.Database", + input: { databaseName: "TestDatabase" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.command( + groupName, + serviceName, + projectName, + taskName, + parameters + ); + console.log(result); +} + +tasksCommand().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCreateOrUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCreateOrUpdateSample.js new file mode 100644 index 000000000000..c68a94c39458 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksCreateOrUpdateSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new task or updates an existing one, although since tasks have no mutable custom properties, there is little reason to update an existing one. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new task or updates an existing one, although since tasks have no mutable custom properties, there is little reason to update an existing one. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_CreateOrUpdate.json + */ +async function tasksCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const parameters = { + properties: { + input: { + targetConnectionInfo: { + type: "SqlConnectionInfo", + authentication: "SqlAuthentication", + dataSource: "ssma-test-server.database.windows.net", + encryptConnection: true, + password: "testpassword", + trustServerCertificate: true, + userName: "testuser", + }, + }, + taskType: "ConnectToTarget.SqlDb", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.createOrUpdate( + groupName, + serviceName, + projectName, + taskName, + parameters + ); + console.log(result); +} + +tasksCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksDeleteSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksDeleteSample.js new file mode 100644 index 000000000000..046060b60851 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksDeleteSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a task, canceling it first if it's running. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a task, canceling it first if it's running. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Delete.json + */ +async function tasksDelete() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.delete(groupName, serviceName, projectName, taskName); + console.log(result); +} + +tasksDelete().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksGetSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksGetSample.js new file mode 100644 index 000000000000..11c933df1846 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksGetSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a task. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Get.json + */ +async function tasksGet() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.get(groupName, serviceName, projectName, taskName); + console.log(result); +} + +tasksGet().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksListSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksListSample.js new file mode 100644 index 000000000000..5abfff6c59ec --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_List.json + */ +async function tasksList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tasks.list(groupName, serviceName, projectName)) { + resArray.push(item); + } + console.log(resArray); +} + +tasksList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksUpdateSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksUpdateSample.js new file mode 100644 index 000000000000..64754956e473 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/tasksUpdateSample.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 { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing task, but since tasks have no mutable custom properties, there is little reason to do so. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing task, but since tasks have no mutable custom properties, there is little reason to do so. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Update.json + */ +async function tasksUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const parameters = { + properties: { + input: { + targetConnectionInfo: { + type: "SqlConnectionInfo", + authentication: "SqlAuthentication", + dataSource: "ssma-test-server.database.windows.net", + encryptConnection: true, + password: "testpassword", + trustServerCertificate: true, + userName: "testuser", + }, + }, + taskType: "ConnectToTarget.SqlDb", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.update( + groupName, + serviceName, + projectName, + taskName, + parameters + ); + console.log(result); +} + +tasksUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/usagesListSample.js b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/usagesListSample.js new file mode 100644 index 000000000000..2915d0e07823 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/javascript/usagesListSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataMigrationManagementClient } = require("@azure/arm-datamigration"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to This method returns region-specific quotas and resource usage information for the Database Migration Service. + * + * @summary This method returns region-specific quotas and resource usage information for the Database Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Usages_List.json + */ +async function servicesUsages() { + const subscriptionId = "90fb80a6-0f71-4761-8f03-921e7396f3c0"; + const location = "westus"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.usages.list(location)) { + resArray.push(item); + } + console.log(resArray); +} + +servicesUsages().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/README.md b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/README.md index 45b7a947ae99..7ed8920e1eb3 100644 --- a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/README.md +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/README.md @@ -2,54 +2,113 @@ These sample programs show how to use the TypeScript client libraries for in some common scenarios. -| **File Name** | **Description** | -| ------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [createOrUpdateDatabaseMigrationResourceWithMaximumParameters.ts][createorupdatedatabasemigrationresourcewithmaximumparameters] | Create or Update Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMAX.json | -| [createOrUpdateDatabaseMigrationResourceWithMinimumParameters.ts][createorupdatedatabasemigrationresourcewithminimumparameters] | Create or Update Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMIN.json | -| [createOrUpdateSqlMigrationServiceWithMaximumParameters.ts][createorupdatesqlmigrationservicewithmaximumparameters] | Create or Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMAX.json | -| [createOrUpdateSqlMigrationServiceWithMinimumParameters.ts][createorupdatesqlmigrationservicewithminimumparameters] | Create or Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMIN.json | -| [cutoverOnlineMigrationOperationForTheDatabase.ts][cutoveronlinemigrationoperationforthedatabase] | Cutover online migration operation for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCutoverDatabaseMigration.json | -| [deleteSqlMigrationService.ts][deletesqlmigrationservice] | Delete SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteMigrationService.json | -| [deleteTheIntegrationRuntimeNode.ts][deletetheintegrationruntimenode] | Delete the integration runtime node. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteIntegrationRuntimeNode.json | -| [filesCreateOrUpdate.ts][filescreateorupdate] | The PUT method creates a new file or updates an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_CreateOrUpdate.json | -| [filesDelete.ts][filesdelete] | This method deletes a file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Delete.json | -| [filesList.ts][fileslist] | This method is used for requesting information for reading and writing the file content. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_ReadWrite.json | -| [filesUpdate.ts][filesupdate] | This method updates an existing file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Update.json | -| [getDatabaseMigrationResource.ts][getdatabasemigrationresource] | Retrieve the Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmGetDatabaseMigration.json | -| [getMigrationService.ts][getmigrationservice] | Retrieve the Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMigrationService.json | -| [getMigrationServicesInTheResourceGroup.ts][getmigrationservicesintheresourcegroup] | Retrieve all SQL migration services in the resource group. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListByResourceGroupMigrationService.json | -| [getServicesInTheSubscriptions.ts][getservicesinthesubscriptions] | Retrieve all SQL migration services in the subscriptions. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListBySubscriptionMigrationService.json | -| [listDatabaseMigrationsAttachedToTheService.ts][listdatabasemigrationsattachedtotheservice] | Retrieve the List of database migrations attached to the service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListMigrationsByMigrationService.json | -| [listSkus.ts][listskus] | The skus action returns the list of SKUs that DMS supports. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ResourceSkus_ListSkus.json | -| [listsAllOfTheAvailableSqlRestApiOperations.ts][listsalloftheavailablesqlrestapioperations] | Lists all of the available SQL Migration REST API operations. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListOperation.json | -| [projectsCreateOrUpdate.ts][projectscreateorupdate] | The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_CreateOrUpdate.json | -| [projectsDelete.ts][projectsdelete] | The project resource is a nested resource representing a stored migration project. The DELETE method deletes a project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Delete.json | -| [projectsGet.ts][projectsget] | The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Get.json | -| [projectsList.ts][projectslist] | The project resource is a nested resource representing a stored migration project. This method returns a list of projects owned by a service resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_List.json | -| [projectsUpdate.ts][projectsupdate] | The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Update.json | -| [regenerateTheOfAuthenticationKeys.ts][regeneratetheofauthenticationkeys] | Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/RegenAuthKeysMigrationService.json | -| [retrieveTheListOfAuthenticationKeys.ts][retrievethelistofauthenticationkeys] | Retrieve the List of Authentication Keys for Self Hosted Integration Runtime. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListAuthKeysMigrationService.json | -| [retrieveTheMonitoringData.ts][retrievethemonitoringdata] | Retrieve the Monitoring Data. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMonitorDataMigrationService.json | -| [serviceTasksList.ts][servicetaskslist] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service level tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_List.json | -| [servicesCheckChildrenNameAvailability.ts][servicescheckchildrennameavailability] | This method checks whether a proposed nested resource name is valid and available. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckChildrenNameAvailability.json | -| [servicesCheckNameAvailability.ts][serviceschecknameavailability] | This method checks whether a proposed top-level resource name is valid and available. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckNameAvailability.json | -| [servicesCheckStatus.ts][servicescheckstatus] | The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckStatus.json | -| [servicesCreateOrUpdate.ts][servicescreateorupdate] | The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Update.json | -| [servicesList.ts][serviceslist] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_List.json | -| [servicesListByResourceGroup.ts][serviceslistbyresourcegroup] | The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListByResourceGroup.json | -| [servicesListSkus.ts][serviceslistskus] | The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListSkus.json | -| [servicesStart.ts][servicesstart] | The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Start.json | -| [servicesStop.ts][servicesstop] | The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Stop.json | -| [servicesUsages.ts][servicesusages] | This method returns region-specific quotas and resource usage information for the Database Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Usages_List.json | -| [stopOngoingMigrationForTheDatabase.ts][stopongoingmigrationforthedatabase] | Stop ongoing migration for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCancelDatabaseMigration.json | -| [tasksCancel.ts][taskscancel] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a service task if it's currently queued or running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Cancel.json | -| [tasksCommand.ts][taskscommand] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method executes a command on a running task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Command.json | -| [tasksCreateOrUpdate.ts][taskscreateorupdate] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new service task or updates an existing one, although since service tasks have no mutable custom properties, there is little reason to update an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_CreateOrUpdate.json | -| [tasksDelete.ts][tasksdelete] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a service task, canceling it first if it's running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Delete.json | -| [tasksGet.ts][tasksget] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a service task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Get.json | -| [tasksList.ts][taskslist] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_List.json | -| [tasksUpdate.ts][tasksupdate] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing service task, but since service tasks have no mutable custom properties, there is little reason to do so. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Update.json | -| [updateSqlMigrationService.ts][updatesqlmigrationservice] | Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/UpdateMigrationService.json | +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [createOrUpdateDatabaseMigrationResourceWithMaximumParameters.ts][createorupdatedatabasemigrationresourcewithmaximumparameters] | Create or Update Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMAX.json | +| [createOrUpdateDatabaseMigrationResourceWithMinimumParameters.ts][createorupdatedatabasemigrationresourcewithminimumparameters] | Create or Update Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMIN.json | +| [createOrUpdateSqlMigrationServiceWithMaximumParameters.ts][createorupdatesqlmigrationservicewithmaximumparameters] | Create or Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMAX.json | +| [createOrUpdateSqlMigrationServiceWithMinimumParameters.ts][createorupdatesqlmigrationservicewithminimumparameters] | Create or Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMIN.json | +| [cutoverOnlineMigrationOperationForTheDatabase.ts][cutoveronlinemigrationoperationforthedatabase] | Cutover online migration operation for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCutoverDatabaseMigration.json | +| [databaseMigrationsSqlMiCancelSample.ts][databasemigrationssqlmicancelsample] | Stop migrations in progress for the database x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCancelDatabaseMigration.json | +| [databaseMigrationsSqlMiCreateOrUpdateSample.ts][databasemigrationssqlmicreateorupdatesample] | Create or Update Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCreateOrUpdateDatabaseMigrationMAX.json | +| [databaseMigrationsSqlMiCutoverSample.ts][databasemigrationssqlmicutoversample] | Initiate cutover for online migration in progress for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCutoverDatabaseMigration.json | +| [databaseMigrationsSqlMiGetSample.ts][databasemigrationssqlmigetsample] | Retrieve the Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiGetDatabaseMigration.json | +| [databaseMigrationsSqlVMCancelSample.ts][databasemigrationssqlvmcancelsample] | Stop ongoing migration for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCancelDatabaseMigration.json | +| [databaseMigrationsSqlVMCreateOrUpdateSample.ts][databasemigrationssqlvmcreateorupdatesample] | Create or Update Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMAX.json | +| [databaseMigrationsSqlVMCutoverSample.ts][databasemigrationssqlvmcutoversample] | Cutover online migration operation for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCutoverDatabaseMigration.json | +| [databaseMigrationsSqlVMGetSample.ts][databasemigrationssqlvmgetsample] | Retrieve the Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmGetDatabaseMigration.json | +| [deleteSqlMigrationService.ts][deletesqlmigrationservice] | Delete SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteMigrationService.json | +| [deleteTheIntegrationRuntimeNode.ts][deletetheintegrationruntimenode] | Delete the integration runtime node. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteIntegrationRuntimeNode.json | +| [filesCreateOrUpdate.ts][filescreateorupdate] | The PUT method creates a new file or updates an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_CreateOrUpdate.json | +| [filesCreateOrUpdateSample.ts][filescreateorupdatesample] | The PUT method creates a new file or updates an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_CreateOrUpdate.json | +| [filesDelete.ts][filesdelete] | This method deletes a file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Delete.json | +| [filesDeleteSample.ts][filesdeletesample] | This method deletes a file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Delete.json | +| [filesGetSample.ts][filesgetsample] | The files resource is a nested, proxy-only resource representing a file stored under the project resource. This method retrieves information about a file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Get.json | +| [filesList.ts][fileslist] | This method is used for requesting information for reading and writing the file content. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_ReadWrite.json | +| [filesListSample.ts][fileslistsample] | The project resource is a nested resource representing a stored migration project. This method returns a list of files owned by a project resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_List.json | +| [filesReadSample.ts][filesreadsample] | This method is used for requesting storage information using which contents of the file can be downloaded. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Read.json | +| [filesReadWriteSample.ts][filesreadwritesample] | This method is used for requesting information for reading and writing the file content. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_ReadWrite.json | +| [filesUpdate.ts][filesupdate] | This method updates an existing file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Update.json | +| [filesUpdateSample.ts][filesupdatesample] | This method updates an existing file. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Update.json | +| [getDatabaseMigrationResource.ts][getdatabasemigrationresource] | Retrieve the Database Migration resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmGetDatabaseMigration.json | +| [getMigrationService.ts][getmigrationservice] | Retrieve the Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMigrationService.json | +| [getMigrationServicesInTheResourceGroup.ts][getmigrationservicesintheresourcegroup] | Retrieve all SQL migration services in the resource group. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListByResourceGroupMigrationService.json | +| [getServicesInTheSubscriptions.ts][getservicesinthesubscriptions] | Retrieve all SQL migration services in the subscriptions. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListBySubscriptionMigrationService.json | +| [listDatabaseMigrationsAttachedToTheService.ts][listdatabasemigrationsattachedtotheservice] | Retrieve the List of database migrations attached to the service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListMigrationsByMigrationService.json | +| [listSkus.ts][listskus] | The skus action returns the list of SKUs that DMS supports. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ResourceSkus_ListSkus.json | +| [listsAllOfTheAvailableSqlRestApiOperations.ts][listsalloftheavailablesqlrestapioperations] | Lists all of the available SQL Migration REST API operations. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListOperation.json | +| [operationsListSample.ts][operationslistsample] | Lists all of the available SQL Migration REST API operations. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListOperation.json | +| [projectsCreateOrUpdate.ts][projectscreateorupdate] | The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_CreateOrUpdate.json | +| [projectsCreateOrUpdateSample.ts][projectscreateorupdatesample] | The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_CreateOrUpdate.json | +| [projectsDelete.ts][projectsdelete] | The project resource is a nested resource representing a stored migration project. The DELETE method deletes a project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Delete.json | +| [projectsDeleteSample.ts][projectsdeletesample] | The project resource is a nested resource representing a stored migration project. The DELETE method deletes a project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Delete.json | +| [projectsGet.ts][projectsget] | The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Get.json | +| [projectsGetSample.ts][projectsgetsample] | The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Get.json | +| [projectsList.ts][projectslist] | The project resource is a nested resource representing a stored migration project. This method returns a list of projects owned by a service resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_List.json | +| [projectsListSample.ts][projectslistsample] | The project resource is a nested resource representing a stored migration project. This method returns a list of projects owned by a service resource. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_List.json | +| [projectsUpdate.ts][projectsupdate] | The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Update.json | +| [projectsUpdateSample.ts][projectsupdatesample] | The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Update.json | +| [regenerateTheOfAuthenticationKeys.ts][regeneratetheofauthenticationkeys] | Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/RegenAuthKeysMigrationService.json | +| [resourceSkusListSkusSample.ts][resourceskuslistskussample] | The skus action returns the list of SKUs that DMS supports. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ResourceSkus_ListSkus.json | +| [retrieveTheListOfAuthenticationKeys.ts][retrievethelistofauthenticationkeys] | Retrieve the List of Authentication Keys for Self Hosted Integration Runtime. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListAuthKeysMigrationService.json | +| [retrieveTheMonitoringData.ts][retrievethemonitoringdata] | Retrieve the Monitoring Data. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMonitorDataMigrationService.json | +| [serviceTasksCancelSample.ts][servicetaskscancelsample] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a service task if it's currently queued or running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Cancel.json | +| [serviceTasksCreateOrUpdateSample.ts][servicetaskscreateorupdatesample] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new service task or updates an existing one, although since service tasks have no mutable custom properties, there is little reason to update an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_CreateOrUpdate.json | +| [serviceTasksDeleteSample.ts][servicetasksdeletesample] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a service task, canceling it first if it's running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Delete.json | +| [serviceTasksGetSample.ts][servicetasksgetsample] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a service task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Get.json | +| [serviceTasksList.ts][servicetaskslist] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service level tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_List.json | +| [serviceTasksListSample.ts][servicetaskslistsample] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service level tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_List.json | +| [serviceTasksUpdateSample.ts][servicetasksupdatesample] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing service task, but since service tasks have no mutable custom properties, there is little reason to do so. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Update.json | +| [servicesCheckChildrenNameAvailability.ts][servicescheckchildrennameavailability] | This method checks whether a proposed nested resource name is valid and available. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckChildrenNameAvailability.json | +| [servicesCheckChildrenNameAvailabilitySample.ts][servicescheckchildrennameavailabilitysample] | This method checks whether a proposed nested resource name is valid and available. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckChildrenNameAvailability.json | +| [servicesCheckNameAvailability.ts][serviceschecknameavailability] | This method checks whether a proposed top-level resource name is valid and available. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckNameAvailability.json | +| [servicesCheckNameAvailabilitySample.ts][serviceschecknameavailabilitysample] | This method checks whether a proposed top-level resource name is valid and available. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckNameAvailability.json | +| [servicesCheckStatus.ts][servicescheckstatus] | The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckStatus.json | +| [servicesCheckStatusSample.ts][servicescheckstatussample] | The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckStatus.json | +| [servicesCreateOrUpdate.ts][servicescreateorupdate] | The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Update.json | +| [servicesCreateOrUpdateSample.ts][servicescreateorupdatesample] | The services resource is the top-level resource that represents the Database Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CreateOrUpdate.json | +| [servicesDeleteSample.ts][servicesdeletesample] | The services resource is the top-level resource that represents the Database Migration Service. The DELETE method deletes a service. Any running tasks will be canceled. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Delete.json | +| [servicesGetSample.ts][servicesgetsample] | The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Get.json | +| [servicesList.ts][serviceslist] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_List.json | +| [servicesListByResourceGroup.ts][serviceslistbyresourcegroup] | The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListByResourceGroup.json | +| [servicesListByResourceGroupSample.ts][serviceslistbyresourcegroupsample] | The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListByResourceGroup.json | +| [servicesListSample.ts][serviceslistsample] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_List.json | +| [servicesListSkus.ts][serviceslistskus] | The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListSkus.json | +| [servicesListSkusSample.ts][serviceslistskussample] | The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListSkus.json | +| [servicesStart.ts][servicesstart] | The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Start.json | +| [servicesStartSample.ts][servicesstartsample] | The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Start.json | +| [servicesStop.ts][servicesstop] | The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Stop.json | +| [servicesStopSample.ts][servicesstopsample] | The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Stop.json | +| [servicesUpdateSample.ts][servicesupdatesample] | The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Update.json | +| [servicesUsages.ts][servicesusages] | This method returns region-specific quotas and resource usage information for the Database Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Usages_List.json | +| [sqlMigrationServicesCreateOrUpdateSample.ts][sqlmigrationservicescreateorupdatesample] | Create or Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMAX.json | +| [sqlMigrationServicesDeleteNodeSample.ts][sqlmigrationservicesdeletenodesample] | Delete the integration runtime node. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteIntegrationRuntimeNode.json | +| [sqlMigrationServicesDeleteSample.ts][sqlmigrationservicesdeletesample] | Delete SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteMigrationService.json | +| [sqlMigrationServicesGetSample.ts][sqlmigrationservicesgetsample] | Retrieve the Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMigrationService.json | +| [sqlMigrationServicesListAuthKeysSample.ts][sqlmigrationserviceslistauthkeyssample] | Retrieve the List of Authentication Keys for Self Hosted Integration Runtime. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListAuthKeysMigrationService.json | +| [sqlMigrationServicesListByResourceGroupSample.ts][sqlmigrationserviceslistbyresourcegroupsample] | Retrieve all SQL migration services in the resource group. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListByResourceGroupMigrationService.json | +| [sqlMigrationServicesListBySubscriptionSample.ts][sqlmigrationserviceslistbysubscriptionsample] | Retrieve all SQL migration services in the subscriptions. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListBySubscriptionMigrationService.json | +| [sqlMigrationServicesListMigrationsSample.ts][sqlmigrationserviceslistmigrationssample] | Retrieve the List of database migrations attached to the service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListMigrationsByMigrationService.json | +| [sqlMigrationServicesListMonitoringDataSample.ts][sqlmigrationserviceslistmonitoringdatasample] | Retrieve the Monitoring Data. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMonitorDataMigrationService.json | +| [sqlMigrationServicesRegenerateAuthKeysSample.ts][sqlmigrationservicesregenerateauthkeyssample] | Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/RegenAuthKeysMigrationService.json | +| [sqlMigrationServicesUpdateSample.ts][sqlmigrationservicesupdatesample] | Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/UpdateMigrationService.json | +| [stopOngoingMigrationForTheDatabase.ts][stopongoingmigrationforthedatabase] | Stop ongoing migration for the database. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCancelDatabaseMigration.json | +| [tasksCancel.ts][taskscancel] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a service task if it's currently queued or running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Cancel.json | +| [tasksCancelSample.ts][taskscancelsample] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a task if it's currently queued or running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Cancel.json | +| [tasksCommand.ts][taskscommand] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method executes a command on a running task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Command.json | +| [tasksCommandSample.ts][taskscommandsample] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method executes a command on a running task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Command.json | +| [tasksCreateOrUpdate.ts][taskscreateorupdate] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new service task or updates an existing one, although since service tasks have no mutable custom properties, there is little reason to update an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_CreateOrUpdate.json | +| [tasksCreateOrUpdateSample.ts][taskscreateorupdatesample] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new task or updates an existing one, although since tasks have no mutable custom properties, there is little reason to update an existing one. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_CreateOrUpdate.json | +| [tasksDelete.ts][tasksdelete] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a service task, canceling it first if it's running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Delete.json | +| [tasksDeleteSample.ts][tasksdeletesample] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a task, canceling it first if it's running. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Delete.json | +| [tasksGet.ts][tasksget] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a service task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Get.json | +| [tasksGetSample.ts][tasksgetsample] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Get.json | +| [tasksList.ts][taskslist] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_List.json | +| [tasksListSample.ts][taskslistsample] | The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_List.json | +| [tasksUpdate.ts][tasksupdate] | The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing service task, but since service tasks have no mutable custom properties, there is little reason to do so. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Update.json | +| [tasksUpdateSample.ts][tasksupdatesample] | The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing task, but since tasks have no mutable custom properties, there is little reason to do so. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Update.json | +| [updateSqlMigrationService.ts][updatesqlmigrationservice] | Update SQL Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/UpdateMigrationService.json | +| [usagesListSample.ts][usageslistsample] | This method returns region-specific quotas and resource usage information for the Database Migration Service. x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Usages_List.json | ## Prerequisites @@ -106,12 +165,27 @@ Take a look at our [API Documentation][apiref] for more information about the AP [createorupdatesqlmigrationservicewithmaximumparameters]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/createOrUpdateSqlMigrationServiceWithMaximumParameters.ts [createorupdatesqlmigrationservicewithminimumparameters]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/createOrUpdateSqlMigrationServiceWithMinimumParameters.ts [cutoveronlinemigrationoperationforthedatabase]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/cutoverOnlineMigrationOperationForTheDatabase.ts +[databasemigrationssqlmicancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiCancelSample.ts +[databasemigrationssqlmicreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiCreateOrUpdateSample.ts +[databasemigrationssqlmicutoversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiCutoverSample.ts +[databasemigrationssqlmigetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiGetSample.ts +[databasemigrationssqlvmcancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMCancelSample.ts +[databasemigrationssqlvmcreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMCreateOrUpdateSample.ts +[databasemigrationssqlvmcutoversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMCutoverSample.ts +[databasemigrationssqlvmgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMGetSample.ts [deletesqlmigrationservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/deleteSqlMigrationService.ts [deletetheintegrationruntimenode]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/deleteTheIntegrationRuntimeNode.ts [filescreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesCreateOrUpdate.ts +[filescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesCreateOrUpdateSample.ts [filesdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesDelete.ts +[filesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesDeleteSample.ts +[filesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesGetSample.ts [fileslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesList.ts +[fileslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesListSample.ts +[filesreadsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesReadSample.ts +[filesreadwritesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesReadWriteSample.ts [filesupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesUpdate.ts +[filesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesUpdateSample.ts [getdatabasemigrationresource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/getDatabaseMigrationResource.ts [getmigrationservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/getMigrationService.ts [getmigrationservicesintheresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/getMigrationServicesInTheResourceGroup.ts @@ -119,34 +193,78 @@ Take a look at our [API Documentation][apiref] for more information about the AP [listdatabasemigrationsattachedtotheservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/listDatabaseMigrationsAttachedToTheService.ts [listskus]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/listSkus.ts [listsalloftheavailablesqlrestapioperations]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/listsAllOfTheAvailableSqlRestApiOperations.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/operationsListSample.ts [projectscreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsCreateOrUpdate.ts +[projectscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsCreateOrUpdateSample.ts [projectsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsDelete.ts +[projectsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsDeleteSample.ts [projectsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsGet.ts +[projectsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsGetSample.ts [projectslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsList.ts +[projectslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsListSample.ts [projectsupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsUpdate.ts +[projectsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsUpdateSample.ts [regeneratetheofauthenticationkeys]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/regenerateTheOfAuthenticationKeys.ts +[resourceskuslistskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/resourceSkusListSkusSample.ts [retrievethelistofauthenticationkeys]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/retrieveTheListOfAuthenticationKeys.ts [retrievethemonitoringdata]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/retrieveTheMonitoringData.ts +[servicetaskscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksCancelSample.ts +[servicetaskscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksCreateOrUpdateSample.ts +[servicetasksdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksDeleteSample.ts +[servicetasksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksGetSample.ts [servicetaskslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksList.ts +[servicetaskslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksListSample.ts +[servicetasksupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksUpdateSample.ts [servicescheckchildrennameavailability]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckChildrenNameAvailability.ts +[servicescheckchildrennameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckChildrenNameAvailabilitySample.ts [serviceschecknameavailability]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckNameAvailability.ts +[serviceschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckNameAvailabilitySample.ts [servicescheckstatus]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckStatus.ts +[servicescheckstatussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckStatusSample.ts [servicescreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCreateOrUpdate.ts +[servicescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCreateOrUpdateSample.ts +[servicesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesDeleteSample.ts +[servicesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesGetSample.ts [serviceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesList.ts [serviceslistbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListByResourceGroup.ts +[serviceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListByResourceGroupSample.ts +[serviceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListSample.ts [serviceslistskus]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListSkus.ts +[serviceslistskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListSkusSample.ts [servicesstart]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesStart.ts +[servicesstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesStartSample.ts [servicesstop]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesStop.ts +[servicesstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesStopSample.ts +[servicesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesUpdateSample.ts [servicesusages]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesUsages.ts +[sqlmigrationservicescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesCreateOrUpdateSample.ts +[sqlmigrationservicesdeletenodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesDeleteNodeSample.ts +[sqlmigrationservicesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesDeleteSample.ts +[sqlmigrationservicesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesGetSample.ts +[sqlmigrationserviceslistauthkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListAuthKeysSample.ts +[sqlmigrationserviceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListByResourceGroupSample.ts +[sqlmigrationserviceslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListBySubscriptionSample.ts +[sqlmigrationserviceslistmigrationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListMigrationsSample.ts +[sqlmigrationserviceslistmonitoringdatasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListMonitoringDataSample.ts +[sqlmigrationservicesregenerateauthkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesRegenerateAuthKeysSample.ts +[sqlmigrationservicesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesUpdateSample.ts [stopongoingmigrationforthedatabase]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/stopOngoingMigrationForTheDatabase.ts [taskscancel]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCancel.ts +[taskscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCancelSample.ts [taskscommand]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCommand.ts +[taskscommandsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCommandSample.ts [taskscreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCreateOrUpdate.ts +[taskscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCreateOrUpdateSample.ts [tasksdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksDelete.ts +[tasksdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksDeleteSample.ts [tasksget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksGet.ts +[tasksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksGetSample.ts [taskslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksList.ts +[taskslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksListSample.ts [tasksupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksUpdate.ts +[tasksupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksUpdateSample.ts [updatesqlmigrationservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/updateSqlMigrationService.ts +[usageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/usagesListSample.ts [apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-datamigration?view=azure-node-preview [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datamigration/arm-datamigration/README.md diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiCancelSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiCancelSample.ts new file mode 100644 index 000000000000..f0896cd3a58e --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiCancelSample.ts @@ -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. +import { + MigrationOperationInput, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Stop migrations in progress for the database + * + * @summary Stop migrations in progress for the database + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCancelDatabaseMigration.json + */ +async function stopOngoingMigrationForTheDatabase() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const parameters: MigrationOperationInput = { + migrationOperationId: "4124fe90-d1b6-4b50-b4d9-46d02381f59a" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.beginCancelAndWait( + resourceGroupName, + managedInstanceName, + targetDbName, + parameters + ); + console.log(result); +} + +stopOngoingMigrationForTheDatabase().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiCreateOrUpdateSample.ts new file mode 100644 index 000000000000..1167d7decf01 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiCreateOrUpdateSample.ts @@ -0,0 +1,137 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + DatabaseMigrationSqlMi, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or Update Database Migration resource. + * + * @summary Create or Update Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCreateOrUpdateDatabaseMigrationMAX.json + */ +async function createOrUpdateDatabaseMigrationResourceWithMaximumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const parameters: DatabaseMigrationSqlMi = { + properties: { + backupConfiguration: { + sourceLocation: { + fileShare: { + path: "C:aaa\bbbccc", + password: "placeholder", + username: "name" + } + }, + targetLocation: { + accountKey: "abcd", + storageAccountResourceId: "account.database.windows.net" + } + }, + kind: "SqlMi", + migrationService: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent", + offlineConfiguration: { + lastBackupName: "last_backup_file_name", + offline: true + }, + scope: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance", + sourceDatabaseName: "aaa", + sourceSqlConnection: { + authentication: "WindowsAuthentication", + dataSource: "aaa", + encryptConnection: true, + password: "placeholder", + trustServerCertificate: true, + userName: "bbb" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.beginCreateOrUpdateAndWait( + resourceGroupName, + managedInstanceName, + targetDbName, + parameters + ); + console.log(result); +} + +createOrUpdateDatabaseMigrationResourceWithMaximumParameters().catch( + console.error +); + +/** + * This sample demonstrates how to Create or Update Database Migration resource. + * + * @summary Create or Update Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCreateOrUpdateDatabaseMigrationMIN.json + */ +async function createOrUpdateDatabaseMigrationResourceWithMinimumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const parameters: DatabaseMigrationSqlMi = { + properties: { + backupConfiguration: { + sourceLocation: { + fileShare: { + path: "C:aaa\bbbccc", + password: "placeholder", + username: "name" + } + }, + targetLocation: { + accountKey: "abcd", + storageAccountResourceId: "account.database.windows.net" + } + }, + kind: "SqlMi", + migrationService: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent", + offlineConfiguration: { + lastBackupName: "last_backup_file_name", + offline: true + }, + scope: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance", + sourceDatabaseName: "aaa", + sourceSqlConnection: { + authentication: "WindowsAuthentication", + dataSource: "aaa", + encryptConnection: true, + password: "placeholder", + trustServerCertificate: true, + userName: "bbb" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.beginCreateOrUpdateAndWait( + resourceGroupName, + managedInstanceName, + targetDbName, + parameters + ); + console.log(result); +} + +createOrUpdateDatabaseMigrationResourceWithMinimumParameters().catch( + console.error +); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiCutoverSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiCutoverSample.ts new file mode 100644 index 000000000000..f23063acf40b --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiCutoverSample.ts @@ -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. +import { + MigrationOperationInput, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Initiate cutover for online migration in progress for the database. + * + * @summary Initiate cutover for online migration in progress for the database. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiCutoverDatabaseMigration.json + */ +async function cutoverOnlineMigrationOperationForTheDatabase() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const parameters: MigrationOperationInput = { + migrationOperationId: "4124fe90-d1b6-4b50-b4d9-46d02381f59a" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.beginCutoverAndWait( + resourceGroupName, + managedInstanceName, + targetDbName, + parameters + ); + console.log(result); +} + +cutoverOnlineMigrationOperationForTheDatabase().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiGetSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiGetSample.ts new file mode 100644 index 000000000000..5a9b719885c0 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlMiGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve the Database Migration resource. + * + * @summary Retrieve the Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlMiGetDatabaseMigration.json + */ +async function getDatabaseMigrationResource() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const managedInstanceName = "managedInstance1"; + const targetDbName = "db1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlMi.get( + resourceGroupName, + managedInstanceName, + targetDbName + ); + console.log(result); +} + +getDatabaseMigrationResource().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMCancelSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMCancelSample.ts new file mode 100644 index 000000000000..b6e9ed8d1668 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMCancelSample.ts @@ -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. +import { + MigrationOperationInput, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Stop ongoing migration for the database. + * + * @summary Stop ongoing migration for the database. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCancelDatabaseMigration.json + */ +async function stopOngoingMigrationForTheDatabase() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const parameters: MigrationOperationInput = { + migrationOperationId: "4124fe90-d1b6-4b50-b4d9-46d02381f59a" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.beginCancelAndWait( + resourceGroupName, + sqlVirtualMachineName, + targetDbName, + parameters + ); + console.log(result); +} + +stopOngoingMigrationForTheDatabase().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMCreateOrUpdateSample.ts new file mode 100644 index 000000000000..81d4da355302 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMCreateOrUpdateSample.ts @@ -0,0 +1,137 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + DatabaseMigrationSqlVm, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or Update Database Migration resource. + * + * @summary Create or Update Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMAX.json + */ +async function createOrUpdateDatabaseMigrationResourceWithMaximumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const parameters: DatabaseMigrationSqlVm = { + properties: { + backupConfiguration: { + sourceLocation: { + fileShare: { + path: "C:aaa\bbbccc", + password: "placeholder", + username: "name" + } + }, + targetLocation: { + accountKey: "abcd", + storageAccountResourceId: "account.database.windows.net" + } + }, + kind: "SqlVm", + migrationService: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent", + offlineConfiguration: { + lastBackupName: "last_backup_file_name", + offline: true + }, + scope: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm", + sourceDatabaseName: "aaa", + sourceSqlConnection: { + authentication: "WindowsAuthentication", + dataSource: "aaa", + encryptConnection: true, + password: "placeholder", + trustServerCertificate: true, + userName: "bbb" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.beginCreateOrUpdateAndWait( + resourceGroupName, + sqlVirtualMachineName, + targetDbName, + parameters + ); + console.log(result); +} + +createOrUpdateDatabaseMigrationResourceWithMaximumParameters().catch( + console.error +); + +/** + * This sample demonstrates how to Create or Update Database Migration resource. + * + * @summary Create or Update Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCreateOrUpdateDatabaseMigrationMIN.json + */ +async function createOrUpdateDatabaseMigrationResourceWithMinimumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const parameters: DatabaseMigrationSqlVm = { + properties: { + backupConfiguration: { + sourceLocation: { + fileShare: { + path: "C:aaa\bbbccc", + password: "placeholder", + username: "name" + } + }, + targetLocation: { + accountKey: "abcd", + storageAccountResourceId: "account.database.windows.net" + } + }, + kind: "SqlVm", + migrationService: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent", + offlineConfiguration: { + lastBackupName: "last_backup_file_name", + offline: true + }, + scope: + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm", + sourceDatabaseName: "aaa", + sourceSqlConnection: { + authentication: "WindowsAuthentication", + dataSource: "aaa", + encryptConnection: true, + password: "placeholder", + trustServerCertificate: true, + userName: "bbb" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.beginCreateOrUpdateAndWait( + resourceGroupName, + sqlVirtualMachineName, + targetDbName, + parameters + ); + console.log(result); +} + +createOrUpdateDatabaseMigrationResourceWithMinimumParameters().catch( + console.error +); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMCutoverSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMCutoverSample.ts new file mode 100644 index 000000000000..aa53a32f0012 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMCutoverSample.ts @@ -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. +import { + MigrationOperationInput, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Cutover online migration operation for the database. + * + * @summary Cutover online migration operation for the database. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmCutoverDatabaseMigration.json + */ +async function cutoverOnlineMigrationOperationForTheDatabase() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const parameters: MigrationOperationInput = { + migrationOperationId: "4124fe90-d1b6-4b50-b4d9-46d02381f59a" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.beginCutoverAndWait( + resourceGroupName, + sqlVirtualMachineName, + targetDbName, + parameters + ); + console.log(result); +} + +cutoverOnlineMigrationOperationForTheDatabase().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMGetSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMGetSample.ts new file mode 100644 index 000000000000..0f8cdd63af54 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/databaseMigrationsSqlVMGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve the Database Migration resource. + * + * @summary Retrieve the Database Migration resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/SqlVmGetDatabaseMigration.json + */ +async function getDatabaseMigrationResource() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlVirtualMachineName = "testvm"; + const targetDbName = "db1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.databaseMigrationsSqlVm.get( + resourceGroupName, + sqlVirtualMachineName, + targetDbName + ); + console.log(result); +} + +getDatabaseMigrationResource().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..6ab8542a1cba --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesCreateOrUpdateSample.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 { + ProjectFile, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The PUT method creates a new file or updates an existing one. + * + * @summary The PUT method creates a new file or updates an existing one. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_CreateOrUpdate.json + */ +async function filesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const parameters: ProjectFile = { + properties: { filePath: "DmsSdkFilePath/DmsSdkFile.sql" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.createOrUpdate( + groupName, + serviceName, + projectName, + fileName, + parameters + ); + console.log(result); +} + +filesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesDeleteSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesDeleteSample.ts new file mode 100644 index 000000000000..0eba77f74068 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesDeleteSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method deletes a file. + * + * @summary This method deletes a file. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Delete.json + */ +async function filesDelete() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.delete( + groupName, + serviceName, + projectName, + fileName + ); + console.log(result); +} + +filesDelete().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesGetSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesGetSample.ts new file mode 100644 index 000000000000..a7e23e46fa11 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesGetSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The files resource is a nested, proxy-only resource representing a file stored under the project resource. This method retrieves information about a file. + * + * @summary The files resource is a nested, proxy-only resource representing a file stored under the project resource. This method retrieves information about a file. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Get.json + */ +async function filesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.get( + groupName, + serviceName, + projectName, + fileName + ); + console.log(result); +} + +filesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesListSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesListSample.ts new file mode 100644 index 000000000000..fe4e5415c51f --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesListSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. This method returns a list of files owned by a project resource. + * + * @summary The project resource is a nested resource representing a stored migration project. This method returns a list of files owned by a project resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_List.json + */ +async function filesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.files.list( + groupName, + serviceName, + projectName + )) { + resArray.push(item); + } + console.log(resArray); +} + +filesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesReadSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesReadSample.ts new file mode 100644 index 000000000000..7377eb06e34c --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesReadSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method is used for requesting storage information using which contents of the file can be downloaded. + * + * @summary This method is used for requesting storage information using which contents of the file can be downloaded. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Read.json + */ +async function filesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.read( + groupName, + serviceName, + projectName, + fileName + ); + console.log(result); +} + +filesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesReadWriteSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesReadWriteSample.ts new file mode 100644 index 000000000000..0fca89fe81f8 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesReadWriteSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method is used for requesting information for reading and writing the file content. + * + * @summary This method is used for requesting information for reading and writing the file content. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_ReadWrite.json + */ +async function filesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.readWrite( + groupName, + serviceName, + projectName, + fileName + ); + console.log(result); +} + +filesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesUpdateSample.ts new file mode 100644 index 000000000000..93e3c116a809 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/filesUpdateSample.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 { + ProjectFile, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method updates an existing file. + * + * @summary This method updates an existing file. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Files_Update.json + */ +async function filesUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const fileName = "x114d023d8"; + const parameters: ProjectFile = { + properties: { filePath: "DmsSdkFilePath/DmsSdkFile.sql" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.files.update( + groupName, + serviceName, + projectName, + fileName, + parameters + ); + console.log(result); +} + +filesUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/operationsListSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..a271ebc65436 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/operationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the available SQL Migration REST API operations. + * + * @summary Lists all of the available SQL Migration REST API operations. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListOperation.json + */ +async function listsAllOfTheAvailableSqlRestApiOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listsAllOfTheAvailableSqlRestApiOperations().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..15fdc15e23c5 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsCreateOrUpdateSample.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 { + Project, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one. + * + * @summary The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_CreateOrUpdate.json + */ +async function projectsCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const parameters: Project = { + location: "southcentralus", + sourcePlatform: "SQL", + targetPlatform: "SQLDB" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.projects.createOrUpdate( + groupName, + serviceName, + projectName, + parameters + ); + console.log(result); +} + +projectsCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsDeleteSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsDeleteSample.ts new file mode 100644 index 000000000000..bbcb08ec1d6c --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. The DELETE method deletes a project. + * + * @summary The project resource is a nested resource representing a stored migration project. The DELETE method deletes a project. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Delete.json + */ +async function projectsDelete() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.projects.delete( + groupName, + serviceName, + projectName + ); + console.log(result); +} + +projectsDelete().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsGetSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsGetSample.ts new file mode 100644 index 000000000000..6515c081f383 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project. + * + * @summary The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Get.json + */ +async function projectsGet() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.projects.get(groupName, serviceName, projectName); + console.log(result); +} + +projectsGet().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsListSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsListSample.ts new file mode 100644 index 000000000000..c6d7a9e41c50 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. This method returns a list of projects owned by a service resource. + * + * @summary The project resource is a nested resource representing a stored migration project. This method returns a list of projects owned by a service resource. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_List.json + */ +async function projectsList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.projects.list(groupName, serviceName)) { + resArray.push(item); + } + console.log(resArray); +} + +projectsList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsUpdateSample.ts new file mode 100644 index 000000000000..e23ea2253fd7 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/projectsUpdateSample.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 { + Project, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project. + * + * @summary The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Projects_Update.json + */ +async function projectsUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const parameters: Project = { + location: "southcentralus", + sourcePlatform: "SQL", + targetPlatform: "SQLDB" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.projects.update( + groupName, + serviceName, + projectName, + parameters + ); + console.log(result); +} + +projectsUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/resourceSkusListSkusSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/resourceSkusListSkusSample.ts new file mode 100644 index 000000000000..2bce65ae2393 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/resourceSkusListSkusSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The skus action returns the list of SKUs that DMS supports. + * + * @summary The skus action returns the list of SKUs that DMS supports. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ResourceSkus_ListSkus.json + */ +async function listSkus() { + const subscriptionId = "subid"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceSkus.listSkus()) { + resArray.push(item); + } + console.log(resArray); +} + +listSkus().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksCancelSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksCancelSample.ts new file mode 100644 index 000000000000..c7ac08c110c0 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksCancelSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a service task if it's currently queued or running. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a service task if it's currently queued or running. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Cancel.json + */ +async function tasksCancel() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.cancel( + groupName, + serviceName, + taskName + ); + console.log(result); +} + +tasksCancel().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksCreateOrUpdateSample.ts new file mode 100644 index 000000000000..12634978b1c7 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksCreateOrUpdateSample.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 { + ProjectTask, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new service task or updates an existing one, although since service tasks have no mutable custom properties, there is little reason to update an existing one. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new service task or updates an existing one, although since service tasks have no mutable custom properties, there is little reason to update an existing one. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_CreateOrUpdate.json + */ +async function tasksCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const parameters: ProjectTask = { + properties: { + input: { serverVersion: "NA" }, + taskType: "Service.Check.OCI" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.createOrUpdate( + groupName, + serviceName, + taskName, + parameters + ); + console.log(result); +} + +tasksCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksDeleteSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksDeleteSample.ts new file mode 100644 index 000000000000..323ac6934662 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a service task, canceling it first if it's running. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a service task, canceling it first if it's running. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Delete.json + */ +async function tasksDelete() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.delete( + groupName, + serviceName, + taskName + ); + console.log(result); +} + +tasksDelete().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksGetSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksGetSample.ts new file mode 100644 index 000000000000..4e536e285dc6 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a service task. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a service task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Get.json + */ +async function tasksGet() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.get( + groupName, + serviceName, + taskName + ); + console.log(result); +} + +tasksGet().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksListSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksListSample.ts new file mode 100644 index 000000000000..99e2a8d5226c --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service level tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service level tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_List.json + */ +async function serviceTasksList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serviceTasks.list(groupName, serviceName)) { + resArray.push(item); + } + console.log(resArray); +} + +serviceTasksList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksUpdateSample.ts new file mode 100644 index 000000000000..401fd08ee666 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/serviceTasksUpdateSample.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 { + ProjectTask, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing service task, but since service tasks have no mutable custom properties, there is little reason to do so. + * + * @summary The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing service task, but since service tasks have no mutable custom properties, there is little reason to do so. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ServiceTasks_Update.json + */ +async function tasksUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const taskName = "DmsSdkTask"; + const parameters: ProjectTask = { + properties: { + input: { serverVersion: "NA" }, + taskType: "Service.Check.OCI" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.serviceTasks.update( + groupName, + serviceName, + taskName, + parameters + ); + console.log(result); +} + +tasksUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckChildrenNameAvailabilitySample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckChildrenNameAvailabilitySample.ts new file mode 100644 index 000000000000..19763d837d26 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckChildrenNameAvailabilitySample.ts @@ -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. +import { + NameAvailabilityRequest, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method checks whether a proposed nested resource name is valid and available. + * + * @summary This method checks whether a proposed nested resource name is valid and available. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckChildrenNameAvailability.json + */ +async function servicesCheckChildrenNameAvailability() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const parameters: NameAvailabilityRequest = { name: "Task1", type: "tasks" }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.checkChildrenNameAvailability( + groupName, + serviceName, + parameters + ); + console.log(result); +} + +servicesCheckChildrenNameAvailability().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckNameAvailabilitySample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..7b9ffa503eed --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckNameAvailabilitySample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + NameAvailabilityRequest, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method checks whether a proposed top-level resource name is valid and available. + * + * @summary This method checks whether a proposed top-level resource name is valid and available. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckNameAvailability.json + */ +async function servicesCheckNameAvailability() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const location = "eastus"; + const parameters: NameAvailabilityRequest = { + name: "DmsSdkService", + type: "services" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.checkNameAvailability( + location, + parameters + ); + console.log(result); +} + +servicesCheckNameAvailability().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckStatusSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckStatusSample.ts new file mode 100644 index 000000000000..200924feb4c5 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCheckStatusSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CheckStatus.json + */ +async function servicesCheckStatus() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.checkStatus(groupName, serviceName); + console.log(result); +} + +servicesCheckStatus().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..4c8b6af1af67 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesCreateOrUpdateSample.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 { + DataMigrationService, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_CreateOrUpdate.json + */ +async function servicesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const parameters: DataMigrationService = { + location: "southcentralus", + sku: { name: "Basic_1vCore" }, + virtualSubnetId: + "/subscriptions/fc04246f-04c5-437e-ac5e-206a19e7193f/resourceGroups/DmsSdkTestNetwork/providers/Microsoft.Network/virtualNetworks/DmsSdkTestNetwork/subnets/default" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginCreateOrUpdateAndWait( + groupName, + serviceName, + parameters + ); + console.log(result); +} + +servicesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesDeleteSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesDeleteSample.ts new file mode 100644 index 000000000000..5769ed13e7d2 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The DELETE method deletes a service. Any running tasks will be canceled. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The DELETE method deletes a service. Any running tasks will be canceled. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Delete.json + */ +async function servicesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginDeleteAndWait( + groupName, + serviceName + ); + console.log(result); +} + +servicesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesGetSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesGetSample.ts new file mode 100644 index 000000000000..10c16260c075 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Get.json + */ +async function servicesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.get(groupName, serviceName); + console.log(result); +} + +servicesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListByResourceGroupSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListByResourceGroupSample.ts new file mode 100644 index 000000000000..f8245db7bfa4 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListByResourceGroupSample.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group. + * + * @summary The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListByResourceGroup.json + */ +async function servicesListByResourceGroup() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.services.listByResourceGroup(groupName)) { + resArray.push(item); + } + console.log(resArray); +} + +servicesListByResourceGroup().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListSample.ts new file mode 100644 index 000000000000..3340e5eec51b --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_List.json + */ +async function servicesList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.services.list()) { + resArray.push(item); + } + console.log(resArray); +} + +servicesList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListSkusSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListSkusSample.ts new file mode 100644 index 000000000000..ba0f4e29264f --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesListSkusSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_ListSkus.json + */ +async function servicesListSkus() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.services.listSkus(groupName, serviceName)) { + resArray.push(item); + } + console.log(resArray); +} + +servicesListSkus().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesStartSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesStartSample.ts new file mode 100644 index 000000000000..41638c6e4a15 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesStartSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Start.json + */ +async function servicesStart() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginStartAndWait( + groupName, + serviceName + ); + console.log(result); +} + +servicesStart().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesStopSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesStopSample.ts new file mode 100644 index 000000000000..0d8a53687a45 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesStopSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Stop.json + */ +async function servicesStop() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginStopAndWait(groupName, serviceName); + console.log(result); +} + +servicesStop().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesUpdateSample.ts new file mode 100644 index 000000000000..1606ec6b8ef8 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/servicesUpdateSample.ts @@ -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. +import { + DataMigrationService, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Services_Update.json + */ +async function servicesCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const parameters: DataMigrationService = { + location: "southcentralus", + virtualSubnetId: + "/subscriptions/fc04246f-04c5-437e-ac5e-206a19e7193f/resourceGroups/DmsSdkTestNetwork/providers/Microsoft.Network/virtualNetworks/DmsSdkTestNetwork/subnets/default" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.services.beginUpdateAndWait( + groupName, + serviceName, + parameters + ); + console.log(result); +} + +servicesCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..72c62480083f --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesCreateOrUpdateSample.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + SqlMigrationService, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or Update SQL Migration Service. + * + * @summary Create or Update SQL Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMAX.json + */ +async function createOrUpdateSqlMigrationServiceWithMaximumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "testagent"; + const parameters: SqlMigrationService = { location: "northeurope" }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.beginCreateOrUpdateAndWait( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +createOrUpdateSqlMigrationServiceWithMaximumParameters().catch(console.error); + +/** + * This sample demonstrates how to Create or Update SQL Migration Service. + * + * @summary Create or Update SQL Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/CreateOrUpdateMigrationServiceMIN.json + */ +async function createOrUpdateSqlMigrationServiceWithMinimumParameters() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "testagent"; + const parameters: SqlMigrationService = { location: "northeurope" }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.beginCreateOrUpdateAndWait( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +createOrUpdateSqlMigrationServiceWithMinimumParameters().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesDeleteNodeSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesDeleteNodeSample.ts new file mode 100644 index 000000000000..55edb44926ce --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesDeleteNodeSample.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 { + DeleteNode, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete the integration runtime node. + * + * @summary Delete the integration runtime node. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteIntegrationRuntimeNode.json + */ +async function deleteTheIntegrationRuntimeNode() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const parameters: DeleteNode = { + integrationRuntimeName: "IRName", + nodeName: "nodeName" + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.deleteNode( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +deleteTheIntegrationRuntimeNode().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesDeleteSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesDeleteSample.ts new file mode 100644 index 000000000000..c81f2af81e1a --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete SQL Migration Service. + * + * @summary Delete SQL Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/DeleteMigrationService.json + */ +async function deleteSqlMigrationService() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.beginDeleteAndWait( + resourceGroupName, + sqlMigrationServiceName + ); + console.log(result); +} + +deleteSqlMigrationService().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesGetSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesGetSample.ts new file mode 100644 index 000000000000..995e949ced6c --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve the Migration Service. + * + * @summary Retrieve the Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMigrationService.json + */ +async function getMigrationService() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.get( + resourceGroupName, + sqlMigrationServiceName + ); + console.log(result); +} + +getMigrationService().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListAuthKeysSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListAuthKeysSample.ts new file mode 100644 index 000000000000..b72e11f80fec --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListAuthKeysSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve the List of Authentication Keys for Self Hosted Integration Runtime. + * + * @summary Retrieve the List of Authentication Keys for Self Hosted Integration Runtime. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListAuthKeysMigrationService.json + */ +async function retrieveTheListOfAuthenticationKeys() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.listAuthKeys( + resourceGroupName, + sqlMigrationServiceName + ); + console.log(result); +} + +retrieveTheListOfAuthenticationKeys().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListByResourceGroupSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListByResourceGroupSample.ts new file mode 100644 index 000000000000..8e306572a261 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve all SQL migration services in the resource group. + * + * @summary Retrieve all SQL migration services in the resource group. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListByResourceGroupMigrationService.json + */ +async function getMigrationServicesInTheResourceGroup() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sqlMigrationServices.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +getMigrationServicesInTheResourceGroup().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListBySubscriptionSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListBySubscriptionSample.ts new file mode 100644 index 000000000000..3585ce76469c --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListBySubscriptionSample.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve all SQL migration services in the subscriptions. + * + * @summary Retrieve all SQL migration services in the subscriptions. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListBySubscriptionMigrationService.json + */ +async function getServicesInTheSubscriptions() { + const subscriptionId = + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/managedInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sqlMigrationServices.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +getServicesInTheSubscriptions().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListMigrationsSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListMigrationsSample.ts new file mode 100644 index 000000000000..e91b8c63f774 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListMigrationsSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve the List of database migrations attached to the service. + * + * @summary Retrieve the List of database migrations attached to the service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/ListMigrationsByMigrationService.json + */ +async function listDatabaseMigrationsAttachedToTheService() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sqlMigrationServices.listMigrations( + resourceGroupName, + sqlMigrationServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listDatabaseMigrationsAttachedToTheService().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListMonitoringDataSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListMonitoringDataSample.ts new file mode 100644 index 000000000000..97aa7d0ec2b5 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesListMonitoringDataSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Retrieve the Monitoring Data. + * + * @summary Retrieve the Monitoring Data. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/GetMonitorDataMigrationService.json + */ +async function retrieveTheMonitoringData() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.listMonitoringData( + resourceGroupName, + sqlMigrationServiceName + ); + console.log(result); +} + +retrieveTheMonitoringData().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesRegenerateAuthKeysSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesRegenerateAuthKeysSample.ts new file mode 100644 index 000000000000..932dabefc23e --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesRegenerateAuthKeysSample.ts @@ -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. +import { + RegenAuthKeys, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime. + * + * @summary Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/RegenAuthKeysMigrationService.json + */ +async function regenerateTheOfAuthenticationKeys() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "service1"; + const parameters: RegenAuthKeys = { keyName: "authKey1" }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.regenerateAuthKeys( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +regenerateTheOfAuthenticationKeys().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesUpdateSample.ts new file mode 100644 index 000000000000..3ccb8551d5ff --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/sqlMigrationServicesUpdateSample.ts @@ -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. +import { + SqlMigrationServiceUpdate, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update SQL Migration Service. + * + * @summary Update SQL Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/UpdateMigrationService.json + */ +async function updateSqlMigrationService() { + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const resourceGroupName = "testrg"; + const sqlMigrationServiceName = "testagent"; + const parameters: SqlMigrationServiceUpdate = { tags: { mytag: "myval" } }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.sqlMigrationServices.beginUpdateAndWait( + resourceGroupName, + sqlMigrationServiceName, + parameters + ); + console.log(result); +} + +updateSqlMigrationService().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCancelSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCancelSample.ts new file mode 100644 index 000000000000..192b7f1b8455 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCancelSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a task if it's currently queued or running. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a task if it's currently queued or running. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Cancel.json + */ +async function tasksCancel() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.cancel( + groupName, + serviceName, + projectName, + taskName + ); + console.log(result); +} + +tasksCancel().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCommandSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCommandSample.ts new file mode 100644 index 000000000000..665fe29a95b5 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCommandSample.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 { + MigrateSyncCompleteCommandProperties, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method executes a command on a running task. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method executes a command on a running task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Command.json + */ +async function tasksCommand() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const parameters: MigrateSyncCompleteCommandProperties = { + commandType: "Migrate.Sync.Complete.Database", + input: { databaseName: "TestDatabase" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.command( + groupName, + serviceName, + projectName, + taskName, + parameters + ); + console.log(result); +} + +tasksCommand().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCreateOrUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCreateOrUpdateSample.ts new file mode 100644 index 000000000000..6c12c8fbc399 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksCreateOrUpdateSample.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + ProjectTask, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new task or updates an existing one, although since tasks have no mutable custom properties, there is little reason to update an existing one. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new task or updates an existing one, although since tasks have no mutable custom properties, there is little reason to update an existing one. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_CreateOrUpdate.json + */ +async function tasksCreateOrUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const parameters: ProjectTask = { + properties: { + input: { + targetConnectionInfo: { + type: "SqlConnectionInfo", + authentication: "SqlAuthentication", + dataSource: "ssma-test-server.database.windows.net", + encryptConnection: true, + password: "testpassword", + trustServerCertificate: true, + userName: "testuser" + } + }, + taskType: "ConnectToTarget.SqlDb" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.createOrUpdate( + groupName, + serviceName, + projectName, + taskName, + parameters + ); + console.log(result); +} + +tasksCreateOrUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksDeleteSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksDeleteSample.ts new file mode 100644 index 000000000000..bd09f3eebc5d --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksDeleteSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a task, canceling it first if it's running. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a task, canceling it first if it's running. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Delete.json + */ +async function tasksDelete() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.delete( + groupName, + serviceName, + projectName, + taskName + ); + console.log(result); +} + +tasksDelete().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksGetSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksGetSample.ts new file mode 100644 index 000000000000..c7370e5aef7e --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksGetSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a task. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Get.json + */ +async function tasksGet() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.get( + groupName, + serviceName, + projectName, + taskName + ); + console.log(result); +} + +tasksGet().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksListSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksListSample.ts new file mode 100644 index 000000000000..ef5f7ee8fe35 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksListSample.ts @@ -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. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. + * + * @summary The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_List.json + */ +async function tasksList() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tasks.list( + groupName, + serviceName, + projectName + )) { + resArray.push(item); + } + console.log(resArray); +} + +tasksList().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksUpdateSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksUpdateSample.ts new file mode 100644 index 000000000000..80b1a8b70072 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/tasksUpdateSample.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + ProjectTask, + DataMigrationManagementClient +} from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing task, but since tasks have no mutable custom properties, there is little reason to do so. + * + * @summary The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing task, but since tasks have no mutable custom properties, there is little reason to do so. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Tasks_Update.json + */ +async function tasksUpdate() { + const subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + const groupName = "DmsSdkRg"; + const serviceName = "DmsSdkService"; + const projectName = "DmsSdkProject"; + const taskName = "DmsSdkTask"; + const parameters: ProjectTask = { + properties: { + input: { + targetConnectionInfo: { + type: "SqlConnectionInfo", + authentication: "SqlAuthentication", + dataSource: "ssma-test-server.database.windows.net", + encryptConnection: true, + password: "testpassword", + trustServerCertificate: true, + userName: "testuser" + } + }, + taskType: "ConnectToTarget.SqlDb" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const result = await client.tasks.update( + groupName, + serviceName, + projectName, + taskName, + parameters + ); + console.log(result); +} + +tasksUpdate().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/usagesListSample.ts b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/usagesListSample.ts new file mode 100644 index 000000000000..f963ce620ab0 --- /dev/null +++ b/sdk/datamigration/arm-datamigration/samples/v3-beta/typescript/src/usagesListSample.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataMigrationManagementClient } from "@azure/arm-datamigration"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This method returns region-specific quotas and resource usage information for the Database Migration Service. + * + * @summary This method returns region-specific quotas and resource usage information for the Database Migration Service. + * x-ms-original-file: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/examples/Usages_List.json + */ +async function servicesUsages() { + const subscriptionId = "90fb80a6-0f71-4761-8f03-921e7396f3c0"; + const location = "westus"; + const credential = new DefaultAzureCredential(); + const client = new DataMigrationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.usages.list(location)) { + resArray.push(item); + } + console.log(resArray); +} + +servicesUsages().catch(console.error); diff --git a/sdk/datamigration/arm-datamigration/src/dataMigrationManagementClient.ts b/sdk/datamigration/arm-datamigration/src/dataMigrationManagementClient.ts index d4015dc282d3..daf1b2c00e54 100644 --- a/sdk/datamigration/arm-datamigration/src/dataMigrationManagementClient.ts +++ b/sdk/datamigration/arm-datamigration/src/dataMigrationManagementClient.ts @@ -7,6 +7,7 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { DatabaseMigrationsSqlMiImpl, @@ -68,7 +69,7 @@ export class DataMigrationManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-datamigration/3.0.0-beta.1`; + const packageDetails = `azsdk-js-arm-datamigration/3.0.0-beta.2`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -83,9 +84,33 @@ export class DataMigrationManagementClient extends coreClient.ServiceClient { userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint || "https://management.azure.com" + baseUri: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + } // Parameter assignments this.subscriptionId = subscriptionId; diff --git a/sdk/datamigration/arm-datamigration/src/operations/databaseMigrationsSqlMi.ts b/sdk/datamigration/arm-datamigration/src/operations/databaseMigrationsSqlMi.ts index d5f565833cfa..b627f531b69f 100644 --- a/sdk/datamigration/arm-datamigration/src/operations/databaseMigrationsSqlMi.ts +++ b/sdk/datamigration/arm-datamigration/src/operations/databaseMigrationsSqlMi.ts @@ -127,10 +127,12 @@ export class DatabaseMigrationsSqlMiImpl implements DatabaseMigrationsSqlMi { }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -225,10 +227,12 @@ export class DatabaseMigrationsSqlMiImpl implements DatabaseMigrationsSqlMi { }, cancelOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -323,10 +327,12 @@ export class DatabaseMigrationsSqlMiImpl implements DatabaseMigrationsSqlMi { }, cutoverOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/datamigration/arm-datamigration/src/operations/databaseMigrationsSqlVm.ts b/sdk/datamigration/arm-datamigration/src/operations/databaseMigrationsSqlVm.ts index 81c15452c31d..6135da2e5145 100644 --- a/sdk/datamigration/arm-datamigration/src/operations/databaseMigrationsSqlVm.ts +++ b/sdk/datamigration/arm-datamigration/src/operations/databaseMigrationsSqlVm.ts @@ -127,10 +127,12 @@ export class DatabaseMigrationsSqlVmImpl implements DatabaseMigrationsSqlVm { }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -225,10 +227,12 @@ export class DatabaseMigrationsSqlVmImpl implements DatabaseMigrationsSqlVm { }, cancelOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -323,10 +327,12 @@ export class DatabaseMigrationsSqlVmImpl implements DatabaseMigrationsSqlVm { }, cutoverOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/datamigration/arm-datamigration/src/operations/services.ts b/sdk/datamigration/arm-datamigration/src/operations/services.ts index 3ae4287eb759..efee77c33352 100644 --- a/sdk/datamigration/arm-datamigration/src/operations/services.ts +++ b/sdk/datamigration/arm-datamigration/src/operations/services.ts @@ -286,10 +286,12 @@ export class ServicesImpl implements Services { { groupName, serviceName, parameters, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -395,10 +397,12 @@ export class ServicesImpl implements Services { { groupName, serviceName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -482,10 +486,12 @@ export class ServicesImpl implements Services { { groupName, serviceName, parameters, options }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -587,10 +593,12 @@ export class ServicesImpl implements Services { { groupName, serviceName, options }, startOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -666,10 +674,12 @@ export class ServicesImpl implements Services { { groupName, serviceName, options }, stopOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/datamigration/arm-datamigration/src/operations/sqlMigrationServices.ts b/sdk/datamigration/arm-datamigration/src/operations/sqlMigrationServices.ts index 18a61b1affc2..49298ba36713 100644 --- a/sdk/datamigration/arm-datamigration/src/operations/sqlMigrationServices.ts +++ b/sdk/datamigration/arm-datamigration/src/operations/sqlMigrationServices.ts @@ -311,10 +311,12 @@ export class SqlMigrationServicesImpl implements SqlMigrationServices { { resourceGroupName, sqlMigrationServiceName, parameters, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -396,10 +398,12 @@ export class SqlMigrationServicesImpl implements SqlMigrationServices { { resourceGroupName, sqlMigrationServiceName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -485,10 +489,12 @@ export class SqlMigrationServicesImpl implements SqlMigrationServices { { resourceGroupName, sqlMigrationServiceName, parameters, options }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/datamigration/arm-datamigration/tsconfig.json b/sdk/datamigration/arm-datamigration/tsconfig.json index cdd6536f04f7..d771f630bc69 100644 --- a/sdk/datamigration/arm-datamigration/tsconfig.json +++ b/sdk/datamigration/arm-datamigration/tsconfig.json @@ -9,12 +9,25 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "declaration": true, "outDir": "./dist-esm", "importHelpers": true, - "paths": { "@azure/arm-datamigration": ["./src/index"] } + "paths": { + "@azure/arm-datamigration": [ + "./src/index" + ] + } }, - "include": ["./src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"], - "exclude": ["node_modules"] -} + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/datamigration/ci.mgmt.yml b/sdk/datamigration/ci.mgmt.yml index 84f05594422a..8c98f32c5e79 100644 --- a/sdk/datamigration/ci.mgmt.yml +++ b/sdk/datamigration/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -9,7 +9,7 @@ trigger: paths: include: - sdk/datamigration/ci.mgmt.yml - - sdk/datamigration/arm-datamigration/ + - sdk/datamigration/arm-datamigration pr: branches: include: @@ -22,12 +22,11 @@ pr: paths: include: - sdk/datamigration/ci.mgmt.yml - - sdk/datamigration/arm-datamigration/ - + - sdk/datamigration/arm-datamigration extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: datamigration Artifacts: - name: azure-arm-datamigration - safeName: azurearmdatamigration \ No newline at end of file + safeName: azurearmdatamigration diff --git a/sdk/deploymentmanager/arm-deploymentmanager/CHANGELOG.md b/sdk/deploymentmanager/arm-deploymentmanager/CHANGELOG.md index ff28ed084fa3..aad844462d35 100644 --- a/sdk/deploymentmanager/arm-deploymentmanager/CHANGELOG.md +++ b/sdk/deploymentmanager/arm-deploymentmanager/CHANGELOG.md @@ -1,24 +1,8 @@ # Release History + +## 4.0.0-beta.3 (2022-04-18) -## 4.0.0-beta.3 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 4.0.0-beta.2 (2022-01-26) - -**Feature** - - - Update link - -## 4.0.0-beta.1 (2022-01-17) - -The package of @azure/arm-deploymentmanager is using our next generation design principles since version 4.0.0-beta.1, which contains breaking changes. +The package of @azure/arm-deploymentmanager is using our next generation design principles since version 4.0.0-beta.3, which contains breaking changes. To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). diff --git a/sdk/deploymentmanager/arm-deploymentmanager/LICENSE.txt b/sdk/deploymentmanager/arm-deploymentmanager/LICENSE.txt deleted file mode 100644 index b73b4a1293c3..000000000000 --- a/sdk/deploymentmanager/arm-deploymentmanager/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 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. diff --git a/sdk/deploymentmanager/arm-deploymentmanager/README.md b/sdk/deploymentmanager/arm-deploymentmanager/README.md index 6cbf79c29f59..ea43465e6db2 100644 --- a/sdk/deploymentmanager/arm-deploymentmanager/README.md +++ b/sdk/deploymentmanager/arm-deploymentmanager/README.md @@ -2,7 +2,7 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Service client. -REST APIs for orchestrating deployments using the Azure Deployment Manager (ADM). See https://docs.microsoft.com/azure/azure-resource-manager/deployment-manager-overview for more information. +REST APIs for orchestrating deployments using the Azure Deployment Manager (ADM). See https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information. [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deploymentmanager/arm-deploymentmanager) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-deploymentmanager) | @@ -16,6 +16,8 @@ REST APIs for orchestrating deployments using the Azure Deployment Manager (ADM) - [LTS versions of Node.js](https://nodejs.org/about/releases/) - 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]. @@ -49,8 +51,17 @@ For more information about how to create an Azure AD Application check out [this ```javascript const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); 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 AzureDeploymentManager(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new AzureDeploymentManager(credential, subscriptionId); ``` diff --git a/sdk/deploymentmanager/arm-deploymentmanager/_meta.json b/sdk/deploymentmanager/arm-deploymentmanager/_meta.json index 815e34ac2909..f3b4e1129149 100644 --- a/sdk/deploymentmanager/arm-deploymentmanager/_meta.json +++ b/sdk/deploymentmanager/arm-deploymentmanager/_meta.json @@ -1,7 +1,8 @@ { "commit": "dc439efcfc15448824877603f66fc1578d1c71c5", - "readme": "specification/deploymentmanager/resource-manager/readme.md", - "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211217.1", + "readme": "specification\\deploymentmanager\\resource-manager\\readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\deploymentmanager\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20211217.1" -} + "release_tool": "@azure-tools/js-sdk-release-tools@2.2.6", + "use": "@autorest/typescript@6.0.0-alpha.19.20220408.1" +} \ No newline at end of file diff --git a/sdk/deploymentmanager/arm-deploymentmanager/api-extractor.json b/sdk/deploymentmanager/arm-deploymentmanager/api-extractor.json index 5a3059197edc..17a4013c3ea3 100644 --- a/sdk/deploymentmanager/arm-deploymentmanager/api-extractor.json +++ b/sdk/deploymentmanager/arm-deploymentmanager/api-extractor.json @@ -1,18 +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" }, + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, "dtsRollup": { "enabled": true, "untrimmedFilePath": "", "publicTrimmedFilePath": "./types/arm-deploymentmanager.d.ts" }, "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } } } -} +} \ No newline at end of file diff --git a/sdk/deploymentmanager/arm-deploymentmanager/package.json b/sdk/deploymentmanager/arm-deploymentmanager/package.json index 527109d82d98..00b06e601874 100644 --- a/sdk/deploymentmanager/arm-deploymentmanager/package.json +++ b/sdk/deploymentmanager/arm-deploymentmanager/package.json @@ -10,9 +10,9 @@ "dependencies": { "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.5.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -28,13 +28,13 @@ "types": "./types/arm-deploymentmanager.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.18.11", - "@rollup/plugin-commonjs": "11.0.2", - "@rollup/plugin-json": "^4.0.0", - "@rollup/plugin-multi-entry": "^3.0.0", - "@rollup/plugin-node-resolve": "^8.0.0", + "@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": "^1.16.3", - "rollup-plugin-sourcemaps": "^0.4.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.2.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", @@ -97,5 +97,21 @@ "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true -} + "//metadata": { + "constantPaths": [ + { + "path": "src/azureDeploymentManager.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-deploymentmanager?view=azure-node-preview" + } +} \ No newline at end of file diff --git a/sdk/deploymentmanager/arm-deploymentmanager/rollup.config.js b/sdk/deploymentmanager/arm-deploymentmanager/rollup.config.js index 9be1955eb7f1..3f89d7309da5 100644 --- a/sdk/deploymentmanager/arm-deploymentmanager/rollup.config.js +++ b/sdk/deploymentmanager/arm-deploymentmanager/rollup.config.js @@ -14,62 +14,14 @@ import json from "@rollup/plugin-json"; import nodeBuiltins from "builtin-modules"; -/** - * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. - * - * NOTE: this manual configuration is only needed because OpenTelemetry uses an - * __exportStar downleveled helper function to declare its exports which confuses - * rollup's automatic discovery mechanism. - * - * @returns an object reference that can be `...`'d into your cjs() configuration. - */ -export function openTelemetryCommonJs() { - const namedExports = {}; - - for (const key of [ - "@opentelemetry/api", - "@azure/core-tracing/node_modules/@opentelemetry/api" - ]) { - namedExports[key] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "SpanStatusCode", - "getSpanContext", - "setSpanContext" - ]; - } - - const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; - - for (const version of releasedOpenTelemetryVersions) { - namedExports[ - // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. - `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` - ] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "StatusCode", - "CanonicalCode", - "getSpanContext", - "setSpanContext" - ]; - } - - return namedExports; -} - // #region Warning Handler /** - * A function that can determine whether a rollupwarning should be ignored. If + * 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 ignoreNiseSinonEvalWarnings(warning) { +function ignoreNiseSinonEval(warning) { return ( warning.code === "EVAL" && warning.id && @@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) { ); } -function ignoreChaiCircularDependencyWarnings(warning) { +function ignoreChaiCircularDependency(warning) { return ( warning.code === "CIRCULAR_DEPENDENCY" && warning.importer && warning.importer.includes("node_modules/chai") === true ); } -const warningInhibitors = [ - ignoreChaiCircularDependencyWarnings, - ignoreNiseSinonEvalWarnings -]; +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; /** * Construct a warning handler for the shared rollup configuration @@ -122,22 +71,7 @@ function makeBrowserTestConfig() { nodeResolve({ mainFields: ["module", "browser"] }), - cjs({ - namedExports: { - // Chai's strange internal architecture makes it impossible to statically - // analyze its exports. - chai: [ - "version", - "use", - "util", - "config", - "expect", - "should", - "assert" - ], - ...openTelemetryCommonJs() - } - }), + cjs(), json(), sourcemaps() //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) @@ -173,7 +107,7 @@ export function makeConfig(pkg, options) { ], output: { file: "dist/index.js", format: "cjs", sourcemap: true }, preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve(), cjs()] + plugins: [sourcemaps(), nodeResolve()] }; const config = [baseConfig]; diff --git a/sdk/deploymentmanager/arm-deploymentmanager/sample.env b/sdk/deploymentmanager/arm-deploymentmanager/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/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/deploymentmanager/arm-deploymentmanager/samples-dev/artifactSourcesCreateOrUpdateSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/artifactSourcesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..1d86881c943d --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/artifactSourcesCreateOrUpdateSample.ts @@ -0,0 +1,89 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + ArtifactSource, + ArtifactSourcesCreateOrUpdateOptionalParams, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Synchronously creates a new artifact source or updates an existing artifact source. + * + * @summary Synchronously creates a new artifact source or updates an existing artifact source. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_createorupdate.json + */ +async function createArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const artifactSourceName = "myArtifactSource"; + const artifactSourceInfo: ArtifactSource = { + authentication: { + type: "Sas", + sasUri: + "https://mystorageaccount.blob.core.windows.net/myartifactsource?st=2018-07-07T14%3A10%3A00Z&se=2019-12-31T15%3A10%3A00Z&sp=rl&sv=2017-04-17&sr=c&sig=Yh2SoJ1NhhLRwCLln7de%2Fkabcdefghijklmno5sWEIk%3D" + }, + location: "centralus", + sourceType: "AzureStorage", + tags: {} + }; + const options: ArtifactSourcesCreateOrUpdateOptionalParams = { + artifactSourceInfo + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.createOrUpdate( + resourceGroupName, + artifactSourceName, + options + ); + console.log(result); +} + +createArtifactSource().catch(console.error); + +/** + * This sample demonstrates how to Synchronously creates a new artifact source or updates an existing artifact source. + * + * @summary Synchronously creates a new artifact source or updates an existing artifact source. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_createorupdate_artifactroot.json + */ +async function createArtifactSourceWithArtifactRootAnOffsetIntoTheStorageContainer() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const artifactSourceName = "myArtifactSource"; + const artifactSourceInfo: ArtifactSource = { + artifactRoot: "1.0.0.0", + authentication: { + type: "Sas", + sasUri: + "https://mystorageaccount.blob.core.windows.net/myartifactsource?st=2018-07-07T14%3A10%3A00Z&se=2019-12-31T15%3A10%3A00Z&sp=rl&sv=2017-04-17&sr=c&sig=Yh2SoJ1NhhLRwCLln7de%2Fkabcdefghijklmno5sWEIk%3D" + }, + location: "centralus", + sourceType: "AzureStorage", + tags: {} + }; + const options: ArtifactSourcesCreateOrUpdateOptionalParams = { + artifactSourceInfo + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.createOrUpdate( + resourceGroupName, + artifactSourceName, + options + ); + console.log(result); +} + +createArtifactSourceWithArtifactRootAnOffsetIntoTheStorageContainer().catch( + console.error +); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/artifactSourcesDeleteSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/artifactSourcesDeleteSample.ts new file mode 100644 index 000000000000..1d7639a302b7 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/artifactSourcesDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes an artifact source. + * + * @summary Deletes an artifact source. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_delete.json + */ +async function deleteArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const artifactSourceName = "myArtifactSource"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.delete( + resourceGroupName, + artifactSourceName + ); + console.log(result); +} + +deleteArtifactSource().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/artifactSourcesGetSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/artifactSourcesGetSample.ts new file mode 100644 index 000000000000..86cec067fe1d --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/artifactSourcesGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets an artifact source. + * + * @summary Gets an artifact source. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_get.json + */ +async function getArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const artifactSourceName = "myArtifactSource"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.get( + resourceGroupName, + artifactSourceName + ); + console.log(result); +} + +getArtifactSource().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/artifactSourcesListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/artifactSourcesListSample.ts new file mode 100644 index 000000000000..3cbf400a46e6 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/artifactSourcesListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the artifact sources in a resource group. + * + * @summary Lists the artifact sources in a resource group. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsources_list.json + */ +async function listSteps() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.list(resourceGroupName); + console.log(result); +} + +listSteps().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/operationsListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..84ac3c3aa379 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/operationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the supported operations. + * + * @summary Lists the supported operations. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/operations_list.json + */ +async function getOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.operations.list(); + console.log(result); +} + +getOperations().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsCancelSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsCancelSample.ts new file mode 100644 index 000000000000..bb76762c1c7b --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsCancelSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Only running rollouts can be canceled. + * + * @summary Only running rollouts can be canceled. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_post_cancel.json + */ +async function cancelRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.cancel(resourceGroupName, rolloutName); + console.log(result); +} + +cancelRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsCreateOrUpdateSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..1ea5248ec569 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsCreateOrUpdateSample.ts @@ -0,0 +1,81 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + RolloutRequest, + RolloutsCreateOrUpdateOptionalParams, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This is an asynchronous operation and can be polled to completion using the location header returned by this operation. + * + * @summary This is an asynchronous operation and can be polled to completion using the location header returned by this operation. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_createorupdate.json + */ +async function createOrUpdateRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const rolloutRequest: RolloutRequest = { + artifactSourceId: + "/subscriptions/caac1590-e859-444f-a9e0-62091c0f5929/resourceGroups/myResourceGroup/Microsoft.DeploymentManager/artifactSources/myArtifactSource", + buildVersion: "1.0.0.1", + identity: { + type: "userAssigned", + identityIds: [ + "/subscriptions/caac1590-e859-444f-a9e0-62091c0f5929/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userassignedidentities/myuseridentity" + ] + }, + location: "centralus", + stepGroups: [ + { + name: "FirstRegion", + deploymentTargetId: + "Microsoft.DeploymentManager/serviceTopologies/myTopology/services/myService/serviceUnits/myServiceUnit1'", + postDeploymentSteps: [ + { stepId: "Microsoft.DeploymentManager/steps/postDeployStep1" } + ], + preDeploymentSteps: [ + { stepId: "Microsoft.DeploymentManager/steps/preDeployStep1" }, + { stepId: "Microsoft.DeploymentManager/steps/preDeployStep2" } + ] + }, + { + name: "SecondRegion", + dependsOnStepGroups: ["FirstRegion"], + deploymentTargetId: + "Microsoft.DeploymentManager/serviceTopologies/myTopology/services/myService/serviceUnits/myServiceUnit2'", + postDeploymentSteps: [ + { stepId: "Microsoft.DeploymentManager/steps/postDeployStep5" } + ], + preDeploymentSteps: [ + { stepId: "Microsoft.DeploymentManager/steps/preDeployStep3" }, + { stepId: "Microsoft.DeploymentManager/steps/preDeployStep4" } + ] + } + ], + tags: {}, + targetServiceTopologyId: + "/subscriptions/caac1590-e859-444f-a9e0-62091c0f5929/resourceGroups/myResourceGroup/Microsoft.DeploymentManager/serviceTopologies/myTopology" + }; + const options: RolloutsCreateOrUpdateOptionalParams = { rolloutRequest }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.beginCreateOrUpdateAndWait( + resourceGroupName, + rolloutName, + options + ); + console.log(result); +} + +createOrUpdateRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsDeleteSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsDeleteSample.ts new file mode 100644 index 000000000000..a80c656f63f4 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsDeleteSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Only rollouts in terminal state can be deleted. + * + * @summary Only rollouts in terminal state can be deleted. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_delete.json + */ +async function deleteRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.delete(resourceGroupName, rolloutName); + console.log(result); +} + +deleteRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsGetSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsGetSample.ts new file mode 100644 index 000000000000..03eb5efc6135 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets detailed information of a rollout. + * + * @summary Gets detailed information of a rollout. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_get.json + */ +async function getRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.get(resourceGroupName, rolloutName); + console.log(result); +} + +getRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsListSample.ts new file mode 100644 index 000000000000..0773f7db3a4d --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the rollouts in a resource group. + * + * @summary Lists the rollouts in a resource group. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollouts_list.json + */ +async function listRolloutsByResourceGroup() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.list(resourceGroupName); + console.log(result); +} + +listRolloutsByResourceGroup().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsRestartSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsRestartSample.ts new file mode 100644 index 000000000000..d59bbb85530c --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/rolloutsRestartSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RolloutsRestartOptionalParams, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Only failed rollouts can be restarted. + * + * @summary Only failed rollouts can be restarted. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_post_restart.json + */ +async function restartRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const skipSucceeded = true; + const options: RolloutsRestartOptionalParams = { skipSucceeded }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.restart( + resourceGroupName, + rolloutName, + options + ); + console.log(result); +} + +restartRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceTopologiesCreateOrUpdateSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceTopologiesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..9c754c280861 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceTopologiesCreateOrUpdateSample.ts @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + ServiceTopologyResource, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Synchronously creates a new service topology or updates an existing service topology. + * + * @summary Synchronously creates a new service topology or updates an existing service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_createorupdate.json + */ +async function createATopologyWithArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceTopologyInfo: ServiceTopologyResource = { + artifactSourceId: + "Microsoft.DeploymentManager/artifactSources/myArtifactSource", + location: "centralus", + tags: {} + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.createOrUpdate( + resourceGroupName, + serviceTopologyName, + serviceTopologyInfo + ); + console.log(result); +} + +createATopologyWithArtifactSource().catch(console.error); + +/** + * This sample demonstrates how to Synchronously creates a new service topology or updates an existing service topology. + * + * @summary Synchronously creates a new service topology or updates an existing service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_createorupdate_noartifactsource.json + */ +async function createATopologyWithoutArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceTopologyInfo: ServiceTopologyResource = { + location: "centralus", + tags: {} + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.createOrUpdate( + resourceGroupName, + serviceTopologyName, + serviceTopologyInfo + ); + console.log(result); +} + +createATopologyWithoutArtifactSource().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceTopologiesDeleteSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceTopologiesDeleteSample.ts new file mode 100644 index 000000000000..3802c776a4f9 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceTopologiesDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the service topology. + * + * @summary Deletes the service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_delete.json + */ +async function deleteTopology() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.delete( + resourceGroupName, + serviceTopologyName + ); + console.log(result); +} + +deleteTopology().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceTopologiesGetSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceTopologiesGetSample.ts new file mode 100644 index 000000000000..c6517b5718a5 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceTopologiesGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the service topology. + * + * @summary Gets the service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_get.json + */ +async function getTopology() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.get( + resourceGroupName, + serviceTopologyName + ); + console.log(result); +} + +getTopology().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceTopologiesListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceTopologiesListSample.ts new file mode 100644 index 000000000000..6b734e2a2aa8 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceTopologiesListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the service topologies in the resource group. + * + * @summary Lists the service topologies in the resource group. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopologies_list.json + */ +async function listTopologies() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.list(resourceGroupName); + console.log(result); +} + +listTopologies().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceUnitsCreateOrUpdateSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceUnitsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..81b256b95b11 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceUnitsCreateOrUpdateSample.ts @@ -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. +import { + ServiceUnitResource, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. + * + * @summary This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_createorupdate_noartifactsource.json + */ +async function createServiceUnitUsingSasUrIs() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceUnitName = "myServiceUnit"; + const serviceUnitInfo: ServiceUnitResource = { + artifacts: { + parametersUri: + "https://mystorageaccount.blob.core.windows.net/myartifactsource/parameter/myTopologyUnit.parameters.json?st=2018-07-07T14%3A10%3A00Z&se=2019-12-31T15%3A10%3A00Z&sp=rl&sv=2017-04-17&sr=c&sig=Yh2SoJ1NhhLRwCLln7de%2Fkabcdefghijklmno5sWEIk%3D", + templateUri: + "https://mystorageaccount.blob.core.windows.net/myartifactsource/templates/myTopologyUnit.template.json?st=2018-07-07T14%3A10%3A00Z&se=2019-12-31T15%3A10%3A00Z&sp=rl&sv=2017-04-17&sr=c&sig=Yh2SoJ1NhhLRwCLln7de%2Fkabcdefghijklmno5sWEIk%3D" + }, + deploymentMode: "Incremental", + location: "centralus", + tags: {}, + targetResourceGroup: "myDeploymentResourceGroup" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.beginCreateOrUpdateAndWait( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + serviceUnitInfo + ); + console.log(result); +} + +createServiceUnitUsingSasUrIs().catch(console.error); + +/** + * This sample demonstrates how to This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. + * + * @summary This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_createorupdate.json + */ +async function createServiceUnitUsingRelativePathsIntoTheArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceUnitName = "myServiceUnit"; + const serviceUnitInfo: ServiceUnitResource = { + artifacts: { + parametersArtifactSourceRelativePath: + "parameter/myTopologyUnit.parameters.json", + templateArtifactSourceRelativePath: + "templates/myTopologyUnit.template.json" + }, + deploymentMode: "Incremental", + location: "centralus", + tags: {}, + targetResourceGroup: "myDeploymentResourceGroup" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.beginCreateOrUpdateAndWait( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + serviceUnitInfo + ); + console.log(result); +} + +createServiceUnitUsingRelativePathsIntoTheArtifactSource().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceUnitsDeleteSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceUnitsDeleteSample.ts new file mode 100644 index 000000000000..0b857d234c4e --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceUnitsDeleteSample.ts @@ -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. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the service unit. + * + * @summary Deletes the service unit. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_delete.json + */ +async function deleteServiceUnit() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceUnitName = "myServiceUnit"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.delete( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName + ); + console.log(result); +} + +deleteServiceUnit().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceUnitsGetSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceUnitsGetSample.ts new file mode 100644 index 000000000000..2f95cf5f92d3 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceUnitsGetSample.ts @@ -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. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the service unit. + * + * @summary Gets the service unit. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_get.json + */ +async function getServiceUnit() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceUnitName = "myServiceUnit"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.get( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName + ); + console.log(result); +} + +getServiceUnit().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceUnitsListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceUnitsListSample.ts new file mode 100644 index 000000000000..5716ac3fc068 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/serviceUnitsListSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the service units under a service in the service topology. + * + * @summary Lists the service units under a service in the service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunits_list.json + */ +async function listServiceUnits() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.list( + resourceGroupName, + serviceTopologyName, + serviceName + ); + console.log(result); +} + +listServiceUnits().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/servicesCreateOrUpdateSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/servicesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..23de9ca2df58 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/servicesCreateOrUpdateSample.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 { + ServiceResource, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Synchronously creates a new service or updates an existing service. + * + * @summary Synchronously creates a new service or updates an existing service. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_createorupdate.json + */ +async function createService() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceInfo: ServiceResource = { + location: "centralus", + tags: {}, + targetLocation: "centralus", + targetSubscriptionId: "600c95c5-3ee5-44fe-b190-ca38a19adcd7" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.services.createOrUpdate( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceInfo + ); + console.log(result); +} + +createService().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/servicesDeleteSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/servicesDeleteSample.ts new file mode 100644 index 000000000000..6f790defad44 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/servicesDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the service. + * + * @summary Deletes the service. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_delete.json + */ +async function deleteService() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.services.delete( + resourceGroupName, + serviceTopologyName, + serviceName + ); + console.log(result); +} + +deleteService().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/servicesGetSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/servicesGetSample.ts new file mode 100644 index 000000000000..b1255a81a583 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/servicesGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the service. + * + * @summary Gets the service. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_get.json + */ +async function getService() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.services.get( + resourceGroupName, + serviceTopologyName, + serviceName + ); + console.log(result); +} + +getService().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/servicesListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/servicesListSample.ts new file mode 100644 index 000000000000..88975d798a0d --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/servicesListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the services in the service topology. + * + * @summary Lists the services in the service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/services_list.json + */ +async function listServices() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.services.list( + resourceGroupName, + serviceTopologyName + ); + console.log(result); +} + +listServices().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/stepsCreateOrUpdateSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/stepsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..0bcaf901d043 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/stepsCreateOrUpdateSample.ts @@ -0,0 +1,131 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + StepResource, + StepsCreateOrUpdateOptionalParams, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Synchronously creates a new step or updates an existing step. + * + * @summary Synchronously creates a new step or updates an existing step. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_health_check_createorupdate.json + */ +async function createHealthCheckStep() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const stepName = "healthCheckStep"; + const stepInfo: StepResource = { + location: "centralus", + properties: { + attributes: { + type: "REST", + healthChecks: [ + { + name: "appHealth", + response: { + regex: { + matchQuantifier: "All", + matches: [ + "(?i)Contoso-App", + '(?i)"health_status":((.|\n)*)"(green|yellow)"', + '(?mi)^("application_host": 94781052)$' + ] + }, + successStatusCodes: ["OK"] + }, + request: { + method: "GET", + authentication: { + name: "Code", + type: "ApiKey", + in: "Query", + value: "" + }, + uri: + "https://resthealth.healthservice.com/api/applications/contosoApp/healthStatus" + } + }, + { + name: "serviceHealth", + response: { + regex: { + matchQuantifier: "All", + matches: [ + "(?i)Contoso-Service-EndToEnd", + '(?i)"health_status":((.|\n)*)"(green)"' + ] + }, + successStatusCodes: ["OK"] + }, + request: { + method: "GET", + authentication: { + name: "code", + type: "ApiKey", + in: "Header", + value: "" + }, + uri: + "https://resthealth.healthservice.com/api/services/contosoService/healthStatus" + } + } + ], + healthyStateDuration: "PT2H", + maxElasticDuration: "PT30M", + waitDuration: "PT15M" + }, + stepType: "HealthCheck" + }, + tags: {} + }; + const options: StepsCreateOrUpdateOptionalParams = { stepInfo }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.createOrUpdate( + resourceGroupName, + stepName, + options + ); + console.log(result); +} + +createHealthCheckStep().catch(console.error); + +/** + * This sample demonstrates how to Synchronously creates a new step or updates an existing step. + * + * @summary Synchronously creates a new step or updates an existing step. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_wait_createorupdate.json + */ +async function createWaitStep() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const stepName = "waitStep"; + const stepInfo: StepResource = { + location: "centralus", + properties: { attributes: { duration: "PT20M" }, stepType: "Wait" }, + tags: {} + }; + const options: StepsCreateOrUpdateOptionalParams = { stepInfo }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.createOrUpdate( + resourceGroupName, + stepName, + options + ); + console.log(result); +} + +createWaitStep().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/stepsDeleteSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/stepsDeleteSample.ts new file mode 100644 index 000000000000..f8d86fa93290 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/stepsDeleteSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the step. + * + * @summary Deletes the step. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_delete.json + */ +async function deleteDeploymentStep() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const stepName = "deploymentStep1"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.delete(resourceGroupName, stepName); + console.log(result); +} + +deleteDeploymentStep().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/stepsGetSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/stepsGetSample.ts new file mode 100644 index 000000000000..b1c141111b85 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/stepsGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the step. + * + * @summary Gets the step. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_get.json + */ +async function getDeploymentStep() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const stepName = "waitStep"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.get(resourceGroupName, stepName); + console.log(result); +} + +getDeploymentStep().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/stepsListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/stepsListSample.ts new file mode 100644 index 000000000000..04aaa5f5a9df --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples-dev/stepsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the steps in a resource group. + * + * @summary Lists the steps in a resource group. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/steps_list.json + */ +async function listSteps() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.list(resourceGroupName); + console.log(result); +} + +listSteps().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/README.md b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/README.md new file mode 100644 index 000000000000..7f0afd2699f2 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/README.md @@ -0,0 +1,102 @@ +# 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** | +| --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [artifactSourcesCreateOrUpdateSample.js][artifactsourcescreateorupdatesample] | Synchronously creates a new artifact source or updates an existing artifact source. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_createorupdate.json | +| [artifactSourcesDeleteSample.js][artifactsourcesdeletesample] | Deletes an artifact source. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_delete.json | +| [artifactSourcesGetSample.js][artifactsourcesgetsample] | Gets an artifact source. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_get.json | +| [artifactSourcesListSample.js][artifactsourceslistsample] | Lists the artifact sources in a resource group. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsources_list.json | +| [operationsListSample.js][operationslistsample] | Lists the supported operations. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/operations_list.json | +| [rolloutsCancelSample.js][rolloutscancelsample] | Only running rollouts can be canceled. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_post_cancel.json | +| [rolloutsCreateOrUpdateSample.js][rolloutscreateorupdatesample] | This is an asynchronous operation and can be polled to completion using the location header returned by this operation. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_createorupdate.json | +| [rolloutsDeleteSample.js][rolloutsdeletesample] | Only rollouts in terminal state can be deleted. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_delete.json | +| [rolloutsGetSample.js][rolloutsgetsample] | Gets detailed information of a rollout. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_get.json | +| [rolloutsListSample.js][rolloutslistsample] | Lists the rollouts in a resource group. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollouts_list.json | +| [rolloutsRestartSample.js][rolloutsrestartsample] | Only failed rollouts can be restarted. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_post_restart.json | +| [serviceTopologiesCreateOrUpdateSample.js][servicetopologiescreateorupdatesample] | Synchronously creates a new service topology or updates an existing service topology. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_createorupdate.json | +| [serviceTopologiesDeleteSample.js][servicetopologiesdeletesample] | Deletes the service topology. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_delete.json | +| [serviceTopologiesGetSample.js][servicetopologiesgetsample] | Gets the service topology. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_get.json | +| [serviceTopologiesListSample.js][servicetopologieslistsample] | Lists the service topologies in the resource group. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopologies_list.json | +| [serviceUnitsCreateOrUpdateSample.js][serviceunitscreateorupdatesample] | This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_createorupdate_noartifactsource.json | +| [serviceUnitsDeleteSample.js][serviceunitsdeletesample] | Deletes the service unit. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_delete.json | +| [serviceUnitsGetSample.js][serviceunitsgetsample] | Gets the service unit. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_get.json | +| [serviceUnitsListSample.js][serviceunitslistsample] | Lists the service units under a service in the service topology. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunits_list.json | +| [servicesCreateOrUpdateSample.js][servicescreateorupdatesample] | Synchronously creates a new service or updates an existing service. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_createorupdate.json | +| [servicesDeleteSample.js][servicesdeletesample] | Deletes the service. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_delete.json | +| [servicesGetSample.js][servicesgetsample] | Gets the service. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_get.json | +| [servicesListSample.js][serviceslistsample] | Lists the services in the service topology. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/services_list.json | +| [stepsCreateOrUpdateSample.js][stepscreateorupdatesample] | Synchronously creates a new step or updates an existing step. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_health_check_createorupdate.json | +| [stepsDeleteSample.js][stepsdeletesample] | Deletes the step. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_delete.json | +| [stepsGetSample.js][stepsgetsample] | Gets the step. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_get.json | +| [stepsListSample.js][stepslistsample] | Lists the steps in a resource group. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/steps_list.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +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 artifactSourcesCreateOrUpdateSample.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 node artifactSourcesCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[artifactsourcescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesCreateOrUpdateSample.js +[artifactsourcesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesDeleteSample.js +[artifactsourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesGetSample.js +[artifactsourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesListSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/operationsListSample.js +[rolloutscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsCancelSample.js +[rolloutscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsCreateOrUpdateSample.js +[rolloutsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsDeleteSample.js +[rolloutsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsGetSample.js +[rolloutslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsListSample.js +[rolloutsrestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsRestartSample.js +[servicetopologiescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesCreateOrUpdateSample.js +[servicetopologiesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesDeleteSample.js +[servicetopologiesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesGetSample.js +[servicetopologieslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesListSample.js +[serviceunitscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsCreateOrUpdateSample.js +[serviceunitsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsDeleteSample.js +[serviceunitsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsGetSample.js +[serviceunitslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsListSample.js +[servicescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesCreateOrUpdateSample.js +[servicesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesDeleteSample.js +[servicesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesGetSample.js +[serviceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesListSample.js +[stepscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsCreateOrUpdateSample.js +[stepsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsDeleteSample.js +[stepsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsGetSample.js +[stepslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsListSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-deploymentmanager?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deploymentmanager/arm-deploymentmanager/README.md diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesCreateOrUpdateSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesCreateOrUpdateSample.js new file mode 100644 index 000000000000..7987a8250066 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesCreateOrUpdateSample.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 { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Synchronously creates a new artifact source or updates an existing artifact source. + * + * @summary Synchronously creates a new artifact source or updates an existing artifact source. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_createorupdate.json + */ +async function createArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const artifactSourceName = "myArtifactSource"; + const artifactSourceInfo = { + authentication: { + type: "Sas", + sasUri: + "https://mystorageaccount.blob.core.windows.net/myartifactsource?st=2018-07-07T14%3A10%3A00Z&se=2019-12-31T15%3A10%3A00Z&sp=rl&sv=2017-04-17&sr=c&sig=Yh2SoJ1NhhLRwCLln7de%2Fkabcdefghijklmno5sWEIk%3D", + }, + location: "centralus", + sourceType: "AzureStorage", + tags: {}, + }; + const options = { + artifactSourceInfo, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.createOrUpdate( + resourceGroupName, + artifactSourceName, + options + ); + console.log(result); +} + +createArtifactSource().catch(console.error); + +/** + * This sample demonstrates how to Synchronously creates a new artifact source or updates an existing artifact source. + * + * @summary Synchronously creates a new artifact source or updates an existing artifact source. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_createorupdate_artifactroot.json + */ +async function createArtifactSourceWithArtifactRootAnOffsetIntoTheStorageContainer() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const artifactSourceName = "myArtifactSource"; + const artifactSourceInfo = { + artifactRoot: "1.0.0.0", + authentication: { + type: "Sas", + sasUri: + "https://mystorageaccount.blob.core.windows.net/myartifactsource?st=2018-07-07T14%3A10%3A00Z&se=2019-12-31T15%3A10%3A00Z&sp=rl&sv=2017-04-17&sr=c&sig=Yh2SoJ1NhhLRwCLln7de%2Fkabcdefghijklmno5sWEIk%3D", + }, + location: "centralus", + sourceType: "AzureStorage", + tags: {}, + }; + const options = { + artifactSourceInfo, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.createOrUpdate( + resourceGroupName, + artifactSourceName, + options + ); + console.log(result); +} + +createArtifactSourceWithArtifactRootAnOffsetIntoTheStorageContainer().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesDeleteSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesDeleteSample.js new file mode 100644 index 000000000000..4fd7b752a6fe --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesDeleteSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes an artifact source. + * + * @summary Deletes an artifact source. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_delete.json + */ +async function deleteArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const artifactSourceName = "myArtifactSource"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.delete(resourceGroupName, artifactSourceName); + console.log(result); +} + +deleteArtifactSource().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesGetSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesGetSample.js new file mode 100644 index 000000000000..8002650e4a47 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets an artifact source. + * + * @summary Gets an artifact source. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_get.json + */ +async function getArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const artifactSourceName = "myArtifactSource"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.get(resourceGroupName, artifactSourceName); + console.log(result); +} + +getArtifactSource().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesListSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesListSample.js new file mode 100644 index 000000000000..a9547000e0a9 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/artifactSourcesListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists the artifact sources in a resource group. + * + * @summary Lists the artifact sources in a resource group. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsources_list.json + */ +async function listSteps() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.list(resourceGroupName); + console.log(result); +} + +listSteps().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/operationsListSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/operationsListSample.js new file mode 100644 index 000000000000..75bffdc2784b --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/operationsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists the supported operations. + * + * @summary Lists the supported operations. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/operations_list.json + */ +async function getOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.operations.list(); + console.log(result); +} + +getOperations().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/package.json b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/package.json new file mode 100644 index 000000000000..64b6250115f0 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-deploymentmanager-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/deploymentmanager/arm-deploymentmanager" + }, + "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/deploymentmanager/arm-deploymentmanager", + "dependencies": { + "@azure/arm-deploymentmanager": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsCancelSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsCancelSample.js new file mode 100644 index 000000000000..bd43044dd506 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsCancelSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Only running rollouts can be canceled. + * + * @summary Only running rollouts can be canceled. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_post_cancel.json + */ +async function cancelRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.cancel(resourceGroupName, rolloutName); + console.log(result); +} + +cancelRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsCreateOrUpdateSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsCreateOrUpdateSample.js new file mode 100644 index 000000000000..830d1c8185dc --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsCreateOrUpdateSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to This is an asynchronous operation and can be polled to completion using the location header returned by this operation. + * + * @summary This is an asynchronous operation and can be polled to completion using the location header returned by this operation. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_createorupdate.json + */ +async function createOrUpdateRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const rolloutRequest = { + artifactSourceId: + "/subscriptions/caac1590-e859-444f-a9e0-62091c0f5929/resourceGroups/myResourceGroup/Microsoft.DeploymentManager/artifactSources/myArtifactSource", + buildVersion: "1.0.0.1", + identity: { + type: "userAssigned", + identityIds: [ + "/subscriptions/caac1590-e859-444f-a9e0-62091c0f5929/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userassignedidentities/myuseridentity", + ], + }, + location: "centralus", + stepGroups: [ + { + name: "FirstRegion", + deploymentTargetId: + "Microsoft.DeploymentManager/serviceTopologies/myTopology/services/myService/serviceUnits/myServiceUnit1'", + postDeploymentSteps: [{ stepId: "Microsoft.DeploymentManager/steps/postDeployStep1" }], + preDeploymentSteps: [ + { stepId: "Microsoft.DeploymentManager/steps/preDeployStep1" }, + { stepId: "Microsoft.DeploymentManager/steps/preDeployStep2" }, + ], + }, + { + name: "SecondRegion", + dependsOnStepGroups: ["FirstRegion"], + deploymentTargetId: + "Microsoft.DeploymentManager/serviceTopologies/myTopology/services/myService/serviceUnits/myServiceUnit2'", + postDeploymentSteps: [{ stepId: "Microsoft.DeploymentManager/steps/postDeployStep5" }], + preDeploymentSteps: [ + { stepId: "Microsoft.DeploymentManager/steps/preDeployStep3" }, + { stepId: "Microsoft.DeploymentManager/steps/preDeployStep4" }, + ], + }, + ], + tags: {}, + targetServiceTopologyId: + "/subscriptions/caac1590-e859-444f-a9e0-62091c0f5929/resourceGroups/myResourceGroup/Microsoft.DeploymentManager/serviceTopologies/myTopology", + }; + const options = { rolloutRequest }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.beginCreateOrUpdateAndWait( + resourceGroupName, + rolloutName, + options + ); + console.log(result); +} + +createOrUpdateRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsDeleteSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsDeleteSample.js new file mode 100644 index 000000000000..60dda98a2153 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsDeleteSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Only rollouts in terminal state can be deleted. + * + * @summary Only rollouts in terminal state can be deleted. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_delete.json + */ +async function deleteRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.delete(resourceGroupName, rolloutName); + console.log(result); +} + +deleteRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsGetSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsGetSample.js new file mode 100644 index 000000000000..742fecf809c4 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets detailed information of a rollout. + * + * @summary Gets detailed information of a rollout. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_get.json + */ +async function getRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.get(resourceGroupName, rolloutName); + console.log(result); +} + +getRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsListSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsListSample.js new file mode 100644 index 000000000000..f45b0eb6ac89 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists the rollouts in a resource group. + * + * @summary Lists the rollouts in a resource group. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollouts_list.json + */ +async function listRolloutsByResourceGroup() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.list(resourceGroupName); + console.log(result); +} + +listRolloutsByResourceGroup().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsRestartSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsRestartSample.js new file mode 100644 index 000000000000..37d8f1baee52 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/rolloutsRestartSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Only failed rollouts can be restarted. + * + * @summary Only failed rollouts can be restarted. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_post_restart.json + */ +async function restartRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const skipSucceeded = true; + const options = { skipSucceeded }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.restart(resourceGroupName, rolloutName, options); + console.log(result); +} + +restartRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/sample.env b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-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/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesCreateOrUpdateSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesCreateOrUpdateSample.js new file mode 100644 index 000000000000..f5fa59be6efe --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesCreateOrUpdateSample.js @@ -0,0 +1,65 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Synchronously creates a new service topology or updates an existing service topology. + * + * @summary Synchronously creates a new service topology or updates an existing service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_createorupdate.json + */ +async function createATopologyWithArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceTopologyInfo = { + artifactSourceId: "Microsoft.DeploymentManager/artifactSources/myArtifactSource", + location: "centralus", + tags: {}, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.createOrUpdate( + resourceGroupName, + serviceTopologyName, + serviceTopologyInfo + ); + console.log(result); +} + +createATopologyWithArtifactSource().catch(console.error); + +/** + * This sample demonstrates how to Synchronously creates a new service topology or updates an existing service topology. + * + * @summary Synchronously creates a new service topology or updates an existing service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_createorupdate_noartifactsource.json + */ +async function createATopologyWithoutArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceTopologyInfo = { + location: "centralus", + tags: {}, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.createOrUpdate( + resourceGroupName, + serviceTopologyName, + serviceTopologyInfo + ); + console.log(result); +} + +createATopologyWithoutArtifactSource().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesDeleteSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesDeleteSample.js new file mode 100644 index 000000000000..7f87c430c1e6 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesDeleteSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes the service topology. + * + * @summary Deletes the service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_delete.json + */ +async function deleteTopology() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.delete(resourceGroupName, serviceTopologyName); + console.log(result); +} + +deleteTopology().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesGetSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesGetSample.js new file mode 100644 index 000000000000..752b64e58c61 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the service topology. + * + * @summary Gets the service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_get.json + */ +async function getTopology() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.get(resourceGroupName, serviceTopologyName); + console.log(result); +} + +getTopology().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesListSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesListSample.js new file mode 100644 index 000000000000..ef00f77d4b17 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceTopologiesListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists the service topologies in the resource group. + * + * @summary Lists the service topologies in the resource group. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopologies_list.json + */ +async function listTopologies() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.list(resourceGroupName); + console.log(result); +} + +listTopologies().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsCreateOrUpdateSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsCreateOrUpdateSample.js new file mode 100644 index 000000000000..d0bdda9874f7 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsCreateOrUpdateSample.js @@ -0,0 +1,86 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. + * + * @summary This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_createorupdate_noartifactsource.json + */ +async function createServiceUnitUsingSasUrIs() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceUnitName = "myServiceUnit"; + const serviceUnitInfo = { + artifacts: { + parametersUri: + "https://mystorageaccount.blob.core.windows.net/myartifactsource/parameter/myTopologyUnit.parameters.json?st=2018-07-07T14%3A10%3A00Z&se=2019-12-31T15%3A10%3A00Z&sp=rl&sv=2017-04-17&sr=c&sig=Yh2SoJ1NhhLRwCLln7de%2Fkabcdefghijklmno5sWEIk%3D", + templateUri: + "https://mystorageaccount.blob.core.windows.net/myartifactsource/templates/myTopologyUnit.template.json?st=2018-07-07T14%3A10%3A00Z&se=2019-12-31T15%3A10%3A00Z&sp=rl&sv=2017-04-17&sr=c&sig=Yh2SoJ1NhhLRwCLln7de%2Fkabcdefghijklmno5sWEIk%3D", + }, + deploymentMode: "Incremental", + location: "centralus", + tags: {}, + targetResourceGroup: "myDeploymentResourceGroup", + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.beginCreateOrUpdateAndWait( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + serviceUnitInfo + ); + console.log(result); +} + +createServiceUnitUsingSasUrIs().catch(console.error); + +/** + * This sample demonstrates how to This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. + * + * @summary This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_createorupdate.json + */ +async function createServiceUnitUsingRelativePathsIntoTheArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceUnitName = "myServiceUnit"; + const serviceUnitInfo = { + artifacts: { + parametersArtifactSourceRelativePath: "parameter/myTopologyUnit.parameters.json", + templateArtifactSourceRelativePath: "templates/myTopologyUnit.template.json", + }, + deploymentMode: "Incremental", + location: "centralus", + tags: {}, + targetResourceGroup: "myDeploymentResourceGroup", + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.beginCreateOrUpdateAndWait( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + serviceUnitInfo + ); + console.log(result); +} + +createServiceUnitUsingRelativePathsIntoTheArtifactSource().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsDeleteSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsDeleteSample.js new file mode 100644 index 000000000000..234568c03c73 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsDeleteSample.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 { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes the service unit. + * + * @summary Deletes the service unit. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_delete.json + */ +async function deleteServiceUnit() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceUnitName = "myServiceUnit"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.delete( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName + ); + console.log(result); +} + +deleteServiceUnit().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsGetSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsGetSample.js new file mode 100644 index 000000000000..74b4e059fc90 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsGetSample.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 { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the service unit. + * + * @summary Gets the service unit. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_get.json + */ +async function getServiceUnit() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceUnitName = "myServiceUnit"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.get( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName + ); + console.log(result); +} + +getServiceUnit().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsListSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsListSample.js new file mode 100644 index 000000000000..3b9b3cce4038 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/serviceUnitsListSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists the service units under a service in the service topology. + * + * @summary Lists the service units under a service in the service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunits_list.json + */ +async function listServiceUnits() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.list( + resourceGroupName, + serviceTopologyName, + serviceName + ); + console.log(result); +} + +listServiceUnits().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesCreateOrUpdateSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesCreateOrUpdateSample.js new file mode 100644 index 000000000000..4921491bd0f8 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesCreateOrUpdateSample.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 { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Synchronously creates a new service or updates an existing service. + * + * @summary Synchronously creates a new service or updates an existing service. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_createorupdate.json + */ +async function createService() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceInfo = { + location: "centralus", + tags: {}, + targetLocation: "centralus", + targetSubscriptionId: "600c95c5-3ee5-44fe-b190-ca38a19adcd7", + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.services.createOrUpdate( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceInfo + ); + console.log(result); +} + +createService().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesDeleteSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesDeleteSample.js new file mode 100644 index 000000000000..d838f4e4b8bb --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesDeleteSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes the service. + * + * @summary Deletes the service. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_delete.json + */ +async function deleteService() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.services.delete(resourceGroupName, serviceTopologyName, serviceName); + console.log(result); +} + +deleteService().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesGetSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesGetSample.js new file mode 100644 index 000000000000..eae454cdd8ae --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the service. + * + * @summary Gets the service. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_get.json + */ +async function getService() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.services.get(resourceGroupName, serviceTopologyName, serviceName); + console.log(result); +} + +getService().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesListSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesListSample.js new file mode 100644 index 000000000000..7a14ef27c0ee --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/servicesListSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists the services in the service topology. + * + * @summary Lists the services in the service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/services_list.json + */ +async function listServices() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.services.list(resourceGroupName, serviceTopologyName); + console.log(result); +} + +listServices().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsCreateOrUpdateSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsCreateOrUpdateSample.js new file mode 100644 index 000000000000..6ebeaa4db8e9 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsCreateOrUpdateSample.js @@ -0,0 +1,114 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Synchronously creates a new step or updates an existing step. + * + * @summary Synchronously creates a new step or updates an existing step. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_health_check_createorupdate.json + */ +async function createHealthCheckStep() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const stepName = "healthCheckStep"; + const stepInfo = { + location: "centralus", + properties: { + attributes: { + type: "REST", + healthChecks: [ + { + name: "appHealth", + response: { + regex: { + matchQuantifier: "All", + matches: [ + "(?i)Contoso-App", + '(?i)"health_status":((.|\n)*)"(green|yellow)"', + '(?mi)^("application_host": 94781052)$', + ], + }, + successStatusCodes: ["OK"], + }, + request: { + method: "GET", + authentication: { + name: "Code", + type: "ApiKey", + in: "Query", + value: "", + }, + uri: "https://resthealth.healthservice.com/api/applications/contosoApp/healthStatus", + }, + }, + { + name: "serviceHealth", + response: { + regex: { + matchQuantifier: "All", + matches: ["(?i)Contoso-Service-EndToEnd", '(?i)"health_status":((.|\n)*)"(green)"'], + }, + successStatusCodes: ["OK"], + }, + request: { + method: "GET", + authentication: { + name: "code", + type: "ApiKey", + in: "Header", + value: "", + }, + uri: "https://resthealth.healthservice.com/api/services/contosoService/healthStatus", + }, + }, + ], + healthyStateDuration: "PT2H", + maxElasticDuration: "PT30M", + waitDuration: "PT15M", + }, + stepType: "HealthCheck", + }, + tags: {}, + }; + const options = { stepInfo }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.createOrUpdate(resourceGroupName, stepName, options); + console.log(result); +} + +createHealthCheckStep().catch(console.error); + +/** + * This sample demonstrates how to Synchronously creates a new step or updates an existing step. + * + * @summary Synchronously creates a new step or updates an existing step. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_wait_createorupdate.json + */ +async function createWaitStep() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const stepName = "waitStep"; + const stepInfo = { + location: "centralus", + properties: { attributes: { duration: "PT20M" }, stepType: "Wait" }, + tags: {}, + }; + const options = { stepInfo }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.createOrUpdate(resourceGroupName, stepName, options); + console.log(result); +} + +createWaitStep().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsDeleteSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsDeleteSample.js new file mode 100644 index 000000000000..d64a977b8573 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsDeleteSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes the step. + * + * @summary Deletes the step. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_delete.json + */ +async function deleteDeploymentStep() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const stepName = "deploymentStep1"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.delete(resourceGroupName, stepName); + console.log(result); +} + +deleteDeploymentStep().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsGetSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsGetSample.js new file mode 100644 index 000000000000..39eb99715ed7 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the step. + * + * @summary Gets the step. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_get.json + */ +async function getDeploymentStep() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const stepName = "waitStep"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.get(resourceGroupName, stepName); + console.log(result); +} + +getDeploymentStep().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsListSample.js b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsListSample.js new file mode 100644 index 000000000000..971bb3089968 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/javascript/stepsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDeploymentManager } = require("@azure/arm-deploymentmanager"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists the steps in a resource group. + * + * @summary Lists the steps in a resource group. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/steps_list.json + */ +async function listSteps() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.list(resourceGroupName); + console.log(result); +} + +listSteps().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/README.md b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/README.md new file mode 100644 index 000000000000..c2959594c4ed --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/README.md @@ -0,0 +1,115 @@ +# 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** | +| --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [artifactSourcesCreateOrUpdateSample.ts][artifactsourcescreateorupdatesample] | Synchronously creates a new artifact source or updates an existing artifact source. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_createorupdate.json | +| [artifactSourcesDeleteSample.ts][artifactsourcesdeletesample] | Deletes an artifact source. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_delete.json | +| [artifactSourcesGetSample.ts][artifactsourcesgetsample] | Gets an artifact source. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_get.json | +| [artifactSourcesListSample.ts][artifactsourceslistsample] | Lists the artifact sources in a resource group. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsources_list.json | +| [operationsListSample.ts][operationslistsample] | Lists the supported operations. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/operations_list.json | +| [rolloutsCancelSample.ts][rolloutscancelsample] | Only running rollouts can be canceled. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_post_cancel.json | +| [rolloutsCreateOrUpdateSample.ts][rolloutscreateorupdatesample] | This is an asynchronous operation and can be polled to completion using the location header returned by this operation. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_createorupdate.json | +| [rolloutsDeleteSample.ts][rolloutsdeletesample] | Only rollouts in terminal state can be deleted. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_delete.json | +| [rolloutsGetSample.ts][rolloutsgetsample] | Gets detailed information of a rollout. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_get.json | +| [rolloutsListSample.ts][rolloutslistsample] | Lists the rollouts in a resource group. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollouts_list.json | +| [rolloutsRestartSample.ts][rolloutsrestartsample] | Only failed rollouts can be restarted. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_post_restart.json | +| [serviceTopologiesCreateOrUpdateSample.ts][servicetopologiescreateorupdatesample] | Synchronously creates a new service topology or updates an existing service topology. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_createorupdate.json | +| [serviceTopologiesDeleteSample.ts][servicetopologiesdeletesample] | Deletes the service topology. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_delete.json | +| [serviceTopologiesGetSample.ts][servicetopologiesgetsample] | Gets the service topology. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_get.json | +| [serviceTopologiesListSample.ts][servicetopologieslistsample] | Lists the service topologies in the resource group. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopologies_list.json | +| [serviceUnitsCreateOrUpdateSample.ts][serviceunitscreateorupdatesample] | This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_createorupdate_noartifactsource.json | +| [serviceUnitsDeleteSample.ts][serviceunitsdeletesample] | Deletes the service unit. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_delete.json | +| [serviceUnitsGetSample.ts][serviceunitsgetsample] | Gets the service unit. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_get.json | +| [serviceUnitsListSample.ts][serviceunitslistsample] | Lists the service units under a service in the service topology. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunits_list.json | +| [servicesCreateOrUpdateSample.ts][servicescreateorupdatesample] | Synchronously creates a new service or updates an existing service. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_createorupdate.json | +| [servicesDeleteSample.ts][servicesdeletesample] | Deletes the service. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_delete.json | +| [servicesGetSample.ts][servicesgetsample] | Gets the service. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_get.json | +| [servicesListSample.ts][serviceslistsample] | Lists the services in the service topology. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/services_list.json | +| [stepsCreateOrUpdateSample.ts][stepscreateorupdatesample] | Synchronously creates a new step or updates an existing step. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_health_check_createorupdate.json | +| [stepsDeleteSample.ts][stepsdeletesample] | Deletes the step. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_delete.json | +| [stepsGetSample.ts][stepsgetsample] | Gets the step. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_get.json | +| [stepsListSample.ts][stepslistsample] | Lists the steps in a resource group. x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/steps_list.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +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/artifactSourcesCreateOrUpdateSample.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 node dist/artifactSourcesCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[artifactsourcescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesCreateOrUpdateSample.ts +[artifactsourcesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesDeleteSample.ts +[artifactsourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesGetSample.ts +[artifactsourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesListSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/operationsListSample.ts +[rolloutscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsCancelSample.ts +[rolloutscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsCreateOrUpdateSample.ts +[rolloutsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsDeleteSample.ts +[rolloutsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsGetSample.ts +[rolloutslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsListSample.ts +[rolloutsrestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsRestartSample.ts +[servicetopologiescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesCreateOrUpdateSample.ts +[servicetopologiesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesDeleteSample.ts +[servicetopologiesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesGetSample.ts +[servicetopologieslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesListSample.ts +[serviceunitscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsCreateOrUpdateSample.ts +[serviceunitsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsDeleteSample.ts +[serviceunitsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsGetSample.ts +[serviceunitslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsListSample.ts +[servicescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesCreateOrUpdateSample.ts +[servicesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesDeleteSample.ts +[servicesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesGetSample.ts +[serviceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesListSample.ts +[stepscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsCreateOrUpdateSample.ts +[stepsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsDeleteSample.ts +[stepsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsGetSample.ts +[stepslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsListSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-deploymentmanager?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deploymentmanager/arm-deploymentmanager/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/package.json b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/package.json new file mode 100644 index 000000000000..d40b78b7045e --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-deploymentmanager-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/deploymentmanager/arm-deploymentmanager" + }, + "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/deploymentmanager/arm-deploymentmanager", + "dependencies": { + "@azure/arm-deploymentmanager": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/sample.env b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-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/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesCreateOrUpdateSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..1d86881c943d --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesCreateOrUpdateSample.ts @@ -0,0 +1,89 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + ArtifactSource, + ArtifactSourcesCreateOrUpdateOptionalParams, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Synchronously creates a new artifact source or updates an existing artifact source. + * + * @summary Synchronously creates a new artifact source or updates an existing artifact source. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_createorupdate.json + */ +async function createArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const artifactSourceName = "myArtifactSource"; + const artifactSourceInfo: ArtifactSource = { + authentication: { + type: "Sas", + sasUri: + "https://mystorageaccount.blob.core.windows.net/myartifactsource?st=2018-07-07T14%3A10%3A00Z&se=2019-12-31T15%3A10%3A00Z&sp=rl&sv=2017-04-17&sr=c&sig=Yh2SoJ1NhhLRwCLln7de%2Fkabcdefghijklmno5sWEIk%3D" + }, + location: "centralus", + sourceType: "AzureStorage", + tags: {} + }; + const options: ArtifactSourcesCreateOrUpdateOptionalParams = { + artifactSourceInfo + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.createOrUpdate( + resourceGroupName, + artifactSourceName, + options + ); + console.log(result); +} + +createArtifactSource().catch(console.error); + +/** + * This sample demonstrates how to Synchronously creates a new artifact source or updates an existing artifact source. + * + * @summary Synchronously creates a new artifact source or updates an existing artifact source. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_createorupdate_artifactroot.json + */ +async function createArtifactSourceWithArtifactRootAnOffsetIntoTheStorageContainer() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const artifactSourceName = "myArtifactSource"; + const artifactSourceInfo: ArtifactSource = { + artifactRoot: "1.0.0.0", + authentication: { + type: "Sas", + sasUri: + "https://mystorageaccount.blob.core.windows.net/myartifactsource?st=2018-07-07T14%3A10%3A00Z&se=2019-12-31T15%3A10%3A00Z&sp=rl&sv=2017-04-17&sr=c&sig=Yh2SoJ1NhhLRwCLln7de%2Fkabcdefghijklmno5sWEIk%3D" + }, + location: "centralus", + sourceType: "AzureStorage", + tags: {} + }; + const options: ArtifactSourcesCreateOrUpdateOptionalParams = { + artifactSourceInfo + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.createOrUpdate( + resourceGroupName, + artifactSourceName, + options + ); + console.log(result); +} + +createArtifactSourceWithArtifactRootAnOffsetIntoTheStorageContainer().catch( + console.error +); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesDeleteSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesDeleteSample.ts new file mode 100644 index 000000000000..1d7639a302b7 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes an artifact source. + * + * @summary Deletes an artifact source. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_delete.json + */ +async function deleteArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const artifactSourceName = "myArtifactSource"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.delete( + resourceGroupName, + artifactSourceName + ); + console.log(result); +} + +deleteArtifactSource().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesGetSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesGetSample.ts new file mode 100644 index 000000000000..86cec067fe1d --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets an artifact source. + * + * @summary Gets an artifact source. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_get.json + */ +async function getArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const artifactSourceName = "myArtifactSource"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.get( + resourceGroupName, + artifactSourceName + ); + console.log(result); +} + +getArtifactSource().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesListSample.ts new file mode 100644 index 000000000000..3cbf400a46e6 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/artifactSourcesListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the artifact sources in a resource group. + * + * @summary Lists the artifact sources in a resource group. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsources_list.json + */ +async function listSteps() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.artifactSources.list(resourceGroupName); + console.log(result); +} + +listSteps().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/operationsListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..84ac3c3aa379 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/operationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the supported operations. + * + * @summary Lists the supported operations. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/operations_list.json + */ +async function getOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.operations.list(); + console.log(result); +} + +getOperations().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsCancelSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsCancelSample.ts new file mode 100644 index 000000000000..bb76762c1c7b --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsCancelSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Only running rollouts can be canceled. + * + * @summary Only running rollouts can be canceled. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_post_cancel.json + */ +async function cancelRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.cancel(resourceGroupName, rolloutName); + console.log(result); +} + +cancelRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsCreateOrUpdateSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..1ea5248ec569 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsCreateOrUpdateSample.ts @@ -0,0 +1,81 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + RolloutRequest, + RolloutsCreateOrUpdateOptionalParams, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This is an asynchronous operation and can be polled to completion using the location header returned by this operation. + * + * @summary This is an asynchronous operation and can be polled to completion using the location header returned by this operation. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_createorupdate.json + */ +async function createOrUpdateRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const rolloutRequest: RolloutRequest = { + artifactSourceId: + "/subscriptions/caac1590-e859-444f-a9e0-62091c0f5929/resourceGroups/myResourceGroup/Microsoft.DeploymentManager/artifactSources/myArtifactSource", + buildVersion: "1.0.0.1", + identity: { + type: "userAssigned", + identityIds: [ + "/subscriptions/caac1590-e859-444f-a9e0-62091c0f5929/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userassignedidentities/myuseridentity" + ] + }, + location: "centralus", + stepGroups: [ + { + name: "FirstRegion", + deploymentTargetId: + "Microsoft.DeploymentManager/serviceTopologies/myTopology/services/myService/serviceUnits/myServiceUnit1'", + postDeploymentSteps: [ + { stepId: "Microsoft.DeploymentManager/steps/postDeployStep1" } + ], + preDeploymentSteps: [ + { stepId: "Microsoft.DeploymentManager/steps/preDeployStep1" }, + { stepId: "Microsoft.DeploymentManager/steps/preDeployStep2" } + ] + }, + { + name: "SecondRegion", + dependsOnStepGroups: ["FirstRegion"], + deploymentTargetId: + "Microsoft.DeploymentManager/serviceTopologies/myTopology/services/myService/serviceUnits/myServiceUnit2'", + postDeploymentSteps: [ + { stepId: "Microsoft.DeploymentManager/steps/postDeployStep5" } + ], + preDeploymentSteps: [ + { stepId: "Microsoft.DeploymentManager/steps/preDeployStep3" }, + { stepId: "Microsoft.DeploymentManager/steps/preDeployStep4" } + ] + } + ], + tags: {}, + targetServiceTopologyId: + "/subscriptions/caac1590-e859-444f-a9e0-62091c0f5929/resourceGroups/myResourceGroup/Microsoft.DeploymentManager/serviceTopologies/myTopology" + }; + const options: RolloutsCreateOrUpdateOptionalParams = { rolloutRequest }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.beginCreateOrUpdateAndWait( + resourceGroupName, + rolloutName, + options + ); + console.log(result); +} + +createOrUpdateRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsDeleteSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsDeleteSample.ts new file mode 100644 index 000000000000..a80c656f63f4 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsDeleteSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Only rollouts in terminal state can be deleted. + * + * @summary Only rollouts in terminal state can be deleted. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_delete.json + */ +async function deleteRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.delete(resourceGroupName, rolloutName); + console.log(result); +} + +deleteRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsGetSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsGetSample.ts new file mode 100644 index 000000000000..03eb5efc6135 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets detailed information of a rollout. + * + * @summary Gets detailed information of a rollout. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_get.json + */ +async function getRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.get(resourceGroupName, rolloutName); + console.log(result); +} + +getRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsListSample.ts new file mode 100644 index 000000000000..0773f7db3a4d --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the rollouts in a resource group. + * + * @summary Lists the rollouts in a resource group. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollouts_list.json + */ +async function listRolloutsByResourceGroup() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.list(resourceGroupName); + console.log(result); +} + +listRolloutsByResourceGroup().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsRestartSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsRestartSample.ts new file mode 100644 index 000000000000..d59bbb85530c --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/rolloutsRestartSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RolloutsRestartOptionalParams, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Only failed rollouts can be restarted. + * + * @summary Only failed rollouts can be restarted. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_post_restart.json + */ +async function restartRollout() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const rolloutName = "myRollout"; + const skipSucceeded = true; + const options: RolloutsRestartOptionalParams = { skipSucceeded }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.rollouts.restart( + resourceGroupName, + rolloutName, + options + ); + console.log(result); +} + +restartRollout().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesCreateOrUpdateSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..9c754c280861 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesCreateOrUpdateSample.ts @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + ServiceTopologyResource, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Synchronously creates a new service topology or updates an existing service topology. + * + * @summary Synchronously creates a new service topology or updates an existing service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_createorupdate.json + */ +async function createATopologyWithArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceTopologyInfo: ServiceTopologyResource = { + artifactSourceId: + "Microsoft.DeploymentManager/artifactSources/myArtifactSource", + location: "centralus", + tags: {} + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.createOrUpdate( + resourceGroupName, + serviceTopologyName, + serviceTopologyInfo + ); + console.log(result); +} + +createATopologyWithArtifactSource().catch(console.error); + +/** + * This sample demonstrates how to Synchronously creates a new service topology or updates an existing service topology. + * + * @summary Synchronously creates a new service topology or updates an existing service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_createorupdate_noartifactsource.json + */ +async function createATopologyWithoutArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceTopologyInfo: ServiceTopologyResource = { + location: "centralus", + tags: {} + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.createOrUpdate( + resourceGroupName, + serviceTopologyName, + serviceTopologyInfo + ); + console.log(result); +} + +createATopologyWithoutArtifactSource().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesDeleteSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesDeleteSample.ts new file mode 100644 index 000000000000..3802c776a4f9 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the service topology. + * + * @summary Deletes the service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_delete.json + */ +async function deleteTopology() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.delete( + resourceGroupName, + serviceTopologyName + ); + console.log(result); +} + +deleteTopology().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesGetSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesGetSample.ts new file mode 100644 index 000000000000..c6517b5718a5 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the service topology. + * + * @summary Gets the service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_get.json + */ +async function getTopology() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.get( + resourceGroupName, + serviceTopologyName + ); + console.log(result); +} + +getTopology().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesListSample.ts new file mode 100644 index 000000000000..6b734e2a2aa8 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceTopologiesListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the service topologies in the resource group. + * + * @summary Lists the service topologies in the resource group. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopologies_list.json + */ +async function listTopologies() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceTopologies.list(resourceGroupName); + console.log(result); +} + +listTopologies().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsCreateOrUpdateSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..81b256b95b11 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsCreateOrUpdateSample.ts @@ -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. +import { + ServiceUnitResource, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. + * + * @summary This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_createorupdate_noartifactsource.json + */ +async function createServiceUnitUsingSasUrIs() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceUnitName = "myServiceUnit"; + const serviceUnitInfo: ServiceUnitResource = { + artifacts: { + parametersUri: + "https://mystorageaccount.blob.core.windows.net/myartifactsource/parameter/myTopologyUnit.parameters.json?st=2018-07-07T14%3A10%3A00Z&se=2019-12-31T15%3A10%3A00Z&sp=rl&sv=2017-04-17&sr=c&sig=Yh2SoJ1NhhLRwCLln7de%2Fkabcdefghijklmno5sWEIk%3D", + templateUri: + "https://mystorageaccount.blob.core.windows.net/myartifactsource/templates/myTopologyUnit.template.json?st=2018-07-07T14%3A10%3A00Z&se=2019-12-31T15%3A10%3A00Z&sp=rl&sv=2017-04-17&sr=c&sig=Yh2SoJ1NhhLRwCLln7de%2Fkabcdefghijklmno5sWEIk%3D" + }, + deploymentMode: "Incremental", + location: "centralus", + tags: {}, + targetResourceGroup: "myDeploymentResourceGroup" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.beginCreateOrUpdateAndWait( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + serviceUnitInfo + ); + console.log(result); +} + +createServiceUnitUsingSasUrIs().catch(console.error); + +/** + * This sample demonstrates how to This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. + * + * @summary This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_createorupdate.json + */ +async function createServiceUnitUsingRelativePathsIntoTheArtifactSource() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceUnitName = "myServiceUnit"; + const serviceUnitInfo: ServiceUnitResource = { + artifacts: { + parametersArtifactSourceRelativePath: + "parameter/myTopologyUnit.parameters.json", + templateArtifactSourceRelativePath: + "templates/myTopologyUnit.template.json" + }, + deploymentMode: "Incremental", + location: "centralus", + tags: {}, + targetResourceGroup: "myDeploymentResourceGroup" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.beginCreateOrUpdateAndWait( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + serviceUnitInfo + ); + console.log(result); +} + +createServiceUnitUsingRelativePathsIntoTheArtifactSource().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsDeleteSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsDeleteSample.ts new file mode 100644 index 000000000000..0b857d234c4e --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsDeleteSample.ts @@ -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. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the service unit. + * + * @summary Deletes the service unit. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_delete.json + */ +async function deleteServiceUnit() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceUnitName = "myServiceUnit"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.delete( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName + ); + console.log(result); +} + +deleteServiceUnit().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsGetSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsGetSample.ts new file mode 100644 index 000000000000..2f95cf5f92d3 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsGetSample.ts @@ -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. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the service unit. + * + * @summary Gets the service unit. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_get.json + */ +async function getServiceUnit() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceUnitName = "myServiceUnit"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.get( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName + ); + console.log(result); +} + +getServiceUnit().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsListSample.ts new file mode 100644 index 000000000000..5716ac3fc068 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/serviceUnitsListSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the service units under a service in the service topology. + * + * @summary Lists the service units under a service in the service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunits_list.json + */ +async function listServiceUnits() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.serviceUnits.list( + resourceGroupName, + serviceTopologyName, + serviceName + ); + console.log(result); +} + +listServiceUnits().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesCreateOrUpdateSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..23de9ca2df58 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesCreateOrUpdateSample.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 { + ServiceResource, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Synchronously creates a new service or updates an existing service. + * + * @summary Synchronously creates a new service or updates an existing service. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_createorupdate.json + */ +async function createService() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const serviceInfo: ServiceResource = { + location: "centralus", + tags: {}, + targetLocation: "centralus", + targetSubscriptionId: "600c95c5-3ee5-44fe-b190-ca38a19adcd7" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.services.createOrUpdate( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceInfo + ); + console.log(result); +} + +createService().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesDeleteSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesDeleteSample.ts new file mode 100644 index 000000000000..6f790defad44 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the service. + * + * @summary Deletes the service. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_delete.json + */ +async function deleteService() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.services.delete( + resourceGroupName, + serviceTopologyName, + serviceName + ); + console.log(result); +} + +deleteService().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesGetSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesGetSample.ts new file mode 100644 index 000000000000..b1255a81a583 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the service. + * + * @summary Gets the service. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_get.json + */ +async function getService() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const serviceName = "myService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.services.get( + resourceGroupName, + serviceTopologyName, + serviceName + ); + console.log(result); +} + +getService().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesListSample.ts new file mode 100644 index 000000000000..88975d798a0d --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/servicesListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the services in the service topology. + * + * @summary Lists the services in the service topology. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/services_list.json + */ +async function listServices() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const serviceTopologyName = "myTopology"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.services.list( + resourceGroupName, + serviceTopologyName + ); + console.log(result); +} + +listServices().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsCreateOrUpdateSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..0bcaf901d043 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsCreateOrUpdateSample.ts @@ -0,0 +1,131 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + StepResource, + StepsCreateOrUpdateOptionalParams, + AzureDeploymentManager +} from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Synchronously creates a new step or updates an existing step. + * + * @summary Synchronously creates a new step or updates an existing step. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_health_check_createorupdate.json + */ +async function createHealthCheckStep() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const stepName = "healthCheckStep"; + const stepInfo: StepResource = { + location: "centralus", + properties: { + attributes: { + type: "REST", + healthChecks: [ + { + name: "appHealth", + response: { + regex: { + matchQuantifier: "All", + matches: [ + "(?i)Contoso-App", + '(?i)"health_status":((.|\n)*)"(green|yellow)"', + '(?mi)^("application_host": 94781052)$' + ] + }, + successStatusCodes: ["OK"] + }, + request: { + method: "GET", + authentication: { + name: "Code", + type: "ApiKey", + in: "Query", + value: "" + }, + uri: + "https://resthealth.healthservice.com/api/applications/contosoApp/healthStatus" + } + }, + { + name: "serviceHealth", + response: { + regex: { + matchQuantifier: "All", + matches: [ + "(?i)Contoso-Service-EndToEnd", + '(?i)"health_status":((.|\n)*)"(green)"' + ] + }, + successStatusCodes: ["OK"] + }, + request: { + method: "GET", + authentication: { + name: "code", + type: "ApiKey", + in: "Header", + value: "" + }, + uri: + "https://resthealth.healthservice.com/api/services/contosoService/healthStatus" + } + } + ], + healthyStateDuration: "PT2H", + maxElasticDuration: "PT30M", + waitDuration: "PT15M" + }, + stepType: "HealthCheck" + }, + tags: {} + }; + const options: StepsCreateOrUpdateOptionalParams = { stepInfo }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.createOrUpdate( + resourceGroupName, + stepName, + options + ); + console.log(result); +} + +createHealthCheckStep().catch(console.error); + +/** + * This sample demonstrates how to Synchronously creates a new step or updates an existing step. + * + * @summary Synchronously creates a new step or updates an existing step. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_wait_createorupdate.json + */ +async function createWaitStep() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const stepName = "waitStep"; + const stepInfo: StepResource = { + location: "centralus", + properties: { attributes: { duration: "PT20M" }, stepType: "Wait" }, + tags: {} + }; + const options: StepsCreateOrUpdateOptionalParams = { stepInfo }; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.createOrUpdate( + resourceGroupName, + stepName, + options + ); + console.log(result); +} + +createWaitStep().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsDeleteSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsDeleteSample.ts new file mode 100644 index 000000000000..f8d86fa93290 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsDeleteSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the step. + * + * @summary Deletes the step. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_delete.json + */ +async function deleteDeploymentStep() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const stepName = "deploymentStep1"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.delete(resourceGroupName, stepName); + console.log(result); +} + +deleteDeploymentStep().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsGetSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsGetSample.ts new file mode 100644 index 000000000000..b1c141111b85 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the step. + * + * @summary Gets the step. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_get.json + */ +async function getDeploymentStep() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const stepName = "waitStep"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.get(resourceGroupName, stepName); + console.log(result); +} + +getDeploymentStep().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsListSample.ts b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsListSample.ts new file mode 100644 index 000000000000..04aaa5f5a9df --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/src/stepsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDeploymentManager } from "@azure/arm-deploymentmanager"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the steps in a resource group. + * + * @summary Lists the steps in a resource group. + * x-ms-original-file: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/steps_list.json + */ +async function listSteps() { + const subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new AzureDeploymentManager(credential, subscriptionId); + const result = await client.steps.list(resourceGroupName); + console.log(result); +} + +listSteps().catch(console.error); diff --git a/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/tsconfig.json b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..416c2dd82e00 --- /dev/null +++ b/sdk/deploymentmanager/arm-deploymentmanager/samples/v4-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "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/deploymentmanager/arm-deploymentmanager/src/azureDeploymentManager.ts b/sdk/deploymentmanager/arm-deploymentmanager/src/azureDeploymentManager.ts index ffe6ef7bd9b1..0b5cc89fabe9 100644 --- a/sdk/deploymentmanager/arm-deploymentmanager/src/azureDeploymentManager.ts +++ b/sdk/deploymentmanager/arm-deploymentmanager/src/azureDeploymentManager.ts @@ -7,6 +7,7 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { ServiceTopologiesImpl, @@ -61,7 +62,7 @@ export class AzureDeploymentManager extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-deploymentmanager/4.0.0-beta.2`; + const packageDetails = `azsdk-js-arm-deploymentmanager/4.0.0-beta.3`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -76,9 +77,33 @@ export class AzureDeploymentManager extends coreClient.ServiceClient { userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint || "https://management.azure.com" + baseUri: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + } // Parameter assignments this.subscriptionId = subscriptionId; diff --git a/sdk/deploymentmanager/arm-deploymentmanager/src/operations/rollouts.ts b/sdk/deploymentmanager/arm-deploymentmanager/src/operations/rollouts.ts index 561cccb1420e..b2a408f03dfb 100644 --- a/sdk/deploymentmanager/arm-deploymentmanager/src/operations/rollouts.ts +++ b/sdk/deploymentmanager/arm-deploymentmanager/src/operations/rollouts.ts @@ -100,10 +100,12 @@ export class RolloutsImpl implements Rollouts { { resourceGroupName, rolloutName, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/deploymentmanager/arm-deploymentmanager/src/operations/serviceUnits.ts b/sdk/deploymentmanager/arm-deploymentmanager/src/operations/serviceUnits.ts index c0999e53e347..8f259d31b15d 100644 --- a/sdk/deploymentmanager/arm-deploymentmanager/src/operations/serviceUnits.ts +++ b/sdk/deploymentmanager/arm-deploymentmanager/src/operations/serviceUnits.ts @@ -110,10 +110,12 @@ export class ServiceUnitsImpl implements ServiceUnits { }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/deploymentmanager/arm-deploymentmanager/tsconfig.json b/sdk/deploymentmanager/arm-deploymentmanager/tsconfig.json index 6e3251194117..a4b8acb581bc 100644 --- a/sdk/deploymentmanager/arm-deploymentmanager/tsconfig.json +++ b/sdk/deploymentmanager/arm-deploymentmanager/tsconfig.json @@ -9,11 +9,25 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true + "importHelpers": true, + "paths": { + "@azure/arm-deploymentmanager": [ + "./src/index" + ] + } }, - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "exclude": ["node_modules"] -} + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/deploymentmanager/ci.mgmt.yml b/sdk/deploymentmanager/ci.mgmt.yml index c5a26a29edd3..22201dcffa6f 100644 --- a/sdk/deploymentmanager/ci.mgmt.yml +++ b/sdk/deploymentmanager/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -9,7 +9,7 @@ trigger: paths: include: - sdk/deploymentmanager/ci.mgmt.yml - - sdk/deploymentmanager/arm-deploymentmanager/ + - sdk/deploymentmanager/arm-deploymentmanager pr: branches: include: @@ -22,12 +22,11 @@ pr: paths: include: - sdk/deploymentmanager/ci.mgmt.yml - - sdk/deploymentmanager/arm-deploymentmanager/ - + - sdk/deploymentmanager/arm-deploymentmanager extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: deploymentmanager Artifacts: - name: azure-arm-deploymentmanager - safeName: azurearmdeploymentmanager \ No newline at end of file + safeName: azurearmdeploymentmanager diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/CHANGELOG.md b/sdk/desktopvirtualization/arm-desktopvirtualization/CHANGELOG.md index 20ec0c7f46c0..8e8ddd8c4799 100644 --- a/sdk/desktopvirtualization/arm-desktopvirtualization/CHANGELOG.md +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/CHANGELOG.md @@ -1,14 +1,10 @@ # Release History -## 1.0.0-beta.3 (Unreleased) +## 1.0.0-beta.3 (2022-04-18) -### Features Added +**features** -### Breaking Changes - -### Bugs Fixed - -### Other Changes + - bug fix ## 1.0.0-beta.2 (2021-12-27) diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/LICENSE b/sdk/desktopvirtualization/arm-desktopvirtualization/LICENSE index ccb63b166732..5d1d36e0af80 100644 --- a/sdk/desktopvirtualization/arm-desktopvirtualization/LICENSE +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2021 Microsoft +Copyright (c) 2022 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 diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/README.md b/sdk/desktopvirtualization/arm-desktopvirtualization/README.md index 2410ec605f9f..fcbb07798fd4 100644 --- a/sdk/desktopvirtualization/arm-desktopvirtualization/README.md +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/README.md @@ -16,6 +16,8 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f - [LTS versions of Node.js](https://nodejs.org/about/releases/) - 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]. @@ -49,8 +51,17 @@ For more information about how to create an Azure AD Application check out [this ```javascript const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); 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 DesktopVirtualizationAPIClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); ``` diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/_meta.json b/sdk/desktopvirtualization/arm-desktopvirtualization/_meta.json index 6f14536ae603..fc2e2269a42f 100644 --- a/sdk/desktopvirtualization/arm-desktopvirtualization/_meta.json +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/_meta.json @@ -1,7 +1,8 @@ { "commit": "c77c6c634dc3644d65d3e35df5d73a9c34d3c956", - "readme": "specification/desktopvirtualization/resource-manager/readme.md", - "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/desktopvirtualization/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211217.1", + "readme": "specification\\desktopvirtualization\\resource-manager\\readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\desktopvirtualization\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20211217.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.2.6", + "use": "@autorest/typescript@6.0.0-alpha.19.20220408.1" } \ No newline at end of file diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/api-extractor.json b/sdk/desktopvirtualization/arm-desktopvirtualization/api-extractor.json index 19402970b50e..391ea6b62b0f 100644 --- a/sdk/desktopvirtualization/arm-desktopvirtualization/api-extractor.json +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/api-extractor.json @@ -1,18 +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" }, + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, "dtsRollup": { "enabled": true, "untrimmedFilePath": "", "publicTrimmedFilePath": "./types/arm-desktopvirtualization.d.ts" }, "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } } } -} +} \ No newline at end of file diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/package.json b/sdk/desktopvirtualization/arm-desktopvirtualization/package.json index 32d3003f383e..32a4c684dfd9 100644 --- a/sdk/desktopvirtualization/arm-desktopvirtualization/package.json +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/package.json @@ -9,9 +9,9 @@ }, "dependencies": { "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.5.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -28,12 +28,12 @@ "devDependencies": { "@microsoft/api-extractor": "^7.18.11", "@rollup/plugin-commonjs": "^21.0.1", - "@rollup/plugin-json": "^4.0.0", - "@rollup/plugin-multi-entry": "^3.0.0", - "@rollup/plugin-node-resolve": "^8.0.0", + "@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.0.0", - "rollup-plugin-sourcemaps": "^0.4.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.2.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", @@ -96,5 +96,21 @@ "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true + "//metadata": { + "constantPaths": [ + { + "path": "src/desktopVirtualizationAPIClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-desktopvirtualization?view=azure-node-preview" + } } diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/rollup.config.js b/sdk/desktopvirtualization/arm-desktopvirtualization/rollup.config.js index 9be1955eb7f1..3f89d7309da5 100644 --- a/sdk/desktopvirtualization/arm-desktopvirtualization/rollup.config.js +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/rollup.config.js @@ -14,62 +14,14 @@ import json from "@rollup/plugin-json"; import nodeBuiltins from "builtin-modules"; -/** - * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. - * - * NOTE: this manual configuration is only needed because OpenTelemetry uses an - * __exportStar downleveled helper function to declare its exports which confuses - * rollup's automatic discovery mechanism. - * - * @returns an object reference that can be `...`'d into your cjs() configuration. - */ -export function openTelemetryCommonJs() { - const namedExports = {}; - - for (const key of [ - "@opentelemetry/api", - "@azure/core-tracing/node_modules/@opentelemetry/api" - ]) { - namedExports[key] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "SpanStatusCode", - "getSpanContext", - "setSpanContext" - ]; - } - - const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; - - for (const version of releasedOpenTelemetryVersions) { - namedExports[ - // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. - `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` - ] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "StatusCode", - "CanonicalCode", - "getSpanContext", - "setSpanContext" - ]; - } - - return namedExports; -} - // #region Warning Handler /** - * A function that can determine whether a rollupwarning should be ignored. If + * 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 ignoreNiseSinonEvalWarnings(warning) { +function ignoreNiseSinonEval(warning) { return ( warning.code === "EVAL" && warning.id && @@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) { ); } -function ignoreChaiCircularDependencyWarnings(warning) { +function ignoreChaiCircularDependency(warning) { return ( warning.code === "CIRCULAR_DEPENDENCY" && warning.importer && warning.importer.includes("node_modules/chai") === true ); } -const warningInhibitors = [ - ignoreChaiCircularDependencyWarnings, - ignoreNiseSinonEvalWarnings -]; +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; /** * Construct a warning handler for the shared rollup configuration @@ -122,22 +71,7 @@ function makeBrowserTestConfig() { nodeResolve({ mainFields: ["module", "browser"] }), - cjs({ - namedExports: { - // Chai's strange internal architecture makes it impossible to statically - // analyze its exports. - chai: [ - "version", - "use", - "util", - "config", - "expect", - "should", - "assert" - ], - ...openTelemetryCommonJs() - } - }), + cjs(), json(), sourcemaps() //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) @@ -173,7 +107,7 @@ export function makeConfig(pkg, options) { ], output: { file: "dist/index.js", format: "cjs", sourcemap: true }, preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve(), cjs()] + plugins: [sourcemaps(), nodeResolve()] }; const config = [baseConfig]; diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/sample.env b/sdk/desktopvirtualization/arm-desktopvirtualization/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/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/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsCreateOrUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..84d5e6a20ca1 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsCreateOrUpdateSample.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 { + ApplicationGroup, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update an applicationGroup. + * + * @summary Create or update an applicationGroup. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Create.json + */ +async function applicationGroupCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationGroup: ApplicationGroup = { + description: "des1", + applicationGroupType: "RemoteApp", + friendlyName: "friendly", + hostPoolArmPath: + "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1", + location: "centralus", + migrationRequest: { + migrationPath: + "TenantGroups/{defaultV1TenantGroup.Name}/Tenants/{defaultV1Tenant.Name}/HostPools/{sessionHostPool.Name}", + operation: "Start" + }, + tags: { tag1: "value1", tag2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applicationGroups.createOrUpdate( + resourceGroupName, + applicationGroupName, + applicationGroup + ); + console.log(result); +} + +applicationGroupCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsDeleteSample.ts new file mode 100644 index 000000000000..ce3c686421f0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove an applicationGroup. + * + * @summary Remove an applicationGroup. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Delete.json + */ +async function applicationGroupDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applicationGroups.delete( + resourceGroupName, + applicationGroupName + ); + console.log(result); +} + +applicationGroupDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsGetSample.ts new file mode 100644 index 000000000000..60f81db8c9a0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get an application group. + * + * @summary Get an application group. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Get.json + */ +async function applicationGroupGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applicationGroups.get( + resourceGroupName, + applicationGroupName + ); + console.log(result); +} + +applicationGroupGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsListByResourceGroupSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsListByResourceGroupSample.ts new file mode 100644 index 000000000000..da9453e8156f --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsListByResourceGroupSample.ts @@ -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. +import { + ApplicationGroupsListByResourceGroupOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List applicationGroups. + * + * @summary List applicationGroups. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_ListByResourceGroup.json + */ +async function applicationGroupListByResourceGroup() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const filter = "applicationGroupType eq 'RailApplication'"; + const options: ApplicationGroupsListByResourceGroupOptionalParams = { + filter + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applicationGroups.listByResourceGroup( + resourceGroupName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +applicationGroupListByResourceGroup().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsListBySubscriptionSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsListBySubscriptionSample.ts new file mode 100644 index 000000000000..2fe00c52404a --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsListBySubscriptionSample.ts @@ -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. +import { + ApplicationGroupsListBySubscriptionOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List applicationGroups in subscription. + * + * @summary List applicationGroups in subscription. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_ListBySubscription.json + */ +async function applicationGroupList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const filter = "applicationGroupType eq 'RailApplication'"; + const options: ApplicationGroupsListBySubscriptionOptionalParams = { filter }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applicationGroups.listBySubscription(options)) { + resArray.push(item); + } + console.log(resArray); +} + +applicationGroupList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsUpdateSample.ts new file mode 100644 index 000000000000..438c18aaf4e0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationGroupsUpdateSample.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 { + ApplicationGroupPatch, + ApplicationGroupsUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update an applicationGroup. + * + * @summary Update an applicationGroup. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Update.json + */ +async function applicationGroupsUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationGroup: ApplicationGroupPatch = { + description: "des1", + friendlyName: "friendly", + tags: { tag1: "value1", tag2: "value2" } + }; + const options: ApplicationGroupsUpdateOptionalParams = { applicationGroup }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applicationGroups.update( + resourceGroupName, + applicationGroupName, + options + ); + console.log(result); +} + +applicationGroupsUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsCreateOrUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ae286c7a6f76 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsCreateOrUpdateSample.ts @@ -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. +import { + Application, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update an application. + * + * @summary Create or update an application. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Create.json + */ +async function applicationCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationName = "application1"; + const application: Application = { + description: "des1", + commandLineArguments: "arguments", + commandLineSetting: "Allow", + filePath: "path", + friendlyName: "friendly", + iconIndex: 1, + iconPath: "icon", + showInPortal: true + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applications.createOrUpdate( + resourceGroupName, + applicationGroupName, + applicationName, + application + ); + console.log(result); +} + +applicationCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsDeleteSample.ts new file mode 100644 index 000000000000..57209ff29e8c --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove an application. + * + * @summary Remove an application. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Delete.json + */ +async function applicationDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationName = "application1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applications.delete( + resourceGroupName, + applicationGroupName, + applicationName + ); + console.log(result); +} + +applicationDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsGetSample.ts new file mode 100644 index 000000000000..f54ce8448617 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get an application. + * + * @summary Get an application. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Get.json + */ +async function applicationGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationName = "application1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applications.get( + resourceGroupName, + applicationGroupName, + applicationName + ); + console.log(result); +} + +applicationGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsListSample.ts new file mode 100644 index 000000000000..d262a4037e7f --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsListSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List applications. + * + * @summary List applications. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_List.json + */ +async function applicationsList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applications.list( + resourceGroupName, + applicationGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +applicationsList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsUpdateSample.ts new file mode 100644 index 000000000000..6d3dec85bed4 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/applicationsUpdateSample.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 { + ApplicationPatch, + ApplicationsUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update an application. + * + * @summary Update an application. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Update.json + */ +async function applicationUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationName = "application1"; + const application: ApplicationPatch = { + description: "des1", + applicationType: "InBuilt", + commandLineArguments: "arguments", + commandLineSetting: "Allow", + filePath: "path", + friendlyName: "friendly", + iconIndex: 1, + iconPath: "icon", + msixPackageApplicationId: undefined, + msixPackageFamilyName: undefined, + showInPortal: true + }; + const options: ApplicationsUpdateOptionalParams = { application }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applications.update( + resourceGroupName, + applicationGroupName, + applicationName, + options + ); + console.log(result); +} + +applicationUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/desktopsGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/desktopsGetSample.ts new file mode 100644 index 000000000000..f8b879624070 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/desktopsGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a desktop. + * + * @summary Get a desktop. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_Get.json + */ +async function desktopGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const desktopName = "SessionDesktop"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.desktops.get( + resourceGroupName, + applicationGroupName, + desktopName + ); + console.log(result); +} + +desktopGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/desktopsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/desktopsListSample.ts new file mode 100644 index 000000000000..1a1e34451c30 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/desktopsListSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List desktops. + * + * @summary List desktops. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_List.json + */ +async function desktopList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.desktops.list( + resourceGroupName, + applicationGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +desktopList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/desktopsUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/desktopsUpdateSample.ts new file mode 100644 index 000000000000..1c8f58fc2976 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/desktopsUpdateSample.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 { + DesktopPatch, + DesktopsUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a desktop. + * + * @summary Update a desktop. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_Update.json + */ +async function desktopUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const desktopName = "SessionDesktop"; + const desktop: DesktopPatch = { + description: "des1", + friendlyName: "friendly" + }; + const options: DesktopsUpdateOptionalParams = { desktop }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.desktops.update( + resourceGroupName, + applicationGroupName, + desktopName, + options + ); + console.log(result); +} + +desktopUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsCreateOrUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..26653cd9e735 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsCreateOrUpdateSample.ts @@ -0,0 +1,65 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + HostPool, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update a host pool. + * + * @summary Create or update a host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Create.json + */ +async function hostPoolCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const hostPool: HostPool = { + description: "des1", + customRdpProperty: undefined, + friendlyName: "friendly", + hostPoolType: "Pooled", + loadBalancerType: "BreadthFirst", + location: "centralus", + maxSessionLimit: 999999, + migrationRequest: { + migrationPath: + "TenantGroups/{defaultV1TenantGroup.Name}/Tenants/{defaultV1Tenant.Name}/HostPools/{sessionHostPool.Name}", + operation: "Start" + }, + personalDesktopAssignmentType: "Automatic", + preferredAppGroupType: "Desktop", + publicNetworkAccess: "Enabled", + registrationInfo: { + expirationTime: new Date("2020-10-01T14:01:54.9571247Z"), + registrationTokenOperation: "Update" + }, + ssoClientId: "client", + ssoClientSecretKeyVaultPath: "https://keyvault/secret", + ssoSecretType: "SharedKey", + ssoadfsAuthority: "https://adfs", + startVMOnConnect: false, + tags: { tag1: "value1", tag2: "value2" }, + vmTemplate: "{json:json}" + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.createOrUpdate( + resourceGroupName, + hostPoolName, + hostPool + ); + console.log(result); +} + +hostPoolCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsDeleteSample.ts new file mode 100644 index 000000000000..2579f8b52d59 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsDeleteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + HostPoolsDeleteOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a host pool. + * + * @summary Remove a host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Delete.json + */ +async function hostPoolDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const force = true; + const options: HostPoolsDeleteOptionalParams = { force }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.delete( + resourceGroupName, + hostPoolName, + options + ); + console.log(result); +} + +hostPoolDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsGetSample.ts new file mode 100644 index 000000000000..4d220cedf48a --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a host pool. + * + * @summary Get a host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Get.json + */ +async function hostPoolGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.get(resourceGroupName, hostPoolName); + console.log(result); +} + +hostPoolGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsListByResourceGroupSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsListByResourceGroupSample.ts new file mode 100644 index 000000000000..f57842501769 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List hostPools. + * + * @summary List hostPools. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_ListByResourceGroup.json + */ +async function hostPoolListByResourceGroup() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.hostPools.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +hostPoolListByResourceGroup().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsListSample.ts new file mode 100644 index 000000000000..818e9c551775 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List hostPools in subscription. + * + * @summary List hostPools in subscription. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_List.json + */ +async function hostPoolList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.hostPools.list()) { + resArray.push(item); + } + console.log(resArray); +} + +hostPoolList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsRetrieveRegistrationTokenSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsRetrieveRegistrationTokenSample.ts new file mode 100644 index 000000000000..d33a2c8da357 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsRetrieveRegistrationTokenSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Registration token of the host pool. + * + * @summary Registration token of the host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPools_RetrieveRegistrationToken_Post.json + */ +async function hostPoolsRetrieveRegistrationTokenPost() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.retrieveRegistrationToken( + resourceGroupName, + hostPoolName + ); + console.log(result); +} + +hostPoolsRetrieveRegistrationTokenPost().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsUpdateSample.ts new file mode 100644 index 000000000000..0f0fbbd50a72 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/hostPoolsUpdateSample.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + HostPoolPatch, + HostPoolsUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a host pool. + * + * @summary Update a host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Update.json + */ +async function hostPoolUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const hostPool: HostPoolPatch = { + description: "des1", + customRdpProperty: undefined, + friendlyName: "friendly", + loadBalancerType: "BreadthFirst", + maxSessionLimit: 999999, + personalDesktopAssignmentType: "Automatic", + publicNetworkAccess: "Enabled", + registrationInfo: { + expirationTime: new Date("2020-10-01T15:01:54.9571247Z"), + registrationTokenOperation: "Update" + }, + ssoClientId: "client", + ssoClientSecretKeyVaultPath: "https://keyvault/secret", + ssoSecretType: "SharedKey", + ssoadfsAuthority: "https://adfs", + startVMOnConnect: false, + tags: { tag1: "value1", tag2: "value2" }, + vmTemplate: "{json:json}" + }; + const options: HostPoolsUpdateOptionalParams = { hostPool }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.update( + resourceGroupName, + hostPoolName, + options + ); + console.log(result); +} + +hostPoolUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixImagesExpandSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixImagesExpandSample.ts new file mode 100644 index 000000000000..3859b2b3c908 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixImagesExpandSample.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 { + MsixImageURI, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Expands and Lists MSIX packages in an Image, given the Image Path. + * + * @summary Expands and Lists MSIX packages in an Image, given the Image Path. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixImage_Expand_Post.json + */ +async function msixImageExpand() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixImageURI: MsixImageURI = { uri: "imagepath" }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.msixImages.listExpand( + resourceGroupName, + hostPoolName, + msixImageURI + )) { + resArray.push(item); + } + console.log(resArray); +} + +msixImageExpand().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesCreateOrUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..4cece9a01354 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesCreateOrUpdateSample.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + MsixPackage, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update a MSIX package. + * + * @summary Create or update a MSIX package. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Create.json + */ +async function msixPackageCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixPackageFullName = "msixpackagefullname"; + const msixPackage: MsixPackage = { + displayName: "displayname", + imagePath: "imagepath", + isActive: false, + isRegularRegistration: false, + lastUpdated: new Date("2008-09-22T14:01:54.9571247Z"), + packageApplications: [ + { + description: "application-desc", + appId: "ApplicationId", + appUserModelID: "AppUserModelId", + friendlyName: "friendlyname", + iconImageName: "Apptile", + rawIcon: new Uint8Array(), + rawPng: new Uint8Array() + } + ], + packageDependencies: [ + { + dependencyName: "MsixTest_Dependency_Name", + minVersion: "version", + publisher: "PublishedName" + } + ], + packageFamilyName: "MsixPackage_FamilyName", + packageName: "MsixPackage_name", + packageRelativePath: "packagerelativepath", + version: "version" + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.msixPackages.createOrUpdate( + resourceGroupName, + hostPoolName, + msixPackageFullName, + msixPackage + ); + console.log(result); +} + +msixPackageCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesDeleteSample.ts new file mode 100644 index 000000000000..d4abb283ac73 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove an MSIX Package. + * + * @summary Remove an MSIX Package. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Delete.json + */ +async function msixPackageDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixPackageFullName = "packagefullname"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.msixPackages.delete( + resourceGroupName, + hostPoolName, + msixPackageFullName + ); + console.log(result); +} + +msixPackageDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesGetSample.ts new file mode 100644 index 000000000000..5adb1aee65cb --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a msixpackage. + * + * @summary Get a msixpackage. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Get.json + */ +async function msixPackageGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixPackageFullName = "packagefullname"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.msixPackages.get( + resourceGroupName, + hostPoolName, + msixPackageFullName + ); + console.log(result); +} + +msixPackageGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesListSample.ts new file mode 100644 index 000000000000..507db8d4599a --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesListSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List MSIX packages in hostpool. + * + * @summary List MSIX packages in hostpool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_List.json + */ +async function msixPackageList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.msixPackages.list( + resourceGroupName, + hostPoolName + )) { + resArray.push(item); + } + console.log(resArray); +} + +msixPackageList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesUpdateSample.ts new file mode 100644 index 000000000000..bb79b48276f0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/msixPackagesUpdateSample.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 { + MsixPackagePatch, + MsixPackagesUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update an MSIX Package. + * + * @summary Update an MSIX Package. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Update.json + */ +async function msixPackageUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixPackageFullName = "msixpackagefullname"; + const msixPackage: MsixPackagePatch = { + displayName: "displayname", + isActive: true, + isRegularRegistration: false + }; + const options: MsixPackagesUpdateOptionalParams = { msixPackage }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.msixPackages.update( + resourceGroupName, + hostPoolName, + msixPackageFullName, + options + ); + console.log(result); +} + +msixPackageUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/operationsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..93bb53df7fde --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/operationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all of the available operations the Desktop Virtualization resource provider supports. + * + * @summary List all of the available operations the Desktop Virtualization resource provider supports. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/OperationDescription_List.json + */ +async function operationDescriptionList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationDescriptionList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsDeleteByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsDeleteByHostPoolSample.ts new file mode 100644 index 000000000000..0bd7022d7226 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsDeleteByHostPoolSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a connection. + * + * @summary Remove a connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_DeleteByHostPool.json + */ +async function privateEndpointConnectionDeleteByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const privateEndpointConnectionName = + "hostPool1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.deleteByHostPool( + resourceGroupName, + hostPoolName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionDeleteByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsDeleteByWorkspaceSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsDeleteByWorkspaceSample.ts new file mode 100644 index 000000000000..ec03bf7eb741 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsDeleteByWorkspaceSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a connection. + * + * @summary Remove a connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_DeleteByWorkspace.json + */ +async function privateEndpointConnectionDeleteByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const privateEndpointConnectionName = + "workspace1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.deleteByWorkspace( + resourceGroupName, + workspaceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionDeleteByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsGetByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsGetByHostPoolSample.ts new file mode 100644 index 000000000000..0e9a5a379cc6 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsGetByHostPoolSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a private endpoint connection. + * + * @summary Get a private endpoint connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_GetByHostPool.json + */ +async function privateEndpointConnectionGetByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const privateEndpointConnectionName = + "hostPool1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.getByHostPool( + resourceGroupName, + hostPoolName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionGetByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsGetByWorkspaceSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsGetByWorkspaceSample.ts new file mode 100644 index 000000000000..0c1550045cd9 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsGetByWorkspaceSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a private endpoint connection. + * + * @summary Get a private endpoint connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_GetByWorkspace.json + */ +async function privateEndpointConnectionGetByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const privateEndpointConnectionName = + "workspace1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.getByWorkspace( + resourceGroupName, + workspaceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionGetByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsListByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsListByHostPoolSample.ts new file mode 100644 index 000000000000..864ec415b3b3 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsListByHostPoolSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List private endpoint connections associated with hostpool. + * + * @summary List private endpoint connections associated with hostpool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_ListByHostPool.json + */ +async function privateEndpointConnectionListByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.listByHostPool( + resourceGroupName, + hostPoolName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateEndpointConnectionListByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsListByWorkspaceSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsListByWorkspaceSample.ts new file mode 100644 index 000000000000..7128e8acccab --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsListByWorkspaceSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List private endpoint connections. + * + * @summary List private endpoint connections. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_ListByWorkspace.json + */ +async function privateEndpointConnectionListByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.listByWorkspace( + resourceGroupName, + workspaceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateEndpointConnectionListByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsUpdateByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsUpdateByHostPoolSample.ts new file mode 100644 index 000000000000..c74663253db0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsUpdateByHostPoolSample.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 { + PrivateEndpointConnection, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Approve or reject a private endpoint connection. + * + * @summary Approve or reject a private endpoint connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_UpdateByHostPool.json + */ +async function privateEndpointConnectionUpdateByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const privateEndpointConnectionName = + "hostPool1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const connection: PrivateEndpointConnection = { + privateLinkServiceConnectionState: { + description: "Approved by admin@consoto.com", + actionsRequired: "None", + status: "Approved" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.updateByHostPool( + resourceGroupName, + hostPoolName, + privateEndpointConnectionName, + connection + ); + console.log(result); +} + +privateEndpointConnectionUpdateByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsUpdateByWorkspaceSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsUpdateByWorkspaceSample.ts new file mode 100644 index 000000000000..f623610b4f8d --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateEndpointConnectionsUpdateByWorkspaceSample.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 { + PrivateEndpointConnection, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Approve or reject a private endpoint connection. + * + * @summary Approve or reject a private endpoint connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_UpdateByWorkspace.json + */ +async function privateEndpointConnectionUpdateByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const privateEndpointConnectionName = + "workspace1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const connection: PrivateEndpointConnection = { + privateLinkServiceConnectionState: { + description: "Approved by admin@consoto.com", + actionsRequired: "None", + status: "Approved" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.updateByWorkspace( + resourceGroupName, + workspaceName, + privateEndpointConnectionName, + connection + ); + console.log(result); +} + +privateEndpointConnectionUpdateByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateLinkResourcesListByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateLinkResourcesListByHostPoolSample.ts new file mode 100644 index 000000000000..713f2ebf1206 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateLinkResourcesListByHostPoolSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the private link resources available for this hostpool. + * + * @summary List the private link resources available for this hostpool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateLinkResources_ListByHostPool.json + */ +async function privateLinkResourcesListByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinkResources.listByHostPool( + resourceGroupName, + hostPoolName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateLinkResourcesListByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateLinkResourcesListByWorkspaceSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateLinkResourcesListByWorkspaceSample.ts new file mode 100644 index 000000000000..7be4576a7b88 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/privateLinkResourcesListByWorkspaceSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the private link resources available for this workspace. + * + * @summary List the private link resources available for this workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateLinkResources_ListByWorkspace.json + */ +async function privateLinkResourcesListByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinkResources.listByWorkspace( + resourceGroupName, + workspaceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateLinkResourcesListByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansCreateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansCreateSample.ts new file mode 100644 index 000000000000..e5326892da49 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansCreateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ScalingPlan, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update a scaling plan. + * + * @summary Create or update a scaling plan. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Create.json + */ +async function scalingPlansCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const scalingPlanName = "scalingPlan1"; + const scalingPlan: ScalingPlan = { + description: "Description of Scaling Plan", + exclusionTag: "value", + friendlyName: "Scaling Plan 1", + hostPoolReferences: [ + { + hostPoolArmPath: + "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1", + scalingPlanEnabled: true + } + ], + hostPoolType: "Pooled", + location: "centralus", + schedules: [ + { + name: "schedule1", + daysOfWeek: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"], + offPeakLoadBalancingAlgorithm: "DepthFirst", + offPeakStartTime: { hour: 20, minute: 0 }, + peakLoadBalancingAlgorithm: "BreadthFirst", + peakStartTime: { hour: 8, minute: 0 }, + rampDownCapacityThresholdPct: 50, + rampDownForceLogoffUsers: true, + rampDownLoadBalancingAlgorithm: "DepthFirst", + rampDownMinimumHostsPct: 20, + rampDownNotificationMessage: "message", + rampDownStartTime: { hour: 18, minute: 0 }, + rampDownWaitTimeMinutes: 30, + rampUpCapacityThresholdPct: 80, + rampUpLoadBalancingAlgorithm: "DepthFirst", + rampUpMinimumHostsPct: 20, + rampUpStartTime: { hour: 6, minute: 0 } + } + ], + tags: { tag1: "value1", tag2: "value2" }, + timeZone: "Central Standard Time" + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.scalingPlans.create( + resourceGroupName, + scalingPlanName, + scalingPlan + ); + console.log(result); +} + +scalingPlansCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansDeleteSample.ts new file mode 100644 index 000000000000..73e3f9adbfbe --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a scaling plan. + * + * @summary Remove a scaling plan. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Delete.json + */ +async function scalingPlansDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const scalingPlanName = "scalingPlan1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.scalingPlans.delete( + resourceGroupName, + scalingPlanName + ); + console.log(result); +} + +scalingPlansDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansGetSample.ts new file mode 100644 index 000000000000..41ff30f614db --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a scaling plan. + * + * @summary Get a scaling plan. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Get.json + */ +async function scalingPlansGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const scalingPlanName = "scalingPlan1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.scalingPlans.get( + resourceGroupName, + scalingPlanName + ); + console.log(result); +} + +scalingPlansGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansListByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansListByHostPoolSample.ts new file mode 100644 index 000000000000..ad372ff54f90 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansListByHostPoolSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List scaling plan associated with hostpool. + * + * @summary List scaling plan associated with hostpool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListByHostPool.json + */ +async function scalingPlanListByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.scalingPlans.listByHostPool( + resourceGroupName, + hostPoolName + )) { + resArray.push(item); + } + console.log(resArray); +} + +scalingPlanListByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansListByResourceGroupSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansListByResourceGroupSample.ts new file mode 100644 index 000000000000..3d11498b64fc --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List scaling plans. + * + * @summary List scaling plans. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListByResourceGroup.json + */ +async function scalingPlansListByResourceGroup() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.scalingPlans.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +scalingPlansListByResourceGroup().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansListBySubscriptionSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansListBySubscriptionSample.ts new file mode 100644 index 000000000000..cedcb09c9656 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List scaling plans in subscription. + * + * @summary List scaling plans in subscription. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListBySubscription.json + */ +async function scalingPlansListBySubscription() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.scalingPlans.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +scalingPlansListBySubscription().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansUpdateSample.ts new file mode 100644 index 000000000000..55a37770aaac --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/scalingPlansUpdateSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a scaling plan. + * + * @summary Update a scaling plan. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Update.json + */ +async function scalingPlansUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const scalingPlanName = "scalingPlan1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.scalingPlans.update( + resourceGroupName, + scalingPlanName + ); + console.log(result); +} + +scalingPlansUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/sessionHostsDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/sessionHostsDeleteSample.ts new file mode 100644 index 000000000000..c183db223e4e --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/sessionHostsDeleteSample.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 { + SessionHostsDeleteOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a SessionHost. + * + * @summary Remove a SessionHost. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Delete.json + */ +async function sessionHostDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const force = true; + const options: SessionHostsDeleteOptionalParams = { force }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.sessionHosts.delete( + resourceGroupName, + hostPoolName, + sessionHostName, + options + ); + console.log(result); +} + +sessionHostDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/sessionHostsGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/sessionHostsGetSample.ts new file mode 100644 index 000000000000..4bedb5e52ac6 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/sessionHostsGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a session host. + * + * @summary Get a session host. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Get.json + */ +async function sessionHostGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.sessionHosts.get( + resourceGroupName, + hostPoolName, + sessionHostName + ); + console.log(result); +} + +sessionHostGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/sessionHostsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/sessionHostsListSample.ts new file mode 100644 index 000000000000..799daa854893 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/sessionHostsListSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List sessionHosts. + * + * @summary List sessionHosts. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_List.json + */ +async function sessionHostList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sessionHosts.list( + resourceGroupName, + hostPoolName + )) { + resArray.push(item); + } + console.log(resArray); +} + +sessionHostList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/sessionHostsUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/sessionHostsUpdateSample.ts new file mode 100644 index 000000000000..dc7aad071061 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/sessionHostsUpdateSample.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 { + SessionHostPatch, + SessionHostsUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a session host. + * + * @summary Update a session host. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Update.json + */ +async function sessionHostUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const force = true; + const sessionHost: SessionHostPatch = { + allowNewSession: true, + assignedUser: "user1@microsoft.com" + }; + const options: SessionHostsUpdateOptionalParams = { force, sessionHost }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.sessionHosts.update( + resourceGroupName, + hostPoolName, + sessionHostName, + options + ); + console.log(result); +} + +sessionHostUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/startMenuItemsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/startMenuItemsListSample.ts new file mode 100644 index 000000000000..e1eecf40c05c --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/startMenuItemsListSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List start menu items in the given application group. + * + * @summary List start menu items in the given application group. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/StartMenuItem_List.json + */ +async function startMenuItemList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.startMenuItems.list( + resourceGroupName, + applicationGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +startMenuItemList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsDeleteSample.ts new file mode 100644 index 000000000000..bd9889e593cc --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsDeleteSample.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 { + UserSessionsDeleteOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a userSession. + * + * @summary Remove a userSession. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Delete.json + */ +async function userSessionDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const userSessionId = "1"; + const force = true; + const options: UserSessionsDeleteOptionalParams = { force }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.userSessions.delete( + resourceGroupName, + hostPoolName, + sessionHostName, + userSessionId, + options + ); + console.log(result); +} + +userSessionDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsDisconnectSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsDisconnectSample.ts new file mode 100644 index 000000000000..3d26ffe9857e --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsDisconnectSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Disconnect a userSession. + * + * @summary Disconnect a userSession. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Disconnect_Post.json + */ +async function userSessionDisconnectPost() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const userSessionId = "1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.userSessions.disconnect( + resourceGroupName, + hostPoolName, + sessionHostName, + userSessionId + ); + console.log(result); +} + +userSessionDisconnectPost().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsGetSample.ts new file mode 100644 index 000000000000..dbb54be4d4a7 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsGetSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a userSession. + * + * @summary Get a userSession. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Get.json + */ +async function userSessionGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const userSessionId = "1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.userSessions.get( + resourceGroupName, + hostPoolName, + sessionHostName, + userSessionId + ); + console.log(result); +} + +userSessionGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsListByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsListByHostPoolSample.ts new file mode 100644 index 000000000000..032aa62b21ac --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsListByHostPoolSample.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 { + UserSessionsListByHostPoolOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List userSessions. + * + * @summary List userSessions. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_ListByHostPool.json + */ +async function userSessionListByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const filter = + "userPrincipalName eq 'user1@microsoft.com' and state eq 'active'"; + const options: UserSessionsListByHostPoolOptionalParams = { filter }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.userSessions.listByHostPool( + resourceGroupName, + hostPoolName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +userSessionListByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsListSample.ts new file mode 100644 index 000000000000..342e3277f03f --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsListSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List userSessions. + * + * @summary List userSessions. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_List.json + */ +async function userSessionList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.userSessions.list( + resourceGroupName, + hostPoolName, + sessionHostName + )) { + resArray.push(item); + } + console.log(resArray); +} + +userSessionList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsSendMessageSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsSendMessageSample.ts new file mode 100644 index 000000000000..2d8b81360e7f --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/userSessionsSendMessageSample.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 { + SendMessage, + UserSessionsSendMessageOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Send a message to a user. + * + * @summary Send a message to a user. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_SendMessage_Post.json + */ +async function userSessionSendMessagePost() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const userSessionId = "1"; + const sendMessage: SendMessage = { + messageBody: "body", + messageTitle: "title" + }; + const options: UserSessionsSendMessageOptionalParams = { sendMessage }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.userSessions.sendMessage( + resourceGroupName, + hostPoolName, + sessionHostName, + userSessionId, + options + ); + console.log(result); +} + +userSessionSendMessagePost().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesCreateOrUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..dc9a2f7f2277 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesCreateOrUpdateSample.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 { + Workspace, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update a workspace. + * + * @summary Create or update a workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Create.json + */ +async function workspaceCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const workspace: Workspace = { + description: "des1", + friendlyName: "friendly", + location: "centralus", + tags: { tag1: "value1", tag2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.workspaces.createOrUpdate( + resourceGroupName, + workspaceName, + workspace + ); + console.log(result); +} + +workspaceCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesDeleteSample.ts new file mode 100644 index 000000000000..854cb3d33da0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a workspace. + * + * @summary Remove a workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Delete.json + */ +async function workspaceDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.workspaces.delete( + resourceGroupName, + workspaceName + ); + console.log(result); +} + +workspaceDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesGetSample.ts new file mode 100644 index 000000000000..fa431675741d --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a workspace. + * + * @summary Get a workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Get.json + */ +async function workspaceGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.workspaces.get(resourceGroupName, workspaceName); + console.log(result); +} + +workspaceGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesListByResourceGroupSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesListByResourceGroupSample.ts new file mode 100644 index 000000000000..e964a4aa1888 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List workspaces. + * + * @summary List workspaces. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_ListByResourceGroup.json + */ +async function workspaceListByResourceGroup() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.workspaces.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +workspaceListByResourceGroup().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesListBySubscriptionSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesListBySubscriptionSample.ts new file mode 100644 index 000000000000..06c7477bf9cd --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List workspaces in subscription. + * + * @summary List workspaces in subscription. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_ListBySubscription.json + */ +async function workspaceListBySubscription() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.workspaces.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +workspaceListBySubscription().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesUpdateSample.ts new file mode 100644 index 000000000000..2a70aae32d57 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples-dev/workspacesUpdateSample.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 { + WorkspacePatch, + WorkspacesUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a workspace. + * + * @summary Update a workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Update.json + */ +async function workspaceUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const workspace: WorkspacePatch = { + description: "des1", + friendlyName: "friendly", + publicNetworkAccess: "Enabled", + tags: { tag1: "value1", tag2: "value2" } + }; + const options: WorkspacesUpdateOptionalParams = { workspace }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.workspaces.update( + resourceGroupName, + workspaceName, + options + ); + console.log(result); +} + +workspaceUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/README.md b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/README.md new file mode 100644 index 000000000000..2a4acd08098e --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/README.md @@ -0,0 +1,172 @@ +# 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** | +| --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [applicationGroupsCreateOrUpdateSample.js][applicationgroupscreateorupdatesample] | Create or update an applicationGroup. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Create.json | +| [applicationGroupsDeleteSample.js][applicationgroupsdeletesample] | Remove an applicationGroup. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Delete.json | +| [applicationGroupsGetSample.js][applicationgroupsgetsample] | Get an application group. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Get.json | +| [applicationGroupsListByResourceGroupSample.js][applicationgroupslistbyresourcegroupsample] | List applicationGroups. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_ListByResourceGroup.json | +| [applicationGroupsListBySubscriptionSample.js][applicationgroupslistbysubscriptionsample] | List applicationGroups in subscription. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_ListBySubscription.json | +| [applicationGroupsUpdateSample.js][applicationgroupsupdatesample] | Update an applicationGroup. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Update.json | +| [applicationsCreateOrUpdateSample.js][applicationscreateorupdatesample] | Create or update an application. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Create.json | +| [applicationsDeleteSample.js][applicationsdeletesample] | Remove an application. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Delete.json | +| [applicationsGetSample.js][applicationsgetsample] | Get an application. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Get.json | +| [applicationsListSample.js][applicationslistsample] | List applications. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_List.json | +| [applicationsUpdateSample.js][applicationsupdatesample] | Update an application. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Update.json | +| [desktopsGetSample.js][desktopsgetsample] | Get a desktop. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_Get.json | +| [desktopsListSample.js][desktopslistsample] | List desktops. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_List.json | +| [desktopsUpdateSample.js][desktopsupdatesample] | Update a desktop. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_Update.json | +| [hostPoolsCreateOrUpdateSample.js][hostpoolscreateorupdatesample] | Create or update a host pool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Create.json | +| [hostPoolsDeleteSample.js][hostpoolsdeletesample] | Remove a host pool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Delete.json | +| [hostPoolsGetSample.js][hostpoolsgetsample] | Get a host pool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Get.json | +| [hostPoolsListByResourceGroupSample.js][hostpoolslistbyresourcegroupsample] | List hostPools. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_ListByResourceGroup.json | +| [hostPoolsListSample.js][hostpoolslistsample] | List hostPools in subscription. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_List.json | +| [hostPoolsRetrieveRegistrationTokenSample.js][hostpoolsretrieveregistrationtokensample] | Registration token of the host pool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPools_RetrieveRegistrationToken_Post.json | +| [hostPoolsUpdateSample.js][hostpoolsupdatesample] | Update a host pool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Update.json | +| [msixImagesExpandSample.js][msiximagesexpandsample] | Expands and Lists MSIX packages in an Image, given the Image Path. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixImage_Expand_Post.json | +| [msixPackagesCreateOrUpdateSample.js][msixpackagescreateorupdatesample] | Create or update a MSIX package. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Create.json | +| [msixPackagesDeleteSample.js][msixpackagesdeletesample] | Remove an MSIX Package. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Delete.json | +| [msixPackagesGetSample.js][msixpackagesgetsample] | Get a msixpackage. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Get.json | +| [msixPackagesListSample.js][msixpackageslistsample] | List MSIX packages in hostpool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_List.json | +| [msixPackagesUpdateSample.js][msixpackagesupdatesample] | Update an MSIX Package. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Update.json | +| [operationsListSample.js][operationslistsample] | List all of the available operations the Desktop Virtualization resource provider supports. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/OperationDescription_List.json | +| [privateEndpointConnectionsDeleteByHostPoolSample.js][privateendpointconnectionsdeletebyhostpoolsample] | Remove a connection. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_DeleteByHostPool.json | +| [privateEndpointConnectionsDeleteByWorkspaceSample.js][privateendpointconnectionsdeletebyworkspacesample] | Remove a connection. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_DeleteByWorkspace.json | +| [privateEndpointConnectionsGetByHostPoolSample.js][privateendpointconnectionsgetbyhostpoolsample] | Get a private endpoint connection. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_GetByHostPool.json | +| [privateEndpointConnectionsGetByWorkspaceSample.js][privateendpointconnectionsgetbyworkspacesample] | Get a private endpoint connection. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_GetByWorkspace.json | +| [privateEndpointConnectionsListByHostPoolSample.js][privateendpointconnectionslistbyhostpoolsample] | List private endpoint connections associated with hostpool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_ListByHostPool.json | +| [privateEndpointConnectionsListByWorkspaceSample.js][privateendpointconnectionslistbyworkspacesample] | List private endpoint connections. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_ListByWorkspace.json | +| [privateEndpointConnectionsUpdateByHostPoolSample.js][privateendpointconnectionsupdatebyhostpoolsample] | Approve or reject a private endpoint connection. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_UpdateByHostPool.json | +| [privateEndpointConnectionsUpdateByWorkspaceSample.js][privateendpointconnectionsupdatebyworkspacesample] | Approve or reject a private endpoint connection. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_UpdateByWorkspace.json | +| [privateLinkResourcesListByHostPoolSample.js][privatelinkresourceslistbyhostpoolsample] | List the private link resources available for this hostpool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateLinkResources_ListByHostPool.json | +| [privateLinkResourcesListByWorkspaceSample.js][privatelinkresourceslistbyworkspacesample] | List the private link resources available for this workspace. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateLinkResources_ListByWorkspace.json | +| [scalingPlansCreateSample.js][scalingplanscreatesample] | Create or update a scaling plan. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Create.json | +| [scalingPlansDeleteSample.js][scalingplansdeletesample] | Remove a scaling plan. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Delete.json | +| [scalingPlansGetSample.js][scalingplansgetsample] | Get a scaling plan. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Get.json | +| [scalingPlansListByHostPoolSample.js][scalingplanslistbyhostpoolsample] | List scaling plan associated with hostpool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListByHostPool.json | +| [scalingPlansListByResourceGroupSample.js][scalingplanslistbyresourcegroupsample] | List scaling plans. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListByResourceGroup.json | +| [scalingPlansListBySubscriptionSample.js][scalingplanslistbysubscriptionsample] | List scaling plans in subscription. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListBySubscription.json | +| [scalingPlansUpdateSample.js][scalingplansupdatesample] | Update a scaling plan. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Update.json | +| [sessionHostsDeleteSample.js][sessionhostsdeletesample] | Remove a SessionHost. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Delete.json | +| [sessionHostsGetSample.js][sessionhostsgetsample] | Get a session host. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Get.json | +| [sessionHostsListSample.js][sessionhostslistsample] | List sessionHosts. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_List.json | +| [sessionHostsUpdateSample.js][sessionhostsupdatesample] | Update a session host. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Update.json | +| [startMenuItemsListSample.js][startmenuitemslistsample] | List start menu items in the given application group. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/StartMenuItem_List.json | +| [userSessionsDeleteSample.js][usersessionsdeletesample] | Remove a userSession. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Delete.json | +| [userSessionsDisconnectSample.js][usersessionsdisconnectsample] | Disconnect a userSession. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Disconnect_Post.json | +| [userSessionsGetSample.js][usersessionsgetsample] | Get a userSession. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Get.json | +| [userSessionsListByHostPoolSample.js][usersessionslistbyhostpoolsample] | List userSessions. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_ListByHostPool.json | +| [userSessionsListSample.js][usersessionslistsample] | List userSessions. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_List.json | +| [userSessionsSendMessageSample.js][usersessionssendmessagesample] | Send a message to a user. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_SendMessage_Post.json | +| [workspacesCreateOrUpdateSample.js][workspacescreateorupdatesample] | Create or update a workspace. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Create.json | +| [workspacesDeleteSample.js][workspacesdeletesample] | Remove a workspace. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Delete.json | +| [workspacesGetSample.js][workspacesgetsample] | Get a workspace. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Get.json | +| [workspacesListByResourceGroupSample.js][workspaceslistbyresourcegroupsample] | List workspaces. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_ListByResourceGroup.json | +| [workspacesListBySubscriptionSample.js][workspaceslistbysubscriptionsample] | List workspaces in subscription. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_ListBySubscription.json | +| [workspacesUpdateSample.js][workspacesupdatesample] | Update a workspace. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Update.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +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 applicationGroupsCreateOrUpdateSample.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 node applicationGroupsCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[applicationgroupscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsCreateOrUpdateSample.js +[applicationgroupsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsDeleteSample.js +[applicationgroupsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsGetSample.js +[applicationgroupslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsListByResourceGroupSample.js +[applicationgroupslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsListBySubscriptionSample.js +[applicationgroupsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsUpdateSample.js +[applicationscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsCreateOrUpdateSample.js +[applicationsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsDeleteSample.js +[applicationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsGetSample.js +[applicationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsListSample.js +[applicationsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsUpdateSample.js +[desktopsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/desktopsGetSample.js +[desktopslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/desktopsListSample.js +[desktopsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/desktopsUpdateSample.js +[hostpoolscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsCreateOrUpdateSample.js +[hostpoolsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsDeleteSample.js +[hostpoolsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsGetSample.js +[hostpoolslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsListByResourceGroupSample.js +[hostpoolslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsListSample.js +[hostpoolsretrieveregistrationtokensample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsRetrieveRegistrationTokenSample.js +[hostpoolsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsUpdateSample.js +[msiximagesexpandsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixImagesExpandSample.js +[msixpackagescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesCreateOrUpdateSample.js +[msixpackagesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesDeleteSample.js +[msixpackagesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesGetSample.js +[msixpackageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesListSample.js +[msixpackagesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesUpdateSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/operationsListSample.js +[privateendpointconnectionsdeletebyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsDeleteByHostPoolSample.js +[privateendpointconnectionsdeletebyworkspacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsDeleteByWorkspaceSample.js +[privateendpointconnectionsgetbyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsGetByHostPoolSample.js +[privateendpointconnectionsgetbyworkspacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsGetByWorkspaceSample.js +[privateendpointconnectionslistbyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsListByHostPoolSample.js +[privateendpointconnectionslistbyworkspacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsListByWorkspaceSample.js +[privateendpointconnectionsupdatebyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsUpdateByHostPoolSample.js +[privateendpointconnectionsupdatebyworkspacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsUpdateByWorkspaceSample.js +[privatelinkresourceslistbyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateLinkResourcesListByHostPoolSample.js +[privatelinkresourceslistbyworkspacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateLinkResourcesListByWorkspaceSample.js +[scalingplanscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansCreateSample.js +[scalingplansdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansDeleteSample.js +[scalingplansgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansGetSample.js +[scalingplanslistbyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansListByHostPoolSample.js +[scalingplanslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansListByResourceGroupSample.js +[scalingplanslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansListBySubscriptionSample.js +[scalingplansupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansUpdateSample.js +[sessionhostsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsDeleteSample.js +[sessionhostsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsGetSample.js +[sessionhostslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsListSample.js +[sessionhostsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsUpdateSample.js +[startmenuitemslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/startMenuItemsListSample.js +[usersessionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsDeleteSample.js +[usersessionsdisconnectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsDisconnectSample.js +[usersessionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsGetSample.js +[usersessionslistbyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsListByHostPoolSample.js +[usersessionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsListSample.js +[usersessionssendmessagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsSendMessageSample.js +[workspacescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesCreateOrUpdateSample.js +[workspacesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesDeleteSample.js +[workspacesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesGetSample.js +[workspaceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesListByResourceGroupSample.js +[workspaceslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesListBySubscriptionSample.js +[workspacesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesUpdateSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-desktopvirtualization?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/desktopvirtualization/arm-desktopvirtualization/README.md diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsCreateOrUpdateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsCreateOrUpdateSample.js new file mode 100644 index 000000000000..e731fd54ce1f --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsCreateOrUpdateSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or update an applicationGroup. + * + * @summary Create or update an applicationGroup. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Create.json + */ +async function applicationGroupCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationGroup = { + description: "des1", + applicationGroupType: "RemoteApp", + friendlyName: "friendly", + hostPoolArmPath: + "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1", + location: "centralus", + migrationRequest: { + migrationPath: + "TenantGroups/{defaultV1TenantGroup.Name}/Tenants/{defaultV1Tenant.Name}/HostPools/{sessionHostPool.Name}", + operation: "Start", + }, + tags: { tag1: "value1", tag2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applicationGroups.createOrUpdate( + resourceGroupName, + applicationGroupName, + applicationGroup + ); + console.log(result); +} + +applicationGroupCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsDeleteSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsDeleteSample.js new file mode 100644 index 000000000000..ebf2d4584336 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsDeleteSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Remove an applicationGroup. + * + * @summary Remove an applicationGroup. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Delete.json + */ +async function applicationGroupDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applicationGroups.delete(resourceGroupName, applicationGroupName); + console.log(result); +} + +applicationGroupDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsGetSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsGetSample.js new file mode 100644 index 000000000000..f73d910f3ad6 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get an application group. + * + * @summary Get an application group. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Get.json + */ +async function applicationGroupGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applicationGroups.get(resourceGroupName, applicationGroupName); + console.log(result); +} + +applicationGroupGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsListByResourceGroupSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsListByResourceGroupSample.js new file mode 100644 index 000000000000..72f132ee9ba8 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsListByResourceGroupSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List applicationGroups. + * + * @summary List applicationGroups. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_ListByResourceGroup.json + */ +async function applicationGroupListByResourceGroup() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const filter = "applicationGroupType eq 'RailApplication'"; + const options = { + filter, + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applicationGroups.listByResourceGroup(resourceGroupName, options)) { + resArray.push(item); + } + console.log(resArray); +} + +applicationGroupListByResourceGroup().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsListBySubscriptionSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsListBySubscriptionSample.js new file mode 100644 index 000000000000..9a95a594c669 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsListBySubscriptionSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List applicationGroups in subscription. + * + * @summary List applicationGroups in subscription. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_ListBySubscription.json + */ +async function applicationGroupList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const filter = "applicationGroupType eq 'RailApplication'"; + const options = { filter }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applicationGroups.listBySubscription(options)) { + resArray.push(item); + } + console.log(resArray); +} + +applicationGroupList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsUpdateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsUpdateSample.js new file mode 100644 index 000000000000..8ce94024b268 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationGroupsUpdateSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update an applicationGroup. + * + * @summary Update an applicationGroup. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Update.json + */ +async function applicationGroupsUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationGroup = { + description: "des1", + friendlyName: "friendly", + tags: { tag1: "value1", tag2: "value2" }, + }; + const options = { applicationGroup }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applicationGroups.update( + resourceGroupName, + applicationGroupName, + options + ); + console.log(result); +} + +applicationGroupsUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsCreateOrUpdateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsCreateOrUpdateSample.js new file mode 100644 index 000000000000..9b97fef6426e --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsCreateOrUpdateSample.js @@ -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. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or update an application. + * + * @summary Create or update an application. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Create.json + */ +async function applicationCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationName = "application1"; + const application = { + description: "des1", + commandLineArguments: "arguments", + commandLineSetting: "Allow", + filePath: "path", + friendlyName: "friendly", + iconIndex: 1, + iconPath: "icon", + showInPortal: true, + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applications.createOrUpdate( + resourceGroupName, + applicationGroupName, + applicationName, + application + ); + console.log(result); +} + +applicationCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsDeleteSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsDeleteSample.js new file mode 100644 index 000000000000..54cf3959b8d8 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsDeleteSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Remove an application. + * + * @summary Remove an application. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Delete.json + */ +async function applicationDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationName = "application1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applications.delete( + resourceGroupName, + applicationGroupName, + applicationName + ); + console.log(result); +} + +applicationDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsGetSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsGetSample.js new file mode 100644 index 000000000000..4c6fa5e2b2c2 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get an application. + * + * @summary Get an application. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Get.json + */ +async function applicationGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationName = "application1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applications.get( + resourceGroupName, + applicationGroupName, + applicationName + ); + console.log(result); +} + +applicationGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsListSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsListSample.js new file mode 100644 index 000000000000..db034ef36999 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List applications. + * + * @summary List applications. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_List.json + */ +async function applicationsList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applications.list(resourceGroupName, applicationGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +applicationsList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsUpdateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsUpdateSample.js new file mode 100644 index 000000000000..a3e90bb83f1a --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/applicationsUpdateSample.js @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update an application. + * + * @summary Update an application. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Update.json + */ +async function applicationUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationName = "application1"; + const application = { + description: "des1", + applicationType: "InBuilt", + commandLineArguments: "arguments", + commandLineSetting: "Allow", + filePath: "path", + friendlyName: "friendly", + iconIndex: 1, + iconPath: "icon", + msixPackageApplicationId: undefined, + msixPackageFamilyName: undefined, + showInPortal: true, + }; + const options = { application }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applications.update( + resourceGroupName, + applicationGroupName, + applicationName, + options + ); + console.log(result); +} + +applicationUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/desktopsGetSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/desktopsGetSample.js new file mode 100644 index 000000000000..c57bb4731509 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/desktopsGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get a desktop. + * + * @summary Get a desktop. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_Get.json + */ +async function desktopGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const desktopName = "SessionDesktop"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.desktops.get(resourceGroupName, applicationGroupName, desktopName); + console.log(result); +} + +desktopGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/desktopsListSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/desktopsListSample.js new file mode 100644 index 000000000000..07ee159533c0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/desktopsListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List desktops. + * + * @summary List desktops. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_List.json + */ +async function desktopList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.desktops.list(resourceGroupName, applicationGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +desktopList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/desktopsUpdateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/desktopsUpdateSample.js new file mode 100644 index 000000000000..7107c04b2216 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/desktopsUpdateSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update a desktop. + * + * @summary Update a desktop. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_Update.json + */ +async function desktopUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const desktopName = "SessionDesktop"; + const desktop = { + description: "des1", + friendlyName: "friendly", + }; + const options = { desktop }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.desktops.update( + resourceGroupName, + applicationGroupName, + desktopName, + options + ); + console.log(result); +} + +desktopUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsCreateOrUpdateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsCreateOrUpdateSample.js new file mode 100644 index 000000000000..da623ad0aa2d --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsCreateOrUpdateSample.js @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or update a host pool. + * + * @summary Create or update a host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Create.json + */ +async function hostPoolCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const hostPool = { + description: "des1", + customRdpProperty: undefined, + friendlyName: "friendly", + hostPoolType: "Pooled", + loadBalancerType: "BreadthFirst", + location: "centralus", + maxSessionLimit: 999999, + migrationRequest: { + migrationPath: + "TenantGroups/{defaultV1TenantGroup.Name}/Tenants/{defaultV1Tenant.Name}/HostPools/{sessionHostPool.Name}", + operation: "Start", + }, + personalDesktopAssignmentType: "Automatic", + preferredAppGroupType: "Desktop", + publicNetworkAccess: "Enabled", + registrationInfo: { + expirationTime: new Date("2020-10-01T14:01:54.9571247Z"), + registrationTokenOperation: "Update", + }, + ssoClientId: "client", + ssoClientSecretKeyVaultPath: "https://keyvault/secret", + ssoSecretType: "SharedKey", + ssoadfsAuthority: "https://adfs", + startVMOnConnect: false, + tags: { tag1: "value1", tag2: "value2" }, + vmTemplate: "{json:json}", + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.createOrUpdate(resourceGroupName, hostPoolName, hostPool); + console.log(result); +} + +hostPoolCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsDeleteSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsDeleteSample.js new file mode 100644 index 000000000000..c03c7aa4aff1 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsDeleteSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Remove a host pool. + * + * @summary Remove a host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Delete.json + */ +async function hostPoolDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const force = true; + const options = { force }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.delete(resourceGroupName, hostPoolName, options); + console.log(result); +} + +hostPoolDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsGetSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsGetSample.js new file mode 100644 index 000000000000..0a2e7c094ce4 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get a host pool. + * + * @summary Get a host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Get.json + */ +async function hostPoolGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.get(resourceGroupName, hostPoolName); + console.log(result); +} + +hostPoolGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsListByResourceGroupSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsListByResourceGroupSample.js new file mode 100644 index 000000000000..16706918244e --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsListByResourceGroupSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List hostPools. + * + * @summary List hostPools. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_ListByResourceGroup.json + */ +async function hostPoolListByResourceGroup() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.hostPools.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +hostPoolListByResourceGroup().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsListSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsListSample.js new file mode 100644 index 000000000000..7e7d24cdfe5e --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List hostPools in subscription. + * + * @summary List hostPools in subscription. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_List.json + */ +async function hostPoolList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.hostPools.list()) { + resArray.push(item); + } + console.log(resArray); +} + +hostPoolList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsRetrieveRegistrationTokenSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsRetrieveRegistrationTokenSample.js new file mode 100644 index 000000000000..8b619f7f5d23 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsRetrieveRegistrationTokenSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Registration token of the host pool. + * + * @summary Registration token of the host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPools_RetrieveRegistrationToken_Post.json + */ +async function hostPoolsRetrieveRegistrationTokenPost() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.retrieveRegistrationToken(resourceGroupName, hostPoolName); + console.log(result); +} + +hostPoolsRetrieveRegistrationTokenPost().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsUpdateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsUpdateSample.js new file mode 100644 index 000000000000..d5f05ef8293a --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/hostPoolsUpdateSample.js @@ -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. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update a host pool. + * + * @summary Update a host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Update.json + */ +async function hostPoolUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const hostPool = { + description: "des1", + customRdpProperty: undefined, + friendlyName: "friendly", + loadBalancerType: "BreadthFirst", + maxSessionLimit: 999999, + personalDesktopAssignmentType: "Automatic", + publicNetworkAccess: "Enabled", + registrationInfo: { + expirationTime: new Date("2020-10-01T15:01:54.9571247Z"), + registrationTokenOperation: "Update", + }, + ssoClientId: "client", + ssoClientSecretKeyVaultPath: "https://keyvault/secret", + ssoSecretType: "SharedKey", + ssoadfsAuthority: "https://adfs", + startVMOnConnect: false, + tags: { tag1: "value1", tag2: "value2" }, + vmTemplate: "{json:json}", + }; + const options = { hostPool }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.update(resourceGroupName, hostPoolName, options); + console.log(result); +} + +hostPoolUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixImagesExpandSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixImagesExpandSample.js new file mode 100644 index 000000000000..a1492cb8525c --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixImagesExpandSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Expands and Lists MSIX packages in an Image, given the Image Path. + * + * @summary Expands and Lists MSIX packages in an Image, given the Image Path. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixImage_Expand_Post.json + */ +async function msixImageExpand() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixImageURI = { uri: "imagepath" }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.msixImages.listExpand( + resourceGroupName, + hostPoolName, + msixImageURI + )) { + resArray.push(item); + } + console.log(resArray); +} + +msixImageExpand().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesCreateOrUpdateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesCreateOrUpdateSample.js new file mode 100644 index 000000000000..431c95e5abd0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesCreateOrUpdateSample.js @@ -0,0 +1,65 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or update a MSIX package. + * + * @summary Create or update a MSIX package. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Create.json + */ +async function msixPackageCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixPackageFullName = "msixpackagefullname"; + const msixPackage = { + displayName: "displayname", + imagePath: "imagepath", + isActive: false, + isRegularRegistration: false, + lastUpdated: new Date("2008-09-22T14:01:54.9571247Z"), + packageApplications: [ + { + description: "application-desc", + appId: "ApplicationId", + appUserModelID: "AppUserModelId", + friendlyName: "friendlyname", + iconImageName: "Apptile", + rawIcon: VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo, + rawPng: VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo, + }, + ], + packageDependencies: [ + { + dependencyName: "MsixTest_Dependency_Name", + minVersion: "version", + publisher: "PublishedName", + }, + ], + packageFamilyName: "MsixPackage_FamilyName", + packageName: "MsixPackage_name", + packageRelativePath: "packagerelativepath", + version: "version", + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.msixPackages.createOrUpdate( + resourceGroupName, + hostPoolName, + msixPackageFullName, + msixPackage + ); + console.log(result); +} + +msixPackageCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesDeleteSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesDeleteSample.js new file mode 100644 index 000000000000..bde61c866d48 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesDeleteSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Remove an MSIX Package. + * + * @summary Remove an MSIX Package. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Delete.json + */ +async function msixPackageDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixPackageFullName = "packagefullname"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.msixPackages.delete( + resourceGroupName, + hostPoolName, + msixPackageFullName + ); + console.log(result); +} + +msixPackageDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesGetSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesGetSample.js new file mode 100644 index 000000000000..d1b8bb15b4ef --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get a msixpackage. + * + * @summary Get a msixpackage. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Get.json + */ +async function msixPackageGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixPackageFullName = "packagefullname"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.msixPackages.get( + resourceGroupName, + hostPoolName, + msixPackageFullName + ); + console.log(result); +} + +msixPackageGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesListSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesListSample.js new file mode 100644 index 000000000000..dd903089e5bc --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List MSIX packages in hostpool. + * + * @summary List MSIX packages in hostpool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_List.json + */ +async function msixPackageList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.msixPackages.list(resourceGroupName, hostPoolName)) { + resArray.push(item); + } + console.log(resArray); +} + +msixPackageList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesUpdateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesUpdateSample.js new file mode 100644 index 000000000000..6288e6c8b2c5 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/msixPackagesUpdateSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update an MSIX Package. + * + * @summary Update an MSIX Package. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Update.json + */ +async function msixPackageUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixPackageFullName = "msixpackagefullname"; + const msixPackage = { + displayName: "displayname", + isActive: true, + isRegularRegistration: false, + }; + const options = { msixPackage }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.msixPackages.update( + resourceGroupName, + hostPoolName, + msixPackageFullName, + options + ); + console.log(result); +} + +msixPackageUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/operationsListSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/operationsListSample.js new file mode 100644 index 000000000000..2c12948f0c82 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/operationsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List all of the available operations the Desktop Virtualization resource provider supports. + * + * @summary List all of the available operations the Desktop Virtualization resource provider supports. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/OperationDescription_List.json + */ +async function operationDescriptionList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationDescriptionList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/package.json b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/package.json new file mode 100644 index 000000000000..a357486522f2 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-desktopvirtualization-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/desktopvirtualization/arm-desktopvirtualization" + }, + "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/desktopvirtualization/arm-desktopvirtualization", + "dependencies": { + "@azure/arm-desktopvirtualization": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsDeleteByHostPoolSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsDeleteByHostPoolSample.js new file mode 100644 index 000000000000..bb374b665ec6 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsDeleteByHostPoolSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Remove a connection. + * + * @summary Remove a connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_DeleteByHostPool.json + */ +async function privateEndpointConnectionDeleteByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const privateEndpointConnectionName = "hostPool1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.deleteByHostPool( + resourceGroupName, + hostPoolName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionDeleteByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsDeleteByWorkspaceSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsDeleteByWorkspaceSample.js new file mode 100644 index 000000000000..eae9a3f73522 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsDeleteByWorkspaceSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Remove a connection. + * + * @summary Remove a connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_DeleteByWorkspace.json + */ +async function privateEndpointConnectionDeleteByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const privateEndpointConnectionName = "workspace1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.deleteByWorkspace( + resourceGroupName, + workspaceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionDeleteByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsGetByHostPoolSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsGetByHostPoolSample.js new file mode 100644 index 000000000000..b4ffaf9214bf --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsGetByHostPoolSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get a private endpoint connection. + * + * @summary Get a private endpoint connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_GetByHostPool.json + */ +async function privateEndpointConnectionGetByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const privateEndpointConnectionName = "hostPool1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.getByHostPool( + resourceGroupName, + hostPoolName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionGetByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsGetByWorkspaceSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsGetByWorkspaceSample.js new file mode 100644 index 000000000000..1b88ebc0a62b --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsGetByWorkspaceSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get a private endpoint connection. + * + * @summary Get a private endpoint connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_GetByWorkspace.json + */ +async function privateEndpointConnectionGetByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const privateEndpointConnectionName = "workspace1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.getByWorkspace( + resourceGroupName, + workspaceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionGetByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsListByHostPoolSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsListByHostPoolSample.js new file mode 100644 index 000000000000..3daef8ef160a --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsListByHostPoolSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List private endpoint connections associated with hostpool. + * + * @summary List private endpoint connections associated with hostpool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_ListByHostPool.json + */ +async function privateEndpointConnectionListByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.listByHostPool( + resourceGroupName, + hostPoolName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateEndpointConnectionListByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsListByWorkspaceSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsListByWorkspaceSample.js new file mode 100644 index 000000000000..eaa710186e9c --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsListByWorkspaceSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List private endpoint connections. + * + * @summary List private endpoint connections. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_ListByWorkspace.json + */ +async function privateEndpointConnectionListByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.listByWorkspace( + resourceGroupName, + workspaceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateEndpointConnectionListByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsUpdateByHostPoolSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsUpdateByHostPoolSample.js new file mode 100644 index 000000000000..38a0cc9bed29 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsUpdateByHostPoolSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Approve or reject a private endpoint connection. + * + * @summary Approve or reject a private endpoint connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_UpdateByHostPool.json + */ +async function privateEndpointConnectionUpdateByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const privateEndpointConnectionName = "hostPool1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const connection = { + privateLinkServiceConnectionState: { + description: "Approved by admin@consoto.com", + actionsRequired: "None", + status: "Approved", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.updateByHostPool( + resourceGroupName, + hostPoolName, + privateEndpointConnectionName, + connection + ); + console.log(result); +} + +privateEndpointConnectionUpdateByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsUpdateByWorkspaceSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsUpdateByWorkspaceSample.js new file mode 100644 index 000000000000..e86fd501d976 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateEndpointConnectionsUpdateByWorkspaceSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Approve or reject a private endpoint connection. + * + * @summary Approve or reject a private endpoint connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_UpdateByWorkspace.json + */ +async function privateEndpointConnectionUpdateByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const privateEndpointConnectionName = "workspace1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const connection = { + privateLinkServiceConnectionState: { + description: "Approved by admin@consoto.com", + actionsRequired: "None", + status: "Approved", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.updateByWorkspace( + resourceGroupName, + workspaceName, + privateEndpointConnectionName, + connection + ); + console.log(result); +} + +privateEndpointConnectionUpdateByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateLinkResourcesListByHostPoolSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateLinkResourcesListByHostPoolSample.js new file mode 100644 index 000000000000..59b18d38a987 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateLinkResourcesListByHostPoolSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List the private link resources available for this hostpool. + * + * @summary List the private link resources available for this hostpool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateLinkResources_ListByHostPool.json + */ +async function privateLinkResourcesListByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinkResources.listByHostPool( + resourceGroupName, + hostPoolName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateLinkResourcesListByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateLinkResourcesListByWorkspaceSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateLinkResourcesListByWorkspaceSample.js new file mode 100644 index 000000000000..65fb742efb6f --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/privateLinkResourcesListByWorkspaceSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List the private link resources available for this workspace. + * + * @summary List the private link resources available for this workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateLinkResources_ListByWorkspace.json + */ +async function privateLinkResourcesListByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinkResources.listByWorkspace( + resourceGroupName, + workspaceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateLinkResourcesListByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sample.env b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/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/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansCreateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansCreateSample.js new file mode 100644 index 000000000000..4a693a8c42ca --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansCreateSample.js @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or update a scaling plan. + * + * @summary Create or update a scaling plan. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Create.json + */ +async function scalingPlansCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const scalingPlanName = "scalingPlan1"; + const scalingPlan = { + description: "Description of Scaling Plan", + exclusionTag: "value", + friendlyName: "Scaling Plan 1", + hostPoolReferences: [ + { + hostPoolArmPath: + "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1", + scalingPlanEnabled: true, + }, + ], + hostPoolType: "Pooled", + location: "centralus", + schedules: [ + { + name: "schedule1", + daysOfWeek: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"], + offPeakLoadBalancingAlgorithm: "DepthFirst", + offPeakStartTime: { hour: 20, minute: 0 }, + peakLoadBalancingAlgorithm: "BreadthFirst", + peakStartTime: { hour: 8, minute: 0 }, + rampDownCapacityThresholdPct: 50, + rampDownForceLogoffUsers: true, + rampDownLoadBalancingAlgorithm: "DepthFirst", + rampDownMinimumHostsPct: 20, + rampDownNotificationMessage: "message", + rampDownStartTime: { hour: 18, minute: 0 }, + rampDownWaitTimeMinutes: 30, + rampUpCapacityThresholdPct: 80, + rampUpLoadBalancingAlgorithm: "DepthFirst", + rampUpMinimumHostsPct: 20, + rampUpStartTime: { hour: 6, minute: 0 }, + }, + ], + tags: { tag1: "value1", tag2: "value2" }, + timeZone: "Central Standard Time", + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.scalingPlans.create(resourceGroupName, scalingPlanName, scalingPlan); + console.log(result); +} + +scalingPlansCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansDeleteSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansDeleteSample.js new file mode 100644 index 000000000000..f02647708092 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansDeleteSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Remove a scaling plan. + * + * @summary Remove a scaling plan. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Delete.json + */ +async function scalingPlansDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const scalingPlanName = "scalingPlan1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.scalingPlans.delete(resourceGroupName, scalingPlanName); + console.log(result); +} + +scalingPlansDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansGetSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansGetSample.js new file mode 100644 index 000000000000..a769dce08743 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get a scaling plan. + * + * @summary Get a scaling plan. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Get.json + */ +async function scalingPlansGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const scalingPlanName = "scalingPlan1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.scalingPlans.get(resourceGroupName, scalingPlanName); + console.log(result); +} + +scalingPlansGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansListByHostPoolSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansListByHostPoolSample.js new file mode 100644 index 000000000000..03b5672b3570 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansListByHostPoolSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List scaling plan associated with hostpool. + * + * @summary List scaling plan associated with hostpool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListByHostPool.json + */ +async function scalingPlanListByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.scalingPlans.listByHostPool(resourceGroupName, hostPoolName)) { + resArray.push(item); + } + console.log(resArray); +} + +scalingPlanListByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansListByResourceGroupSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansListByResourceGroupSample.js new file mode 100644 index 000000000000..4d568de74de3 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansListByResourceGroupSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List scaling plans. + * + * @summary List scaling plans. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListByResourceGroup.json + */ +async function scalingPlansListByResourceGroup() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.scalingPlans.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +scalingPlansListByResourceGroup().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansListBySubscriptionSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansListBySubscriptionSample.js new file mode 100644 index 000000000000..6d3bc1593267 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansListBySubscriptionSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List scaling plans in subscription. + * + * @summary List scaling plans in subscription. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListBySubscription.json + */ +async function scalingPlansListBySubscription() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.scalingPlans.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +scalingPlansListBySubscription().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansUpdateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansUpdateSample.js new file mode 100644 index 000000000000..6c820e2e474e --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/scalingPlansUpdateSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update a scaling plan. + * + * @summary Update a scaling plan. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Update.json + */ +async function scalingPlansUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const scalingPlanName = "scalingPlan1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.scalingPlans.update(resourceGroupName, scalingPlanName); + console.log(result); +} + +scalingPlansUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsDeleteSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsDeleteSample.js new file mode 100644 index 000000000000..861d36ed2e0e --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsDeleteSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Remove a SessionHost. + * + * @summary Remove a SessionHost. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Delete.json + */ +async function sessionHostDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const force = true; + const options = { force }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.sessionHosts.delete( + resourceGroupName, + hostPoolName, + sessionHostName, + options + ); + console.log(result); +} + +sessionHostDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsGetSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsGetSample.js new file mode 100644 index 000000000000..f0000fadd0b8 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get a session host. + * + * @summary Get a session host. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Get.json + */ +async function sessionHostGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.sessionHosts.get(resourceGroupName, hostPoolName, sessionHostName); + console.log(result); +} + +sessionHostGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsListSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsListSample.js new file mode 100644 index 000000000000..ff6f7ac7ea2d --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List sessionHosts. + * + * @summary List sessionHosts. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_List.json + */ +async function sessionHostList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sessionHosts.list(resourceGroupName, hostPoolName)) { + resArray.push(item); + } + console.log(resArray); +} + +sessionHostList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsUpdateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsUpdateSample.js new file mode 100644 index 000000000000..d13bc5696246 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/sessionHostsUpdateSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update a session host. + * + * @summary Update a session host. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Update.json + */ +async function sessionHostUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const force = true; + const sessionHost = { + allowNewSession: true, + assignedUser: "user1@microsoft.com", + }; + const options = { force, sessionHost }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.sessionHosts.update( + resourceGroupName, + hostPoolName, + sessionHostName, + options + ); + console.log(result); +} + +sessionHostUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/startMenuItemsListSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/startMenuItemsListSample.js new file mode 100644 index 000000000000..b1daee3d60aa --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/startMenuItemsListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List start menu items in the given application group. + * + * @summary List start menu items in the given application group. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/StartMenuItem_List.json + */ +async function startMenuItemList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.startMenuItems.list(resourceGroupName, applicationGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +startMenuItemList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsDeleteSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsDeleteSample.js new file mode 100644 index 000000000000..284f901b5c76 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsDeleteSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Remove a userSession. + * + * @summary Remove a userSession. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Delete.json + */ +async function userSessionDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const userSessionId = "1"; + const force = true; + const options = { force }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.userSessions.delete( + resourceGroupName, + hostPoolName, + sessionHostName, + userSessionId, + options + ); + console.log(result); +} + +userSessionDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsDisconnectSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsDisconnectSample.js new file mode 100644 index 000000000000..beaa78532c4e --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsDisconnectSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Disconnect a userSession. + * + * @summary Disconnect a userSession. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Disconnect_Post.json + */ +async function userSessionDisconnectPost() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const userSessionId = "1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.userSessions.disconnect( + resourceGroupName, + hostPoolName, + sessionHostName, + userSessionId + ); + console.log(result); +} + +userSessionDisconnectPost().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsGetSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsGetSample.js new file mode 100644 index 000000000000..db865423dac0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsGetSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get a userSession. + * + * @summary Get a userSession. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Get.json + */ +async function userSessionGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const userSessionId = "1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.userSessions.get( + resourceGroupName, + hostPoolName, + sessionHostName, + userSessionId + ); + console.log(result); +} + +userSessionGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsListByHostPoolSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsListByHostPoolSample.js new file mode 100644 index 000000000000..b43b1b6beb45 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsListByHostPoolSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List userSessions. + * + * @summary List userSessions. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_ListByHostPool.json + */ +async function userSessionListByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const filter = "userPrincipalName eq 'user1@microsoft.com' and state eq 'active'"; + const options = { filter }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.userSessions.listByHostPool( + resourceGroupName, + hostPoolName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +userSessionListByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsListSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsListSample.js new file mode 100644 index 000000000000..1dcc09631137 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsListSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List userSessions. + * + * @summary List userSessions. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_List.json + */ +async function userSessionList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.userSessions.list( + resourceGroupName, + hostPoolName, + sessionHostName + )) { + resArray.push(item); + } + console.log(resArray); +} + +userSessionList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsSendMessageSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsSendMessageSample.js new file mode 100644 index 000000000000..65edd4b712a8 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/userSessionsSendMessageSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Send a message to a user. + * + * @summary Send a message to a user. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_SendMessage_Post.json + */ +async function userSessionSendMessagePost() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const userSessionId = "1"; + const sendMessage = { + messageBody: "body", + messageTitle: "title", + }; + const options = { sendMessage }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.userSessions.sendMessage( + resourceGroupName, + hostPoolName, + sessionHostName, + userSessionId, + options + ); + console.log(result); +} + +userSessionSendMessagePost().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesCreateOrUpdateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesCreateOrUpdateSample.js new file mode 100644 index 000000000000..8ba783a1c0ed --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesCreateOrUpdateSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or update a workspace. + * + * @summary Create or update a workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Create.json + */ +async function workspaceCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const workspace = { + description: "des1", + friendlyName: "friendly", + location: "centralus", + tags: { tag1: "value1", tag2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.workspaces.createOrUpdate( + resourceGroupName, + workspaceName, + workspace + ); + console.log(result); +} + +workspaceCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesDeleteSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesDeleteSample.js new file mode 100644 index 000000000000..e0464c3aea8b --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesDeleteSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Remove a workspace. + * + * @summary Remove a workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Delete.json + */ +async function workspaceDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.workspaces.delete(resourceGroupName, workspaceName); + console.log(result); +} + +workspaceDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesGetSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesGetSample.js new file mode 100644 index 000000000000..f1cfc7d7be40 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get a workspace. + * + * @summary Get a workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Get.json + */ +async function workspaceGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.workspaces.get(resourceGroupName, workspaceName); + console.log(result); +} + +workspaceGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesListByResourceGroupSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesListByResourceGroupSample.js new file mode 100644 index 000000000000..1c980e8b98f3 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesListByResourceGroupSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List workspaces. + * + * @summary List workspaces. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_ListByResourceGroup.json + */ +async function workspaceListByResourceGroup() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.workspaces.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +workspaceListByResourceGroup().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesListBySubscriptionSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesListBySubscriptionSample.js new file mode 100644 index 000000000000..27a7064bbeea --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesListBySubscriptionSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List workspaces in subscription. + * + * @summary List workspaces in subscription. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_ListBySubscription.json + */ +async function workspaceListBySubscription() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.workspaces.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +workspaceListBySubscription().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesUpdateSample.js b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesUpdateSample.js new file mode 100644 index 000000000000..128abc94132f --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/javascript/workspacesUpdateSample.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 { DesktopVirtualizationAPIClient } = require("@azure/arm-desktopvirtualization"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update a workspace. + * + * @summary Update a workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Update.json + */ +async function workspaceUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const workspace = { + description: "des1", + friendlyName: "friendly", + publicNetworkAccess: "Enabled", + tags: { tag1: "value1", tag2: "value2" }, + }; + const options = { workspace }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.workspaces.update(resourceGroupName, workspaceName, options); + console.log(result); +} + +workspaceUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/README.md b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/README.md new file mode 100644 index 000000000000..929bf976a3f5 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/README.md @@ -0,0 +1,185 @@ +# 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** | +| --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [applicationGroupsCreateOrUpdateSample.ts][applicationgroupscreateorupdatesample] | Create or update an applicationGroup. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Create.json | +| [applicationGroupsDeleteSample.ts][applicationgroupsdeletesample] | Remove an applicationGroup. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Delete.json | +| [applicationGroupsGetSample.ts][applicationgroupsgetsample] | Get an application group. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Get.json | +| [applicationGroupsListByResourceGroupSample.ts][applicationgroupslistbyresourcegroupsample] | List applicationGroups. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_ListByResourceGroup.json | +| [applicationGroupsListBySubscriptionSample.ts][applicationgroupslistbysubscriptionsample] | List applicationGroups in subscription. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_ListBySubscription.json | +| [applicationGroupsUpdateSample.ts][applicationgroupsupdatesample] | Update an applicationGroup. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Update.json | +| [applicationsCreateOrUpdateSample.ts][applicationscreateorupdatesample] | Create or update an application. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Create.json | +| [applicationsDeleteSample.ts][applicationsdeletesample] | Remove an application. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Delete.json | +| [applicationsGetSample.ts][applicationsgetsample] | Get an application. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Get.json | +| [applicationsListSample.ts][applicationslistsample] | List applications. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_List.json | +| [applicationsUpdateSample.ts][applicationsupdatesample] | Update an application. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Update.json | +| [desktopsGetSample.ts][desktopsgetsample] | Get a desktop. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_Get.json | +| [desktopsListSample.ts][desktopslistsample] | List desktops. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_List.json | +| [desktopsUpdateSample.ts][desktopsupdatesample] | Update a desktop. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_Update.json | +| [hostPoolsCreateOrUpdateSample.ts][hostpoolscreateorupdatesample] | Create or update a host pool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Create.json | +| [hostPoolsDeleteSample.ts][hostpoolsdeletesample] | Remove a host pool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Delete.json | +| [hostPoolsGetSample.ts][hostpoolsgetsample] | Get a host pool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Get.json | +| [hostPoolsListByResourceGroupSample.ts][hostpoolslistbyresourcegroupsample] | List hostPools. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_ListByResourceGroup.json | +| [hostPoolsListSample.ts][hostpoolslistsample] | List hostPools in subscription. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_List.json | +| [hostPoolsRetrieveRegistrationTokenSample.ts][hostpoolsretrieveregistrationtokensample] | Registration token of the host pool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPools_RetrieveRegistrationToken_Post.json | +| [hostPoolsUpdateSample.ts][hostpoolsupdatesample] | Update a host pool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Update.json | +| [msixImagesExpandSample.ts][msiximagesexpandsample] | Expands and Lists MSIX packages in an Image, given the Image Path. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixImage_Expand_Post.json | +| [msixPackagesCreateOrUpdateSample.ts][msixpackagescreateorupdatesample] | Create or update a MSIX package. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Create.json | +| [msixPackagesDeleteSample.ts][msixpackagesdeletesample] | Remove an MSIX Package. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Delete.json | +| [msixPackagesGetSample.ts][msixpackagesgetsample] | Get a msixpackage. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Get.json | +| [msixPackagesListSample.ts][msixpackageslistsample] | List MSIX packages in hostpool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_List.json | +| [msixPackagesUpdateSample.ts][msixpackagesupdatesample] | Update an MSIX Package. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Update.json | +| [operationsListSample.ts][operationslistsample] | List all of the available operations the Desktop Virtualization resource provider supports. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/OperationDescription_List.json | +| [privateEndpointConnectionsDeleteByHostPoolSample.ts][privateendpointconnectionsdeletebyhostpoolsample] | Remove a connection. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_DeleteByHostPool.json | +| [privateEndpointConnectionsDeleteByWorkspaceSample.ts][privateendpointconnectionsdeletebyworkspacesample] | Remove a connection. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_DeleteByWorkspace.json | +| [privateEndpointConnectionsGetByHostPoolSample.ts][privateendpointconnectionsgetbyhostpoolsample] | Get a private endpoint connection. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_GetByHostPool.json | +| [privateEndpointConnectionsGetByWorkspaceSample.ts][privateendpointconnectionsgetbyworkspacesample] | Get a private endpoint connection. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_GetByWorkspace.json | +| [privateEndpointConnectionsListByHostPoolSample.ts][privateendpointconnectionslistbyhostpoolsample] | List private endpoint connections associated with hostpool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_ListByHostPool.json | +| [privateEndpointConnectionsListByWorkspaceSample.ts][privateendpointconnectionslistbyworkspacesample] | List private endpoint connections. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_ListByWorkspace.json | +| [privateEndpointConnectionsUpdateByHostPoolSample.ts][privateendpointconnectionsupdatebyhostpoolsample] | Approve or reject a private endpoint connection. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_UpdateByHostPool.json | +| [privateEndpointConnectionsUpdateByWorkspaceSample.ts][privateendpointconnectionsupdatebyworkspacesample] | Approve or reject a private endpoint connection. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_UpdateByWorkspace.json | +| [privateLinkResourcesListByHostPoolSample.ts][privatelinkresourceslistbyhostpoolsample] | List the private link resources available for this hostpool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateLinkResources_ListByHostPool.json | +| [privateLinkResourcesListByWorkspaceSample.ts][privatelinkresourceslistbyworkspacesample] | List the private link resources available for this workspace. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateLinkResources_ListByWorkspace.json | +| [scalingPlansCreateSample.ts][scalingplanscreatesample] | Create or update a scaling plan. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Create.json | +| [scalingPlansDeleteSample.ts][scalingplansdeletesample] | Remove a scaling plan. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Delete.json | +| [scalingPlansGetSample.ts][scalingplansgetsample] | Get a scaling plan. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Get.json | +| [scalingPlansListByHostPoolSample.ts][scalingplanslistbyhostpoolsample] | List scaling plan associated with hostpool. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListByHostPool.json | +| [scalingPlansListByResourceGroupSample.ts][scalingplanslistbyresourcegroupsample] | List scaling plans. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListByResourceGroup.json | +| [scalingPlansListBySubscriptionSample.ts][scalingplanslistbysubscriptionsample] | List scaling plans in subscription. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListBySubscription.json | +| [scalingPlansUpdateSample.ts][scalingplansupdatesample] | Update a scaling plan. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Update.json | +| [sessionHostsDeleteSample.ts][sessionhostsdeletesample] | Remove a SessionHost. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Delete.json | +| [sessionHostsGetSample.ts][sessionhostsgetsample] | Get a session host. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Get.json | +| [sessionHostsListSample.ts][sessionhostslistsample] | List sessionHosts. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_List.json | +| [sessionHostsUpdateSample.ts][sessionhostsupdatesample] | Update a session host. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Update.json | +| [startMenuItemsListSample.ts][startmenuitemslistsample] | List start menu items in the given application group. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/StartMenuItem_List.json | +| [userSessionsDeleteSample.ts][usersessionsdeletesample] | Remove a userSession. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Delete.json | +| [userSessionsDisconnectSample.ts][usersessionsdisconnectsample] | Disconnect a userSession. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Disconnect_Post.json | +| [userSessionsGetSample.ts][usersessionsgetsample] | Get a userSession. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Get.json | +| [userSessionsListByHostPoolSample.ts][usersessionslistbyhostpoolsample] | List userSessions. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_ListByHostPool.json | +| [userSessionsListSample.ts][usersessionslistsample] | List userSessions. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_List.json | +| [userSessionsSendMessageSample.ts][usersessionssendmessagesample] | Send a message to a user. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_SendMessage_Post.json | +| [workspacesCreateOrUpdateSample.ts][workspacescreateorupdatesample] | Create or update a workspace. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Create.json | +| [workspacesDeleteSample.ts][workspacesdeletesample] | Remove a workspace. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Delete.json | +| [workspacesGetSample.ts][workspacesgetsample] | Get a workspace. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Get.json | +| [workspacesListByResourceGroupSample.ts][workspaceslistbyresourcegroupsample] | List workspaces. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_ListByResourceGroup.json | +| [workspacesListBySubscriptionSample.ts][workspaceslistbysubscriptionsample] | List workspaces in subscription. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_ListBySubscription.json | +| [workspacesUpdateSample.ts][workspacesupdatesample] | Update a workspace. x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Update.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +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/applicationGroupsCreateOrUpdateSample.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 node dist/applicationGroupsCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[applicationgroupscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsCreateOrUpdateSample.ts +[applicationgroupsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsDeleteSample.ts +[applicationgroupsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsGetSample.ts +[applicationgroupslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsListByResourceGroupSample.ts +[applicationgroupslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsListBySubscriptionSample.ts +[applicationgroupsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsUpdateSample.ts +[applicationscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsCreateOrUpdateSample.ts +[applicationsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsDeleteSample.ts +[applicationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsGetSample.ts +[applicationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsListSample.ts +[applicationsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsUpdateSample.ts +[desktopsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/desktopsGetSample.ts +[desktopslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/desktopsListSample.ts +[desktopsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/desktopsUpdateSample.ts +[hostpoolscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsCreateOrUpdateSample.ts +[hostpoolsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsDeleteSample.ts +[hostpoolsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsGetSample.ts +[hostpoolslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsListByResourceGroupSample.ts +[hostpoolslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsListSample.ts +[hostpoolsretrieveregistrationtokensample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsRetrieveRegistrationTokenSample.ts +[hostpoolsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsUpdateSample.ts +[msiximagesexpandsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixImagesExpandSample.ts +[msixpackagescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesCreateOrUpdateSample.ts +[msixpackagesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesDeleteSample.ts +[msixpackagesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesGetSample.ts +[msixpackageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesListSample.ts +[msixpackagesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesUpdateSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/operationsListSample.ts +[privateendpointconnectionsdeletebyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteByHostPoolSample.ts +[privateendpointconnectionsdeletebyworkspacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteByWorkspaceSample.ts +[privateendpointconnectionsgetbyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsGetByHostPoolSample.ts +[privateendpointconnectionsgetbyworkspacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsGetByWorkspaceSample.ts +[privateendpointconnectionslistbyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsListByHostPoolSample.ts +[privateendpointconnectionslistbyworkspacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsListByWorkspaceSample.ts +[privateendpointconnectionsupdatebyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsUpdateByHostPoolSample.ts +[privateendpointconnectionsupdatebyworkspacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsUpdateByWorkspaceSample.ts +[privatelinkresourceslistbyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateLinkResourcesListByHostPoolSample.ts +[privatelinkresourceslistbyworkspacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateLinkResourcesListByWorkspaceSample.ts +[scalingplanscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansCreateSample.ts +[scalingplansdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansDeleteSample.ts +[scalingplansgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansGetSample.ts +[scalingplanslistbyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansListByHostPoolSample.ts +[scalingplanslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansListByResourceGroupSample.ts +[scalingplanslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansListBySubscriptionSample.ts +[scalingplansupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansUpdateSample.ts +[sessionhostsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsDeleteSample.ts +[sessionhostsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsGetSample.ts +[sessionhostslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsListSample.ts +[sessionhostsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsUpdateSample.ts +[startmenuitemslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/startMenuItemsListSample.ts +[usersessionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsDeleteSample.ts +[usersessionsdisconnectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsDisconnectSample.ts +[usersessionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsGetSample.ts +[usersessionslistbyhostpoolsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsListByHostPoolSample.ts +[usersessionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsListSample.ts +[usersessionssendmessagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsSendMessageSample.ts +[workspacescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesCreateOrUpdateSample.ts +[workspacesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesDeleteSample.ts +[workspacesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesGetSample.ts +[workspaceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesListByResourceGroupSample.ts +[workspaceslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesListBySubscriptionSample.ts +[workspacesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesUpdateSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-desktopvirtualization?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/desktopvirtualization/arm-desktopvirtualization/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/package.json b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/package.json new file mode 100644 index 000000000000..6aa39eb6cff3 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-desktopvirtualization-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/desktopvirtualization/arm-desktopvirtualization" + }, + "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/desktopvirtualization/arm-desktopvirtualization", + "dependencies": { + "@azure/arm-desktopvirtualization": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/sample.env b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/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/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsCreateOrUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..84d5e6a20ca1 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsCreateOrUpdateSample.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 { + ApplicationGroup, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update an applicationGroup. + * + * @summary Create or update an applicationGroup. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Create.json + */ +async function applicationGroupCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationGroup: ApplicationGroup = { + description: "des1", + applicationGroupType: "RemoteApp", + friendlyName: "friendly", + hostPoolArmPath: + "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1", + location: "centralus", + migrationRequest: { + migrationPath: + "TenantGroups/{defaultV1TenantGroup.Name}/Tenants/{defaultV1Tenant.Name}/HostPools/{sessionHostPool.Name}", + operation: "Start" + }, + tags: { tag1: "value1", tag2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applicationGroups.createOrUpdate( + resourceGroupName, + applicationGroupName, + applicationGroup + ); + console.log(result); +} + +applicationGroupCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsDeleteSample.ts new file mode 100644 index 000000000000..ce3c686421f0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove an applicationGroup. + * + * @summary Remove an applicationGroup. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Delete.json + */ +async function applicationGroupDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applicationGroups.delete( + resourceGroupName, + applicationGroupName + ); + console.log(result); +} + +applicationGroupDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsGetSample.ts new file mode 100644 index 000000000000..60f81db8c9a0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get an application group. + * + * @summary Get an application group. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Get.json + */ +async function applicationGroupGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applicationGroups.get( + resourceGroupName, + applicationGroupName + ); + console.log(result); +} + +applicationGroupGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsListByResourceGroupSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsListByResourceGroupSample.ts new file mode 100644 index 000000000000..da9453e8156f --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsListByResourceGroupSample.ts @@ -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. +import { + ApplicationGroupsListByResourceGroupOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List applicationGroups. + * + * @summary List applicationGroups. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_ListByResourceGroup.json + */ +async function applicationGroupListByResourceGroup() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const filter = "applicationGroupType eq 'RailApplication'"; + const options: ApplicationGroupsListByResourceGroupOptionalParams = { + filter + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applicationGroups.listByResourceGroup( + resourceGroupName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +applicationGroupListByResourceGroup().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsListBySubscriptionSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsListBySubscriptionSample.ts new file mode 100644 index 000000000000..2fe00c52404a --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsListBySubscriptionSample.ts @@ -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. +import { + ApplicationGroupsListBySubscriptionOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List applicationGroups in subscription. + * + * @summary List applicationGroups in subscription. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_ListBySubscription.json + */ +async function applicationGroupList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const filter = "applicationGroupType eq 'RailApplication'"; + const options: ApplicationGroupsListBySubscriptionOptionalParams = { filter }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applicationGroups.listBySubscription(options)) { + resArray.push(item); + } + console.log(resArray); +} + +applicationGroupList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsUpdateSample.ts new file mode 100644 index 000000000000..438c18aaf4e0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationGroupsUpdateSample.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 { + ApplicationGroupPatch, + ApplicationGroupsUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update an applicationGroup. + * + * @summary Update an applicationGroup. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ApplicationGroup_Update.json + */ +async function applicationGroupsUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationGroup: ApplicationGroupPatch = { + description: "des1", + friendlyName: "friendly", + tags: { tag1: "value1", tag2: "value2" } + }; + const options: ApplicationGroupsUpdateOptionalParams = { applicationGroup }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applicationGroups.update( + resourceGroupName, + applicationGroupName, + options + ); + console.log(result); +} + +applicationGroupsUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsCreateOrUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ae286c7a6f76 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsCreateOrUpdateSample.ts @@ -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. +import { + Application, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update an application. + * + * @summary Create or update an application. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Create.json + */ +async function applicationCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationName = "application1"; + const application: Application = { + description: "des1", + commandLineArguments: "arguments", + commandLineSetting: "Allow", + filePath: "path", + friendlyName: "friendly", + iconIndex: 1, + iconPath: "icon", + showInPortal: true + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applications.createOrUpdate( + resourceGroupName, + applicationGroupName, + applicationName, + application + ); + console.log(result); +} + +applicationCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsDeleteSample.ts new file mode 100644 index 000000000000..57209ff29e8c --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove an application. + * + * @summary Remove an application. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Delete.json + */ +async function applicationDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationName = "application1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applications.delete( + resourceGroupName, + applicationGroupName, + applicationName + ); + console.log(result); +} + +applicationDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsGetSample.ts new file mode 100644 index 000000000000..f54ce8448617 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get an application. + * + * @summary Get an application. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Get.json + */ +async function applicationGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationName = "application1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applications.get( + resourceGroupName, + applicationGroupName, + applicationName + ); + console.log(result); +} + +applicationGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsListSample.ts new file mode 100644 index 000000000000..d262a4037e7f --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsListSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List applications. + * + * @summary List applications. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_List.json + */ +async function applicationsList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applications.list( + resourceGroupName, + applicationGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +applicationsList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsUpdateSample.ts new file mode 100644 index 000000000000..6d3dec85bed4 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/applicationsUpdateSample.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 { + ApplicationPatch, + ApplicationsUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update an application. + * + * @summary Update an application. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Application_Update.json + */ +async function applicationUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const applicationName = "application1"; + const application: ApplicationPatch = { + description: "des1", + applicationType: "InBuilt", + commandLineArguments: "arguments", + commandLineSetting: "Allow", + filePath: "path", + friendlyName: "friendly", + iconIndex: 1, + iconPath: "icon", + msixPackageApplicationId: undefined, + msixPackageFamilyName: undefined, + showInPortal: true + }; + const options: ApplicationsUpdateOptionalParams = { application }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.applications.update( + resourceGroupName, + applicationGroupName, + applicationName, + options + ); + console.log(result); +} + +applicationUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/desktopsGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/desktopsGetSample.ts new file mode 100644 index 000000000000..f8b879624070 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/desktopsGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a desktop. + * + * @summary Get a desktop. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_Get.json + */ +async function desktopGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const desktopName = "SessionDesktop"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.desktops.get( + resourceGroupName, + applicationGroupName, + desktopName + ); + console.log(result); +} + +desktopGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/desktopsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/desktopsListSample.ts new file mode 100644 index 000000000000..1a1e34451c30 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/desktopsListSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List desktops. + * + * @summary List desktops. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_List.json + */ +async function desktopList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.desktops.list( + resourceGroupName, + applicationGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +desktopList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/desktopsUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/desktopsUpdateSample.ts new file mode 100644 index 000000000000..1c8f58fc2976 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/desktopsUpdateSample.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 { + DesktopPatch, + DesktopsUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a desktop. + * + * @summary Update a desktop. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Desktop_Update.json + */ +async function desktopUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const desktopName = "SessionDesktop"; + const desktop: DesktopPatch = { + description: "des1", + friendlyName: "friendly" + }; + const options: DesktopsUpdateOptionalParams = { desktop }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.desktops.update( + resourceGroupName, + applicationGroupName, + desktopName, + options + ); + console.log(result); +} + +desktopUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsCreateOrUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..26653cd9e735 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsCreateOrUpdateSample.ts @@ -0,0 +1,65 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + HostPool, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update a host pool. + * + * @summary Create or update a host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Create.json + */ +async function hostPoolCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const hostPool: HostPool = { + description: "des1", + customRdpProperty: undefined, + friendlyName: "friendly", + hostPoolType: "Pooled", + loadBalancerType: "BreadthFirst", + location: "centralus", + maxSessionLimit: 999999, + migrationRequest: { + migrationPath: + "TenantGroups/{defaultV1TenantGroup.Name}/Tenants/{defaultV1Tenant.Name}/HostPools/{sessionHostPool.Name}", + operation: "Start" + }, + personalDesktopAssignmentType: "Automatic", + preferredAppGroupType: "Desktop", + publicNetworkAccess: "Enabled", + registrationInfo: { + expirationTime: new Date("2020-10-01T14:01:54.9571247Z"), + registrationTokenOperation: "Update" + }, + ssoClientId: "client", + ssoClientSecretKeyVaultPath: "https://keyvault/secret", + ssoSecretType: "SharedKey", + ssoadfsAuthority: "https://adfs", + startVMOnConnect: false, + tags: { tag1: "value1", tag2: "value2" }, + vmTemplate: "{json:json}" + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.createOrUpdate( + resourceGroupName, + hostPoolName, + hostPool + ); + console.log(result); +} + +hostPoolCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsDeleteSample.ts new file mode 100644 index 000000000000..2579f8b52d59 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsDeleteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + HostPoolsDeleteOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a host pool. + * + * @summary Remove a host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Delete.json + */ +async function hostPoolDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const force = true; + const options: HostPoolsDeleteOptionalParams = { force }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.delete( + resourceGroupName, + hostPoolName, + options + ); + console.log(result); +} + +hostPoolDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsGetSample.ts new file mode 100644 index 000000000000..4d220cedf48a --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a host pool. + * + * @summary Get a host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Get.json + */ +async function hostPoolGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.get(resourceGroupName, hostPoolName); + console.log(result); +} + +hostPoolGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsListByResourceGroupSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsListByResourceGroupSample.ts new file mode 100644 index 000000000000..f57842501769 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List hostPools. + * + * @summary List hostPools. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_ListByResourceGroup.json + */ +async function hostPoolListByResourceGroup() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.hostPools.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +hostPoolListByResourceGroup().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsListSample.ts new file mode 100644 index 000000000000..818e9c551775 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List hostPools in subscription. + * + * @summary List hostPools in subscription. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_List.json + */ +async function hostPoolList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.hostPools.list()) { + resArray.push(item); + } + console.log(resArray); +} + +hostPoolList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsRetrieveRegistrationTokenSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsRetrieveRegistrationTokenSample.ts new file mode 100644 index 000000000000..d33a2c8da357 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsRetrieveRegistrationTokenSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Registration token of the host pool. + * + * @summary Registration token of the host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPools_RetrieveRegistrationToken_Post.json + */ +async function hostPoolsRetrieveRegistrationTokenPost() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.retrieveRegistrationToken( + resourceGroupName, + hostPoolName + ); + console.log(result); +} + +hostPoolsRetrieveRegistrationTokenPost().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsUpdateSample.ts new file mode 100644 index 000000000000..0f0fbbd50a72 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/hostPoolsUpdateSample.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + HostPoolPatch, + HostPoolsUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a host pool. + * + * @summary Update a host pool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/HostPool_Update.json + */ +async function hostPoolUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const hostPool: HostPoolPatch = { + description: "des1", + customRdpProperty: undefined, + friendlyName: "friendly", + loadBalancerType: "BreadthFirst", + maxSessionLimit: 999999, + personalDesktopAssignmentType: "Automatic", + publicNetworkAccess: "Enabled", + registrationInfo: { + expirationTime: new Date("2020-10-01T15:01:54.9571247Z"), + registrationTokenOperation: "Update" + }, + ssoClientId: "client", + ssoClientSecretKeyVaultPath: "https://keyvault/secret", + ssoSecretType: "SharedKey", + ssoadfsAuthority: "https://adfs", + startVMOnConnect: false, + tags: { tag1: "value1", tag2: "value2" }, + vmTemplate: "{json:json}" + }; + const options: HostPoolsUpdateOptionalParams = { hostPool }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.hostPools.update( + resourceGroupName, + hostPoolName, + options + ); + console.log(result); +} + +hostPoolUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixImagesExpandSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixImagesExpandSample.ts new file mode 100644 index 000000000000..3859b2b3c908 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixImagesExpandSample.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 { + MsixImageURI, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Expands and Lists MSIX packages in an Image, given the Image Path. + * + * @summary Expands and Lists MSIX packages in an Image, given the Image Path. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixImage_Expand_Post.json + */ +async function msixImageExpand() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixImageURI: MsixImageURI = { uri: "imagepath" }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.msixImages.listExpand( + resourceGroupName, + hostPoolName, + msixImageURI + )) { + resArray.push(item); + } + console.log(resArray); +} + +msixImageExpand().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesCreateOrUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..afa8f5faf04c --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesCreateOrUpdateSample.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + MsixPackage, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update a MSIX package. + * + * @summary Create or update a MSIX package. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Create.json + */ +async function msixPackageCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixPackageFullName = "msixpackagefullname"; + const msixPackage: MsixPackage = { + displayName: "displayname", + imagePath: "imagepath", + isActive: false, + isRegularRegistration: false, + lastUpdated: new Date("2008-09-22T14:01:54.9571247Z"), + packageApplications: [ + { + description: "application-desc", + appId: "ApplicationId", + appUserModelID: "AppUserModelId", + friendlyName: "friendlyname", + iconImageName: "Apptile", + rawIcon: VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo, + rawPng: VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo + } + ], + packageDependencies: [ + { + dependencyName: "MsixTest_Dependency_Name", + minVersion: "version", + publisher: "PublishedName" + } + ], + packageFamilyName: "MsixPackage_FamilyName", + packageName: "MsixPackage_name", + packageRelativePath: "packagerelativepath", + version: "version" + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.msixPackages.createOrUpdate( + resourceGroupName, + hostPoolName, + msixPackageFullName, + msixPackage + ); + console.log(result); +} + +msixPackageCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesDeleteSample.ts new file mode 100644 index 000000000000..d4abb283ac73 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove an MSIX Package. + * + * @summary Remove an MSIX Package. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Delete.json + */ +async function msixPackageDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixPackageFullName = "packagefullname"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.msixPackages.delete( + resourceGroupName, + hostPoolName, + msixPackageFullName + ); + console.log(result); +} + +msixPackageDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesGetSample.ts new file mode 100644 index 000000000000..5adb1aee65cb --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a msixpackage. + * + * @summary Get a msixpackage. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Get.json + */ +async function msixPackageGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixPackageFullName = "packagefullname"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.msixPackages.get( + resourceGroupName, + hostPoolName, + msixPackageFullName + ); + console.log(result); +} + +msixPackageGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesListSample.ts new file mode 100644 index 000000000000..507db8d4599a --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesListSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List MSIX packages in hostpool. + * + * @summary List MSIX packages in hostpool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_List.json + */ +async function msixPackageList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.msixPackages.list( + resourceGroupName, + hostPoolName + )) { + resArray.push(item); + } + console.log(resArray); +} + +msixPackageList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesUpdateSample.ts new file mode 100644 index 000000000000..bb79b48276f0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/msixPackagesUpdateSample.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 { + MsixPackagePatch, + MsixPackagesUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update an MSIX Package. + * + * @summary Update an MSIX Package. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/MsixPackage_Update.json + */ +async function msixPackageUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostpool1"; + const msixPackageFullName = "msixpackagefullname"; + const msixPackage: MsixPackagePatch = { + displayName: "displayname", + isActive: true, + isRegularRegistration: false + }; + const options: MsixPackagesUpdateOptionalParams = { msixPackage }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.msixPackages.update( + resourceGroupName, + hostPoolName, + msixPackageFullName, + options + ); + console.log(result); +} + +msixPackageUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..93bb53df7fde --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/operationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all of the available operations the Desktop Virtualization resource provider supports. + * + * @summary List all of the available operations the Desktop Virtualization resource provider supports. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/OperationDescription_List.json + */ +async function operationDescriptionList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationDescriptionList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteByHostPoolSample.ts new file mode 100644 index 000000000000..0bd7022d7226 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteByHostPoolSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a connection. + * + * @summary Remove a connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_DeleteByHostPool.json + */ +async function privateEndpointConnectionDeleteByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const privateEndpointConnectionName = + "hostPool1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.deleteByHostPool( + resourceGroupName, + hostPoolName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionDeleteByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteByWorkspaceSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteByWorkspaceSample.ts new file mode 100644 index 000000000000..ec03bf7eb741 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteByWorkspaceSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a connection. + * + * @summary Remove a connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_DeleteByWorkspace.json + */ +async function privateEndpointConnectionDeleteByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const privateEndpointConnectionName = + "workspace1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.deleteByWorkspace( + resourceGroupName, + workspaceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionDeleteByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsGetByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsGetByHostPoolSample.ts new file mode 100644 index 000000000000..0e9a5a379cc6 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsGetByHostPoolSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a private endpoint connection. + * + * @summary Get a private endpoint connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_GetByHostPool.json + */ +async function privateEndpointConnectionGetByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const privateEndpointConnectionName = + "hostPool1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.getByHostPool( + resourceGroupName, + hostPoolName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionGetByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsGetByWorkspaceSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsGetByWorkspaceSample.ts new file mode 100644 index 000000000000..0c1550045cd9 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsGetByWorkspaceSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a private endpoint connection. + * + * @summary Get a private endpoint connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_GetByWorkspace.json + */ +async function privateEndpointConnectionGetByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const privateEndpointConnectionName = + "workspace1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.getByWorkspace( + resourceGroupName, + workspaceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionGetByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsListByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsListByHostPoolSample.ts new file mode 100644 index 000000000000..864ec415b3b3 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsListByHostPoolSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List private endpoint connections associated with hostpool. + * + * @summary List private endpoint connections associated with hostpool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_ListByHostPool.json + */ +async function privateEndpointConnectionListByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.listByHostPool( + resourceGroupName, + hostPoolName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateEndpointConnectionListByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsListByWorkspaceSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsListByWorkspaceSample.ts new file mode 100644 index 000000000000..7128e8acccab --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsListByWorkspaceSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List private endpoint connections. + * + * @summary List private endpoint connections. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_ListByWorkspace.json + */ +async function privateEndpointConnectionListByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.listByWorkspace( + resourceGroupName, + workspaceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateEndpointConnectionListByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsUpdateByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsUpdateByHostPoolSample.ts new file mode 100644 index 000000000000..c74663253db0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsUpdateByHostPoolSample.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 { + PrivateEndpointConnection, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Approve or reject a private endpoint connection. + * + * @summary Approve or reject a private endpoint connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_UpdateByHostPool.json + */ +async function privateEndpointConnectionUpdateByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const privateEndpointConnectionName = + "hostPool1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const connection: PrivateEndpointConnection = { + privateLinkServiceConnectionState: { + description: "Approved by admin@consoto.com", + actionsRequired: "None", + status: "Approved" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.updateByHostPool( + resourceGroupName, + hostPoolName, + privateEndpointConnectionName, + connection + ); + console.log(result); +} + +privateEndpointConnectionUpdateByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsUpdateByWorkspaceSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsUpdateByWorkspaceSample.ts new file mode 100644 index 000000000000..f623610b4f8d --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateEndpointConnectionsUpdateByWorkspaceSample.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 { + PrivateEndpointConnection, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Approve or reject a private endpoint connection. + * + * @summary Approve or reject a private endpoint connection. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateEndpointConnection_UpdateByWorkspace.json + */ +async function privateEndpointConnectionUpdateByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const privateEndpointConnectionName = + "workspace1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; + const connection: PrivateEndpointConnection = { + privateLinkServiceConnectionState: { + description: "Approved by admin@consoto.com", + actionsRequired: "None", + status: "Approved" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.updateByWorkspace( + resourceGroupName, + workspaceName, + privateEndpointConnectionName, + connection + ); + console.log(result); +} + +privateEndpointConnectionUpdateByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateLinkResourcesListByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateLinkResourcesListByHostPoolSample.ts new file mode 100644 index 000000000000..713f2ebf1206 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateLinkResourcesListByHostPoolSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the private link resources available for this hostpool. + * + * @summary List the private link resources available for this hostpool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateLinkResources_ListByHostPool.json + */ +async function privateLinkResourcesListByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinkResources.listByHostPool( + resourceGroupName, + hostPoolName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateLinkResourcesListByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateLinkResourcesListByWorkspaceSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateLinkResourcesListByWorkspaceSample.ts new file mode 100644 index 000000000000..7be4576a7b88 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/privateLinkResourcesListByWorkspaceSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the private link resources available for this workspace. + * + * @summary List the private link resources available for this workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/PrivateLinkResources_ListByWorkspace.json + */ +async function privateLinkResourcesListByWorkspace() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinkResources.listByWorkspace( + resourceGroupName, + workspaceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateLinkResourcesListByWorkspace().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansCreateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansCreateSample.ts new file mode 100644 index 000000000000..e5326892da49 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansCreateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ScalingPlan, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update a scaling plan. + * + * @summary Create or update a scaling plan. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Create.json + */ +async function scalingPlansCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const scalingPlanName = "scalingPlan1"; + const scalingPlan: ScalingPlan = { + description: "Description of Scaling Plan", + exclusionTag: "value", + friendlyName: "Scaling Plan 1", + hostPoolReferences: [ + { + hostPoolArmPath: + "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1", + scalingPlanEnabled: true + } + ], + hostPoolType: "Pooled", + location: "centralus", + schedules: [ + { + name: "schedule1", + daysOfWeek: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"], + offPeakLoadBalancingAlgorithm: "DepthFirst", + offPeakStartTime: { hour: 20, minute: 0 }, + peakLoadBalancingAlgorithm: "BreadthFirst", + peakStartTime: { hour: 8, minute: 0 }, + rampDownCapacityThresholdPct: 50, + rampDownForceLogoffUsers: true, + rampDownLoadBalancingAlgorithm: "DepthFirst", + rampDownMinimumHostsPct: 20, + rampDownNotificationMessage: "message", + rampDownStartTime: { hour: 18, minute: 0 }, + rampDownWaitTimeMinutes: 30, + rampUpCapacityThresholdPct: 80, + rampUpLoadBalancingAlgorithm: "DepthFirst", + rampUpMinimumHostsPct: 20, + rampUpStartTime: { hour: 6, minute: 0 } + } + ], + tags: { tag1: "value1", tag2: "value2" }, + timeZone: "Central Standard Time" + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.scalingPlans.create( + resourceGroupName, + scalingPlanName, + scalingPlan + ); + console.log(result); +} + +scalingPlansCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansDeleteSample.ts new file mode 100644 index 000000000000..73e3f9adbfbe --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a scaling plan. + * + * @summary Remove a scaling plan. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Delete.json + */ +async function scalingPlansDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const scalingPlanName = "scalingPlan1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.scalingPlans.delete( + resourceGroupName, + scalingPlanName + ); + console.log(result); +} + +scalingPlansDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansGetSample.ts new file mode 100644 index 000000000000..41ff30f614db --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a scaling plan. + * + * @summary Get a scaling plan. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Get.json + */ +async function scalingPlansGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const scalingPlanName = "scalingPlan1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.scalingPlans.get( + resourceGroupName, + scalingPlanName + ); + console.log(result); +} + +scalingPlansGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansListByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansListByHostPoolSample.ts new file mode 100644 index 000000000000..ad372ff54f90 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansListByHostPoolSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List scaling plan associated with hostpool. + * + * @summary List scaling plan associated with hostpool. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListByHostPool.json + */ +async function scalingPlanListByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.scalingPlans.listByHostPool( + resourceGroupName, + hostPoolName + )) { + resArray.push(item); + } + console.log(resArray); +} + +scalingPlanListByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansListByResourceGroupSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansListByResourceGroupSample.ts new file mode 100644 index 000000000000..3d11498b64fc --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List scaling plans. + * + * @summary List scaling plans. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListByResourceGroup.json + */ +async function scalingPlansListByResourceGroup() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.scalingPlans.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +scalingPlansListByResourceGroup().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansListBySubscriptionSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansListBySubscriptionSample.ts new file mode 100644 index 000000000000..cedcb09c9656 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List scaling plans in subscription. + * + * @summary List scaling plans in subscription. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_ListBySubscription.json + */ +async function scalingPlansListBySubscription() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.scalingPlans.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +scalingPlansListBySubscription().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansUpdateSample.ts new file mode 100644 index 000000000000..55a37770aaac --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/scalingPlansUpdateSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a scaling plan. + * + * @summary Update a scaling plan. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/ScalingPlan_Update.json + */ +async function scalingPlansUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const scalingPlanName = "scalingPlan1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.scalingPlans.update( + resourceGroupName, + scalingPlanName + ); + console.log(result); +} + +scalingPlansUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsDeleteSample.ts new file mode 100644 index 000000000000..c183db223e4e --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsDeleteSample.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 { + SessionHostsDeleteOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a SessionHost. + * + * @summary Remove a SessionHost. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Delete.json + */ +async function sessionHostDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const force = true; + const options: SessionHostsDeleteOptionalParams = { force }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.sessionHosts.delete( + resourceGroupName, + hostPoolName, + sessionHostName, + options + ); + console.log(result); +} + +sessionHostDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsGetSample.ts new file mode 100644 index 000000000000..4bedb5e52ac6 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a session host. + * + * @summary Get a session host. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Get.json + */ +async function sessionHostGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.sessionHosts.get( + resourceGroupName, + hostPoolName, + sessionHostName + ); + console.log(result); +} + +sessionHostGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsListSample.ts new file mode 100644 index 000000000000..799daa854893 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsListSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List sessionHosts. + * + * @summary List sessionHosts. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_List.json + */ +async function sessionHostList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sessionHosts.list( + resourceGroupName, + hostPoolName + )) { + resArray.push(item); + } + console.log(resArray); +} + +sessionHostList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsUpdateSample.ts new file mode 100644 index 000000000000..dc7aad071061 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/sessionHostsUpdateSample.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 { + SessionHostPatch, + SessionHostsUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a session host. + * + * @summary Update a session host. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/SessionHost_Update.json + */ +async function sessionHostUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const force = true; + const sessionHost: SessionHostPatch = { + allowNewSession: true, + assignedUser: "user1@microsoft.com" + }; + const options: SessionHostsUpdateOptionalParams = { force, sessionHost }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.sessionHosts.update( + resourceGroupName, + hostPoolName, + sessionHostName, + options + ); + console.log(result); +} + +sessionHostUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/startMenuItemsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/startMenuItemsListSample.ts new file mode 100644 index 000000000000..e1eecf40c05c --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/startMenuItemsListSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List start menu items in the given application group. + * + * @summary List start menu items in the given application group. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/StartMenuItem_List.json + */ +async function startMenuItemList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const applicationGroupName = "applicationGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.startMenuItems.list( + resourceGroupName, + applicationGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +startMenuItemList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsDeleteSample.ts new file mode 100644 index 000000000000..bd9889e593cc --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsDeleteSample.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 { + UserSessionsDeleteOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a userSession. + * + * @summary Remove a userSession. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Delete.json + */ +async function userSessionDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const userSessionId = "1"; + const force = true; + const options: UserSessionsDeleteOptionalParams = { force }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.userSessions.delete( + resourceGroupName, + hostPoolName, + sessionHostName, + userSessionId, + options + ); + console.log(result); +} + +userSessionDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsDisconnectSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsDisconnectSample.ts new file mode 100644 index 000000000000..3d26ffe9857e --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsDisconnectSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Disconnect a userSession. + * + * @summary Disconnect a userSession. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Disconnect_Post.json + */ +async function userSessionDisconnectPost() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const userSessionId = "1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.userSessions.disconnect( + resourceGroupName, + hostPoolName, + sessionHostName, + userSessionId + ); + console.log(result); +} + +userSessionDisconnectPost().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsGetSample.ts new file mode 100644 index 000000000000..dbb54be4d4a7 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsGetSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a userSession. + * + * @summary Get a userSession. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_Get.json + */ +async function userSessionGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const userSessionId = "1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.userSessions.get( + resourceGroupName, + hostPoolName, + sessionHostName, + userSessionId + ); + console.log(result); +} + +userSessionGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsListByHostPoolSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsListByHostPoolSample.ts new file mode 100644 index 000000000000..032aa62b21ac --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsListByHostPoolSample.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 { + UserSessionsListByHostPoolOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List userSessions. + * + * @summary List userSessions. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_ListByHostPool.json + */ +async function userSessionListByHostPool() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const filter = + "userPrincipalName eq 'user1@microsoft.com' and state eq 'active'"; + const options: UserSessionsListByHostPoolOptionalParams = { filter }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.userSessions.listByHostPool( + resourceGroupName, + hostPoolName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +userSessionListByHostPool().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsListSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsListSample.ts new file mode 100644 index 000000000000..342e3277f03f --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsListSample.ts @@ -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. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List userSessions. + * + * @summary List userSessions. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_List.json + */ +async function userSessionList() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.userSessions.list( + resourceGroupName, + hostPoolName, + sessionHostName + )) { + resArray.push(item); + } + console.log(resArray); +} + +userSessionList().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsSendMessageSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsSendMessageSample.ts new file mode 100644 index 000000000000..2d8b81360e7f --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/userSessionsSendMessageSample.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 { + SendMessage, + UserSessionsSendMessageOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Send a message to a user. + * + * @summary Send a message to a user. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/UserSession_SendMessage_Post.json + */ +async function userSessionSendMessagePost() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const hostPoolName = "hostPool1"; + const sessionHostName = "sessionHost1.microsoft.com"; + const userSessionId = "1"; + const sendMessage: SendMessage = { + messageBody: "body", + messageTitle: "title" + }; + const options: UserSessionsSendMessageOptionalParams = { sendMessage }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.userSessions.sendMessage( + resourceGroupName, + hostPoolName, + sessionHostName, + userSessionId, + options + ); + console.log(result); +} + +userSessionSendMessagePost().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesCreateOrUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..dc9a2f7f2277 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesCreateOrUpdateSample.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 { + Workspace, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update a workspace. + * + * @summary Create or update a workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Create.json + */ +async function workspaceCreate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const workspace: Workspace = { + description: "des1", + friendlyName: "friendly", + location: "centralus", + tags: { tag1: "value1", tag2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.workspaces.createOrUpdate( + resourceGroupName, + workspaceName, + workspace + ); + console.log(result); +} + +workspaceCreate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesDeleteSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesDeleteSample.ts new file mode 100644 index 000000000000..854cb3d33da0 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Remove a workspace. + * + * @summary Remove a workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Delete.json + */ +async function workspaceDelete() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.workspaces.delete( + resourceGroupName, + workspaceName + ); + console.log(result); +} + +workspaceDelete().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesGetSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesGetSample.ts new file mode 100644 index 000000000000..fa431675741d --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a workspace. + * + * @summary Get a workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Get.json + */ +async function workspaceGet() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.workspaces.get(resourceGroupName, workspaceName); + console.log(result); +} + +workspaceGet().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesListByResourceGroupSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesListByResourceGroupSample.ts new file mode 100644 index 000000000000..e964a4aa1888 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List workspaces. + * + * @summary List workspaces. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_ListByResourceGroup.json + */ +async function workspaceListByResourceGroup() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.workspaces.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +workspaceListByResourceGroup().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesListBySubscriptionSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesListBySubscriptionSample.ts new file mode 100644 index 000000000000..06c7477bf9cd --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DesktopVirtualizationAPIClient } from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List workspaces in subscription. + * + * @summary List workspaces in subscription. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_ListBySubscription.json + */ +async function workspaceListBySubscription() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.workspaces.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +workspaceListBySubscription().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesUpdateSample.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesUpdateSample.ts new file mode 100644 index 000000000000..2a70aae32d57 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/src/workspacesUpdateSample.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 { + WorkspacePatch, + WorkspacesUpdateOptionalParams, + DesktopVirtualizationAPIClient +} from "@azure/arm-desktopvirtualization"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a workspace. + * + * @summary Update a workspace. + * x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2021-09-03-preview/examples/Workspace_Update.json + */ +async function workspaceUpdate() { + const subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + const resourceGroupName = "resourceGroup1"; + const workspaceName = "workspace1"; + const workspace: WorkspacePatch = { + description: "des1", + friendlyName: "friendly", + publicNetworkAccess: "Enabled", + tags: { tag1: "value1", tag2: "value2" } + }; + const options: WorkspacesUpdateOptionalParams = { workspace }; + const credential = new DefaultAzureCredential(); + const client = new DesktopVirtualizationAPIClient(credential, subscriptionId); + const result = await client.workspaces.update( + resourceGroupName, + workspaceName, + options + ); + console.log(result); +} + +workspaceUpdate().catch(console.error); diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/tsconfig.json b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..416c2dd82e00 --- /dev/null +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/samples/v1-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "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/desktopvirtualization/arm-desktopvirtualization/src/desktopVirtualizationAPIClient.ts b/sdk/desktopvirtualization/arm-desktopvirtualization/src/desktopVirtualizationAPIClient.ts index 88bfa8985d58..f4a2bf142083 100644 --- a/sdk/desktopvirtualization/arm-desktopvirtualization/src/desktopVirtualizationAPIClient.ts +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/src/desktopVirtualizationAPIClient.ts @@ -7,6 +7,7 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { OperationsImpl, @@ -74,7 +75,7 @@ export class DesktopVirtualizationAPIClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-desktopvirtualization/1.0.0-beta.2`; + const packageDetails = `azsdk-js-arm-desktopvirtualization/1.0.0-beta.3`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -89,9 +90,33 @@ export class DesktopVirtualizationAPIClient extends coreClient.ServiceClient { userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint || "https://management.azure.com" + baseUri: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + } // Parameter assignments this.subscriptionId = subscriptionId; diff --git a/sdk/desktopvirtualization/arm-desktopvirtualization/tsconfig.json b/sdk/desktopvirtualization/arm-desktopvirtualization/tsconfig.json index 6e3251194117..02d427ad910e 100644 --- a/sdk/desktopvirtualization/arm-desktopvirtualization/tsconfig.json +++ b/sdk/desktopvirtualization/arm-desktopvirtualization/tsconfig.json @@ -9,11 +9,25 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true + "importHelpers": true, + "paths": { + "@azure/arm-desktopvirtualization": [ + "./src/index" + ] + } }, - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "exclude": ["node_modules"] -} + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/desktopvirtualization/ci.mgmt.yml b/sdk/desktopvirtualization/ci.mgmt.yml index 49dcccde78de..4bcedc523f89 100644 --- a/sdk/desktopvirtualization/ci.mgmt.yml +++ b/sdk/desktopvirtualization/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -9,7 +9,7 @@ trigger: paths: include: - sdk/desktopvirtualization/ci.mgmt.yml - - sdk/desktopvirtualization/arm-desktopvirtualization/ + - sdk/desktopvirtualization/arm-desktopvirtualization pr: branches: include: @@ -22,12 +22,11 @@ pr: paths: include: - sdk/desktopvirtualization/ci.mgmt.yml - - sdk/desktopvirtualization/arm-desktopvirtualization/ - + - sdk/desktopvirtualization/arm-desktopvirtualization extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: desktopvirtualization Artifacts: - name: azure-arm-desktopvirtualization - safeName: azurearmdesktopvirtualization \ No newline at end of file + safeName: azurearmdesktopvirtualization diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/CHANGELOG.md b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/CHANGELOG.md index 1d357a94a163..f8af930f0050 100644 --- a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/CHANGELOG.md +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/CHANGELOG.md @@ -1,14 +1,10 @@ # Release History -## 4.1.1 (Unreleased) +## 4.1.1 (2022-04-18) -### Features Added +**features** -### Breaking Changes - -### Bugs Fixed - -### Other Changes + - bug fix ## 4.1.0 (2022-01-24) diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/LICENSE.txt b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/LICENSE.txt deleted file mode 100644 index a70e8cf66038..000000000000 --- a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 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. diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/README.md b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/README.md index c464628e2494..9be3f4bbaa44 100644 --- a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/README.md +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/README.md @@ -16,6 +16,8 @@ API for using the Azure IoT Hub Device Provisioning Service features. - [LTS versions of Node.js](https://nodejs.org/about/releases/) - 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]. @@ -49,8 +51,17 @@ For more information about how to create an Azure AD Application check out [this ```javascript const { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); 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 IotDpsClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new IotDpsClient(credential, subscriptionId); ``` diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/_meta.json b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/_meta.json index d095d371c7cb..88d8eb0f0a46 100644 --- a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/_meta.json +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/_meta.json @@ -1,7 +1,8 @@ { "commit": "2a2aa10bc5e772934d22628faf45a53055ee96c6", - "readme": "specification/deviceprovisioningservices/resource-manager/readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/deviceprovisioningservices/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220114.1 --generate-sample=true", + "readme": "specification\\deviceprovisioningservices\\resource-manager\\readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\deviceprovisioningservices\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20220114.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.2.6", + "use": "@autorest/typescript@6.0.0-alpha.19.20220408.1" } \ No newline at end of file diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/package.json b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/package.json index 23383ab83671..c24ed74afa2f 100644 --- a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/package.json +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/package.json @@ -11,9 +11,9 @@ "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.5.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -29,13 +29,13 @@ "types": "./types/arm-deviceprovisioningservices.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.18.11", - "@rollup/plugin-commonjs": "11.0.2", - "@rollup/plugin-json": "^4.0.0", - "@rollup/plugin-multi-entry": "^3.0.0", - "@rollup/plugin-node-resolve": "^8.0.0", + "@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": "^1.16.3", - "rollup-plugin-sourcemaps": "^0.4.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.2.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", @@ -101,7 +101,7 @@ "//metadata": { "constantPaths": [ { - "path": "src/IotDpsClient.ts", + "path": "src/iotDpsClient.ts", "prefix": "packageDetails" } ] diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/rollup.config.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/rollup.config.js index 9be1955eb7f1..3f89d7309da5 100644 --- a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/rollup.config.js +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/rollup.config.js @@ -14,62 +14,14 @@ import json from "@rollup/plugin-json"; import nodeBuiltins from "builtin-modules"; -/** - * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. - * - * NOTE: this manual configuration is only needed because OpenTelemetry uses an - * __exportStar downleveled helper function to declare its exports which confuses - * rollup's automatic discovery mechanism. - * - * @returns an object reference that can be `...`'d into your cjs() configuration. - */ -export function openTelemetryCommonJs() { - const namedExports = {}; - - for (const key of [ - "@opentelemetry/api", - "@azure/core-tracing/node_modules/@opentelemetry/api" - ]) { - namedExports[key] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "SpanStatusCode", - "getSpanContext", - "setSpanContext" - ]; - } - - const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; - - for (const version of releasedOpenTelemetryVersions) { - namedExports[ - // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. - `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` - ] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "StatusCode", - "CanonicalCode", - "getSpanContext", - "setSpanContext" - ]; - } - - return namedExports; -} - // #region Warning Handler /** - * A function that can determine whether a rollupwarning should be ignored. If + * 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 ignoreNiseSinonEvalWarnings(warning) { +function ignoreNiseSinonEval(warning) { return ( warning.code === "EVAL" && warning.id && @@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) { ); } -function ignoreChaiCircularDependencyWarnings(warning) { +function ignoreChaiCircularDependency(warning) { return ( warning.code === "CIRCULAR_DEPENDENCY" && warning.importer && warning.importer.includes("node_modules/chai") === true ); } -const warningInhibitors = [ - ignoreChaiCircularDependencyWarnings, - ignoreNiseSinonEvalWarnings -]; +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; /** * Construct a warning handler for the shared rollup configuration @@ -122,22 +71,7 @@ function makeBrowserTestConfig() { nodeResolve({ mainFields: ["module", "browser"] }), - cjs({ - namedExports: { - // Chai's strange internal architecture makes it impossible to statically - // analyze its exports. - chai: [ - "version", - "use", - "util", - "config", - "expect", - "should", - "assert" - ], - ...openTelemetryCommonJs() - } - }), + cjs(), json(), sourcemaps() //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) @@ -173,7 +107,7 @@ export function makeConfig(pkg, options) { ], output: { file: "dist/index.js", format: "cjs", sourcemap: true }, preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve(), cjs()] + plugins: [sourcemaps(), nodeResolve()] }; const config = [baseConfig]; diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateCreateOrUpdateSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateCreateOrUpdateSample.ts new file mode 100644 index 000000000000..3752d3c94817 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateCreateOrUpdateSample.ts @@ -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. +import { + CertificateBodyDescription, + IotDpsClient +} from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Add new certificate or update an existing certificate. + * + * @summary Add new certificate or update an existing certificate. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCertificateCreateOrUpdate.json + */ +async function dpsCreateOrUpdateCertificate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const certificateName = "cert"; + const certificateDescription: CertificateBodyDescription = { + certificate: "############################################" + }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.createOrUpdate( + resourceGroupName, + provisioningServiceName, + certificateName, + certificateDescription + ); + console.log(result); +} + +dpsCreateOrUpdateCertificate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateDeleteSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateDeleteSample.ts new file mode 100644 index 000000000000..fc8851af5e57 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateDeleteSample.ts @@ -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. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the specified certificate associated with the Provisioning Service + * + * @summary Deletes the specified certificate associated with the Provisioning Service + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeleteCertificate.json + */ +async function dpsDeleteCertificate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const ifMatch = "AAAAAAAADGk="; + const provisioningServiceName = "myFirstProvisioningService"; + const certificateName = "cert"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.delete( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName + ); + console.log(result); +} + +dpsDeleteCertificate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateGenerateVerificationCodeSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateGenerateVerificationCodeSample.ts new file mode 100644 index 000000000000..bffb370b6a30 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateGenerateVerificationCodeSample.ts @@ -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. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Generate verification code for Proof of Possession. + * + * @summary Generate verification code for Proof of Possession. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGenerateVerificationCode.json + */ +async function dpsGenerateVerificationCode() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const certificateName = "cert"; + const ifMatch = "AAAAAAAADGk="; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.generateVerificationCode( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName + ); + console.log(result); +} + +dpsGenerateVerificationCode().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateGetSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateGetSample.ts new file mode 100644 index 000000000000..6e6a244a35a9 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the certificate from the provisioning service. + * + * @summary Get the certificate from the provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificate.json + */ +async function dpsGetCertificate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const certificateName = "cert"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.get( + certificateName, + resourceGroupName, + provisioningServiceName + ); + console.log(result); +} + +dpsGetCertificate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateListSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateListSample.ts new file mode 100644 index 000000000000..c71aa99ff7c3 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get all the certificates tied to the provisioning service. + * + * @summary Get all the certificates tied to the provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificates.json + */ +async function dpsGetCertificates() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.list( + resourceGroupName, + provisioningServiceName + ); + console.log(result); +} + +dpsGetCertificates().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateVerifyCertificateSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateVerifyCertificateSample.ts new file mode 100644 index 000000000000..fe508b98b7f3 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCertificateVerifyCertificateSample.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 { + VerificationCodeRequest, + IotDpsClient +} from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @summary Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSVerifyCertificate.json + */ +async function dpsVerifyCertificate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const certificateName = "cert"; + const ifMatch = "AAAAAAAADGk="; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const request: VerificationCodeRequest = { + certificate: "#####################################" + }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.verifyCertificate( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + request + ); + console.log(result); +} + +dpsVerifyCertificate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCheckName.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCheckName.ts index 817515c538b0..bfb063695197 100644 --- a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCheckName.ts +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/dpsCheckName.ts @@ -22,11 +22,10 @@ import { DefaultAzureCredential } from "@azure/identity"; async function dpsCheckName() { const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; - const arguments: OperationInputs = { name: "test213123" }; const credential = new DefaultAzureCredential(); const client = new IotDpsClient(credential, subscriptionId); const result = await client.iotDpsResource.checkProvisioningServiceNameAvailability( - arguments + { name: "test213123" } ); console.log(result); } diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceCheckProvisioningServiceNameAvailabilitySample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceCheckProvisioningServiceNameAvailabilitySample.ts new file mode 100644 index 000000000000..f27d5cd30dc9 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceCheckProvisioningServiceNameAvailabilitySample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + OperationInputs, + IotDpsClient +} from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable + * + * @summary Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCheckNameAvailability.json + */ +async function dpsCheckName() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const argumentsParam: OperationInputs = { name: "test213123" }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.checkProvisioningServiceNameAvailability( + argumentsParam + ); + console.log(result); +} + +dpsCheckName().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceCreateOrUpdatePrivateEndpointConnectionSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceCreateOrUpdatePrivateEndpointConnectionSample.ts new file mode 100644 index 000000000000..ddfac6cad886 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceCreateOrUpdatePrivateEndpointConnectionSample.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 { + PrivateEndpointConnection, + IotDpsClient +} from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update the status of a private endpoint connection with the specified name + * + * @summary Create or update the status of a private endpoint connection with the specified name + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreateOrUpdatePrivateEndpointConnection.json + */ +async function privateEndpointConnectionCreateOrUpdate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const privateEndpointConnectionName = "myPrivateEndpointConnection"; + const privateEndpointConnection: PrivateEndpointConnection = { + properties: { + privateLinkServiceConnectionState: { + description: "Approved by johndoe@contoso.com", + status: "Approved" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginCreateOrUpdatePrivateEndpointConnectionAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection + ); + console.log(result); +} + +privateEndpointConnectionCreateOrUpdate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceCreateOrUpdateSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceCreateOrUpdateSample.ts new file mode 100644 index 000000000000..cf6b9acbd0cd --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceCreateOrUpdateSample.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 { + ProvisioningServiceDescription, + IotDpsClient +} from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * + * @summary Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreate.json + */ +async function dpsCreate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const iotDpsDescription: ProvisioningServiceDescription = { + location: "East US", + properties: { enableDataResidency: false }, + sku: { name: "S1", capacity: 1 }, + tags: {} + }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginCreateOrUpdateAndWait( + resourceGroupName, + provisioningServiceName, + iotDpsDescription + ); + console.log(result); +} + +dpsCreate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceDeletePrivateEndpointConnectionSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceDeletePrivateEndpointConnectionSample.ts new file mode 100644 index 000000000000..f7fd62c9b85f --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceDeletePrivateEndpointConnectionSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete private endpoint connection with the specified name + * + * @summary Delete private endpoint connection with the specified name + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeletePrivateEndpointConnection.json + */ +async function privateEndpointConnectionDelete() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const privateEndpointConnectionName = "myPrivateEndpointConnection"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginDeletePrivateEndpointConnectionAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionDelete().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceDeleteSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceDeleteSample.ts new file mode 100644 index 000000000000..d5f3160c74fa --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the Provisioning Service. + * + * @summary Deletes the Provisioning Service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDelete.json + */ +async function dpsDelete() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginDeleteAndWait( + provisioningServiceName, + resourceGroupName + ); + console.log(result); +} + +dpsDelete().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceGetOperationResultSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceGetOperationResultSample.ts new file mode 100644 index 000000000000..64c9d627a292 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceGetOperationResultSample.ts @@ -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. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @summary Gets the status of a long running operation, such as create, update or delete a provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetOperationResult.json + */ +async function dpsGetOperationResult() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const operationId = "MTY5OTNmZDctODI5Yy00N2E2LTkxNDQtMDU1NGIyYzY1ZjRl"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const asyncinfo = "1508265712453"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.getOperationResult( + operationId, + resourceGroupName, + provisioningServiceName, + asyncinfo + ); + console.log(result); +} + +dpsGetOperationResult().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceGetPrivateEndpointConnectionSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceGetPrivateEndpointConnectionSample.ts new file mode 100644 index 000000000000..079317964d0c --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceGetPrivateEndpointConnectionSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get private endpoint connection properties + * + * @summary Get private endpoint connection properties + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateEndpointConnection.json + */ +async function privateEndpointConnectionGet() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const privateEndpointConnectionName = "myPrivateEndpointConnection"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.getPrivateEndpointConnection( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionGet().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceGetPrivateLinkResourcesSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceGetPrivateLinkResourcesSample.ts new file mode 100644 index 000000000000..a7d3890374c2 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceGetPrivateLinkResourcesSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the specified private link resource for the given provisioning service + * + * @summary Get the specified private link resource for the given provisioning service + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateLinkResources.json + */ +async function privateLinkResourcesList() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const groupId = "iotDps"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.getPrivateLinkResources( + resourceGroupName, + resourceName, + groupId + ); + console.log(result); +} + +privateLinkResourcesList().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceGetSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceGetSample.ts new file mode 100644 index 000000000000..de3ea37c2656 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the metadata of the provisioning service without SAS keys. + * + * @summary Get the metadata of the provisioning service without SAS keys. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGet.json + */ +async function dpsGet() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.get( + provisioningServiceName, + resourceGroupName + ); + console.log(result); +} + +dpsGet().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListByResourceGroupSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListByResourceGroupSample.ts new file mode 100644 index 000000000000..d178bf7e8b56 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a list of all provisioning services in the given resource group. + * + * @summary Get a list of all provisioning services in the given resource group. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListByResourceGroup.json + */ +async function dpsListByResourceGroup() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.iotDpsResource.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +dpsListByResourceGroup().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListBySubscriptionSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListBySubscriptionSample.ts new file mode 100644 index 000000000000..7996c6b43524 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all the provisioning services for a given subscription id. + * + * @summary List all the provisioning services for a given subscription id. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListBySubscription.json + */ +async function dpsListBySubscription() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.iotDpsResource.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +dpsListBySubscription().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListKeysForKeyNameSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListKeysForKeyNameSample.ts new file mode 100644 index 000000000000..642d4aede58e --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListKeysForKeyNameSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List primary and secondary keys for a specific key name + * + * @summary List primary and secondary keys for a specific key name + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetKey.json + */ +async function dpsGetKey() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const keyName = "testKey"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.listKeysForKeyName( + provisioningServiceName, + keyName, + resourceGroupName + ); + console.log(result); +} + +dpsGetKey().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListKeysSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListKeysSample.ts new file mode 100644 index 000000000000..ff770d90e9c1 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListKeysSample.ts @@ -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. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the primary and secondary keys for a provisioning service. + * + * @summary List the primary and secondary keys for a provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListKeys.json + */ +async function dpsListKeys() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.iotDpsResource.listKeys( + provisioningServiceName, + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +dpsListKeys().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListPrivateEndpointConnectionsSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListPrivateEndpointConnectionsSample.ts new file mode 100644 index 000000000000..ddef1cb8a097 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListPrivateEndpointConnectionsSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List private endpoint connection properties + * + * @summary List private endpoint connection properties + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateEndpointConnections.json + */ +async function privateEndpointConnectionsList() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.listPrivateEndpointConnections( + resourceGroupName, + resourceName + ); + console.log(result); +} + +privateEndpointConnectionsList().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListPrivateLinkResourcesSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListPrivateLinkResourcesSample.ts new file mode 100644 index 000000000000..2494de61c0b1 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListPrivateLinkResourcesSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List private link resources for the given provisioning service + * + * @summary List private link resources for the given provisioning service + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateLinkResources.json + */ +async function privateLinkResourcesList() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.listPrivateLinkResources( + resourceGroupName, + resourceName + ); + console.log(result); +} + +privateLinkResourcesList().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListValidSkusSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListValidSkusSample.ts new file mode 100644 index 000000000000..709a3b91151c --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceListValidSkusSample.ts @@ -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. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the list of valid SKUs and tiers for a provisioning service. + * + * @summary Gets the list of valid SKUs and tiers for a provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetValidSku.json + */ +async function dpsGetValidSku() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.iotDpsResource.listValidSkus( + provisioningServiceName, + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +dpsGetValidSku().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceUpdateSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceUpdateSample.ts new file mode 100644 index 000000000000..aab4c3f55fea --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/iotDpsResourceUpdateSample.ts @@ -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. +import { + TagsResource, + IotDpsClient +} from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method + * + * @summary Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSPatch.json + */ +async function dpsPatch() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const provisioningServiceTags: TagsResource = { tags: { foo: "bar" } }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginUpdateAndWait( + resourceGroupName, + provisioningServiceName, + provisioningServiceTags + ); + console.log(result); +} + +dpsPatch().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/operationsListSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..6724664b3ee9 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples-dev/operationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the available Microsoft.Devices REST API operations. + * + * @summary Lists all of the available Microsoft.Devices REST API operations. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSOperations.json + */ +async function dpsOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +dpsOperations().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/README.md b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/README.md index 4ab10da315a2..91762f764081 100644 --- a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/README.md +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/README.md @@ -2,31 +2,55 @@ These sample programs show how to use the JavaScript client libraries for in some common scenarios. -| **File Name** | **Description** | -| ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [dpsCheckName.js][dpscheckname] | Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCheckNameAvailability.json | -| [dpsCreate.js][dpscreate] | Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreate.json | -| [dpsCreateOrUpdateCertificate.js][dpscreateorupdatecertificate] | Add new certificate or update an existing certificate. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCertificateCreateOrUpdate.json | -| [dpsDelete.js][dpsdelete] | Deletes the Provisioning Service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDelete.json | -| [dpsDeleteCertificate.js][dpsdeletecertificate] | Deletes the specified certificate associated with the Provisioning Service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeleteCertificate.json | -| [dpsGenerateVerificationCode.js][dpsgenerateverificationcode] | Generate verification code for Proof of Possession. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGenerateVerificationCode.json | -| [dpsGet.js][dpsget] | Get the metadata of the provisioning service without SAS keys. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGet.json | -| [dpsGetCertificate.js][dpsgetcertificate] | Get the certificate from the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificate.json | -| [dpsGetCertificates.js][dpsgetcertificates] | Get all the certificates tied to the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificates.json | -| [dpsGetKey.js][dpsgetkey] | List primary and secondary keys for a specific key name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetKey.json | -| [dpsGetOperationResult.js][dpsgetoperationresult] | Gets the status of a long running operation, such as create, update or delete a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetOperationResult.json | -| [dpsGetValidSku.js][dpsgetvalidsku] | Gets the list of valid SKUs and tiers for a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetValidSku.json | -| [dpsListByResourceGroup.js][dpslistbyresourcegroup] | Get a list of all provisioning services in the given resource group. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListByResourceGroup.json | -| [dpsListBySubscription.js][dpslistbysubscription] | List all the provisioning services for a given subscription id. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListBySubscription.json | -| [dpsListKeys.js][dpslistkeys] | List the primary and secondary keys for a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListKeys.json | -| [dpsOperations.js][dpsoperations] | Lists all of the available Microsoft.Devices REST API operations. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSOperations.json | -| [dpsPatch.js][dpspatch] | Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSPatch.json | -| [dpsVerifyCertificate.js][dpsverifycertificate] | Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSVerifyCertificate.json | -| [privateEndpointConnectionCreateOrUpdate.js][privateendpointconnectioncreateorupdate] | Create or update the status of a private endpoint connection with the specified name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreateOrUpdatePrivateEndpointConnection.json | -| [privateEndpointConnectionDelete.js][privateendpointconnectiondelete] | Delete private endpoint connection with the specified name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeletePrivateEndpointConnection.json | -| [privateEndpointConnectionGet.js][privateendpointconnectionget] | Get private endpoint connection properties x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateEndpointConnection.json | -| [privateEndpointConnectionsList.js][privateendpointconnectionslist] | List private endpoint connection properties x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateEndpointConnections.json | -| [privateLinkResourcesList.js][privatelinkresourceslist] | Get the specified private link resource for the given provisioning service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateLinkResources.json | +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [dpsCertificateCreateOrUpdateSample.js][dpscertificatecreateorupdatesample] | Add new certificate or update an existing certificate. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCertificateCreateOrUpdate.json | +| [dpsCertificateDeleteSample.js][dpscertificatedeletesample] | Deletes the specified certificate associated with the Provisioning Service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeleteCertificate.json | +| [dpsCertificateGenerateVerificationCodeSample.js][dpscertificategenerateverificationcodesample] | Generate verification code for Proof of Possession. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGenerateVerificationCode.json | +| [dpsCertificateGetSample.js][dpscertificategetsample] | Get the certificate from the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificate.json | +| [dpsCertificateListSample.js][dpscertificatelistsample] | Get all the certificates tied to the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificates.json | +| [dpsCertificateVerifyCertificateSample.js][dpscertificateverifycertificatesample] | Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSVerifyCertificate.json | +| [dpsCheckName.js][dpscheckname] | Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCheckNameAvailability.json | +| [dpsCreate.js][dpscreate] | Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreate.json | +| [dpsCreateOrUpdateCertificate.js][dpscreateorupdatecertificate] | Add new certificate or update an existing certificate. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCertificateCreateOrUpdate.json | +| [dpsDelete.js][dpsdelete] | Deletes the Provisioning Service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDelete.json | +| [dpsDeleteCertificate.js][dpsdeletecertificate] | Deletes the specified certificate associated with the Provisioning Service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeleteCertificate.json | +| [dpsGenerateVerificationCode.js][dpsgenerateverificationcode] | Generate verification code for Proof of Possession. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGenerateVerificationCode.json | +| [dpsGet.js][dpsget] | Get the metadata of the provisioning service without SAS keys. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGet.json | +| [dpsGetCertificate.js][dpsgetcertificate] | Get the certificate from the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificate.json | +| [dpsGetCertificates.js][dpsgetcertificates] | Get all the certificates tied to the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificates.json | +| [dpsGetKey.js][dpsgetkey] | List primary and secondary keys for a specific key name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetKey.json | +| [dpsGetOperationResult.js][dpsgetoperationresult] | Gets the status of a long running operation, such as create, update or delete a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetOperationResult.json | +| [dpsGetValidSku.js][dpsgetvalidsku] | Gets the list of valid SKUs and tiers for a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetValidSku.json | +| [dpsListByResourceGroup.js][dpslistbyresourcegroup] | Get a list of all provisioning services in the given resource group. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListByResourceGroup.json | +| [dpsListBySubscription.js][dpslistbysubscription] | List all the provisioning services for a given subscription id. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListBySubscription.json | +| [dpsListKeys.js][dpslistkeys] | List the primary and secondary keys for a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListKeys.json | +| [dpsOperations.js][dpsoperations] | Lists all of the available Microsoft.Devices REST API operations. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSOperations.json | +| [dpsPatch.js][dpspatch] | Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSPatch.json | +| [dpsVerifyCertificate.js][dpsverifycertificate] | Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSVerifyCertificate.json | +| [iotDpsResourceCheckProvisioningServiceNameAvailabilitySample.js][iotdpsresourcecheckprovisioningservicenameavailabilitysample] | Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCheckNameAvailability.json | +| [iotDpsResourceCreateOrUpdatePrivateEndpointConnectionSample.js][iotdpsresourcecreateorupdateprivateendpointconnectionsample] | Create or update the status of a private endpoint connection with the specified name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreateOrUpdatePrivateEndpointConnection.json | +| [iotDpsResourceCreateOrUpdateSample.js][iotdpsresourcecreateorupdatesample] | Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreate.json | +| [iotDpsResourceDeletePrivateEndpointConnectionSample.js][iotdpsresourcedeleteprivateendpointconnectionsample] | Delete private endpoint connection with the specified name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeletePrivateEndpointConnection.json | +| [iotDpsResourceDeleteSample.js][iotdpsresourcedeletesample] | Deletes the Provisioning Service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDelete.json | +| [iotDpsResourceGetOperationResultSample.js][iotdpsresourcegetoperationresultsample] | Gets the status of a long running operation, such as create, update or delete a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetOperationResult.json | +| [iotDpsResourceGetPrivateEndpointConnectionSample.js][iotdpsresourcegetprivateendpointconnectionsample] | Get private endpoint connection properties x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateEndpointConnection.json | +| [iotDpsResourceGetPrivateLinkResourcesSample.js][iotdpsresourcegetprivatelinkresourcessample] | Get the specified private link resource for the given provisioning service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateLinkResources.json | +| [iotDpsResourceGetSample.js][iotdpsresourcegetsample] | Get the metadata of the provisioning service without SAS keys. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGet.json | +| [iotDpsResourceListByResourceGroupSample.js][iotdpsresourcelistbyresourcegroupsample] | Get a list of all provisioning services in the given resource group. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListByResourceGroup.json | +| [iotDpsResourceListBySubscriptionSample.js][iotdpsresourcelistbysubscriptionsample] | List all the provisioning services for a given subscription id. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListBySubscription.json | +| [iotDpsResourceListKeysForKeyNameSample.js][iotdpsresourcelistkeysforkeynamesample] | List primary and secondary keys for a specific key name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetKey.json | +| [iotDpsResourceListKeysSample.js][iotdpsresourcelistkeyssample] | List the primary and secondary keys for a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListKeys.json | +| [iotDpsResourceListPrivateEndpointConnectionsSample.js][iotdpsresourcelistprivateendpointconnectionssample] | List private endpoint connection properties x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateEndpointConnections.json | +| [iotDpsResourceListPrivateLinkResourcesSample.js][iotdpsresourcelistprivatelinkresourcessample] | List private link resources for the given provisioning service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateLinkResources.json | +| [iotDpsResourceListValidSkusSample.js][iotdpsresourcelistvalidskussample] | Gets the list of valid SKUs and tiers for a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetValidSku.json | +| [iotDpsResourceUpdateSample.js][iotdpsresourceupdatesample] | Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSPatch.json | +| [operationsListSample.js][operationslistsample] | Lists all of the available Microsoft.Devices REST API operations. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSOperations.json | +| [privateEndpointConnectionCreateOrUpdate.js][privateendpointconnectioncreateorupdate] | Create or update the status of a private endpoint connection with the specified name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreateOrUpdatePrivateEndpointConnection.json | +| [privateEndpointConnectionDelete.js][privateendpointconnectiondelete] | Delete private endpoint connection with the specified name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeletePrivateEndpointConnection.json | +| [privateEndpointConnectionGet.js][privateendpointconnectionget] | Get private endpoint connection properties x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateEndpointConnection.json | +| [privateEndpointConnectionsList.js][privateendpointconnectionslist] | List private endpoint connection properties x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateEndpointConnections.json | +| [privateLinkResourcesList.js][privatelinkresourceslist] | Get the specified private link resource for the given provisioning service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateLinkResources.json | ## Prerequisites @@ -53,19 +77,25 @@ npm install 3. Run whichever samples you like (note that some samples may require additional setup, see the table above): ```bash -node dpsCheckName.js +node dpsCertificateCreateOrUpdateSample.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 node dpsCheckName.js +npx cross-env node dpsCertificateCreateOrUpdateSample.js ``` ## Next Steps Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. +[dpscertificatecreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateCreateOrUpdateSample.js +[dpscertificatedeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateDeleteSample.js +[dpscertificategenerateverificationcodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateGenerateVerificationCodeSample.js +[dpscertificategetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateGetSample.js +[dpscertificatelistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateListSample.js +[dpscertificateverifycertificatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateVerifyCertificateSample.js [dpscheckname]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCheckName.js [dpscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCreate.js [dpscreateorupdatecertificate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCreateOrUpdateCertificate.js @@ -84,6 +114,24 @@ Take a look at our [API Documentation][apiref] for more information about the AP [dpsoperations]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsOperations.js [dpspatch]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsPatch.js [dpsverifycertificate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsVerifyCertificate.js +[iotdpsresourcecheckprovisioningservicenameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceCheckProvisioningServiceNameAvailabilitySample.js +[iotdpsresourcecreateorupdateprivateendpointconnectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceCreateOrUpdatePrivateEndpointConnectionSample.js +[iotdpsresourcecreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceCreateOrUpdateSample.js +[iotdpsresourcedeleteprivateendpointconnectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceDeletePrivateEndpointConnectionSample.js +[iotdpsresourcedeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceDeleteSample.js +[iotdpsresourcegetoperationresultsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetOperationResultSample.js +[iotdpsresourcegetprivateendpointconnectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetPrivateEndpointConnectionSample.js +[iotdpsresourcegetprivatelinkresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetPrivateLinkResourcesSample.js +[iotdpsresourcegetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetSample.js +[iotdpsresourcelistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListByResourceGroupSample.js +[iotdpsresourcelistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListBySubscriptionSample.js +[iotdpsresourcelistkeysforkeynamesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListKeysForKeyNameSample.js +[iotdpsresourcelistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListKeysSample.js +[iotdpsresourcelistprivateendpointconnectionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListPrivateEndpointConnectionsSample.js +[iotdpsresourcelistprivatelinkresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListPrivateLinkResourcesSample.js +[iotdpsresourcelistvalidskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListValidSkusSample.js +[iotdpsresourceupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceUpdateSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/operationsListSample.js [privateendpointconnectioncreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/privateEndpointConnectionCreateOrUpdate.js [privateendpointconnectiondelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/privateEndpointConnectionDelete.js [privateendpointconnectionget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/privateEndpointConnectionGet.js diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateCreateOrUpdateSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateCreateOrUpdateSample.js new file mode 100644 index 000000000000..9e759dd42fb3 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateCreateOrUpdateSample.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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Add new certificate or update an existing certificate. + * + * @summary Add new certificate or update an existing certificate. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCertificateCreateOrUpdate.json + */ +async function dpsCreateOrUpdateCertificate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const certificateName = "cert"; + const certificateDescription = { + certificate: "############################################", + }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.createOrUpdate( + resourceGroupName, + provisioningServiceName, + certificateName, + certificateDescription + ); + console.log(result); +} + +dpsCreateOrUpdateCertificate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateDeleteSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateDeleteSample.js new file mode 100644 index 000000000000..b9b4e031edf0 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateDeleteSample.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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes the specified certificate associated with the Provisioning Service + * + * @summary Deletes the specified certificate associated with the Provisioning Service + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeleteCertificate.json + */ +async function dpsDeleteCertificate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const ifMatch = "AAAAAAAADGk="; + const provisioningServiceName = "myFirstProvisioningService"; + const certificateName = "cert"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.delete( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName + ); + console.log(result); +} + +dpsDeleteCertificate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateGenerateVerificationCodeSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateGenerateVerificationCodeSample.js new file mode 100644 index 000000000000..83d88f606745 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateGenerateVerificationCodeSample.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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Generate verification code for Proof of Possession. + * + * @summary Generate verification code for Proof of Possession. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGenerateVerificationCode.json + */ +async function dpsGenerateVerificationCode() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const certificateName = "cert"; + const ifMatch = "AAAAAAAADGk="; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.generateVerificationCode( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName + ); + console.log(result); +} + +dpsGenerateVerificationCode().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateGetSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateGetSample.js new file mode 100644 index 000000000000..3a52e409a394 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get the certificate from the provisioning service. + * + * @summary Get the certificate from the provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificate.json + */ +async function dpsGetCertificate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const certificateName = "cert"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.get( + certificateName, + resourceGroupName, + provisioningServiceName + ); + console.log(result); +} + +dpsGetCertificate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateListSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateListSample.js new file mode 100644 index 000000000000..e2683365426b --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateListSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get all the certificates tied to the provisioning service. + * + * @summary Get all the certificates tied to the provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificates.json + */ +async function dpsGetCertificates() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.list(resourceGroupName, provisioningServiceName); + console.log(result); +} + +dpsGetCertificates().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateVerifyCertificateSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateVerifyCertificateSample.js new file mode 100644 index 000000000000..9119f7065deb --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/dpsCertificateVerifyCertificateSample.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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @summary Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSVerifyCertificate.json + */ +async function dpsVerifyCertificate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const certificateName = "cert"; + const ifMatch = "AAAAAAAADGk="; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const request = { + certificate: "#####################################", + }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.verifyCertificate( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + request + ); + console.log(result); +} + +dpsVerifyCertificate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceCheckProvisioningServiceNameAvailabilitySample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceCheckProvisioningServiceNameAvailabilitySample.js new file mode 100644 index 000000000000..828f66f6358b --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceCheckProvisioningServiceNameAvailabilitySample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable + * + * @summary Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCheckNameAvailability.json + */ +async function dpsCheckName() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const argumentsParam = { name: "test213123" }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.checkProvisioningServiceNameAvailability( + argumentsParam + ); + console.log(result); +} + +dpsCheckName().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceCreateOrUpdatePrivateEndpointConnectionSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceCreateOrUpdatePrivateEndpointConnectionSample.js new file mode 100644 index 000000000000..bfbb59e8b814 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceCreateOrUpdatePrivateEndpointConnectionSample.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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or update the status of a private endpoint connection with the specified name + * + * @summary Create or update the status of a private endpoint connection with the specified name + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreateOrUpdatePrivateEndpointConnection.json + */ +async function privateEndpointConnectionCreateOrUpdate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const privateEndpointConnectionName = "myPrivateEndpointConnection"; + const privateEndpointConnection = { + properties: { + privateLinkServiceConnectionState: { + description: "Approved by johndoe@contoso.com", + status: "Approved", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginCreateOrUpdatePrivateEndpointConnectionAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection + ); + console.log(result); +} + +privateEndpointConnectionCreateOrUpdate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceCreateOrUpdateSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceCreateOrUpdateSample.js new file mode 100644 index 000000000000..ab16023bdec4 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceCreateOrUpdateSample.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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * + * @summary Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreate.json + */ +async function dpsCreate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const iotDpsDescription = { + location: "East US", + properties: { enableDataResidency: false }, + sku: { name: "S1", capacity: 1 }, + tags: {}, + }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginCreateOrUpdateAndWait( + resourceGroupName, + provisioningServiceName, + iotDpsDescription + ); + console.log(result); +} + +dpsCreate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceDeletePrivateEndpointConnectionSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceDeletePrivateEndpointConnectionSample.js new file mode 100644 index 000000000000..7c6aad73ac1c --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceDeletePrivateEndpointConnectionSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete private endpoint connection with the specified name + * + * @summary Delete private endpoint connection with the specified name + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeletePrivateEndpointConnection.json + */ +async function privateEndpointConnectionDelete() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const privateEndpointConnectionName = "myPrivateEndpointConnection"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginDeletePrivateEndpointConnectionAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionDelete().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceDeleteSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceDeleteSample.js new file mode 100644 index 000000000000..dd4a20401f52 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceDeleteSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes the Provisioning Service. + * + * @summary Deletes the Provisioning Service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDelete.json + */ +async function dpsDelete() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginDeleteAndWait( + provisioningServiceName, + resourceGroupName + ); + console.log(result); +} + +dpsDelete().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetOperationResultSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetOperationResultSample.js new file mode 100644 index 000000000000..f0d5ac148f4d --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetOperationResultSample.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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @summary Gets the status of a long running operation, such as create, update or delete a provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetOperationResult.json + */ +async function dpsGetOperationResult() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const operationId = "MTY5OTNmZDctODI5Yy00N2E2LTkxNDQtMDU1NGIyYzY1ZjRl"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const asyncinfo = "1508265712453"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.getOperationResult( + operationId, + resourceGroupName, + provisioningServiceName, + asyncinfo + ); + console.log(result); +} + +dpsGetOperationResult().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetPrivateEndpointConnectionSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetPrivateEndpointConnectionSample.js new file mode 100644 index 000000000000..53fd469de4c1 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetPrivateEndpointConnectionSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get private endpoint connection properties + * + * @summary Get private endpoint connection properties + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateEndpointConnection.json + */ +async function privateEndpointConnectionGet() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const privateEndpointConnectionName = "myPrivateEndpointConnection"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.getPrivateEndpointConnection( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionGet().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetPrivateLinkResourcesSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetPrivateLinkResourcesSample.js new file mode 100644 index 000000000000..a5bb7ff49481 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetPrivateLinkResourcesSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get the specified private link resource for the given provisioning service + * + * @summary Get the specified private link resource for the given provisioning service + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateLinkResources.json + */ +async function privateLinkResourcesList() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const groupId = "iotDps"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.getPrivateLinkResources( + resourceGroupName, + resourceName, + groupId + ); + console.log(result); +} + +privateLinkResourcesList().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetSample.js new file mode 100644 index 000000000000..46a7846a07b0 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get the metadata of the provisioning service without SAS keys. + * + * @summary Get the metadata of the provisioning service without SAS keys. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGet.json + */ +async function dpsGet() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.get(provisioningServiceName, resourceGroupName); + console.log(result); +} + +dpsGet().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListByResourceGroupSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListByResourceGroupSample.js new file mode 100644 index 000000000000..69a5c906eb25 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListByResourceGroupSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get a list of all provisioning services in the given resource group. + * + * @summary Get a list of all provisioning services in the given resource group. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListByResourceGroup.json + */ +async function dpsListByResourceGroup() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.iotDpsResource.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +dpsListByResourceGroup().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListBySubscriptionSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListBySubscriptionSample.js new file mode 100644 index 000000000000..feae3ef050d7 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListBySubscriptionSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List all the provisioning services for a given subscription id. + * + * @summary List all the provisioning services for a given subscription id. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListBySubscription.json + */ +async function dpsListBySubscription() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.iotDpsResource.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +dpsListBySubscription().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListKeysForKeyNameSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListKeysForKeyNameSample.js new file mode 100644 index 000000000000..9cc76b53b509 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListKeysForKeyNameSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List primary and secondary keys for a specific key name + * + * @summary List primary and secondary keys for a specific key name + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetKey.json + */ +async function dpsGetKey() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const keyName = "testKey"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.listKeysForKeyName( + provisioningServiceName, + keyName, + resourceGroupName + ); + console.log(result); +} + +dpsGetKey().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListKeysSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListKeysSample.js new file mode 100644 index 000000000000..b75e2bf4c5fb --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListKeysSample.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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List the primary and secondary keys for a provisioning service. + * + * @summary List the primary and secondary keys for a provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListKeys.json + */ +async function dpsListKeys() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.iotDpsResource.listKeys( + provisioningServiceName, + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +dpsListKeys().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListPrivateEndpointConnectionsSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListPrivateEndpointConnectionsSample.js new file mode 100644 index 000000000000..14af7f8ef50a --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListPrivateEndpointConnectionsSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List private endpoint connection properties + * + * @summary List private endpoint connection properties + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateEndpointConnections.json + */ +async function privateEndpointConnectionsList() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.listPrivateEndpointConnections( + resourceGroupName, + resourceName + ); + console.log(result); +} + +privateEndpointConnectionsList().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListPrivateLinkResourcesSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListPrivateLinkResourcesSample.js new file mode 100644 index 000000000000..e7f8aec43ecb --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListPrivateLinkResourcesSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List private link resources for the given provisioning service + * + * @summary List private link resources for the given provisioning service + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateLinkResources.json + */ +async function privateLinkResourcesList() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.listPrivateLinkResources( + resourceGroupName, + resourceName + ); + console.log(result); +} + +privateLinkResourcesList().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListValidSkusSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListValidSkusSample.js new file mode 100644 index 000000000000..77bfa2418bec --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceListValidSkusSample.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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the list of valid SKUs and tiers for a provisioning service. + * + * @summary Gets the list of valid SKUs and tiers for a provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetValidSku.json + */ +async function dpsGetValidSku() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.iotDpsResource.listValidSkus( + provisioningServiceName, + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +dpsGetValidSku().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceUpdateSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceUpdateSample.js new file mode 100644 index 000000000000..d618be3a36a1 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/iotDpsResourceUpdateSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method + * + * @summary Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSPatch.json + */ +async function dpsPatch() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const provisioningServiceTags = { tags: { foo: "bar" } }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginUpdateAndWait( + resourceGroupName, + provisioningServiceName, + provisioningServiceTags + ); + console.log(result); +} + +dpsPatch().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/operationsListSample.js b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/operationsListSample.js new file mode 100644 index 000000000000..af4887e4c574 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/javascript/operationsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { IotDpsClient } = require("@azure/arm-deviceprovisioningservices"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists all of the available Microsoft.Devices REST API operations. + * + * @summary Lists all of the available Microsoft.Devices REST API operations. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSOperations.json + */ +async function dpsOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +dpsOperations().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/README.md b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/README.md index 1110248e794c..65b41b940eed 100644 --- a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/README.md +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/README.md @@ -2,31 +2,55 @@ These sample programs show how to use the TypeScript client libraries for in some common scenarios. -| **File Name** | **Description** | -| ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [dpsCheckName.ts][dpscheckname] | Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCheckNameAvailability.json | -| [dpsCreate.ts][dpscreate] | Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreate.json | -| [dpsCreateOrUpdateCertificate.ts][dpscreateorupdatecertificate] | Add new certificate or update an existing certificate. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCertificateCreateOrUpdate.json | -| [dpsDelete.ts][dpsdelete] | Deletes the Provisioning Service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDelete.json | -| [dpsDeleteCertificate.ts][dpsdeletecertificate] | Deletes the specified certificate associated with the Provisioning Service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeleteCertificate.json | -| [dpsGenerateVerificationCode.ts][dpsgenerateverificationcode] | Generate verification code for Proof of Possession. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGenerateVerificationCode.json | -| [dpsGet.ts][dpsget] | Get the metadata of the provisioning service without SAS keys. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGet.json | -| [dpsGetCertificate.ts][dpsgetcertificate] | Get the certificate from the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificate.json | -| [dpsGetCertificates.ts][dpsgetcertificates] | Get all the certificates tied to the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificates.json | -| [dpsGetKey.ts][dpsgetkey] | List primary and secondary keys for a specific key name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetKey.json | -| [dpsGetOperationResult.ts][dpsgetoperationresult] | Gets the status of a long running operation, such as create, update or delete a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetOperationResult.json | -| [dpsGetValidSku.ts][dpsgetvalidsku] | Gets the list of valid SKUs and tiers for a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetValidSku.json | -| [dpsListByResourceGroup.ts][dpslistbyresourcegroup] | Get a list of all provisioning services in the given resource group. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListByResourceGroup.json | -| [dpsListBySubscription.ts][dpslistbysubscription] | List all the provisioning services for a given subscription id. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListBySubscription.json | -| [dpsListKeys.ts][dpslistkeys] | List the primary and secondary keys for a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListKeys.json | -| [dpsOperations.ts][dpsoperations] | Lists all of the available Microsoft.Devices REST API operations. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSOperations.json | -| [dpsPatch.ts][dpspatch] | Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSPatch.json | -| [dpsVerifyCertificate.ts][dpsverifycertificate] | Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSVerifyCertificate.json | -| [privateEndpointConnectionCreateOrUpdate.ts][privateendpointconnectioncreateorupdate] | Create or update the status of a private endpoint connection with the specified name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreateOrUpdatePrivateEndpointConnection.json | -| [privateEndpointConnectionDelete.ts][privateendpointconnectiondelete] | Delete private endpoint connection with the specified name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeletePrivateEndpointConnection.json | -| [privateEndpointConnectionGet.ts][privateendpointconnectionget] | Get private endpoint connection properties x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateEndpointConnection.json | -| [privateEndpointConnectionsList.ts][privateendpointconnectionslist] | List private endpoint connection properties x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateEndpointConnections.json | -| [privateLinkResourcesList.ts][privatelinkresourceslist] | Get the specified private link resource for the given provisioning service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateLinkResources.json | +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [dpsCertificateCreateOrUpdateSample.ts][dpscertificatecreateorupdatesample] | Add new certificate or update an existing certificate. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCertificateCreateOrUpdate.json | +| [dpsCertificateDeleteSample.ts][dpscertificatedeletesample] | Deletes the specified certificate associated with the Provisioning Service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeleteCertificate.json | +| [dpsCertificateGenerateVerificationCodeSample.ts][dpscertificategenerateverificationcodesample] | Generate verification code for Proof of Possession. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGenerateVerificationCode.json | +| [dpsCertificateGetSample.ts][dpscertificategetsample] | Get the certificate from the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificate.json | +| [dpsCertificateListSample.ts][dpscertificatelistsample] | Get all the certificates tied to the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificates.json | +| [dpsCertificateVerifyCertificateSample.ts][dpscertificateverifycertificatesample] | Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSVerifyCertificate.json | +| [dpsCheckName.ts][dpscheckname] | Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCheckNameAvailability.json | +| [dpsCreate.ts][dpscreate] | Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreate.json | +| [dpsCreateOrUpdateCertificate.ts][dpscreateorupdatecertificate] | Add new certificate or update an existing certificate. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCertificateCreateOrUpdate.json | +| [dpsDelete.ts][dpsdelete] | Deletes the Provisioning Service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDelete.json | +| [dpsDeleteCertificate.ts][dpsdeletecertificate] | Deletes the specified certificate associated with the Provisioning Service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeleteCertificate.json | +| [dpsGenerateVerificationCode.ts][dpsgenerateverificationcode] | Generate verification code for Proof of Possession. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGenerateVerificationCode.json | +| [dpsGet.ts][dpsget] | Get the metadata of the provisioning service without SAS keys. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGet.json | +| [dpsGetCertificate.ts][dpsgetcertificate] | Get the certificate from the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificate.json | +| [dpsGetCertificates.ts][dpsgetcertificates] | Get all the certificates tied to the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificates.json | +| [dpsGetKey.ts][dpsgetkey] | List primary and secondary keys for a specific key name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetKey.json | +| [dpsGetOperationResult.ts][dpsgetoperationresult] | Gets the status of a long running operation, such as create, update or delete a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetOperationResult.json | +| [dpsGetValidSku.ts][dpsgetvalidsku] | Gets the list of valid SKUs and tiers for a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetValidSku.json | +| [dpsListByResourceGroup.ts][dpslistbyresourcegroup] | Get a list of all provisioning services in the given resource group. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListByResourceGroup.json | +| [dpsListBySubscription.ts][dpslistbysubscription] | List all the provisioning services for a given subscription id. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListBySubscription.json | +| [dpsListKeys.ts][dpslistkeys] | List the primary and secondary keys for a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListKeys.json | +| [dpsOperations.ts][dpsoperations] | Lists all of the available Microsoft.Devices REST API operations. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSOperations.json | +| [dpsPatch.ts][dpspatch] | Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSPatch.json | +| [dpsVerifyCertificate.ts][dpsverifycertificate] | Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSVerifyCertificate.json | +| [iotDpsResourceCheckProvisioningServiceNameAvailabilitySample.ts][iotdpsresourcecheckprovisioningservicenameavailabilitysample] | Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCheckNameAvailability.json | +| [iotDpsResourceCreateOrUpdatePrivateEndpointConnectionSample.ts][iotdpsresourcecreateorupdateprivateendpointconnectionsample] | Create or update the status of a private endpoint connection with the specified name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreateOrUpdatePrivateEndpointConnection.json | +| [iotDpsResourceCreateOrUpdateSample.ts][iotdpsresourcecreateorupdatesample] | Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreate.json | +| [iotDpsResourceDeletePrivateEndpointConnectionSample.ts][iotdpsresourcedeleteprivateendpointconnectionsample] | Delete private endpoint connection with the specified name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeletePrivateEndpointConnection.json | +| [iotDpsResourceDeleteSample.ts][iotdpsresourcedeletesample] | Deletes the Provisioning Service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDelete.json | +| [iotDpsResourceGetOperationResultSample.ts][iotdpsresourcegetoperationresultsample] | Gets the status of a long running operation, such as create, update or delete a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetOperationResult.json | +| [iotDpsResourceGetPrivateEndpointConnectionSample.ts][iotdpsresourcegetprivateendpointconnectionsample] | Get private endpoint connection properties x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateEndpointConnection.json | +| [iotDpsResourceGetPrivateLinkResourcesSample.ts][iotdpsresourcegetprivatelinkresourcessample] | Get the specified private link resource for the given provisioning service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateLinkResources.json | +| [iotDpsResourceGetSample.ts][iotdpsresourcegetsample] | Get the metadata of the provisioning service without SAS keys. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGet.json | +| [iotDpsResourceListByResourceGroupSample.ts][iotdpsresourcelistbyresourcegroupsample] | Get a list of all provisioning services in the given resource group. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListByResourceGroup.json | +| [iotDpsResourceListBySubscriptionSample.ts][iotdpsresourcelistbysubscriptionsample] | List all the provisioning services for a given subscription id. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListBySubscription.json | +| [iotDpsResourceListKeysForKeyNameSample.ts][iotdpsresourcelistkeysforkeynamesample] | List primary and secondary keys for a specific key name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetKey.json | +| [iotDpsResourceListKeysSample.ts][iotdpsresourcelistkeyssample] | List the primary and secondary keys for a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListKeys.json | +| [iotDpsResourceListPrivateEndpointConnectionsSample.ts][iotdpsresourcelistprivateendpointconnectionssample] | List private endpoint connection properties x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateEndpointConnections.json | +| [iotDpsResourceListPrivateLinkResourcesSample.ts][iotdpsresourcelistprivatelinkresourcessample] | List private link resources for the given provisioning service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateLinkResources.json | +| [iotDpsResourceListValidSkusSample.ts][iotdpsresourcelistvalidskussample] | Gets the list of valid SKUs and tiers for a provisioning service. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetValidSku.json | +| [iotDpsResourceUpdateSample.ts][iotdpsresourceupdatesample] | Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSPatch.json | +| [operationsListSample.ts][operationslistsample] | Lists all of the available Microsoft.Devices REST API operations. x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSOperations.json | +| [privateEndpointConnectionCreateOrUpdate.ts][privateendpointconnectioncreateorupdate] | Create or update the status of a private endpoint connection with the specified name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreateOrUpdatePrivateEndpointConnection.json | +| [privateEndpointConnectionDelete.ts][privateendpointconnectiondelete] | Delete private endpoint connection with the specified name x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeletePrivateEndpointConnection.json | +| [privateEndpointConnectionGet.ts][privateendpointconnectionget] | Get private endpoint connection properties x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateEndpointConnection.json | +| [privateEndpointConnectionsList.ts][privateendpointconnectionslist] | List private endpoint connection properties x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateEndpointConnections.json | +| [privateLinkResourcesList.ts][privatelinkresourceslist] | Get the specified private link resource for the given provisioning service x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateLinkResources.json | ## Prerequisites @@ -65,19 +89,25 @@ npm run build 4. Run whichever samples you like (note that some samples may require additional setup, see the table above): ```bash -node dist/dpsCheckName.js +node dist/dpsCertificateCreateOrUpdateSample.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 node dist/dpsCheckName.js +npx cross-env node dist/dpsCertificateCreateOrUpdateSample.js ``` ## Next Steps Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. +[dpscertificatecreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateCreateOrUpdateSample.ts +[dpscertificatedeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateDeleteSample.ts +[dpscertificategenerateverificationcodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateGenerateVerificationCodeSample.ts +[dpscertificategetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateGetSample.ts +[dpscertificatelistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateListSample.ts +[dpscertificateverifycertificatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateVerifyCertificateSample.ts [dpscheckname]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCheckName.ts [dpscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCreate.ts [dpscreateorupdatecertificate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCreateOrUpdateCertificate.ts @@ -96,6 +126,24 @@ Take a look at our [API Documentation][apiref] for more information about the AP [dpsoperations]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsOperations.ts [dpspatch]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsPatch.ts [dpsverifycertificate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsVerifyCertificate.ts +[iotdpsresourcecheckprovisioningservicenameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceCheckProvisioningServiceNameAvailabilitySample.ts +[iotdpsresourcecreateorupdateprivateendpointconnectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceCreateOrUpdatePrivateEndpointConnectionSample.ts +[iotdpsresourcecreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceCreateOrUpdateSample.ts +[iotdpsresourcedeleteprivateendpointconnectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceDeletePrivateEndpointConnectionSample.ts +[iotdpsresourcedeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceDeleteSample.ts +[iotdpsresourcegetoperationresultsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetOperationResultSample.ts +[iotdpsresourcegetprivateendpointconnectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetPrivateEndpointConnectionSample.ts +[iotdpsresourcegetprivatelinkresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetPrivateLinkResourcesSample.ts +[iotdpsresourcegetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetSample.ts +[iotdpsresourcelistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListByResourceGroupSample.ts +[iotdpsresourcelistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListBySubscriptionSample.ts +[iotdpsresourcelistkeysforkeynamesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListKeysForKeyNameSample.ts +[iotdpsresourcelistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListKeysSample.ts +[iotdpsresourcelistprivateendpointconnectionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListPrivateEndpointConnectionsSample.ts +[iotdpsresourcelistprivatelinkresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListPrivateLinkResourcesSample.ts +[iotdpsresourcelistvalidskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListValidSkusSample.ts +[iotdpsresourceupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceUpdateSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/operationsListSample.ts [privateendpointconnectioncreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/privateEndpointConnectionCreateOrUpdate.ts [privateendpointconnectiondelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/privateEndpointConnectionDelete.ts [privateendpointconnectionget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/privateEndpointConnectionGet.ts diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateCreateOrUpdateSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateCreateOrUpdateSample.ts new file mode 100644 index 000000000000..3752d3c94817 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateCreateOrUpdateSample.ts @@ -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. +import { + CertificateBodyDescription, + IotDpsClient +} from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Add new certificate or update an existing certificate. + * + * @summary Add new certificate or update an existing certificate. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCertificateCreateOrUpdate.json + */ +async function dpsCreateOrUpdateCertificate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const certificateName = "cert"; + const certificateDescription: CertificateBodyDescription = { + certificate: "############################################" + }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.createOrUpdate( + resourceGroupName, + provisioningServiceName, + certificateName, + certificateDescription + ); + console.log(result); +} + +dpsCreateOrUpdateCertificate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateDeleteSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateDeleteSample.ts new file mode 100644 index 000000000000..fc8851af5e57 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateDeleteSample.ts @@ -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. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the specified certificate associated with the Provisioning Service + * + * @summary Deletes the specified certificate associated with the Provisioning Service + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeleteCertificate.json + */ +async function dpsDeleteCertificate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const ifMatch = "AAAAAAAADGk="; + const provisioningServiceName = "myFirstProvisioningService"; + const certificateName = "cert"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.delete( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName + ); + console.log(result); +} + +dpsDeleteCertificate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateGenerateVerificationCodeSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateGenerateVerificationCodeSample.ts new file mode 100644 index 000000000000..bffb370b6a30 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateGenerateVerificationCodeSample.ts @@ -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. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Generate verification code for Proof of Possession. + * + * @summary Generate verification code for Proof of Possession. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGenerateVerificationCode.json + */ +async function dpsGenerateVerificationCode() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const certificateName = "cert"; + const ifMatch = "AAAAAAAADGk="; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.generateVerificationCode( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName + ); + console.log(result); +} + +dpsGenerateVerificationCode().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateGetSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateGetSample.ts new file mode 100644 index 000000000000..6e6a244a35a9 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the certificate from the provisioning service. + * + * @summary Get the certificate from the provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificate.json + */ +async function dpsGetCertificate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const certificateName = "cert"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.get( + certificateName, + resourceGroupName, + provisioningServiceName + ); + console.log(result); +} + +dpsGetCertificate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateListSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateListSample.ts new file mode 100644 index 000000000000..c71aa99ff7c3 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get all the certificates tied to the provisioning service. + * + * @summary Get all the certificates tied to the provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetCertificates.json + */ +async function dpsGetCertificates() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.list( + resourceGroupName, + provisioningServiceName + ); + console.log(result); +} + +dpsGetCertificates().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateVerifyCertificateSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateVerifyCertificateSample.ts new file mode 100644 index 000000000000..fe508b98b7f3 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/dpsCertificateVerifyCertificateSample.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 { + VerificationCodeRequest, + IotDpsClient +} from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @summary Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSVerifyCertificate.json + */ +async function dpsVerifyCertificate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const certificateName = "cert"; + const ifMatch = "AAAAAAAADGk="; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const request: VerificationCodeRequest = { + certificate: "#####################################" + }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.dpsCertificate.verifyCertificate( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + request + ); + console.log(result); +} + +dpsVerifyCertificate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceCheckProvisioningServiceNameAvailabilitySample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceCheckProvisioningServiceNameAvailabilitySample.ts new file mode 100644 index 000000000000..f27d5cd30dc9 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceCheckProvisioningServiceNameAvailabilitySample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + OperationInputs, + IotDpsClient +} from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable + * + * @summary Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCheckNameAvailability.json + */ +async function dpsCheckName() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const argumentsParam: OperationInputs = { name: "test213123" }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.checkProvisioningServiceNameAvailability( + argumentsParam + ); + console.log(result); +} + +dpsCheckName().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceCreateOrUpdatePrivateEndpointConnectionSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceCreateOrUpdatePrivateEndpointConnectionSample.ts new file mode 100644 index 000000000000..ddfac6cad886 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceCreateOrUpdatePrivateEndpointConnectionSample.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 { + PrivateEndpointConnection, + IotDpsClient +} from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update the status of a private endpoint connection with the specified name + * + * @summary Create or update the status of a private endpoint connection with the specified name + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreateOrUpdatePrivateEndpointConnection.json + */ +async function privateEndpointConnectionCreateOrUpdate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const privateEndpointConnectionName = "myPrivateEndpointConnection"; + const privateEndpointConnection: PrivateEndpointConnection = { + properties: { + privateLinkServiceConnectionState: { + description: "Approved by johndoe@contoso.com", + status: "Approved" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginCreateOrUpdatePrivateEndpointConnectionAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection + ); + console.log(result); +} + +privateEndpointConnectionCreateOrUpdate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceCreateOrUpdateSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceCreateOrUpdateSample.ts new file mode 100644 index 000000000000..cf6b9acbd0cd --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceCreateOrUpdateSample.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 { + ProvisioningServiceDescription, + IotDpsClient +} from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * + * @summary Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSCreate.json + */ +async function dpsCreate() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const iotDpsDescription: ProvisioningServiceDescription = { + location: "East US", + properties: { enableDataResidency: false }, + sku: { name: "S1", capacity: 1 }, + tags: {} + }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginCreateOrUpdateAndWait( + resourceGroupName, + provisioningServiceName, + iotDpsDescription + ); + console.log(result); +} + +dpsCreate().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceDeletePrivateEndpointConnectionSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceDeletePrivateEndpointConnectionSample.ts new file mode 100644 index 000000000000..f7fd62c9b85f --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceDeletePrivateEndpointConnectionSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete private endpoint connection with the specified name + * + * @summary Delete private endpoint connection with the specified name + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDeletePrivateEndpointConnection.json + */ +async function privateEndpointConnectionDelete() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const privateEndpointConnectionName = "myPrivateEndpointConnection"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginDeletePrivateEndpointConnectionAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionDelete().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceDeleteSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceDeleteSample.ts new file mode 100644 index 000000000000..d5f3160c74fa --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the Provisioning Service. + * + * @summary Deletes the Provisioning Service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSDelete.json + */ +async function dpsDelete() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginDeleteAndWait( + provisioningServiceName, + resourceGroupName + ); + console.log(result); +} + +dpsDelete().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetOperationResultSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetOperationResultSample.ts new file mode 100644 index 000000000000..64c9d627a292 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetOperationResultSample.ts @@ -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. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @summary Gets the status of a long running operation, such as create, update or delete a provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetOperationResult.json + */ +async function dpsGetOperationResult() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const operationId = "MTY5OTNmZDctODI5Yy00N2E2LTkxNDQtMDU1NGIyYzY1ZjRl"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const asyncinfo = "1508265712453"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.getOperationResult( + operationId, + resourceGroupName, + provisioningServiceName, + asyncinfo + ); + console.log(result); +} + +dpsGetOperationResult().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetPrivateEndpointConnectionSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetPrivateEndpointConnectionSample.ts new file mode 100644 index 000000000000..079317964d0c --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetPrivateEndpointConnectionSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get private endpoint connection properties + * + * @summary Get private endpoint connection properties + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateEndpointConnection.json + */ +async function privateEndpointConnectionGet() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const privateEndpointConnectionName = "myPrivateEndpointConnection"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.getPrivateEndpointConnection( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionGet().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetPrivateLinkResourcesSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetPrivateLinkResourcesSample.ts new file mode 100644 index 000000000000..a7d3890374c2 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetPrivateLinkResourcesSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the specified private link resource for the given provisioning service + * + * @summary Get the specified private link resource for the given provisioning service + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetPrivateLinkResources.json + */ +async function privateLinkResourcesList() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const groupId = "iotDps"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.getPrivateLinkResources( + resourceGroupName, + resourceName, + groupId + ); + console.log(result); +} + +privateLinkResourcesList().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetSample.ts new file mode 100644 index 000000000000..de3ea37c2656 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the metadata of the provisioning service without SAS keys. + * + * @summary Get the metadata of the provisioning service without SAS keys. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGet.json + */ +async function dpsGet() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.get( + provisioningServiceName, + resourceGroupName + ); + console.log(result); +} + +dpsGet().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListByResourceGroupSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListByResourceGroupSample.ts new file mode 100644 index 000000000000..d178bf7e8b56 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a list of all provisioning services in the given resource group. + * + * @summary Get a list of all provisioning services in the given resource group. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListByResourceGroup.json + */ +async function dpsListByResourceGroup() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.iotDpsResource.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +dpsListByResourceGroup().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListBySubscriptionSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListBySubscriptionSample.ts new file mode 100644 index 000000000000..7996c6b43524 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all the provisioning services for a given subscription id. + * + * @summary List all the provisioning services for a given subscription id. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListBySubscription.json + */ +async function dpsListBySubscription() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.iotDpsResource.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +dpsListBySubscription().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListKeysForKeyNameSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListKeysForKeyNameSample.ts new file mode 100644 index 000000000000..642d4aede58e --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListKeysForKeyNameSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List primary and secondary keys for a specific key name + * + * @summary List primary and secondary keys for a specific key name + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetKey.json + */ +async function dpsGetKey() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const keyName = "testKey"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.listKeysForKeyName( + provisioningServiceName, + keyName, + resourceGroupName + ); + console.log(result); +} + +dpsGetKey().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListKeysSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListKeysSample.ts new file mode 100644 index 000000000000..ff770d90e9c1 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListKeysSample.ts @@ -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. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List the primary and secondary keys for a provisioning service. + * + * @summary List the primary and secondary keys for a provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListKeys.json + */ +async function dpsListKeys() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.iotDpsResource.listKeys( + provisioningServiceName, + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +dpsListKeys().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListPrivateEndpointConnectionsSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListPrivateEndpointConnectionsSample.ts new file mode 100644 index 000000000000..ddef1cb8a097 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListPrivateEndpointConnectionsSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List private endpoint connection properties + * + * @summary List private endpoint connection properties + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateEndpointConnections.json + */ +async function privateEndpointConnectionsList() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.listPrivateEndpointConnections( + resourceGroupName, + resourceName + ); + console.log(result); +} + +privateEndpointConnectionsList().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListPrivateLinkResourcesSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListPrivateLinkResourcesSample.ts new file mode 100644 index 000000000000..2494de61c0b1 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListPrivateLinkResourcesSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List private link resources for the given provisioning service + * + * @summary List private link resources for the given provisioning service + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSListPrivateLinkResources.json + */ +async function privateLinkResourcesList() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "myFirstProvisioningService"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.listPrivateLinkResources( + resourceGroupName, + resourceName + ); + console.log(result); +} + +privateLinkResourcesList().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListValidSkusSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListValidSkusSample.ts new file mode 100644 index 000000000000..709a3b91151c --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceListValidSkusSample.ts @@ -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. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the list of valid SKUs and tiers for a provisioning service. + * + * @summary Gets the list of valid SKUs and tiers for a provisioning service. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSGetValidSku.json + */ +async function dpsGetValidSku() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const provisioningServiceName = "myFirstProvisioningService"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.iotDpsResource.listValidSkus( + provisioningServiceName, + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +dpsGetValidSku().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceUpdateSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceUpdateSample.ts new file mode 100644 index 000000000000..aab4c3f55fea --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/iotDpsResourceUpdateSample.ts @@ -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. +import { + TagsResource, + IotDpsClient +} from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method + * + * @summary Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSPatch.json + */ +async function dpsPatch() { + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const resourceGroupName = "myResourceGroup"; + const provisioningServiceName = "myFirstProvisioningService"; + const provisioningServiceTags: TagsResource = { tags: { foo: "bar" } }; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const result = await client.iotDpsResource.beginUpdateAndWait( + resourceGroupName, + provisioningServiceName, + provisioningServiceTags + ); + console.log(result); +} + +dpsPatch().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/operationsListSample.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..6724664b3ee9 --- /dev/null +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/samples/v4/typescript/src/operationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { IotDpsClient } from "@azure/arm-deviceprovisioningservices"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the available Microsoft.Devices REST API operations. + * + * @summary Lists all of the available Microsoft.Devices REST API operations. + * x-ms-original-file: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2021-10-15/examples/DPSOperations.json + */ +async function dpsOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new IotDpsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +dpsOperations().catch(console.error); diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/src/iotDpsClient.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/src/iotDpsClient.ts index aaf941372db2..da42736c9c6e 100644 --- a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/src/iotDpsClient.ts +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/src/iotDpsClient.ts @@ -7,6 +7,7 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { OperationsImpl, @@ -52,7 +53,7 @@ export class IotDpsClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-deviceprovisioningservices/4.1.0`; + const packageDetails = `azsdk-js-arm-deviceprovisioningservices/4.1.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -67,9 +68,33 @@ export class IotDpsClient extends coreClient.ServiceClient { userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint || "https://management.azure.com" + baseUri: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + } // Parameter assignments this.subscriptionId = subscriptionId; diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/src/operations/iotDpsResource.ts b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/src/operations/iotDpsResource.ts index 3cfc2a29a88f..71185f130ad9 100644 --- a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/src/operations/iotDpsResource.ts +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/src/operations/iotDpsResource.ts @@ -406,10 +406,12 @@ export class IotDpsResourceImpl implements IotDpsResource { }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -504,10 +506,12 @@ export class IotDpsResourceImpl implements IotDpsResource { }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -588,10 +592,12 @@ export class IotDpsResourceImpl implements IotDpsResource { { provisioningServiceName, resourceGroupName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -890,10 +896,12 @@ export class IotDpsResourceImpl implements IotDpsResource { }, createOrUpdatePrivateEndpointConnectionOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -988,10 +996,12 @@ export class IotDpsResourceImpl implements IotDpsResource { }, deletePrivateEndpointConnectionOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/tsconfig.json b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/tsconfig.json index 77ef81f521b8..8bfdb03c3341 100644 --- a/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/tsconfig.json +++ b/sdk/deviceprovisioningservices/arm-deviceprovisioningservices/tsconfig.json @@ -24,7 +24,8 @@ }, "include": [ "./src/**/*.ts", - "./test/**/*.ts" + "./test/**/*.ts", + "samples-dev/**/*.ts" ], "exclude": [ "node_modules" diff --git a/sdk/deviceprovisioningservices/ci.mgmt.yml b/sdk/deviceprovisioningservices/ci.mgmt.yml index 3bb23b88ba0c..12d6ec3c1ef9 100644 --- a/sdk/deviceprovisioningservices/ci.mgmt.yml +++ b/sdk/deviceprovisioningservices/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -9,7 +9,7 @@ trigger: paths: include: - sdk/deviceprovisioningservices/ci.mgmt.yml - - sdk/deviceprovisioningservices/arm-deviceprovisioningservices/ + - sdk/deviceprovisioningservices/arm-deviceprovisioningservices pr: branches: include: @@ -22,12 +22,12 @@ pr: paths: include: - sdk/desktopvirtualization/ci.mgmt.yml - - sdk/desktopvirtualization/arm-desktopvirtualization/ - + - sdk/deviceprovisioningservices/arm-deviceprovisioningservices + - sdk/deviceprovisioningservices/ci.mgmt.yml extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: deviceprovisioningservices Artifacts: - name: azure-arm-deviceprovisioningservices - safeName: azurearmdeviceprovisioningservices \ No newline at end of file + safeName: azurearmdeviceprovisioningservices diff --git a/sdk/devtestlabs/arm-devtestlabs/CHANGELOG.md b/sdk/devtestlabs/arm-devtestlabs/CHANGELOG.md index 55c343154327..38e9c76482c3 100644 --- a/sdk/devtestlabs/arm-devtestlabs/CHANGELOG.md +++ b/sdk/devtestlabs/arm-devtestlabs/CHANGELOG.md @@ -1,14 +1,10 @@ # Release History -## 4.0.1 (Unreleased) +## 4.0.1 (2022-04-18) -### Features Added +**features** -### Breaking Changes - -### Bugs Fixed - -### Other Changes + - bug fix ## 4.0.0 (2021-12-22) diff --git a/sdk/devtestlabs/arm-devtestlabs/LICENSE b/sdk/devtestlabs/arm-devtestlabs/LICENSE index ccb63b166732..5d1d36e0af80 100644 --- a/sdk/devtestlabs/arm-devtestlabs/LICENSE +++ b/sdk/devtestlabs/arm-devtestlabs/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2021 Microsoft +Copyright (c) 2022 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 diff --git a/sdk/devtestlabs/arm-devtestlabs/README.md b/sdk/devtestlabs/arm-devtestlabs/README.md index aaf021c35795..c8bb26e7d995 100644 --- a/sdk/devtestlabs/arm-devtestlabs/README.md +++ b/sdk/devtestlabs/arm-devtestlabs/README.md @@ -16,6 +16,8 @@ The DevTest Labs Client. - [LTS versions of Node.js](https://nodejs.org/about/releases/) - 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]. @@ -49,8 +51,17 @@ For more information about how to create an Azure AD Application check out [this ```javascript const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); 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 DevTestLabsClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new DevTestLabsClient(credential, subscriptionId); ``` diff --git a/sdk/devtestlabs/arm-devtestlabs/_meta.json b/sdk/devtestlabs/arm-devtestlabs/_meta.json index e552a8df02cb..bd706110cffb 100644 --- a/sdk/devtestlabs/arm-devtestlabs/_meta.json +++ b/sdk/devtestlabs/arm-devtestlabs/_meta.json @@ -1,7 +1,8 @@ { "commit": "0cd7b3e83d5e7e21222dcc4bdde4565562da0cdf", - "readme": "specification/devtestlabs/resource-manager/readme.md", - "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/devtestlabs/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211217.1", + "readme": "specification\\devtestlabs\\resource-manager\\readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\devtestlabs\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20211217.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.2.6", + "use": "@autorest/typescript@6.0.0-alpha.19.20220408.1" } \ No newline at end of file diff --git a/sdk/devtestlabs/arm-devtestlabs/api-extractor.json b/sdk/devtestlabs/arm-devtestlabs/api-extractor.json index b421217c647e..da49126d2262 100644 --- a/sdk/devtestlabs/arm-devtestlabs/api-extractor.json +++ b/sdk/devtestlabs/arm-devtestlabs/api-extractor.json @@ -1,18 +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" }, + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, "dtsRollup": { "enabled": true, "untrimmedFilePath": "", "publicTrimmedFilePath": "./types/arm-devtestlabs.d.ts" }, "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } } } -} +} \ No newline at end of file diff --git a/sdk/devtestlabs/arm-devtestlabs/package.json b/sdk/devtestlabs/arm-devtestlabs/package.json index 2c72dfa2e1ba..778d0f69d5b3 100644 --- a/sdk/devtestlabs/arm-devtestlabs/package.json +++ b/sdk/devtestlabs/arm-devtestlabs/package.json @@ -11,9 +11,9 @@ "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.5.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -30,12 +30,12 @@ "devDependencies": { "@microsoft/api-extractor": "^7.18.11", "@rollup/plugin-commonjs": "^21.0.1", - "@rollup/plugin-json": "^4.0.0", - "@rollup/plugin-multi-entry": "^3.0.0", - "@rollup/plugin-node-resolve": "^8.0.0", + "@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.0.0", - "rollup-plugin-sourcemaps": "^0.4.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.2.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", @@ -98,5 +98,21 @@ "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true + "//metadata": { + "constantPaths": [ + { + "path": "src/devTestLabsClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-devtestlabs?view=azure-node-preview" + } } diff --git a/sdk/devtestlabs/arm-devtestlabs/rollup.config.js b/sdk/devtestlabs/arm-devtestlabs/rollup.config.js index 9be1955eb7f1..3f89d7309da5 100644 --- a/sdk/devtestlabs/arm-devtestlabs/rollup.config.js +++ b/sdk/devtestlabs/arm-devtestlabs/rollup.config.js @@ -14,62 +14,14 @@ import json from "@rollup/plugin-json"; import nodeBuiltins from "builtin-modules"; -/** - * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. - * - * NOTE: this manual configuration is only needed because OpenTelemetry uses an - * __exportStar downleveled helper function to declare its exports which confuses - * rollup's automatic discovery mechanism. - * - * @returns an object reference that can be `...`'d into your cjs() configuration. - */ -export function openTelemetryCommonJs() { - const namedExports = {}; - - for (const key of [ - "@opentelemetry/api", - "@azure/core-tracing/node_modules/@opentelemetry/api" - ]) { - namedExports[key] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "SpanStatusCode", - "getSpanContext", - "setSpanContext" - ]; - } - - const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; - - for (const version of releasedOpenTelemetryVersions) { - namedExports[ - // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. - `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` - ] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "StatusCode", - "CanonicalCode", - "getSpanContext", - "setSpanContext" - ]; - } - - return namedExports; -} - // #region Warning Handler /** - * A function that can determine whether a rollupwarning should be ignored. If + * 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 ignoreNiseSinonEvalWarnings(warning) { +function ignoreNiseSinonEval(warning) { return ( warning.code === "EVAL" && warning.id && @@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) { ); } -function ignoreChaiCircularDependencyWarnings(warning) { +function ignoreChaiCircularDependency(warning) { return ( warning.code === "CIRCULAR_DEPENDENCY" && warning.importer && warning.importer.includes("node_modules/chai") === true ); } -const warningInhibitors = [ - ignoreChaiCircularDependencyWarnings, - ignoreNiseSinonEvalWarnings -]; +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; /** * Construct a warning handler for the shared rollup configuration @@ -122,22 +71,7 @@ function makeBrowserTestConfig() { nodeResolve({ mainFields: ["module", "browser"] }), - cjs({ - namedExports: { - // Chai's strange internal architecture makes it impossible to statically - // analyze its exports. - chai: [ - "version", - "use", - "util", - "config", - "expect", - "should", - "assert" - ], - ...openTelemetryCommonJs() - } - }), + cjs(), json(), sourcemaps() //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) @@ -173,7 +107,7 @@ export function makeConfig(pkg, options) { ], output: { file: "dist/index.js", format: "cjs", sourcemap: true }, preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve(), cjs()] + plugins: [sourcemaps(), nodeResolve()] }; const config = [baseConfig]; diff --git a/sdk/devtestlabs/arm-devtestlabs/sample.env b/sdk/devtestlabs/arm-devtestlabs/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/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/devtestlabs/arm-devtestlabs/samples-dev/armTemplatesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/armTemplatesGetSample.ts new file mode 100644 index 000000000000..b85a58d849b0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/armTemplatesGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get azure resource manager template. + * + * @summary Get azure resource manager template. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_Get.json + */ +async function armTemplatesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const name = "{armTemplateName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.armTemplates.get( + resourceGroupName, + labName, + artifactSourceName, + name + ); + console.log(result); +} + +armTemplatesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/armTemplatesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/armTemplatesListSample.ts new file mode 100644 index 000000000000..7106b31bd4ef --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/armTemplatesListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List azure resource manager templates in a given artifact source. + * + * @summary List azure resource manager templates in a given artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_List.json + */ +async function armTemplatesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.armTemplates.list( + resourceGroupName, + labName, + artifactSourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +armTemplatesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..20bd3b43a213 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesCreateOrUpdateSample.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 { ArtifactSource, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing artifact source. + * + * @summary Create or replace an existing artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_CreateOrUpdate.json + */ +async function artifactSourcesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{artifactSourceName}"; + const artifactSource: ArtifactSource = { + armTemplateFolderPath: "{armTemplateFolderPath}", + branchRef: "{branchRef}", + displayName: "{displayName}", + folderPath: "{folderPath}", + securityToken: "{securityToken}", + sourceType: "{VsoGit|GitHub|StorageAccount}", + status: "{Enabled|Disabled}", + tags: { tagName1: "tagValue1" }, + uri: "{artifactSourceUri}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifactSources.createOrUpdate( + resourceGroupName, + labName, + name, + artifactSource + ); + console.log(result); +} + +artifactSourcesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesDeleteSample.ts new file mode 100644 index 000000000000..0b47bf8ed448 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete artifact source. + * + * @summary Delete artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Delete.json + */ +async function artifactSourcesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{artifactSourceName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifactSources.delete( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +artifactSourcesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesGetSample.ts new file mode 100644 index 000000000000..b7df9206c35e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get artifact source. + * + * @summary Get artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Get.json + */ +async function artifactSourcesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{artifactSourceName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifactSources.get( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +artifactSourcesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesListSample.ts new file mode 100644 index 000000000000..b03e109aea03 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List artifact sources in a given lab. + * + * @summary List artifact sources in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_List.json + */ +async function artifactSourcesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.artifactSources.list( + resourceGroupName, + labName + )) { + resArray.push(item); + } + console.log(resArray); +} + +artifactSourcesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesUpdateSample.ts new file mode 100644 index 000000000000..c21d01524963 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactSourcesUpdateSample.ts @@ -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. +import { + ArtifactSourceFragment, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of artifact sources. All other properties will be ignored. + * + * @summary Allows modifying tags of artifact sources. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Update.json + */ +async function artifactSourcesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{artifactSourceName}"; + const artifactSource: ArtifactSourceFragment = { + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifactSources.update( + resourceGroupName, + labName, + name, + artifactSource + ); + console.log(result); +} + +artifactSourcesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactsGenerateArmTemplateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactsGenerateArmTemplateSample.ts new file mode 100644 index 000000000000..5aee02dbcad9 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactsGenerateArmTemplateSample.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 { + GenerateArmTemplateRequest, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. + * + * @summary Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_GenerateArmTemplate.json + */ +async function artifactsGenerateArmTemplate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const name = "{artifactName}"; + const generateArmTemplateRequest: GenerateArmTemplateRequest = { + fileUploadOptions: "None", + location: "{location}", + virtualMachineName: "{vmName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifacts.generateArmTemplate( + resourceGroupName, + labName, + artifactSourceName, + name, + generateArmTemplateRequest + ); + console.log(result); +} + +artifactsGenerateArmTemplate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactsGetSample.ts new file mode 100644 index 000000000000..eb726eed213b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactsGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get artifact. + * + * @summary Get artifact. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_Get.json + */ +async function artifactsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const name = "{artifactName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifacts.get( + resourceGroupName, + labName, + artifactSourceName, + name + ); + console.log(result); +} + +artifactsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactsListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactsListSample.ts new file mode 100644 index 000000000000..743c77ebcf10 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/artifactsListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List artifacts in a given artifact source. + * + * @summary List artifacts in a given artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_List.json + */ +async function artifactsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.artifacts.list( + resourceGroupName, + labName, + artifactSourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +artifactsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/costsCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/costsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..dac39cef2ad1 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/costsCreateOrUpdateSample.ts @@ -0,0 +1,80 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { LabCost, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing cost. + * + * @summary Create or replace an existing cost. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_CreateOrUpdate.json + */ +async function costsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "targetCost"; + const labCost: LabCost = { + currencyCode: "USD", + endDateTime: new Date("2020-12-31T23:59:59Z"), + startDateTime: new Date("2020-12-01T00:00:00Z"), + targetCost: { + costThresholds: [ + { + displayOnChart: "Disabled", + percentageThreshold: { thresholdValue: 25 }, + sendNotificationWhenExceeded: "Disabled", + thresholdId: "00000000-0000-0000-0000-000000000001" + }, + { + displayOnChart: "Enabled", + percentageThreshold: { thresholdValue: 50 }, + sendNotificationWhenExceeded: "Enabled", + thresholdId: "00000000-0000-0000-0000-000000000002" + }, + { + displayOnChart: "Disabled", + percentageThreshold: { thresholdValue: 75 }, + sendNotificationWhenExceeded: "Disabled", + thresholdId: "00000000-0000-0000-0000-000000000003" + }, + { + displayOnChart: "Disabled", + percentageThreshold: { thresholdValue: 100 }, + sendNotificationWhenExceeded: "Disabled", + thresholdId: "00000000-0000-0000-0000-000000000004" + }, + { + displayOnChart: "Disabled", + percentageThreshold: { thresholdValue: 125 }, + sendNotificationWhenExceeded: "Disabled", + thresholdId: "00000000-0000-0000-0000-000000000005" + } + ], + cycleEndDateTime: new Date("2020-12-31T00:00:00.000Z"), + cycleStartDateTime: new Date("2020-12-01T00:00:00.000Z"), + cycleType: "CalendarMonth", + status: "Enabled", + target: 100 + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.costs.createOrUpdate( + resourceGroupName, + labName, + name, + labCost + ); + console.log(result); +} + +costsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/costsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/costsGetSample.ts new file mode 100644 index 000000000000..5a616a22e531 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/costsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get cost. + * + * @summary Get cost. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_Get.json + */ +async function costsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "targetCost"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.costs.get(resourceGroupName, labName, name); + console.log(result); +} + +costsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..194cc8a509ab --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesCreateOrUpdateSample.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 { CustomImage, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing custom image. This operation can take a while to complete. + * + * @summary Create or replace an existing custom image. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_CreateOrUpdate.json + */ +async function customImagesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{customImageName}"; + const customImage: CustomImage = { + description: "My Custom Image", + tags: { tagName1: "tagValue1" }, + vm: { + linuxOsInfo: { linuxOsState: "NonDeprovisioned" }, + sourceVmId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{vmName}" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.customImages.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + customImage + ); + console.log(result); +} + +customImagesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesDeleteSample.ts new file mode 100644 index 000000000000..b3502ee98bc9 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete custom image. This operation can take a while to complete. + * + * @summary Delete custom image. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Delete.json + */ +async function customImagesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{customImageName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.customImages.beginDeleteAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +customImagesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesGetSample.ts new file mode 100644 index 000000000000..282148d3755d --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get custom image. + * + * @summary Get custom image. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Get.json + */ +async function customImagesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{customImageName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.customImages.get( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +customImagesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesListSample.ts new file mode 100644 index 000000000000..d650a6e0f7fd --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List custom images in a given lab. + * + * @summary List custom images in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_List.json + */ +async function customImagesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.customImages.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +customImagesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesUpdateSample.ts new file mode 100644 index 000000000000..0456af65cb2e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/customImagesUpdateSample.ts @@ -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. +import { CustomImageFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of custom images. All other properties will be ignored. + * + * @summary Allows modifying tags of custom images. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Update.json + */ +async function customImagesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{customImageName}"; + const customImage: CustomImageFragment = { tags: { tagName1: "tagValue2" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.customImages.update( + resourceGroupName, + labName, + name, + customImage + ); + console.log(result); +} + +customImagesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksAttachSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksAttachSample.ts new file mode 100644 index 000000000000..7038414c28f1 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksAttachSample.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 { + AttachDiskProperties, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @summary Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Attach.json + */ +async function disksAttach() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userId}"; + const name = "{diskName}"; + const attachDiskProperties: AttachDiskProperties = { + leasedByLabVmId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{vmName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.beginAttachAndWait( + resourceGroupName, + labName, + userName, + name, + attachDiskProperties + ); + console.log(result); +} + +disksAttach().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksCreateOrUpdateSample.ts new file mode 100644 index 000000000000..0a38a52c0546 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksCreateOrUpdateSample.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 { Disk, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing disk. This operation can take a while to complete. + * + * @summary Create or replace an existing disk. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_CreateOrUpdate.json + */ +async function disksCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userId}"; + const name = "{diskName}"; + const disk: Disk = { + diskSizeGiB: 1023, + diskType: "Standard", + leasedByLabVmId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/vmName" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + userName, + name, + disk + ); + console.log(result); +} + +disksCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksDeleteSample.ts new file mode 100644 index 000000000000..479b199492e9 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksDeleteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete disk. This operation can take a while to complete. + * + * @summary Delete disk. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Delete.json + */ +async function disksDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userId}"; + const name = "{diskName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.beginDeleteAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +disksDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksDetachSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksDetachSample.ts new file mode 100644 index 000000000000..a3fe7a030f43 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksDetachSample.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 { + DetachDiskProperties, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @summary Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Detach.json + */ +async function disksDetach() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userId}"; + const name = "{diskName}"; + const detachDiskProperties: DetachDiskProperties = { + leasedByLabVmId: + "/subscriptions/{subscriptionId}/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{vmName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.beginDetachAndWait( + resourceGroupName, + labName, + userName, + name, + detachDiskProperties + ); + console.log(result); +} + +disksDetach().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksGetSample.ts new file mode 100644 index 000000000000..2f78b0c3dbfd --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get disk. + * + * @summary Get disk. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Get.json + */ +async function disksGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{diskName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.get( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +disksGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksListSample.ts new file mode 100644 index 000000000000..674ca8ddc1de --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List disks in a given user profile. + * + * @summary List disks in a given user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_List.json + */ +async function disksList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.disks.list( + resourceGroupName, + labName, + userName + )) { + resArray.push(item); + } + console.log(resArray); +} + +disksList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksUpdateSample.ts new file mode 100644 index 000000000000..017445ff2147 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/disksUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DiskFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of disks. All other properties will be ignored. + * + * @summary Allows modifying tags of disks. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Update.json + */ +async function disksUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "diskName"; + const disk: DiskFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.update( + resourceGroupName, + labName, + userName, + name, + disk + ); + console.log(result); +} + +disksUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..9d5b2e0e4c97 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsCreateOrUpdateSample.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 { DtlEnvironment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing environment. This operation can take a while to complete. + * + * @summary Create or replace an existing environment. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_CreateOrUpdate.json + */ +async function environmentsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{environmentName}"; + const dtlEnvironment: DtlEnvironment = { + deploymentProperties: { + armTemplateId: + "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/artifactSources/{artifactSourceName}/armTemplates/{armTemplateName}", + parameters: [] + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.environments.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + userName, + name, + dtlEnvironment + ); + console.log(result); +} + +environmentsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsDeleteSample.ts new file mode 100644 index 000000000000..177754a4d2e0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsDeleteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete environment. This operation can take a while to complete. + * + * @summary Delete environment. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Delete.json + */ +async function environmentsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{environmentName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.environments.beginDeleteAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +environmentsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsGetSample.ts new file mode 100644 index 000000000000..44af7b8383b0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get environment. + * + * @summary Get environment. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Get.json + */ +async function environmentsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{environmentName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.environments.get( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +environmentsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsListSample.ts new file mode 100644 index 000000000000..1fee8ae2e166 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List environments in a given user profile. + * + * @summary List environments in a given user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_List.json + */ +async function environmentsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.environments.list( + resourceGroupName, + labName, + userName + )) { + resArray.push(item); + } + console.log(resArray); +} + +environmentsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsUpdateSample.ts new file mode 100644 index 000000000000..b9aa4c2fee5e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/environmentsUpdateSample.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 { + DtlEnvironmentFragment, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of environments. All other properties will be ignored. + * + * @summary Allows modifying tags of environments. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Update.json + */ +async function environmentsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{environmentName}"; + const dtlEnvironment: DtlEnvironmentFragment = { + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.environments.update( + resourceGroupName, + labName, + userName, + name, + dtlEnvironment + ); + console.log(result); +} + +environmentsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasCreateOrUpdateSample.ts new file mode 100644 index 000000000000..0b0647db0ba5 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasCreateOrUpdateSample.ts @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { Formula, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing formula. This operation can take a while to complete. + * + * @summary Create or replace an existing formula. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_CreateOrUpdate.json + */ +async function formulasCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{formulaName}"; + const formula: Formula = { + description: "Formula using a Linux base", + formulaContent: { + allowClaim: false, + artifacts: [ + { + artifactId: + "/artifactsources/{artifactSourceName}/artifacts/linux-install-nodejs", + parameters: [] + } + ], + disallowPublicIpAddress: true, + galleryImageReference: { + offer: "0001-com-ubuntu-server-groovy", + osType: "Linux", + publisher: "canonical", + sku: "20_10", + version: "latest" + }, + isAuthenticationWithSshKey: false, + labSubnetName: "Dtl{labName}Subnet", + labVirtualNetworkId: "/virtualnetworks/dtl{labName}", + location: "{location}", + networkInterface: { + sharedPublicIpAddressConfiguration: { + inboundNatRules: [{ backendPort: 22, transportProtocol: "Tcp" }] + } + }, + notes: "Ubuntu Server 20.10", + size: "Standard_B1ms", + storageType: "Standard", + userName: "user" + }, + location: "{location}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.formulas.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + formula + ); + console.log(result); +} + +formulasCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasDeleteSample.ts new file mode 100644 index 000000000000..f8631aeeb6ac --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasDeleteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete formula. + * + * @summary Delete formula. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Delete.json + */ +async function formulasDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{formulaName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.formulas.delete(resourceGroupName, labName, name); + console.log(result); +} + +formulasDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasGetSample.ts new file mode 100644 index 000000000000..59d6dbdf2b35 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get formula. + * + * @summary Get formula. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Get.json + */ +async function formulasGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{formulaName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.formulas.get(resourceGroupName, labName, name); + console.log(result); +} + +formulasGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasListSample.ts new file mode 100644 index 000000000000..51b67145d512 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List formulas in a given lab. + * + * @summary List formulas in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_List.json + */ +async function formulasList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.formulas.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +formulasList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasUpdateSample.ts new file mode 100644 index 000000000000..74e04d82a5f4 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/formulasUpdateSample.ts @@ -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. +import { FormulaFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of formulas. All other properties will be ignored. + * + * @summary Allows modifying tags of formulas. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Update.json + */ +async function formulasUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{formulaName}"; + const formula: FormulaFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.formulas.update( + resourceGroupName, + labName, + name, + formula + ); + console.log(result); +} + +formulasUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/galleryImagesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/galleryImagesListSample.ts new file mode 100644 index 000000000000..23c4f806811c --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/galleryImagesListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List gallery images in a given lab. + * + * @summary List gallery images in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GalleryImages_List.json + */ +async function galleryImagesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.galleryImages.list( + resourceGroupName, + labName + )) { + resArray.push(item); + } + console.log(resArray); +} + +galleryImagesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..3d348cef2423 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesCreateOrUpdateSample.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { Schedule, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing schedule. + * + * @summary Create or replace an existing schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_CreateOrUpdate.json + */ +async function globalSchedulesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const schedule: Schedule = { + status: "Enabled", + taskType: "LabVmsStartupTask", + timeZoneId: "Hawaiian Standard Time", + weeklyRecurrence: { + time: "0700", + weekdays: [ + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.createOrUpdate( + resourceGroupName, + name, + schedule + ); + console.log(result); +} + +globalSchedulesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesDeleteSample.ts new file mode 100644 index 000000000000..06f66963b61b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesDeleteSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete schedule. + * + * @summary Delete schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Delete.json + */ +async function globalSchedulesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.delete(resourceGroupName, name); + console.log(result); +} + +globalSchedulesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesExecuteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesExecuteSample.ts new file mode 100644 index 000000000000..cb631ef20c8f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesExecuteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Execute a schedule. This operation can take a while to complete. + * + * @summary Execute a schedule. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Execute.json + */ +async function globalSchedulesExecute() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.beginExecuteAndWait( + resourceGroupName, + name + ); + console.log(result); +} + +globalSchedulesExecute().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesGetSample.ts new file mode 100644 index 000000000000..a7a12eb2de38 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get schedule. + * + * @summary Get schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Get.json + */ +async function globalSchedulesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.get(resourceGroupName, name); + console.log(result); +} + +globalSchedulesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesListByResourceGroupSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesListByResourceGroupSample.ts new file mode 100644 index 000000000000..a440a800cc4a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List schedules in a resource group. + * + * @summary List schedules in a resource group. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListByResourceGroup.json + */ +async function globalSchedulesListByResourceGroup() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.globalSchedules.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +globalSchedulesListByResourceGroup().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesListBySubscriptionSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesListBySubscriptionSample.ts new file mode 100644 index 000000000000..25300a85b7f4 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List schedules in a subscription. + * + * @summary List schedules in a subscription. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListBySubscription.json + */ +async function globalSchedulesListBySubscription() { + const subscriptionId = "{subscriptionId}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.globalSchedules.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +globalSchedulesListBySubscription().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesRetargetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesRetargetSample.ts new file mode 100644 index 000000000000..662af51065e3 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesRetargetSample.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 { + RetargetScheduleProperties, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @summary Updates a schedule's target resource Id. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Retarget.json + */ +async function globalSchedulesRetarget() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{scheduleName}"; + const retargetScheduleProperties: RetargetScheduleProperties = { + currentResourceId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{targetLab}", + targetResourceId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{currentLab}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.beginRetargetAndWait( + resourceGroupName, + name, + retargetScheduleProperties + ); + console.log(result); +} + +globalSchedulesRetarget().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesUpdateSample.ts new file mode 100644 index 000000000000..da47903e5224 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/globalSchedulesUpdateSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { ScheduleFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of schedules. All other properties will be ignored. + * + * @summary Allows modifying tags of schedules. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Update.json + */ +async function globalSchedulesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const schedule: ScheduleFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.update( + resourceGroupName, + name, + schedule + ); + console.log(result); +} + +globalSchedulesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsClaimAnyVMSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsClaimAnyVMSample.ts new file mode 100644 index 000000000000..8ed9a16f281b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsClaimAnyVMSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @summary Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ClaimAnyVm.json + */ +async function labsClaimAnyVM() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginClaimAnyVmAndWait( + resourceGroupName, + name + ); + console.log(result); +} + +labsClaimAnyVM().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsCreateEnvironmentSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsCreateEnvironmentSample.ts new file mode 100644 index 000000000000..be1b4222199b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsCreateEnvironmentSample.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + LabVirtualMachineCreationParameter, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create virtual machines in a lab. This operation can take a while to complete. + * + * @summary Create virtual machines in a lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateEnvironment.json + */ +async function labsCreateEnvironment() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const labVirtualMachineCreationParameter: LabVirtualMachineCreationParameter = { + name: "{vmName}", + allowClaim: true, + disallowPublicIpAddress: true, + galleryImageReference: { + offer: "UbuntuServer", + osType: "Linux", + publisher: "Canonical", + sku: "16.04-LTS", + version: "Latest" + }, + labSubnetName: "{virtualnetwork-subnet-name}", + labVirtualNetworkId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualnetworks/{virtualNetworkName}", + location: "{location}", + password: "{userPassword}", + size: "Standard_A2_v2", + storageType: "Standard", + tags: { tagName1: "tagValue1" }, + userName: "{userName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginCreateEnvironmentAndWait( + resourceGroupName, + name, + labVirtualMachineCreationParameter + ); + console.log(result); +} + +labsCreateEnvironment().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..2c542735f322 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsCreateOrUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { Lab, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing lab. This operation can take a while to complete. + * + * @summary Create or replace an existing lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateOrUpdate.json + */ +async function labsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const lab: Lab = { + labStorageType: "{Standard|Premium}", + location: "{location}", + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginCreateOrUpdateAndWait( + resourceGroupName, + name, + lab + ); + console.log(result); +} + +labsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsDeleteSample.ts new file mode 100644 index 000000000000..34dd8360f128 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsDeleteSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete lab. This operation can take a while to complete. + * + * @summary Delete lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Delete.json + */ +async function labsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginDeleteAndWait(resourceGroupName, name); + console.log(result); +} + +labsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsExportResourceUsageSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsExportResourceUsageSample.ts new file mode 100644 index 000000000000..fa4dab3d413e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsExportResourceUsageSample.ts @@ -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. +import { + ExportResourceUsageParameters, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @summary Exports the lab resource usage into a storage account This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ExportResourceUsage.json + */ +async function labsExportResourceUsage() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const exportResourceUsageParameters: ExportResourceUsageParameters = { + blobStorageAbsoluteSasUri: + "https://invalid.blob.core.windows.net/export.blob?sv=2015-07-08&sig={sas}&sp=rcw", + usageStartDate: new Date("2020-12-01T00:00:00Z") + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginExportResourceUsageAndWait( + resourceGroupName, + name, + exportResourceUsageParameters + ); + console.log(result); +} + +labsExportResourceUsage().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsGenerateUploadUriSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsGenerateUploadUriSample.ts new file mode 100644 index 000000000000..e75ba6064836 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsGenerateUploadUriSample.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 { + GenerateUploadUriParameter, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Generate a URI for uploading custom disk images to a Lab. + * + * @summary Generate a URI for uploading custom disk images to a Lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_GenerateUploadUri.json + */ +async function labsGenerateUploadUri() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const generateUploadUriParameter: GenerateUploadUriParameter = { + blobName: "{blob-name}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.generateUploadUri( + resourceGroupName, + name, + generateUploadUriParameter + ); + console.log(result); +} + +labsGenerateUploadUri().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsGetSample.ts new file mode 100644 index 000000000000..c19a861d2e88 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get lab. + * + * @summary Get lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Get.json + */ +async function labsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.get(resourceGroupName, name); + console.log(result); +} + +labsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsImportVirtualMachineSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsImportVirtualMachineSample.ts new file mode 100644 index 000000000000..1d276f9e0a1e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsImportVirtualMachineSample.ts @@ -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. +import { + ImportLabVirtualMachineRequest, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @summary Import a virtual machine into a different lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ImportVirtualMachine.json + */ +async function labsImportVirtualMachine() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const importLabVirtualMachineRequest: ImportLabVirtualMachineRequest = { + destinationVirtualMachineName: "{vmName}", + sourceVirtualMachineResourceId: + "/subscriptions/{subscriptionId}/resourceGroups/{otherResourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginImportVirtualMachineAndWait( + resourceGroupName, + name, + importLabVirtualMachineRequest + ); + console.log(result); +} + +labsImportVirtualMachine().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsListByResourceGroupSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsListByResourceGroupSample.ts new file mode 100644 index 000000000000..b54fc3e98b05 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsListByResourceGroupSample.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List labs in a resource group. + * + * @summary List labs in a resource group. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListByResourceGroup.json + */ +async function labsListByResourceGroup() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.labs.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +labsListByResourceGroup().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsListBySubscriptionSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsListBySubscriptionSample.ts new file mode 100644 index 000000000000..da5950cd9d06 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List labs in a subscription. + * + * @summary List labs in a subscription. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListBySubscription.json + */ +async function labsListBySubscription() { + const subscriptionId = "{subscriptionId}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.labs.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +labsListBySubscription().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsListVhdsSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsListVhdsSample.ts new file mode 100644 index 000000000000..abe8bd2d5163 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsListVhdsSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List disk images available for custom image creation. + * + * @summary List disk images available for custom image creation. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListVhds.json + */ +async function labsListVhds() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.labs.listVhds(resourceGroupName, name)) { + resArray.push(item); + } + console.log(resArray); +} + +labsListVhds().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsUpdateSample.ts new file mode 100644 index 000000000000..d02f4f0aa201 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/labsUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { LabFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of labs. All other properties will be ignored. + * + * @summary Allows modifying tags of labs. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Update.json + */ +async function labsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const lab: LabFragment = {}; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.update(resourceGroupName, name, lab); + console.log(result); +} + +labsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..2a747043f718 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsCreateOrUpdateSample.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 { NotificationChannel, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing notification channel. + * + * @summary Create or replace an existing notification channel. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_CreateOrUpdate.json + */ +async function notificationChannelsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const notificationChannel: NotificationChannel = { + description: "Integration configured for auto-shutdown", + emailRecipient: "{email}", + events: [{ eventName: "AutoShutdown" }], + notificationLocale: "en", + webHookUrl: "{webhookUrl}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.createOrUpdate( + resourceGroupName, + labName, + name, + notificationChannel + ); + console.log(result); +} + +notificationChannelsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsDeleteSample.ts new file mode 100644 index 000000000000..3e6692f68c11 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete notification channel. + * + * @summary Delete notification channel. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Delete.json + */ +async function notificationChannelsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.delete( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +notificationChannelsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsGetSample.ts new file mode 100644 index 000000000000..395f02829d5c --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get notification channel. + * + * @summary Get notification channel. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Get.json + */ +async function notificationChannelsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.get( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +notificationChannelsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsListSample.ts new file mode 100644 index 000000000000..f0acfdd6f17b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List notification channels in a given lab. + * + * @summary List notification channels in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_List.json + */ +async function notificationChannelsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.notificationChannels.list( + resourceGroupName, + labName + )) { + resArray.push(item); + } + console.log(resArray); +} + +notificationChannelsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsNotifySample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsNotifySample.ts new file mode 100644 index 000000000000..4d230ee03884 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsNotifySample.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 { NotifyParameters, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Send notification to provided channel. + * + * @summary Send notification to provided channel. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Notify.json + */ +async function notificationChannelsNotify() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const notifyParameters: NotifyParameters = { + eventName: "AutoShutdown", + jsonPayload: + '{"eventType":"AutoShutdown","subscriptionId":"{subscriptionId}","resourceGroupName":"resourceGroupName","labName":"{labName}"}' + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.notify( + resourceGroupName, + labName, + name, + notifyParameters + ); + console.log(result); +} + +notificationChannelsNotify().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsUpdateSample.ts new file mode 100644 index 000000000000..abb22f6d5a1e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/notificationChannelsUpdateSample.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 { + NotificationChannelFragment, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of notification channels. All other properties will be ignored. + * + * @summary Allows modifying tags of notification channels. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Update.json + */ +async function notificationChannelsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const notificationChannel: NotificationChannelFragment = {}; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.update( + resourceGroupName, + labName, + name, + notificationChannel + ); + console.log(result); +} + +notificationChannelsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/operationsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/operationsGetSample.ts new file mode 100644 index 000000000000..d5cdc7b4a3b2 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/operationsGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get operation. + * + * @summary Get operation. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Operations_Get.json + */ +async function operationsGet() { + const subscriptionId = "{subscriptionId}"; + const locationName = "{locationName}"; + const name = "{operationName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.operations.get(locationName, name); + console.log(result); +} + +operationsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..b395d803fe7a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesCreateOrUpdateSample.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 { Policy, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing policy. + * + * @summary Create or replace an existing policy. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_CreateOrUpdate.json + */ +async function policiesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const name = "{policyName}"; + const policy: Policy = { + description: "{policyDescription}", + evaluatorType: "{policyEvaluatorType}", + factData: "{policyFactData}", + factName: "{policyFactName}", + location: "{location}", + status: "{policyStatus}", + tags: { tagName1: "tagValue1" }, + threshold: "{policyThreshold}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policies.createOrUpdate( + resourceGroupName, + labName, + policySetName, + name, + policy + ); + console.log(result); +} + +policiesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesDeleteSample.ts new file mode 100644 index 000000000000..1a6b90b23d32 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesDeleteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete policy. + * + * @summary Delete policy. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Delete.json + */ +async function policiesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const name = "{policyName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policies.delete( + resourceGroupName, + labName, + policySetName, + name + ); + console.log(result); +} + +policiesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesGetSample.ts new file mode 100644 index 000000000000..f2ac425eeeee --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get policy. + * + * @summary Get policy. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Get.json + */ +async function policiesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const name = "{policyName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policies.get( + resourceGroupName, + labName, + policySetName, + name + ); + console.log(result); +} + +policiesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesListSample.ts new file mode 100644 index 000000000000..d30d8a34be69 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List policies in a given policy set. + * + * @summary List policies in a given policy set. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_List.json + */ +async function policiesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.policies.list( + resourceGroupName, + labName, + policySetName + )) { + resArray.push(item); + } + console.log(resArray); +} + +policiesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesUpdateSample.ts new file mode 100644 index 000000000000..9a0df9181890 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/policiesUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { PolicyFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of policies. All other properties will be ignored. + * + * @summary Allows modifying tags of policies. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Update.json + */ +async function policiesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const name = "{policyName}"; + const policy: PolicyFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policies.update( + resourceGroupName, + labName, + policySetName, + name, + policy + ); + console.log(result); +} + +policiesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/policySetsEvaluatePoliciesSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/policySetsEvaluatePoliciesSample.ts new file mode 100644 index 000000000000..1824f64e0b02 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/policySetsEvaluatePoliciesSample.ts @@ -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. +import { + EvaluatePoliciesRequest, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Evaluates lab policy. + * + * @summary Evaluates lab policy. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/PolicySets_EvaluatePolicies.json + */ +async function policySetsEvaluatePolicies() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{policySetName}"; + const evaluatePoliciesRequest: EvaluatePoliciesRequest = { + policies: [{ factName: "LabVmCount", valueOffset: "1" }] + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policySets.evaluatePolicies( + resourceGroupName, + labName, + name, + evaluatePoliciesRequest + ); + console.log(result); +} + +policySetsEvaluatePolicies().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/providerOperationsListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/providerOperationsListSample.ts new file mode 100644 index 000000000000..f1287bbeb77e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/providerOperationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Result of the request to list REST API operations + * + * @summary Result of the request to list REST API operations + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ProviderOperations_List.json + */ +async function providerOperationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.providerOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +providerOperationsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..47bd086bcd0a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesCreateOrUpdateSample.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { Schedule, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing schedule. + * + * @summary Create or replace an existing schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_CreateOrUpdate.json + */ +async function schedulesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const schedule: Schedule = { + dailyRecurrence: { time: "{timeOfTheDayTheScheduleWillOccurEveryDay}" }, + hourlyRecurrence: { minute: 30 }, + location: "{location}", + notificationSettings: { + emailRecipient: "{email}", + notificationLocale: "EN", + status: "{Enabled|Disabled}", + timeInMinutes: 15, + webhookUrl: "{webhookUrl}" + }, + status: "{Enabled|Disabled}", + tags: { tagName1: "tagValue1" }, + targetResourceId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}", + taskType: "{myLabVmTaskType}", + timeZoneId: "Pacific Standard Time", + weeklyRecurrence: { + time: "{timeOfTheDayTheScheduleWillOccurOnThoseDays}", + weekdays: ["Monday", "Wednesday", "Friday"] + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.createOrUpdate( + resourceGroupName, + labName, + name, + schedule + ); + console.log(result); +} + +schedulesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesDeleteSample.ts new file mode 100644 index 000000000000..a8de9f113e45 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete schedule. + * + * @summary Delete schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Delete.json + */ +async function schedulesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.delete( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +schedulesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesExecuteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesExecuteSample.ts new file mode 100644 index 000000000000..0a937cc2f2c0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesExecuteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Execute a schedule. This operation can take a while to complete. + * + * @summary Execute a schedule. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Execute.json + */ +async function schedulesExecute() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.beginExecuteAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +schedulesExecute().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesGetSample.ts new file mode 100644 index 000000000000..ebf4944cf158 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get schedule. + * + * @summary Get schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Get.json + */ +async function schedulesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.get(resourceGroupName, labName, name); + console.log(result); +} + +schedulesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesListApplicableSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesListApplicableSample.ts new file mode 100644 index 000000000000..3c92265b4d10 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesListApplicableSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all applicable schedules + * + * @summary Lists all applicable schedules + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_ListApplicable.json + */ +async function schedulesListApplicable() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schedules.listApplicable( + resourceGroupName, + labName, + name + )) { + resArray.push(item); + } + console.log(resArray); +} + +schedulesListApplicable().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesListSample.ts new file mode 100644 index 000000000000..e0934e29e15a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List schedules in a given lab. + * + * @summary List schedules in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_List.json + */ +async function schedulesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schedules.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +schedulesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesUpdateSample.ts new file mode 100644 index 000000000000..5271092dfb1a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/schedulesUpdateSample.ts @@ -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. +import { ScheduleFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of schedules. All other properties will be ignored. + * + * @summary Allows modifying tags of schedules. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Update.json + */ +async function schedulesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const schedule: ScheduleFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.update( + resourceGroupName, + labName, + name, + schedule + ); + console.log(result); +} + +schedulesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..1e6b79a526b7 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsCreateOrUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { Secret, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing secret. This operation can take a while to complete. + * + * @summary Create or replace an existing secret. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_CreateOrUpdate.json + */ +async function secretsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{secretName}"; + const secret: Secret = { value: "{secret}" }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.secrets.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + userName, + name, + secret + ); + console.log(result); +} + +secretsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsDeleteSample.ts new file mode 100644 index 000000000000..f2e53917fbb7 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsDeleteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete secret. + * + * @summary Delete secret. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Delete.json + */ +async function secretsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{secretName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.secrets.delete( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +secretsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsGetSample.ts new file mode 100644 index 000000000000..35fe8ad6d01b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get secret. + * + * @summary Get secret. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Get.json + */ +async function secretsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{secretName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.secrets.get( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +secretsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsListSample.ts new file mode 100644 index 000000000000..b2e98311283f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List secrets in a given user profile. + * + * @summary List secrets in a given user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_List.json + */ +async function secretsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.secrets.list( + resourceGroupName, + labName, + userName + )) { + resArray.push(item); + } + console.log(resArray); +} + +secretsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsUpdateSample.ts new file mode 100644 index 000000000000..f79059d24203 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/secretsUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { SecretFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of secrets. All other properties will be ignored. + * + * @summary Allows modifying tags of secrets. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Update.json + */ +async function secretsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{secretName}"; + const secret: SecretFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.secrets.update( + resourceGroupName, + labName, + userName, + name, + secret + ); + console.log(result); +} + +secretsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ad6e805d3503 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesCreateOrUpdateSample.ts @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { Schedule, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing schedule. + * + * @summary Create or replace an existing schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_CreateOrUpdate.json + */ +async function serviceFabricSchedulesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const schedule: Schedule = { + dailyRecurrence: { time: "19:00" }, + hourlyRecurrence: { minute: 0 }, + location: "{location}", + notificationSettings: { + emailRecipient: "{email}", + notificationLocale: "EN", + status: "{Enabled|Disabled}", + timeInMinutes: 15, + webhookUrl: "{webhoolUrl}" + }, + status: "{Enabled|Disabled}", + tags: { tagName1: "tagValue1" }, + targetResourceId: + "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/users/{uniqueIdentifier}/servicefabrics/{serviceFrabicName}", + taskType: + "{Unknown|LabVmsShutdownTask|LabVmsStartupTask|LabVmReclamationTask|ComputeVmShutdownTask}", + timeZoneId: "Pacific Standard Time", + weeklyRecurrence: { + time: "19:00", + weekdays: [ + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday" + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.createOrUpdate( + resourceGroupName, + labName, + userName, + serviceFabricName, + name, + schedule + ); + console.log(result); +} + +serviceFabricSchedulesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesDeleteSample.ts new file mode 100644 index 000000000000..339e0da8cd71 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesDeleteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete schedule. + * + * @summary Delete schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Delete.json + */ +async function serviceFabricSchedulesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.delete( + resourceGroupName, + labName, + userName, + serviceFabricName, + name + ); + console.log(result); +} + +serviceFabricSchedulesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesExecuteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesExecuteSample.ts new file mode 100644 index 000000000000..7e77788be160 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesExecuteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Execute a schedule. This operation can take a while to complete. + * + * @summary Execute a schedule. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Execute.json + */ +async function serviceFabricSchedulesExecute() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.beginExecuteAndWait( + resourceGroupName, + labName, + userName, + serviceFabricName, + name + ); + console.log(result); +} + +serviceFabricSchedulesExecute().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesGetSample.ts new file mode 100644 index 000000000000..01af49d6ee8a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get schedule. + * + * @summary Get schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Get.json + */ +async function serviceFabricSchedulesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.get( + resourceGroupName, + labName, + userName, + serviceFabricName, + name + ); + console.log(result); +} + +serviceFabricSchedulesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesListSample.ts new file mode 100644 index 000000000000..42aa8b3fb358 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesListSample.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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List schedules in a given service fabric. + * + * @summary List schedules in a given service fabric. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_List.json + */ +async function serviceFabricSchedulesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serviceFabricSchedules.list( + resourceGroupName, + labName, + userName, + serviceFabricName + )) { + resArray.push(item); + } + console.log(resArray); +} + +serviceFabricSchedulesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesUpdateSample.ts new file mode 100644 index 000000000000..e6fba344c41e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricSchedulesUpdateSample.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 { ScheduleFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of schedules. All other properties will be ignored. + * + * @summary Allows modifying tags of schedules. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Update.json + */ +async function serviceFabricSchedulesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const schedule: ScheduleFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.update( + resourceGroupName, + labName, + userName, + serviceFabricName, + name, + schedule + ); + console.log(result); +} + +serviceFabricSchedulesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..a797ace8c1e2 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsCreateOrUpdateSample.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 { ServiceFabric, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing service fabric. This operation can take a while to complete. + * + * @summary Create or replace an existing service fabric. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_CreateOrUpdate.json + */ +async function serviceFabricsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const serviceFabric: ServiceFabric = { + environmentId: "{environmentId}", + externalServiceFabricId: "{serviceFabricId}", + location: "{location}", + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + userName, + name, + serviceFabric + ); + console.log(result); +} + +serviceFabricsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsDeleteSample.ts new file mode 100644 index 000000000000..18a4530876ee --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsDeleteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete service fabric. This operation can take a while to complete. + * + * @summary Delete service fabric. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Delete.json + */ +async function serviceFabricsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.beginDeleteAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsGetSample.ts new file mode 100644 index 000000000000..c977d00b71df --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get service fabric. + * + * @summary Get service fabric. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Get.json + */ +async function serviceFabricsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.get( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsListApplicableSchedulesSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsListApplicableSchedulesSample.ts new file mode 100644 index 000000000000..dad7bac35e69 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsListApplicableSchedulesSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the applicable start/stop schedules, if any. + * + * @summary Lists the applicable start/stop schedules, if any. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_ListApplicableSchedules.json + */ +async function serviceFabricsListApplicableSchedules() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.listApplicableSchedules( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsListApplicableSchedules().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsListSample.ts new file mode 100644 index 000000000000..292da634250b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List service fabrics in a given user profile. + * + * @summary List service fabrics in a given user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_List.json + */ +async function serviceFabricsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serviceFabrics.list( + resourceGroupName, + labName, + userName + )) { + resArray.push(item); + } + console.log(resArray); +} + +serviceFabricsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsStartSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsStartSample.ts new file mode 100644 index 000000000000..eaaac5158b21 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsStartSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Start a service fabric. This operation can take a while to complete. + * + * @summary Start a service fabric. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Start.json + */ +async function serviceFabricsStart() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.beginStartAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsStart().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsStopSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsStopSample.ts new file mode 100644 index 000000000000..af30e289527d --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsStopSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Stop a service fabric This operation can take a while to complete. + * + * @summary Stop a service fabric This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Stop.json + */ +async function serviceFabricsStop() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.beginStopAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsStop().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsUpdateSample.ts new file mode 100644 index 000000000000..58950edeaade --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceFabricsUpdateSample.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 { + ServiceFabricFragment, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of service fabrics. All other properties will be ignored. + * + * @summary Allows modifying tags of service fabrics. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Update.json + */ +async function serviceFabricsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const serviceFabric: ServiceFabricFragment = { + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.update( + resourceGroupName, + labName, + userName, + name, + serviceFabric + ); + console.log(result); +} + +serviceFabricsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceRunnersCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceRunnersCreateOrUpdateSample.ts new file mode 100644 index 000000000000..f8f0fd7a16c3 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceRunnersCreateOrUpdateSample.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 { ServiceRunner, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing service runner. + * + * @summary Create or replace an existing service runner. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_CreateOrUpdate.json + */ +async function serviceRunnersCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{servicerunnerName}"; + const serviceRunner: ServiceRunner = { + identity: { + type: "{identityType}", + clientSecretUrl: "{identityClientSecretUrl}", + principalId: "{identityPrincipalId}", + tenantId: "{identityTenantId}" + }, + location: "{location}", + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceRunners.createOrUpdate( + resourceGroupName, + labName, + name, + serviceRunner + ); + console.log(result); +} + +serviceRunnersCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceRunnersDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceRunnersDeleteSample.ts new file mode 100644 index 000000000000..7b21791bcb6e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceRunnersDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete service runner. + * + * @summary Delete service runner. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Delete.json + */ +async function serviceRunnersDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{servicerunnerName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceRunners.delete( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +serviceRunnersDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceRunnersGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceRunnersGetSample.ts new file mode 100644 index 000000000000..326f7b162ec4 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/serviceRunnersGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get service runner. + * + * @summary Get service runner. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Get.json + */ +async function serviceRunnersGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{servicerunnerName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceRunners.get( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +serviceRunnersGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersCreateOrUpdateSample.ts new file mode 100644 index 000000000000..00617395040d --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersCreateOrUpdateSample.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 { User, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing user profile. This operation can take a while to complete. + * + * @summary Create or replace an existing user profile. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_CreateOrUpdate.json + */ +async function usersCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{userName}"; + const user: User = { + identity: { + appId: "{appId}", + objectId: "{objectId}", + principalId: "{principalId}", + principalName: "{principalName}", + tenantId: "{tenantId}" + }, + location: "{location}", + secretStore: { keyVaultId: "{keyVaultId}", keyVaultUri: "{keyVaultUri}" }, + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.users.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + user + ); + console.log(result); +} + +usersCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersDeleteSample.ts new file mode 100644 index 000000000000..69280320d33e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete user profile. This operation can take a while to complete. + * + * @summary Delete user profile. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Delete.json + */ +async function usersDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{userName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.users.beginDeleteAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +usersDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersGetSample.ts new file mode 100644 index 000000000000..cab83ae39cef --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get user profile. + * + * @summary Get user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Get.json + */ +async function usersGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{userName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.users.get(resourceGroupName, labName, name); + console.log(result); +} + +usersGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersListSample.ts new file mode 100644 index 000000000000..d66fddf696c1 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List user profiles in a given lab. + * + * @summary List user profiles in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_List.json + */ +async function usersList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.users.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +usersList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersUpdateSample.ts new file mode 100644 index 000000000000..85a12f626feb --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/usersUpdateSample.ts @@ -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. +import { UserFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of user profiles. All other properties will be ignored. + * + * @summary Allows modifying tags of user profiles. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Update.json + */ +async function usersUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{userName}"; + const user: UserFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.users.update( + resourceGroupName, + labName, + name, + user + ); + console.log(result); +} + +usersUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..bd238f6fc331 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesCreateOrUpdateSample.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 { Schedule, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing schedule. + * + * @summary Create or replace an existing schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_CreateOrUpdate.json + */ +async function virtualMachineSchedulesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const schedule: Schedule = { + dailyRecurrence: { time: "1900" }, + hourlyRecurrence: { minute: 30 }, + location: "{location}", + notificationSettings: { + emailRecipient: "{email}", + notificationLocale: "EN", + status: "Enabled", + timeInMinutes: 30, + webhookUrl: "{webhookUrl}" + }, + status: "Enabled", + tags: { tagName1: "tagValue1" }, + targetResourceId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualMachines/{vmName}", + taskType: "LabVmsShutdownTask", + timeZoneId: "Pacific Standard Time", + weeklyRecurrence: { + time: "1700", + weekdays: ["Friday", "Saturday", "Sunday"] + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.createOrUpdate( + resourceGroupName, + labName, + virtualMachineName, + name, + schedule + ); + console.log(result); +} + +virtualMachineSchedulesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesDeleteSample.ts new file mode 100644 index 000000000000..b4f8ea7e4f40 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesDeleteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete schedule. + * + * @summary Delete schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Delete.json + */ +async function virtualMachineSchedulesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.delete( + resourceGroupName, + labName, + virtualMachineName, + name + ); + console.log(result); +} + +virtualMachineSchedulesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesExecuteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesExecuteSample.ts new file mode 100644 index 000000000000..2dbd0deecbae --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesExecuteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Execute a schedule. This operation can take a while to complete. + * + * @summary Execute a schedule. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Execute.json + */ +async function virtualMachineSchedulesExecute() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.beginExecuteAndWait( + resourceGroupName, + labName, + virtualMachineName, + name + ); + console.log(result); +} + +virtualMachineSchedulesExecute().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesGetSample.ts new file mode 100644 index 000000000000..c25efe87c4a0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get schedule. + * + * @summary Get schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Get.json + */ +async function virtualMachineSchedulesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.get( + resourceGroupName, + labName, + virtualMachineName, + name + ); + console.log(result); +} + +virtualMachineSchedulesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesListSample.ts new file mode 100644 index 000000000000..ced846c49565 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List schedules in a given virtual machine. + * + * @summary List schedules in a given virtual machine. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_List.json + */ +async function virtualMachineSchedulesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualMachineSchedules.list( + resourceGroupName, + labName, + virtualMachineName + )) { + resArray.push(item); + } + console.log(resArray); +} + +virtualMachineSchedulesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesUpdateSample.ts new file mode 100644 index 000000000000..6c8e0f26c08c --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachineSchedulesUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ScheduleFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of schedules. All other properties will be ignored. + * + * @summary Allows modifying tags of schedules. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Update.json + */ +async function virtualMachineSchedulesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const schedule: ScheduleFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.update( + resourceGroupName, + labName, + virtualMachineName, + name, + schedule + ); + console.log(result); +} + +virtualMachineSchedulesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesAddDataDiskSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesAddDataDiskSample.ts new file mode 100644 index 000000000000..17f7d54f9da2 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesAddDataDiskSample.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 { DataDiskProperties, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @summary Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_AddDataDisk.json + */ +async function virtualMachinesAddDataDisk() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualMachineName}"; + const dataDiskProperties: DataDiskProperties = { + attachNewDataDiskOptions: { + diskName: "{diskName}", + diskSizeGiB: 127, + diskType: "{diskType}" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginAddDataDiskAndWait( + resourceGroupName, + labName, + name, + dataDiskProperties + ); + console.log(result); +} + +virtualMachinesAddDataDisk().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesApplyArtifactsSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesApplyArtifactsSample.ts new file mode 100644 index 000000000000..46af4e1c56be --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesApplyArtifactsSample.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 { + ApplyArtifactsRequest, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @summary Apply artifacts to virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ApplyArtifacts.json + */ +async function virtualMachinesApplyArtifacts() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const applyArtifactsRequest: ApplyArtifactsRequest = { + artifacts: [ + { + artifactId: + "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/artifactSources/public repo/artifacts/windows-restart" + } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginApplyArtifactsAndWait( + resourceGroupName, + labName, + name, + applyArtifactsRequest + ); + console.log(result); +} + +virtualMachinesApplyArtifacts().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesClaimSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesClaimSample.ts new file mode 100644 index 000000000000..29d584a8c3dd --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesClaimSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @summary Take ownership of an existing virtual machine This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Claim.json + */ +async function virtualMachinesClaim() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginClaimAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesClaim().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ae39939e6ce9 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesCreateOrUpdateSample.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 { LabVirtualMachine, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @summary Create or replace an existing virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_CreateOrUpdate.json + */ +async function virtualMachinesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const labVirtualMachine: LabVirtualMachine = { + allowClaim: true, + disallowPublicIpAddress: true, + galleryImageReference: { + offer: "UbuntuServer", + osType: "Linux", + publisher: "Canonical", + sku: "16.04-LTS", + version: "Latest" + }, + labSubnetName: "{virtualNetworkName}Subnet", + labVirtualNetworkId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualnetworks/{virtualNetworkName}", + location: "{location}", + password: "{userPassword}", + size: "Standard_A2_v2", + storageType: "Standard", + tags: { tagName1: "tagValue1" }, + userName: "{userName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + labVirtualMachine + ); + console.log(result); +} + +virtualMachinesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesDeleteSample.ts new file mode 100644 index 000000000000..34c5650f050f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete virtual machine. This operation can take a while to complete. + * + * @summary Delete virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Delete.json + */ +async function virtualMachinesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginDeleteAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesDetachDataDiskSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesDetachDataDiskSample.ts new file mode 100644 index 000000000000..b4278a5dbf2e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesDetachDataDiskSample.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 { + DetachDataDiskProperties, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @summary Detach the specified disk from the virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_DetachDataDisk.json + */ +async function virtualMachinesDetachDataDisk() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualMachineName}"; + const detachDataDiskProperties: DetachDataDiskProperties = { + existingLabDiskId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{virtualMachineName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginDetachDataDiskAndWait( + resourceGroupName, + labName, + name, + detachDataDiskProperties + ); + console.log(result); +} + +virtualMachinesDetachDataDisk().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesGetRdpFileContentsSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesGetRdpFileContentsSample.ts new file mode 100644 index 000000000000..6e4ba9c8d91f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesGetRdpFileContentsSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets a string that represents the contents of the RDP file for the virtual machine + * + * @summary Gets a string that represents the contents of the RDP file for the virtual machine + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_GetRdpFileContents.json + */ +async function virtualMachinesGetRdpFileContents() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.getRdpFileContents( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesGetRdpFileContents().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesGetSample.ts new file mode 100644 index 000000000000..45cbb51e14a8 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get virtual machine. + * + * @summary Get virtual machine. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Get.json + */ +async function virtualMachinesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.get( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesListApplicableSchedulesSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesListApplicableSchedulesSample.ts new file mode 100644 index 000000000000..d212ed4bb8c3 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesListApplicableSchedulesSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the applicable start/stop schedules, if any. + * + * @summary Lists the applicable start/stop schedules, if any. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ListApplicableSchedules.json + */ +async function virtualMachinesListApplicableSchedules() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.listApplicableSchedules( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesListApplicableSchedules().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesListSample.ts new file mode 100644 index 000000000000..9d11a4cdb952 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List virtual machines in a given lab. + * + * @summary List virtual machines in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_List.json + */ +async function virtualMachinesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualMachines.list( + resourceGroupName, + labName + )) { + resArray.push(item); + } + console.log(resArray); +} + +virtualMachinesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesRedeploySample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesRedeploySample.ts new file mode 100644 index 000000000000..4c42727536af --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesRedeploySample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Redeploy a virtual machine This operation can take a while to complete. + * + * @summary Redeploy a virtual machine This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Redeploy.json + */ +async function virtualMachinesRedeploy() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginRedeployAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesRedeploy().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesResizeSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesResizeSample.ts new file mode 100644 index 000000000000..744aaa6b7aeb --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesResizeSample.ts @@ -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. +import { + ResizeLabVirtualMachineProperties, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Resize Virtual Machine. This operation can take a while to complete. + * + * @summary Resize Virtual Machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Resize.json + */ +async function virtualMachinesResize() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const resizeLabVirtualMachineProperties: ResizeLabVirtualMachineProperties = { + size: "Standard_A4_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginResizeAndWait( + resourceGroupName, + labName, + name, + resizeLabVirtualMachineProperties + ); + console.log(result); +} + +virtualMachinesResize().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesRestartSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesRestartSample.ts new file mode 100644 index 000000000000..1dab79d87e94 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesRestartSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Restart a virtual machine. This operation can take a while to complete. + * + * @summary Restart a virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Restart.json + */ +async function virtualMachinesRestart() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginRestartAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesRestart().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesStartSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesStartSample.ts new file mode 100644 index 000000000000..0edfed3036bd --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesStartSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Start a virtual machine. This operation can take a while to complete. + * + * @summary Start a virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Start.json + */ +async function virtualMachinesStart() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginStartAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesStart().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesStopSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesStopSample.ts new file mode 100644 index 000000000000..5f1442c1e466 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesStopSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Stop a virtual machine This operation can take a while to complete. + * + * @summary Stop a virtual machine This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Stop.json + */ +async function virtualMachinesStop() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginStopAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesStop().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesTransferDisksSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesTransferDisksSample.ts new file mode 100644 index 000000000000..d1ab33525b18 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesTransferDisksSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. + * + * @summary Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_TransferDisks.json + */ +async function virtualMachinesTransferDisks() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualmachineName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginTransferDisksAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesTransferDisks().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesUnClaimSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesUnClaimSample.ts new file mode 100644 index 000000000000..b41fb78c38ee --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesUnClaimSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @summary Release ownership of an existing virtual machine This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_UnClaim.json + */ +async function virtualMachinesUnClaim() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginUnClaimAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesUnClaim().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesUpdateSample.ts new file mode 100644 index 000000000000..5f6f8c5b78be --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualMachinesUpdateSample.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 { + LabVirtualMachineFragment, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of virtual machines. All other properties will be ignored. + * + * @summary Allows modifying tags of virtual machines. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Update.json + */ +async function virtualMachinesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const labVirtualMachine: LabVirtualMachineFragment = {}; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.update( + resourceGroupName, + labName, + name, + labVirtualMachine + ); + console.log(result); +} + +virtualMachinesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksCreateOrUpdateSample.ts new file mode 100644 index 000000000000..e71686aa7575 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksCreateOrUpdateSample.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 { VirtualNetwork, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing virtual network. This operation can take a while to complete. + * + * @summary Create or replace an existing virtual network. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_CreateOrUpdate.json + */ +async function virtualNetworksCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualNetworkName}"; + const virtualNetwork: VirtualNetwork = { + location: "{location}", + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualNetworks.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + virtualNetwork + ); + console.log(result); +} + +virtualNetworksCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksDeleteSample.ts new file mode 100644 index 000000000000..08fed1271dfc --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete virtual network. This operation can take a while to complete. + * + * @summary Delete virtual network. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Delete.json + */ +async function virtualNetworksDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualNetworkName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualNetworks.beginDeleteAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualNetworksDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksGetSample.ts new file mode 100644 index 000000000000..43581b280e56 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get virtual network. + * + * @summary Get virtual network. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Get.json + */ +async function virtualNetworksGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualNetworkName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualNetworks.get( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualNetworksGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksListSample.ts new file mode 100644 index 000000000000..01e41cc303a0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List virtual networks in a given lab. + * + * @summary List virtual networks in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_List.json + */ +async function virtualNetworksList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualNetworks.list( + resourceGroupName, + labName + )) { + resArray.push(item); + } + console.log(resArray); +} + +virtualNetworksList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksUpdateSample.ts new file mode 100644 index 000000000000..79df7641a8f6 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples-dev/virtualNetworksUpdateSample.ts @@ -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. +import { + VirtualNetworkFragment, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of virtual networks. All other properties will be ignored. + * + * @summary Allows modifying tags of virtual networks. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Update.json + */ +async function virtualNetworksUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualNetworkName}"; + const virtualNetwork: VirtualNetworkFragment = { + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualNetworks.update( + resourceGroupName, + labName, + name, + virtualNetwork + ); + console.log(result); +} + +virtualNetworksUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/README.md b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/README.md new file mode 100644 index 000000000000..b1724d4cb208 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/README.md @@ -0,0 +1,312 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [armTemplatesGetSample.js][armtemplatesgetsample] | Get azure resource manager template. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_Get.json | +| [armTemplatesListSample.js][armtemplateslistsample] | List azure resource manager templates in a given artifact source. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_List.json | +| [artifactSourcesCreateOrUpdateSample.js][artifactsourcescreateorupdatesample] | Create or replace an existing artifact source. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_CreateOrUpdate.json | +| [artifactSourcesDeleteSample.js][artifactsourcesdeletesample] | Delete artifact source. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Delete.json | +| [artifactSourcesGetSample.js][artifactsourcesgetsample] | Get artifact source. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Get.json | +| [artifactSourcesListSample.js][artifactsourceslistsample] | List artifact sources in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_List.json | +| [artifactSourcesUpdateSample.js][artifactsourcesupdatesample] | Allows modifying tags of artifact sources. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Update.json | +| [artifactsGenerateArmTemplateSample.js][artifactsgeneratearmtemplatesample] | Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_GenerateArmTemplate.json | +| [artifactsGetSample.js][artifactsgetsample] | Get artifact. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_Get.json | +| [artifactsListSample.js][artifactslistsample] | List artifacts in a given artifact source. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_List.json | +| [costsCreateOrUpdateSample.js][costscreateorupdatesample] | Create or replace an existing cost. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_CreateOrUpdate.json | +| [costsGetSample.js][costsgetsample] | Get cost. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_Get.json | +| [customImagesCreateOrUpdateSample.js][customimagescreateorupdatesample] | Create or replace an existing custom image. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_CreateOrUpdate.json | +| [customImagesDeleteSample.js][customimagesdeletesample] | Delete custom image. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Delete.json | +| [customImagesGetSample.js][customimagesgetsample] | Get custom image. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Get.json | +| [customImagesListSample.js][customimageslistsample] | List custom images in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_List.json | +| [customImagesUpdateSample.js][customimagesupdatesample] | Allows modifying tags of custom images. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Update.json | +| [disksAttachSample.js][disksattachsample] | Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Attach.json | +| [disksCreateOrUpdateSample.js][diskscreateorupdatesample] | Create or replace an existing disk. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_CreateOrUpdate.json | +| [disksDeleteSample.js][disksdeletesample] | Delete disk. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Delete.json | +| [disksDetachSample.js][disksdetachsample] | Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Detach.json | +| [disksGetSample.js][disksgetsample] | Get disk. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Get.json | +| [disksListSample.js][diskslistsample] | List disks in a given user profile. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_List.json | +| [disksUpdateSample.js][disksupdatesample] | Allows modifying tags of disks. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Update.json | +| [environmentsCreateOrUpdateSample.js][environmentscreateorupdatesample] | Create or replace an existing environment. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_CreateOrUpdate.json | +| [environmentsDeleteSample.js][environmentsdeletesample] | Delete environment. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Delete.json | +| [environmentsGetSample.js][environmentsgetsample] | Get environment. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Get.json | +| [environmentsListSample.js][environmentslistsample] | List environments in a given user profile. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_List.json | +| [environmentsUpdateSample.js][environmentsupdatesample] | Allows modifying tags of environments. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Update.json | +| [formulasCreateOrUpdateSample.js][formulascreateorupdatesample] | Create or replace an existing formula. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_CreateOrUpdate.json | +| [formulasDeleteSample.js][formulasdeletesample] | Delete formula. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Delete.json | +| [formulasGetSample.js][formulasgetsample] | Get formula. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Get.json | +| [formulasListSample.js][formulaslistsample] | List formulas in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_List.json | +| [formulasUpdateSample.js][formulasupdatesample] | Allows modifying tags of formulas. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Update.json | +| [galleryImagesListSample.js][galleryimageslistsample] | List gallery images in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GalleryImages_List.json | +| [globalSchedulesCreateOrUpdateSample.js][globalschedulescreateorupdatesample] | Create or replace an existing schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_CreateOrUpdate.json | +| [globalSchedulesDeleteSample.js][globalschedulesdeletesample] | Delete schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Delete.json | +| [globalSchedulesExecuteSample.js][globalschedulesexecutesample] | Execute a schedule. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Execute.json | +| [globalSchedulesGetSample.js][globalschedulesgetsample] | Get schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Get.json | +| [globalSchedulesListByResourceGroupSample.js][globalscheduleslistbyresourcegroupsample] | List schedules in a resource group. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListByResourceGroup.json | +| [globalSchedulesListBySubscriptionSample.js][globalscheduleslistbysubscriptionsample] | List schedules in a subscription. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListBySubscription.json | +| [globalSchedulesRetargetSample.js][globalschedulesretargetsample] | Updates a schedule's target resource Id. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Retarget.json | +| [globalSchedulesUpdateSample.js][globalschedulesupdatesample] | Allows modifying tags of schedules. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Update.json | +| [labsClaimAnyVMSample.js][labsclaimanyvmsample] | Claim a random claimable virtual machine in the lab. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ClaimAnyVm.json | +| [labsCreateEnvironmentSample.js][labscreateenvironmentsample] | Create virtual machines in a lab. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateEnvironment.json | +| [labsCreateOrUpdateSample.js][labscreateorupdatesample] | Create or replace an existing lab. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateOrUpdate.json | +| [labsDeleteSample.js][labsdeletesample] | Delete lab. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Delete.json | +| [labsExportResourceUsageSample.js][labsexportresourceusagesample] | Exports the lab resource usage into a storage account This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ExportResourceUsage.json | +| [labsGenerateUploadUriSample.js][labsgenerateuploadurisample] | Generate a URI for uploading custom disk images to a Lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_GenerateUploadUri.json | +| [labsGetSample.js][labsgetsample] | Get lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Get.json | +| [labsImportVirtualMachineSample.js][labsimportvirtualmachinesample] | Import a virtual machine into a different lab. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ImportVirtualMachine.json | +| [labsListByResourceGroupSample.js][labslistbyresourcegroupsample] | List labs in a resource group. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListByResourceGroup.json | +| [labsListBySubscriptionSample.js][labslistbysubscriptionsample] | List labs in a subscription. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListBySubscription.json | +| [labsListVhdsSample.js][labslistvhdssample] | List disk images available for custom image creation. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListVhds.json | +| [labsUpdateSample.js][labsupdatesample] | Allows modifying tags of labs. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Update.json | +| [notificationChannelsCreateOrUpdateSample.js][notificationchannelscreateorupdatesample] | Create or replace an existing notification channel. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_CreateOrUpdate.json | +| [notificationChannelsDeleteSample.js][notificationchannelsdeletesample] | Delete notification channel. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Delete.json | +| [notificationChannelsGetSample.js][notificationchannelsgetsample] | Get notification channel. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Get.json | +| [notificationChannelsListSample.js][notificationchannelslistsample] | List notification channels in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_List.json | +| [notificationChannelsNotifySample.js][notificationchannelsnotifysample] | Send notification to provided channel. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Notify.json | +| [notificationChannelsUpdateSample.js][notificationchannelsupdatesample] | Allows modifying tags of notification channels. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Update.json | +| [operationsGetSample.js][operationsgetsample] | Get operation. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Operations_Get.json | +| [policiesCreateOrUpdateSample.js][policiescreateorupdatesample] | Create or replace an existing policy. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_CreateOrUpdate.json | +| [policiesDeleteSample.js][policiesdeletesample] | Delete policy. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Delete.json | +| [policiesGetSample.js][policiesgetsample] | Get policy. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Get.json | +| [policiesListSample.js][policieslistsample] | List policies in a given policy set. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_List.json | +| [policiesUpdateSample.js][policiesupdatesample] | Allows modifying tags of policies. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Update.json | +| [policySetsEvaluatePoliciesSample.js][policysetsevaluatepoliciessample] | Evaluates lab policy. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/PolicySets_EvaluatePolicies.json | +| [providerOperationsListSample.js][provideroperationslistsample] | Result of the request to list REST API operations x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ProviderOperations_List.json | +| [schedulesCreateOrUpdateSample.js][schedulescreateorupdatesample] | Create or replace an existing schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_CreateOrUpdate.json | +| [schedulesDeleteSample.js][schedulesdeletesample] | Delete schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Delete.json | +| [schedulesExecuteSample.js][schedulesexecutesample] | Execute a schedule. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Execute.json | +| [schedulesGetSample.js][schedulesgetsample] | Get schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Get.json | +| [schedulesListApplicableSample.js][scheduleslistapplicablesample] | Lists all applicable schedules x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_ListApplicable.json | +| [schedulesListSample.js][scheduleslistsample] | List schedules in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_List.json | +| [schedulesUpdateSample.js][schedulesupdatesample] | Allows modifying tags of schedules. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Update.json | +| [secretsCreateOrUpdateSample.js][secretscreateorupdatesample] | Create or replace an existing secret. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_CreateOrUpdate.json | +| [secretsDeleteSample.js][secretsdeletesample] | Delete secret. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Delete.json | +| [secretsGetSample.js][secretsgetsample] | Get secret. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Get.json | +| [secretsListSample.js][secretslistsample] | List secrets in a given user profile. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_List.json | +| [secretsUpdateSample.js][secretsupdatesample] | Allows modifying tags of secrets. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Update.json | +| [serviceFabricSchedulesCreateOrUpdateSample.js][servicefabricschedulescreateorupdatesample] | Create or replace an existing schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_CreateOrUpdate.json | +| [serviceFabricSchedulesDeleteSample.js][servicefabricschedulesdeletesample] | Delete schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Delete.json | +| [serviceFabricSchedulesExecuteSample.js][servicefabricschedulesexecutesample] | Execute a schedule. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Execute.json | +| [serviceFabricSchedulesGetSample.js][servicefabricschedulesgetsample] | Get schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Get.json | +| [serviceFabricSchedulesListSample.js][servicefabricscheduleslistsample] | List schedules in a given service fabric. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_List.json | +| [serviceFabricSchedulesUpdateSample.js][servicefabricschedulesupdatesample] | Allows modifying tags of schedules. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Update.json | +| [serviceFabricsCreateOrUpdateSample.js][servicefabricscreateorupdatesample] | Create or replace an existing service fabric. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_CreateOrUpdate.json | +| [serviceFabricsDeleteSample.js][servicefabricsdeletesample] | Delete service fabric. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Delete.json | +| [serviceFabricsGetSample.js][servicefabricsgetsample] | Get service fabric. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Get.json | +| [serviceFabricsListApplicableSchedulesSample.js][servicefabricslistapplicableschedulessample] | Lists the applicable start/stop schedules, if any. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_ListApplicableSchedules.json | +| [serviceFabricsListSample.js][servicefabricslistsample] | List service fabrics in a given user profile. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_List.json | +| [serviceFabricsStartSample.js][servicefabricsstartsample] | Start a service fabric. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Start.json | +| [serviceFabricsStopSample.js][servicefabricsstopsample] | Stop a service fabric This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Stop.json | +| [serviceFabricsUpdateSample.js][servicefabricsupdatesample] | Allows modifying tags of service fabrics. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Update.json | +| [serviceRunnersCreateOrUpdateSample.js][servicerunnerscreateorupdatesample] | Create or replace an existing service runner. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_CreateOrUpdate.json | +| [serviceRunnersDeleteSample.js][servicerunnersdeletesample] | Delete service runner. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Delete.json | +| [serviceRunnersGetSample.js][servicerunnersgetsample] | Get service runner. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Get.json | +| [usersCreateOrUpdateSample.js][userscreateorupdatesample] | Create or replace an existing user profile. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_CreateOrUpdate.json | +| [usersDeleteSample.js][usersdeletesample] | Delete user profile. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Delete.json | +| [usersGetSample.js][usersgetsample] | Get user profile. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Get.json | +| [usersListSample.js][userslistsample] | List user profiles in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_List.json | +| [usersUpdateSample.js][usersupdatesample] | Allows modifying tags of user profiles. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Update.json | +| [virtualMachineSchedulesCreateOrUpdateSample.js][virtualmachineschedulescreateorupdatesample] | Create or replace an existing schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_CreateOrUpdate.json | +| [virtualMachineSchedulesDeleteSample.js][virtualmachineschedulesdeletesample] | Delete schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Delete.json | +| [virtualMachineSchedulesExecuteSample.js][virtualmachineschedulesexecutesample] | Execute a schedule. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Execute.json | +| [virtualMachineSchedulesGetSample.js][virtualmachineschedulesgetsample] | Get schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Get.json | +| [virtualMachineSchedulesListSample.js][virtualmachinescheduleslistsample] | List schedules in a given virtual machine. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_List.json | +| [virtualMachineSchedulesUpdateSample.js][virtualmachineschedulesupdatesample] | Allows modifying tags of schedules. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Update.json | +| [virtualMachinesAddDataDiskSample.js][virtualmachinesadddatadisksample] | Attach a new or existing data disk to virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_AddDataDisk.json | +| [virtualMachinesApplyArtifactsSample.js][virtualmachinesapplyartifactssample] | Apply artifacts to virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ApplyArtifacts.json | +| [virtualMachinesClaimSample.js][virtualmachinesclaimsample] | Take ownership of an existing virtual machine This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Claim.json | +| [virtualMachinesCreateOrUpdateSample.js][virtualmachinescreateorupdatesample] | Create or replace an existing virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_CreateOrUpdate.json | +| [virtualMachinesDeleteSample.js][virtualmachinesdeletesample] | Delete virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Delete.json | +| [virtualMachinesDetachDataDiskSample.js][virtualmachinesdetachdatadisksample] | Detach the specified disk from the virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_DetachDataDisk.json | +| [virtualMachinesGetRdpFileContentsSample.js][virtualmachinesgetrdpfilecontentssample] | Gets a string that represents the contents of the RDP file for the virtual machine x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_GetRdpFileContents.json | +| [virtualMachinesGetSample.js][virtualmachinesgetsample] | Get virtual machine. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Get.json | +| [virtualMachinesListApplicableSchedulesSample.js][virtualmachineslistapplicableschedulessample] | Lists the applicable start/stop schedules, if any. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ListApplicableSchedules.json | +| [virtualMachinesListSample.js][virtualmachineslistsample] | List virtual machines in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_List.json | +| [virtualMachinesRedeploySample.js][virtualmachinesredeploysample] | Redeploy a virtual machine This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Redeploy.json | +| [virtualMachinesResizeSample.js][virtualmachinesresizesample] | Resize Virtual Machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Resize.json | +| [virtualMachinesRestartSample.js][virtualmachinesrestartsample] | Restart a virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Restart.json | +| [virtualMachinesStartSample.js][virtualmachinesstartsample] | Start a virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Start.json | +| [virtualMachinesStopSample.js][virtualmachinesstopsample] | Stop a virtual machine This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Stop.json | +| [virtualMachinesTransferDisksSample.js][virtualmachinestransferdiskssample] | Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_TransferDisks.json | +| [virtualMachinesUnClaimSample.js][virtualmachinesunclaimsample] | Release ownership of an existing virtual machine This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_UnClaim.json | +| [virtualMachinesUpdateSample.js][virtualmachinesupdatesample] | Allows modifying tags of virtual machines. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Update.json | +| [virtualNetworksCreateOrUpdateSample.js][virtualnetworkscreateorupdatesample] | Create or replace an existing virtual network. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_CreateOrUpdate.json | +| [virtualNetworksDeleteSample.js][virtualnetworksdeletesample] | Delete virtual network. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Delete.json | +| [virtualNetworksGetSample.js][virtualnetworksgetsample] | Get virtual network. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Get.json | +| [virtualNetworksListSample.js][virtualnetworkslistsample] | List virtual networks in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_List.json | +| [virtualNetworksUpdateSample.js][virtualnetworksupdatesample] | Allows modifying tags of virtual networks. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Update.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +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 armTemplatesGetSample.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 node armTemplatesGetSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[armtemplatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/armTemplatesGetSample.js +[armtemplateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/armTemplatesListSample.js +[artifactsourcescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesCreateOrUpdateSample.js +[artifactsourcesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesDeleteSample.js +[artifactsourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesGetSample.js +[artifactsourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesListSample.js +[artifactsourcesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesUpdateSample.js +[artifactsgeneratearmtemplatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactsGenerateArmTemplateSample.js +[artifactsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactsGetSample.js +[artifactslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactsListSample.js +[costscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/costsCreateOrUpdateSample.js +[costsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/costsGetSample.js +[customimagescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesCreateOrUpdateSample.js +[customimagesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesDeleteSample.js +[customimagesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesGetSample.js +[customimageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesListSample.js +[customimagesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesUpdateSample.js +[disksattachsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksAttachSample.js +[diskscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksCreateOrUpdateSample.js +[disksdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksDeleteSample.js +[disksdetachsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksDetachSample.js +[disksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksGetSample.js +[diskslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksListSample.js +[disksupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksUpdateSample.js +[environmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsCreateOrUpdateSample.js +[environmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsDeleteSample.js +[environmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsGetSample.js +[environmentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsListSample.js +[environmentsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsUpdateSample.js +[formulascreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasCreateOrUpdateSample.js +[formulasdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasDeleteSample.js +[formulasgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasGetSample.js +[formulaslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasListSample.js +[formulasupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasUpdateSample.js +[galleryimageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/galleryImagesListSample.js +[globalschedulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesCreateOrUpdateSample.js +[globalschedulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesDeleteSample.js +[globalschedulesexecutesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesExecuteSample.js +[globalschedulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesGetSample.js +[globalscheduleslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesListByResourceGroupSample.js +[globalscheduleslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesListBySubscriptionSample.js +[globalschedulesretargetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesRetargetSample.js +[globalschedulesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesUpdateSample.js +[labsclaimanyvmsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsClaimAnyVMSample.js +[labscreateenvironmentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsCreateEnvironmentSample.js +[labscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsCreateOrUpdateSample.js +[labsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsDeleteSample.js +[labsexportresourceusagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsExportResourceUsageSample.js +[labsgenerateuploadurisample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsGenerateUploadUriSample.js +[labsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsGetSample.js +[labsimportvirtualmachinesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsImportVirtualMachineSample.js +[labslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsListByResourceGroupSample.js +[labslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsListBySubscriptionSample.js +[labslistvhdssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsListVhdsSample.js +[labsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsUpdateSample.js +[notificationchannelscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsCreateOrUpdateSample.js +[notificationchannelsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsDeleteSample.js +[notificationchannelsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsGetSample.js +[notificationchannelslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsListSample.js +[notificationchannelsnotifysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsNotifySample.js +[notificationchannelsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsUpdateSample.js +[operationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/operationsGetSample.js +[policiescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesCreateOrUpdateSample.js +[policiesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesDeleteSample.js +[policiesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesGetSample.js +[policieslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesListSample.js +[policiesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesUpdateSample.js +[policysetsevaluatepoliciessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policySetsEvaluatePoliciesSample.js +[provideroperationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/providerOperationsListSample.js +[schedulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesCreateOrUpdateSample.js +[schedulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesDeleteSample.js +[schedulesexecutesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesExecuteSample.js +[schedulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesGetSample.js +[scheduleslistapplicablesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesListApplicableSample.js +[scheduleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesListSample.js +[schedulesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesUpdateSample.js +[secretscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsCreateOrUpdateSample.js +[secretsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsDeleteSample.js +[secretsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsGetSample.js +[secretslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsListSample.js +[secretsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsUpdateSample.js +[servicefabricschedulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesCreateOrUpdateSample.js +[servicefabricschedulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesDeleteSample.js +[servicefabricschedulesexecutesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesExecuteSample.js +[servicefabricschedulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesGetSample.js +[servicefabricscheduleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesListSample.js +[servicefabricschedulesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesUpdateSample.js +[servicefabricscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsCreateOrUpdateSample.js +[servicefabricsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsDeleteSample.js +[servicefabricsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsGetSample.js +[servicefabricslistapplicableschedulessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsListApplicableSchedulesSample.js +[servicefabricslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsListSample.js +[servicefabricsstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsStartSample.js +[servicefabricsstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsStopSample.js +[servicefabricsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsUpdateSample.js +[servicerunnerscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceRunnersCreateOrUpdateSample.js +[servicerunnersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceRunnersDeleteSample.js +[servicerunnersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceRunnersGetSample.js +[userscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersCreateOrUpdateSample.js +[usersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersDeleteSample.js +[usersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersGetSample.js +[userslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersListSample.js +[usersupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersUpdateSample.js +[virtualmachineschedulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesCreateOrUpdateSample.js +[virtualmachineschedulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesDeleteSample.js +[virtualmachineschedulesexecutesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesExecuteSample.js +[virtualmachineschedulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesGetSample.js +[virtualmachinescheduleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesListSample.js +[virtualmachineschedulesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesUpdateSample.js +[virtualmachinesadddatadisksample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesAddDataDiskSample.js +[virtualmachinesapplyartifactssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesApplyArtifactsSample.js +[virtualmachinesclaimsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesClaimSample.js +[virtualmachinescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesCreateOrUpdateSample.js +[virtualmachinesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesDeleteSample.js +[virtualmachinesdetachdatadisksample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesDetachDataDiskSample.js +[virtualmachinesgetrdpfilecontentssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesGetRdpFileContentsSample.js +[virtualmachinesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesGetSample.js +[virtualmachineslistapplicableschedulessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesListApplicableSchedulesSample.js +[virtualmachineslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesListSample.js +[virtualmachinesredeploysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesRedeploySample.js +[virtualmachinesresizesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesResizeSample.js +[virtualmachinesrestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesRestartSample.js +[virtualmachinesstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesStartSample.js +[virtualmachinesstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesStopSample.js +[virtualmachinestransferdiskssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesTransferDisksSample.js +[virtualmachinesunclaimsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesUnClaimSample.js +[virtualmachinesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesUpdateSample.js +[virtualnetworkscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksCreateOrUpdateSample.js +[virtualnetworksdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksDeleteSample.js +[virtualnetworksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksGetSample.js +[virtualnetworkslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksListSample.js +[virtualnetworksupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksUpdateSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-devtestlabs?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/devtestlabs/arm-devtestlabs/README.md diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/armTemplatesGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/armTemplatesGetSample.js new file mode 100644 index 000000000000..576da0a0d285 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/armTemplatesGetSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get azure resource manager template. + * + * @summary Get azure resource manager template. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_Get.json + */ +async function armTemplatesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const name = "{armTemplateName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.armTemplates.get( + resourceGroupName, + labName, + artifactSourceName, + name + ); + console.log(result); +} + +armTemplatesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/armTemplatesListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/armTemplatesListSample.js new file mode 100644 index 000000000000..ea83d81b0fda --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/armTemplatesListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List azure resource manager templates in a given artifact source. + * + * @summary List azure resource manager templates in a given artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_List.json + */ +async function armTemplatesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.armTemplates.list(resourceGroupName, labName, artifactSourceName)) { + resArray.push(item); + } + console.log(resArray); +} + +armTemplatesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesCreateOrUpdateSample.js new file mode 100644 index 000000000000..caa8d44091cc --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesCreateOrUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing artifact source. + * + * @summary Create or replace an existing artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_CreateOrUpdate.json + */ +async function artifactSourcesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{artifactSourceName}"; + const artifactSource = { + armTemplateFolderPath: "{armTemplateFolderPath}", + branchRef: "{branchRef}", + displayName: "{displayName}", + folderPath: "{folderPath}", + securityToken: "{securityToken}", + sourceType: "{VsoGit|GitHub|StorageAccount}", + status: "{Enabled|Disabled}", + tags: { tagName1: "tagValue1" }, + uri: "{artifactSourceUri}", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifactSources.createOrUpdate( + resourceGroupName, + labName, + name, + artifactSource + ); + console.log(result); +} + +artifactSourcesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesDeleteSample.js new file mode 100644 index 000000000000..a738335fb374 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesDeleteSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete artifact source. + * + * @summary Delete artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Delete.json + */ +async function artifactSourcesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{artifactSourceName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifactSources.delete(resourceGroupName, labName, name); + console.log(result); +} + +artifactSourcesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesGetSample.js new file mode 100644 index 000000000000..51da9a82bfc5 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get artifact source. + * + * @summary Get artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Get.json + */ +async function artifactSourcesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{artifactSourceName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifactSources.get(resourceGroupName, labName, name); + console.log(result); +} + +artifactSourcesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesListSample.js new file mode 100644 index 000000000000..be761b67b034 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List artifact sources in a given lab. + * + * @summary List artifact sources in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_List.json + */ +async function artifactSourcesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.artifactSources.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +artifactSourcesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesUpdateSample.js new file mode 100644 index 000000000000..42f9844ccb1c --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactSourcesUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of artifact sources. All other properties will be ignored. + * + * @summary Allows modifying tags of artifact sources. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Update.json + */ +async function artifactSourcesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{artifactSourceName}"; + const artifactSource = { + tags: { tagName1: "tagValue1" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifactSources.update( + resourceGroupName, + labName, + name, + artifactSource + ); + console.log(result); +} + +artifactSourcesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactsGenerateArmTemplateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactsGenerateArmTemplateSample.js new file mode 100644 index 000000000000..813df13daafc --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactsGenerateArmTemplateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. + * + * @summary Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_GenerateArmTemplate.json + */ +async function artifactsGenerateArmTemplate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const name = "{artifactName}"; + const generateArmTemplateRequest = { + fileUploadOptions: "None", + location: "{location}", + virtualMachineName: "{vmName}", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifacts.generateArmTemplate( + resourceGroupName, + labName, + artifactSourceName, + name, + generateArmTemplateRequest + ); + console.log(result); +} + +artifactsGenerateArmTemplate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactsGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactsGetSample.js new file mode 100644 index 000000000000..1540f8d028e4 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactsGetSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get artifact. + * + * @summary Get artifact. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_Get.json + */ +async function artifactsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const name = "{artifactName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifacts.get(resourceGroupName, labName, artifactSourceName, name); + console.log(result); +} + +artifactsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactsListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactsListSample.js new file mode 100644 index 000000000000..3143eb5449da --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/artifactsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List artifacts in a given artifact source. + * + * @summary List artifacts in a given artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_List.json + */ +async function artifactsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.artifacts.list(resourceGroupName, labName, artifactSourceName)) { + resArray.push(item); + } + console.log(resArray); +} + +artifactsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/costsCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/costsCreateOrUpdateSample.js new file mode 100644 index 000000000000..db0bd317c84c --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/costsCreateOrUpdateSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing cost. + * + * @summary Create or replace an existing cost. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_CreateOrUpdate.json + */ +async function costsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "targetCost"; + const labCost = { + currencyCode: "USD", + endDateTime: new Date("2020-12-31T23:59:59Z"), + startDateTime: new Date("2020-12-01T00:00:00Z"), + targetCost: { + costThresholds: [ + { + displayOnChart: "Disabled", + percentageThreshold: { thresholdValue: 25 }, + sendNotificationWhenExceeded: "Disabled", + thresholdId: "00000000-0000-0000-0000-000000000001", + }, + { + displayOnChart: "Enabled", + percentageThreshold: { thresholdValue: 50 }, + sendNotificationWhenExceeded: "Enabled", + thresholdId: "00000000-0000-0000-0000-000000000002", + }, + { + displayOnChart: "Disabled", + percentageThreshold: { thresholdValue: 75 }, + sendNotificationWhenExceeded: "Disabled", + thresholdId: "00000000-0000-0000-0000-000000000003", + }, + { + displayOnChart: "Disabled", + percentageThreshold: { thresholdValue: 100 }, + sendNotificationWhenExceeded: "Disabled", + thresholdId: "00000000-0000-0000-0000-000000000004", + }, + { + displayOnChart: "Disabled", + percentageThreshold: { thresholdValue: 125 }, + sendNotificationWhenExceeded: "Disabled", + thresholdId: "00000000-0000-0000-0000-000000000005", + }, + ], + cycleEndDateTime: new Date("2020-12-31T00:00:00.000Z"), + cycleStartDateTime: new Date("2020-12-01T00:00:00.000Z"), + cycleType: "CalendarMonth", + status: "Enabled", + target: 100, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.costs.createOrUpdate(resourceGroupName, labName, name, labCost); + console.log(result); +} + +costsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/costsGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/costsGetSample.js new file mode 100644 index 000000000000..03e473b1c88d --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/costsGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get cost. + * + * @summary Get cost. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_Get.json + */ +async function costsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "targetCost"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.costs.get(resourceGroupName, labName, name); + console.log(result); +} + +costsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesCreateOrUpdateSample.js new file mode 100644 index 000000000000..ec366f3de2c8 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesCreateOrUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing custom image. This operation can take a while to complete. + * + * @summary Create or replace an existing custom image. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_CreateOrUpdate.json + */ +async function customImagesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{customImageName}"; + const customImage = { + description: "My Custom Image", + tags: { tagName1: "tagValue1" }, + vm: { + linuxOsInfo: { linuxOsState: "NonDeprovisioned" }, + sourceVmId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{vmName}", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.customImages.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + customImage + ); + console.log(result); +} + +customImagesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesDeleteSample.js new file mode 100644 index 000000000000..4fd337647019 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesDeleteSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete custom image. This operation can take a while to complete. + * + * @summary Delete custom image. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Delete.json + */ +async function customImagesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{customImageName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.customImages.beginDeleteAndWait(resourceGroupName, labName, name); + console.log(result); +} + +customImagesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesGetSample.js new file mode 100644 index 000000000000..ddfd289be26c --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get custom image. + * + * @summary Get custom image. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Get.json + */ +async function customImagesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{customImageName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.customImages.get(resourceGroupName, labName, name); + console.log(result); +} + +customImagesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesListSample.js new file mode 100644 index 000000000000..62291eef2dd3 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List custom images in a given lab. + * + * @summary List custom images in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_List.json + */ +async function customImagesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.customImages.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +customImagesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesUpdateSample.js new file mode 100644 index 000000000000..adae485cd3bf --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/customImagesUpdateSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of custom images. All other properties will be ignored. + * + * @summary Allows modifying tags of custom images. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Update.json + */ +async function customImagesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{customImageName}"; + const customImage = { tags: { tagName1: "tagValue2" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.customImages.update(resourceGroupName, labName, name, customImage); + console.log(result); +} + +customImagesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksAttachSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksAttachSample.js new file mode 100644 index 000000000000..c0c8371201c0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksAttachSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @summary Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Attach.json + */ +async function disksAttach() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userId}"; + const name = "{diskName}"; + const attachDiskProperties = { + leasedByLabVmId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{vmName}", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.beginAttachAndWait( + resourceGroupName, + labName, + userName, + name, + attachDiskProperties + ); + console.log(result); +} + +disksAttach().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksCreateOrUpdateSample.js new file mode 100644 index 000000000000..3867b849774e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksCreateOrUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing disk. This operation can take a while to complete. + * + * @summary Create or replace an existing disk. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_CreateOrUpdate.json + */ +async function disksCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userId}"; + const name = "{diskName}"; + const disk = { + diskSizeGiB: 1023, + diskType: "Standard", + leasedByLabVmId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/vmName", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + userName, + name, + disk + ); + console.log(result); +} + +disksCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksDeleteSample.js new file mode 100644 index 000000000000..27b19f4de0aa --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksDeleteSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete disk. This operation can take a while to complete. + * + * @summary Delete disk. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Delete.json + */ +async function disksDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userId}"; + const name = "{diskName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.beginDeleteAndWait(resourceGroupName, labName, userName, name); + console.log(result); +} + +disksDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksDetachSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksDetachSample.js new file mode 100644 index 000000000000..a0135714edfb --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksDetachSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @summary Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Detach.json + */ +async function disksDetach() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userId}"; + const name = "{diskName}"; + const detachDiskProperties = { + leasedByLabVmId: + "/subscriptions/{subscriptionId}/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{vmName}", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.beginDetachAndWait( + resourceGroupName, + labName, + userName, + name, + detachDiskProperties + ); + console.log(result); +} + +disksDetach().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksGetSample.js new file mode 100644 index 000000000000..5466a66313f5 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksGetSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get disk. + * + * @summary Get disk. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Get.json + */ +async function disksGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{diskName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.get(resourceGroupName, labName, userName, name); + console.log(result); +} + +disksGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksListSample.js new file mode 100644 index 000000000000..2ce11a4773cc --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List disks in a given user profile. + * + * @summary List disks in a given user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_List.json + */ +async function disksList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.disks.list(resourceGroupName, labName, userName)) { + resArray.push(item); + } + console.log(resArray); +} + +disksList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksUpdateSample.js new file mode 100644 index 000000000000..926741035bd8 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/disksUpdateSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of disks. All other properties will be ignored. + * + * @summary Allows modifying tags of disks. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Update.json + */ +async function disksUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "diskName"; + const disk = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.update(resourceGroupName, labName, userName, name, disk); + console.log(result); +} + +disksUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsCreateOrUpdateSample.js new file mode 100644 index 000000000000..9dd0f04a73ba --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsCreateOrUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing environment. This operation can take a while to complete. + * + * @summary Create or replace an existing environment. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_CreateOrUpdate.json + */ +async function environmentsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{environmentName}"; + const dtlEnvironment = { + deploymentProperties: { + armTemplateId: + "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/artifactSources/{artifactSourceName}/armTemplates/{armTemplateName}", + parameters: [], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.environments.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + userName, + name, + dtlEnvironment + ); + console.log(result); +} + +environmentsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsDeleteSample.js new file mode 100644 index 000000000000..f76a1a72fedb --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsDeleteSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete environment. This operation can take a while to complete. + * + * @summary Delete environment. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Delete.json + */ +async function environmentsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{environmentName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.environments.beginDeleteAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +environmentsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsGetSample.js new file mode 100644 index 000000000000..1f470f5a79fa --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsGetSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get environment. + * + * @summary Get environment. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Get.json + */ +async function environmentsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{environmentName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.environments.get(resourceGroupName, labName, userName, name); + console.log(result); +} + +environmentsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsListSample.js new file mode 100644 index 000000000000..ce32bd84836e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List environments in a given user profile. + * + * @summary List environments in a given user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_List.json + */ +async function environmentsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.environments.list(resourceGroupName, labName, userName)) { + resArray.push(item); + } + console.log(resArray); +} + +environmentsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsUpdateSample.js new file mode 100644 index 000000000000..2b8d086c1f4b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/environmentsUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of environments. All other properties will be ignored. + * + * @summary Allows modifying tags of environments. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Update.json + */ +async function environmentsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{environmentName}"; + const dtlEnvironment = { + tags: { tagName1: "tagValue1" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.environments.update( + resourceGroupName, + labName, + userName, + name, + dtlEnvironment + ); + console.log(result); +} + +environmentsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasCreateOrUpdateSample.js new file mode 100644 index 000000000000..792ea5af4f40 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasCreateOrUpdateSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing formula. This operation can take a while to complete. + * + * @summary Create or replace an existing formula. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_CreateOrUpdate.json + */ +async function formulasCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{formulaName}"; + const formula = { + description: "Formula using a Linux base", + formulaContent: { + allowClaim: false, + artifacts: [ + { + artifactId: "/artifactsources/{artifactSourceName}/artifacts/linux-install-nodejs", + parameters: [], + }, + ], + disallowPublicIpAddress: true, + galleryImageReference: { + offer: "0001-com-ubuntu-server-groovy", + osType: "Linux", + publisher: "canonical", + sku: "20_10", + version: "latest", + }, + isAuthenticationWithSshKey: false, + labSubnetName: "Dtl{labName}Subnet", + labVirtualNetworkId: "/virtualnetworks/dtl{labName}", + location: "{location}", + networkInterface: { + sharedPublicIpAddressConfiguration: { + inboundNatRules: [{ backendPort: 22, transportProtocol: "Tcp" }], + }, + }, + notes: "Ubuntu Server 20.10", + size: "Standard_B1ms", + storageType: "Standard", + userName: "user", + }, + location: "{location}", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.formulas.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + formula + ); + console.log(result); +} + +formulasCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasDeleteSample.js new file mode 100644 index 000000000000..2139654dac64 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasDeleteSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete formula. + * + * @summary Delete formula. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Delete.json + */ +async function formulasDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{formulaName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.formulas.delete(resourceGroupName, labName, name); + console.log(result); +} + +formulasDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasGetSample.js new file mode 100644 index 000000000000..2626536dcc6e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get formula. + * + * @summary Get formula. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Get.json + */ +async function formulasGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{formulaName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.formulas.get(resourceGroupName, labName, name); + console.log(result); +} + +formulasGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasListSample.js new file mode 100644 index 000000000000..9ca195e2f93c --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List formulas in a given lab. + * + * @summary List formulas in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_List.json + */ +async function formulasList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.formulas.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +formulasList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasUpdateSample.js new file mode 100644 index 000000000000..9db3120b8151 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/formulasUpdateSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of formulas. All other properties will be ignored. + * + * @summary Allows modifying tags of formulas. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Update.json + */ +async function formulasUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{formulaName}"; + const formula = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.formulas.update(resourceGroupName, labName, name, formula); + console.log(result); +} + +formulasUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/galleryImagesListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/galleryImagesListSample.js new file mode 100644 index 000000000000..559f08989b9a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/galleryImagesListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List gallery images in a given lab. + * + * @summary List gallery images in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GalleryImages_List.json + */ +async function galleryImagesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.galleryImages.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +galleryImagesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesCreateOrUpdateSample.js new file mode 100644 index 000000000000..a5d99f8a5635 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesCreateOrUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing schedule. + * + * @summary Create or replace an existing schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_CreateOrUpdate.json + */ +async function globalSchedulesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const schedule = { + status: "Enabled", + taskType: "LabVmsStartupTask", + timeZoneId: "Hawaiian Standard Time", + weeklyRecurrence: { + time: "0700", + weekdays: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.createOrUpdate(resourceGroupName, name, schedule); + console.log(result); +} + +globalSchedulesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesDeleteSample.js new file mode 100644 index 000000000000..b5ddf6aa78ed --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesDeleteSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete schedule. + * + * @summary Delete schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Delete.json + */ +async function globalSchedulesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.delete(resourceGroupName, name); + console.log(result); +} + +globalSchedulesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesExecuteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesExecuteSample.js new file mode 100644 index 000000000000..c4e28b8ef9ff --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesExecuteSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Execute a schedule. This operation can take a while to complete. + * + * @summary Execute a schedule. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Execute.json + */ +async function globalSchedulesExecute() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.beginExecuteAndWait(resourceGroupName, name); + console.log(result); +} + +globalSchedulesExecute().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesGetSample.js new file mode 100644 index 000000000000..f2b202dc6b33 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get schedule. + * + * @summary Get schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Get.json + */ +async function globalSchedulesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.get(resourceGroupName, name); + console.log(result); +} + +globalSchedulesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesListByResourceGroupSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesListByResourceGroupSample.js new file mode 100644 index 000000000000..5b9a3c372099 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesListByResourceGroupSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List schedules in a resource group. + * + * @summary List schedules in a resource group. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListByResourceGroup.json + */ +async function globalSchedulesListByResourceGroup() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.globalSchedules.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +globalSchedulesListByResourceGroup().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesListBySubscriptionSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesListBySubscriptionSample.js new file mode 100644 index 000000000000..5fca0abe1bec --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesListBySubscriptionSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List schedules in a subscription. + * + * @summary List schedules in a subscription. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListBySubscription.json + */ +async function globalSchedulesListBySubscription() { + const subscriptionId = "{subscriptionId}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.globalSchedules.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +globalSchedulesListBySubscription().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesRetargetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesRetargetSample.js new file mode 100644 index 000000000000..73d4ff8df936 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesRetargetSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @summary Updates a schedule's target resource Id. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Retarget.json + */ +async function globalSchedulesRetarget() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{scheduleName}"; + const retargetScheduleProperties = { + currentResourceId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{targetLab}", + targetResourceId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{currentLab}", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.beginRetargetAndWait( + resourceGroupName, + name, + retargetScheduleProperties + ); + console.log(result); +} + +globalSchedulesRetarget().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesUpdateSample.js new file mode 100644 index 000000000000..2b71a576d2e2 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/globalSchedulesUpdateSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of schedules. All other properties will be ignored. + * + * @summary Allows modifying tags of schedules. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Update.json + */ +async function globalSchedulesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const schedule = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.update(resourceGroupName, name, schedule); + console.log(result); +} + +globalSchedulesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsClaimAnyVMSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsClaimAnyVMSample.js new file mode 100644 index 000000000000..0b6dc6b096d3 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsClaimAnyVMSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @summary Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ClaimAnyVm.json + */ +async function labsClaimAnyVM() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginClaimAnyVmAndWait(resourceGroupName, name); + console.log(result); +} + +labsClaimAnyVM().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsCreateEnvironmentSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsCreateEnvironmentSample.js new file mode 100644 index 000000000000..eea3a71b57d0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsCreateEnvironmentSample.js @@ -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. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create virtual machines in a lab. This operation can take a while to complete. + * + * @summary Create virtual machines in a lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateEnvironment.json + */ +async function labsCreateEnvironment() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const labVirtualMachineCreationParameter = { + name: "{vmName}", + allowClaim: true, + disallowPublicIpAddress: true, + galleryImageReference: { + offer: "UbuntuServer", + osType: "Linux", + publisher: "Canonical", + sku: "16.04-LTS", + version: "Latest", + }, + labSubnetName: "{virtualnetwork-subnet-name}", + labVirtualNetworkId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualnetworks/{virtualNetworkName}", + location: "{location}", + password: "{userPassword}", + size: "Standard_A2_v2", + storageType: "Standard", + tags: { tagName1: "tagValue1" }, + userName: "{userName}", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginCreateEnvironmentAndWait( + resourceGroupName, + name, + labVirtualMachineCreationParameter + ); + console.log(result); +} + +labsCreateEnvironment().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsCreateOrUpdateSample.js new file mode 100644 index 000000000000..b1ff4c2defe0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsCreateOrUpdateSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing lab. This operation can take a while to complete. + * + * @summary Create or replace an existing lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateOrUpdate.json + */ +async function labsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const lab = { + labStorageType: "{Standard|Premium}", + location: "{location}", + tags: { tagName1: "tagValue1" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginCreateOrUpdateAndWait(resourceGroupName, name, lab); + console.log(result); +} + +labsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsDeleteSample.js new file mode 100644 index 000000000000..7f0da8ce6d47 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsDeleteSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete lab. This operation can take a while to complete. + * + * @summary Delete lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Delete.json + */ +async function labsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginDeleteAndWait(resourceGroupName, name); + console.log(result); +} + +labsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsExportResourceUsageSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsExportResourceUsageSample.js new file mode 100644 index 000000000000..ee91898b745f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsExportResourceUsageSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @summary Exports the lab resource usage into a storage account This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ExportResourceUsage.json + */ +async function labsExportResourceUsage() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const exportResourceUsageParameters = { + blobStorageAbsoluteSasUri: + "https://invalid.blob.core.windows.net/export.blob?sv=2015-07-08&sig={sas}&sp=rcw", + usageStartDate: new Date("2020-12-01T00:00:00Z"), + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginExportResourceUsageAndWait( + resourceGroupName, + name, + exportResourceUsageParameters + ); + console.log(result); +} + +labsExportResourceUsage().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsGenerateUploadUriSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsGenerateUploadUriSample.js new file mode 100644 index 000000000000..c14f65ae31f3 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsGenerateUploadUriSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Generate a URI for uploading custom disk images to a Lab. + * + * @summary Generate a URI for uploading custom disk images to a Lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_GenerateUploadUri.json + */ +async function labsGenerateUploadUri() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const generateUploadUriParameter = { + blobName: "{blob-name}", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.generateUploadUri( + resourceGroupName, + name, + generateUploadUriParameter + ); + console.log(result); +} + +labsGenerateUploadUri().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsGetSample.js new file mode 100644 index 000000000000..7790e82c9308 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get lab. + * + * @summary Get lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Get.json + */ +async function labsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.get(resourceGroupName, name); + console.log(result); +} + +labsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsImportVirtualMachineSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsImportVirtualMachineSample.js new file mode 100644 index 000000000000..c6f7c091334e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsImportVirtualMachineSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @summary Import a virtual machine into a different lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ImportVirtualMachine.json + */ +async function labsImportVirtualMachine() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const importLabVirtualMachineRequest = { + destinationVirtualMachineName: "{vmName}", + sourceVirtualMachineResourceId: + "/subscriptions/{subscriptionId}/resourceGroups/{otherResourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginImportVirtualMachineAndWait( + resourceGroupName, + name, + importLabVirtualMachineRequest + ); + console.log(result); +} + +labsImportVirtualMachine().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsListByResourceGroupSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsListByResourceGroupSample.js new file mode 100644 index 000000000000..c7574f07500d --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsListByResourceGroupSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List labs in a resource group. + * + * @summary List labs in a resource group. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListByResourceGroup.json + */ +async function labsListByResourceGroup() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.labs.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +labsListByResourceGroup().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsListBySubscriptionSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsListBySubscriptionSample.js new file mode 100644 index 000000000000..c9f46ae76fc7 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsListBySubscriptionSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List labs in a subscription. + * + * @summary List labs in a subscription. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListBySubscription.json + */ +async function labsListBySubscription() { + const subscriptionId = "{subscriptionId}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.labs.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +labsListBySubscription().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsListVhdsSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsListVhdsSample.js new file mode 100644 index 000000000000..8828699bf9bd --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsListVhdsSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List disk images available for custom image creation. + * + * @summary List disk images available for custom image creation. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListVhds.json + */ +async function labsListVhds() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.labs.listVhds(resourceGroupName, name)) { + resArray.push(item); + } + console.log(resArray); +} + +labsListVhds().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsUpdateSample.js new file mode 100644 index 000000000000..34d59453b197 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/labsUpdateSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of labs. All other properties will be ignored. + * + * @summary Allows modifying tags of labs. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Update.json + */ +async function labsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const lab = {}; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.update(resourceGroupName, name, lab); + console.log(result); +} + +labsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsCreateOrUpdateSample.js new file mode 100644 index 000000000000..49878552c58f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsCreateOrUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing notification channel. + * + * @summary Create or replace an existing notification channel. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_CreateOrUpdate.json + */ +async function notificationChannelsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const notificationChannel = { + description: "Integration configured for auto-shutdown", + emailRecipient: "{email}", + events: [{ eventName: "AutoShutdown" }], + notificationLocale: "en", + webHookUrl: "{webhookUrl}", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.createOrUpdate( + resourceGroupName, + labName, + name, + notificationChannel + ); + console.log(result); +} + +notificationChannelsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsDeleteSample.js new file mode 100644 index 000000000000..ac5105a6ebd3 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsDeleteSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete notification channel. + * + * @summary Delete notification channel. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Delete.json + */ +async function notificationChannelsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.delete(resourceGroupName, labName, name); + console.log(result); +} + +notificationChannelsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsGetSample.js new file mode 100644 index 000000000000..9c78eb210789 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get notification channel. + * + * @summary Get notification channel. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Get.json + */ +async function notificationChannelsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.get(resourceGroupName, labName, name); + console.log(result); +} + +notificationChannelsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsListSample.js new file mode 100644 index 000000000000..677de6bdf22f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List notification channels in a given lab. + * + * @summary List notification channels in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_List.json + */ +async function notificationChannelsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.notificationChannels.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +notificationChannelsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsNotifySample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsNotifySample.js new file mode 100644 index 000000000000..3b6cc4e193e3 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsNotifySample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Send notification to provided channel. + * + * @summary Send notification to provided channel. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Notify.json + */ +async function notificationChannelsNotify() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const notifyParameters = { + eventName: "AutoShutdown", + jsonPayload: + '{"eventType":"AutoShutdown","subscriptionId":"{subscriptionId}","resourceGroupName":"resourceGroupName","labName":"{labName}"}', + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.notify( + resourceGroupName, + labName, + name, + notifyParameters + ); + console.log(result); +} + +notificationChannelsNotify().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsUpdateSample.js new file mode 100644 index 000000000000..d3eb7b343024 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/notificationChannelsUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of notification channels. All other properties will be ignored. + * + * @summary Allows modifying tags of notification channels. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Update.json + */ +async function notificationChannelsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const notificationChannel = {}; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.update( + resourceGroupName, + labName, + name, + notificationChannel + ); + console.log(result); +} + +notificationChannelsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/operationsGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/operationsGetSample.js new file mode 100644 index 000000000000..956a5dcfcc52 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/operationsGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get operation. + * + * @summary Get operation. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Operations_Get.json + */ +async function operationsGet() { + const subscriptionId = "{subscriptionId}"; + const locationName = "{locationName}"; + const name = "{operationName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.operations.get(locationName, name); + console.log(result); +} + +operationsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/package.json b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/package.json new file mode 100644 index 000000000000..7d14404238e1 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-devtestlabs-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/devtestlabs/arm-devtestlabs" + }, + "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/devtestlabs/arm-devtestlabs", + "dependencies": { + "@azure/arm-devtestlabs": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesCreateOrUpdateSample.js new file mode 100644 index 000000000000..bd0d9f862585 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesCreateOrUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing policy. + * + * @summary Create or replace an existing policy. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_CreateOrUpdate.json + */ +async function policiesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const name = "{policyName}"; + const policy = { + description: "{policyDescription}", + evaluatorType: "{policyEvaluatorType}", + factData: "{policyFactData}", + factName: "{policyFactName}", + location: "{location}", + status: "{policyStatus}", + tags: { tagName1: "tagValue1" }, + threshold: "{policyThreshold}", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policies.createOrUpdate( + resourceGroupName, + labName, + policySetName, + name, + policy + ); + console.log(result); +} + +policiesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesDeleteSample.js new file mode 100644 index 000000000000..c711f7b88a3c --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesDeleteSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete policy. + * + * @summary Delete policy. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Delete.json + */ +async function policiesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const name = "{policyName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policies.delete(resourceGroupName, labName, policySetName, name); + console.log(result); +} + +policiesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesGetSample.js new file mode 100644 index 000000000000..87f17fa6a23d --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesGetSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get policy. + * + * @summary Get policy. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Get.json + */ +async function policiesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const name = "{policyName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policies.get(resourceGroupName, labName, policySetName, name); + console.log(result); +} + +policiesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesListSample.js new file mode 100644 index 000000000000..d8ea31ace481 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List policies in a given policy set. + * + * @summary List policies in a given policy set. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_List.json + */ +async function policiesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.policies.list(resourceGroupName, labName, policySetName)) { + resArray.push(item); + } + console.log(resArray); +} + +policiesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesUpdateSample.js new file mode 100644 index 000000000000..c41c913c893a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policiesUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of policies. All other properties will be ignored. + * + * @summary Allows modifying tags of policies. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Update.json + */ +async function policiesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const name = "{policyName}"; + const policy = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policies.update( + resourceGroupName, + labName, + policySetName, + name, + policy + ); + console.log(result); +} + +policiesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policySetsEvaluatePoliciesSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policySetsEvaluatePoliciesSample.js new file mode 100644 index 000000000000..4a05716b59ab --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/policySetsEvaluatePoliciesSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Evaluates lab policy. + * + * @summary Evaluates lab policy. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/PolicySets_EvaluatePolicies.json + */ +async function policySetsEvaluatePolicies() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{policySetName}"; + const evaluatePoliciesRequest = { + policies: [{ factName: "LabVmCount", valueOffset: "1" }], + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policySets.evaluatePolicies( + resourceGroupName, + labName, + name, + evaluatePoliciesRequest + ); + console.log(result); +} + +policySetsEvaluatePolicies().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/providerOperationsListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/providerOperationsListSample.js new file mode 100644 index 000000000000..8de5c3c12438 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/providerOperationsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Result of the request to list REST API operations + * + * @summary Result of the request to list REST API operations + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ProviderOperations_List.json + */ +async function providerOperationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.providerOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +providerOperationsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/sample.env b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/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/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesCreateOrUpdateSample.js new file mode 100644 index 000000000000..656c0a366b3a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesCreateOrUpdateSample.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing schedule. + * + * @summary Create or replace an existing schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_CreateOrUpdate.json + */ +async function schedulesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const schedule = { + dailyRecurrence: { time: "{timeOfTheDayTheScheduleWillOccurEveryDay}" }, + hourlyRecurrence: { minute: 30 }, + location: "{location}", + notificationSettings: { + emailRecipient: "{email}", + notificationLocale: "EN", + status: "{Enabled|Disabled}", + timeInMinutes: 15, + webhookUrl: "{webhookUrl}", + }, + status: "{Enabled|Disabled}", + tags: { tagName1: "tagValue1" }, + targetResourceId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}", + taskType: "{myLabVmTaskType}", + timeZoneId: "Pacific Standard Time", + weeklyRecurrence: { + time: "{timeOfTheDayTheScheduleWillOccurOnThoseDays}", + weekdays: ["Monday", "Wednesday", "Friday"], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.createOrUpdate(resourceGroupName, labName, name, schedule); + console.log(result); +} + +schedulesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesDeleteSample.js new file mode 100644 index 000000000000..2cd3231e8e7d --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesDeleteSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete schedule. + * + * @summary Delete schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Delete.json + */ +async function schedulesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.delete(resourceGroupName, labName, name); + console.log(result); +} + +schedulesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesExecuteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesExecuteSample.js new file mode 100644 index 000000000000..886a1f461b18 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesExecuteSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Execute a schedule. This operation can take a while to complete. + * + * @summary Execute a schedule. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Execute.json + */ +async function schedulesExecute() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.beginExecuteAndWait(resourceGroupName, labName, name); + console.log(result); +} + +schedulesExecute().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesGetSample.js new file mode 100644 index 000000000000..a013a264cd8b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get schedule. + * + * @summary Get schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Get.json + */ +async function schedulesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.get(resourceGroupName, labName, name); + console.log(result); +} + +schedulesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesListApplicableSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesListApplicableSample.js new file mode 100644 index 000000000000..83805e327738 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesListApplicableSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists all applicable schedules + * + * @summary Lists all applicable schedules + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_ListApplicable.json + */ +async function schedulesListApplicable() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schedules.listApplicable(resourceGroupName, labName, name)) { + resArray.push(item); + } + console.log(resArray); +} + +schedulesListApplicable().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesListSample.js new file mode 100644 index 000000000000..6c3f30d6d29d --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List schedules in a given lab. + * + * @summary List schedules in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_List.json + */ +async function schedulesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schedules.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +schedulesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesUpdateSample.js new file mode 100644 index 000000000000..f4880690cbf1 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/schedulesUpdateSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of schedules. All other properties will be ignored. + * + * @summary Allows modifying tags of schedules. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Update.json + */ +async function schedulesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const schedule = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.update(resourceGroupName, labName, name, schedule); + console.log(result); +} + +schedulesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsCreateOrUpdateSample.js new file mode 100644 index 000000000000..72dd2419a786 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsCreateOrUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing secret. This operation can take a while to complete. + * + * @summary Create or replace an existing secret. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_CreateOrUpdate.json + */ +async function secretsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{secretName}"; + const secret = { value: "{secret}" }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.secrets.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + userName, + name, + secret + ); + console.log(result); +} + +secretsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsDeleteSample.js new file mode 100644 index 000000000000..e0f6cd64c33b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsDeleteSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete secret. + * + * @summary Delete secret. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Delete.json + */ +async function secretsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{secretName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.secrets.delete(resourceGroupName, labName, userName, name); + console.log(result); +} + +secretsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsGetSample.js new file mode 100644 index 000000000000..35e53b2284df --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsGetSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get secret. + * + * @summary Get secret. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Get.json + */ +async function secretsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{secretName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.secrets.get(resourceGroupName, labName, userName, name); + console.log(result); +} + +secretsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsListSample.js new file mode 100644 index 000000000000..5cf303d58b0f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List secrets in a given user profile. + * + * @summary List secrets in a given user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_List.json + */ +async function secretsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.secrets.list(resourceGroupName, labName, userName)) { + resArray.push(item); + } + console.log(resArray); +} + +secretsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsUpdateSample.js new file mode 100644 index 000000000000..84c817bbd7ab --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/secretsUpdateSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of secrets. All other properties will be ignored. + * + * @summary Allows modifying tags of secrets. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Update.json + */ +async function secretsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{secretName}"; + const secret = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.secrets.update(resourceGroupName, labName, userName, name, secret); + console.log(result); +} + +secretsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesCreateOrUpdateSample.js new file mode 100644 index 000000000000..6a4da92e5d26 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesCreateOrUpdateSample.js @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing schedule. + * + * @summary Create or replace an existing schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_CreateOrUpdate.json + */ +async function serviceFabricSchedulesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const schedule = { + dailyRecurrence: { time: "19:00" }, + hourlyRecurrence: { minute: 0 }, + location: "{location}", + notificationSettings: { + emailRecipient: "{email}", + notificationLocale: "EN", + status: "{Enabled|Disabled}", + timeInMinutes: 15, + webhookUrl: "{webhoolUrl}", + }, + status: "{Enabled|Disabled}", + tags: { tagName1: "tagValue1" }, + targetResourceId: + "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/users/{uniqueIdentifier}/servicefabrics/{serviceFrabicName}", + taskType: + "{Unknown|LabVmsShutdownTask|LabVmsStartupTask|LabVmReclamationTask|ComputeVmShutdownTask}", + timeZoneId: "Pacific Standard Time", + weeklyRecurrence: { + time: "19:00", + weekdays: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.createOrUpdate( + resourceGroupName, + labName, + userName, + serviceFabricName, + name, + schedule + ); + console.log(result); +} + +serviceFabricSchedulesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesDeleteSample.js new file mode 100644 index 000000000000..7e342b863b3c --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesDeleteSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete schedule. + * + * @summary Delete schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Delete.json + */ +async function serviceFabricSchedulesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.delete( + resourceGroupName, + labName, + userName, + serviceFabricName, + name + ); + console.log(result); +} + +serviceFabricSchedulesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesExecuteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesExecuteSample.js new file mode 100644 index 000000000000..23518ce1ca0d --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesExecuteSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Execute a schedule. This operation can take a while to complete. + * + * @summary Execute a schedule. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Execute.json + */ +async function serviceFabricSchedulesExecute() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.beginExecuteAndWait( + resourceGroupName, + labName, + userName, + serviceFabricName, + name + ); + console.log(result); +} + +serviceFabricSchedulesExecute().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesGetSample.js new file mode 100644 index 000000000000..458e0e120b73 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesGetSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get schedule. + * + * @summary Get schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Get.json + */ +async function serviceFabricSchedulesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.get( + resourceGroupName, + labName, + userName, + serviceFabricName, + name + ); + console.log(result); +} + +serviceFabricSchedulesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesListSample.js new file mode 100644 index 000000000000..87247de28118 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesListSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List schedules in a given service fabric. + * + * @summary List schedules in a given service fabric. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_List.json + */ +async function serviceFabricSchedulesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serviceFabricSchedules.list( + resourceGroupName, + labName, + userName, + serviceFabricName + )) { + resArray.push(item); + } + console.log(resArray); +} + +serviceFabricSchedulesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesUpdateSample.js new file mode 100644 index 000000000000..1f718be697a2 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricSchedulesUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of schedules. All other properties will be ignored. + * + * @summary Allows modifying tags of schedules. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Update.json + */ +async function serviceFabricSchedulesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const schedule = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.update( + resourceGroupName, + labName, + userName, + serviceFabricName, + name, + schedule + ); + console.log(result); +} + +serviceFabricSchedulesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsCreateOrUpdateSample.js new file mode 100644 index 000000000000..0738563080f7 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsCreateOrUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing service fabric. This operation can take a while to complete. + * + * @summary Create or replace an existing service fabric. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_CreateOrUpdate.json + */ +async function serviceFabricsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const serviceFabric = { + environmentId: "{environmentId}", + externalServiceFabricId: "{serviceFabricId}", + location: "{location}", + tags: { tagName1: "tagValue1" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + userName, + name, + serviceFabric + ); + console.log(result); +} + +serviceFabricsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsDeleteSample.js new file mode 100644 index 000000000000..e07eca8d4d4f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsDeleteSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete service fabric. This operation can take a while to complete. + * + * @summary Delete service fabric. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Delete.json + */ +async function serviceFabricsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.beginDeleteAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsGetSample.js new file mode 100644 index 000000000000..c57fb509a56a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsGetSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get service fabric. + * + * @summary Get service fabric. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Get.json + */ +async function serviceFabricsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.get(resourceGroupName, labName, userName, name); + console.log(result); +} + +serviceFabricsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsListApplicableSchedulesSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsListApplicableSchedulesSample.js new file mode 100644 index 000000000000..62d1e3479bc9 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsListApplicableSchedulesSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists the applicable start/stop schedules, if any. + * + * @summary Lists the applicable start/stop schedules, if any. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_ListApplicableSchedules.json + */ +async function serviceFabricsListApplicableSchedules() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.listApplicableSchedules( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsListApplicableSchedules().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsListSample.js new file mode 100644 index 000000000000..4a6f40e97c8e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsListSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List service fabrics in a given user profile. + * + * @summary List service fabrics in a given user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_List.json + */ +async function serviceFabricsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serviceFabrics.list(resourceGroupName, labName, userName)) { + resArray.push(item); + } + console.log(resArray); +} + +serviceFabricsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsStartSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsStartSample.js new file mode 100644 index 000000000000..b0f47f53b89b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsStartSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Start a service fabric. This operation can take a while to complete. + * + * @summary Start a service fabric. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Start.json + */ +async function serviceFabricsStart() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.beginStartAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsStart().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsStopSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsStopSample.js new file mode 100644 index 000000000000..3bb0f0fd7e3a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsStopSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Stop a service fabric This operation can take a while to complete. + * + * @summary Stop a service fabric This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Stop.json + */ +async function serviceFabricsStop() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.beginStopAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsStop().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsUpdateSample.js new file mode 100644 index 000000000000..f0106d3d01e6 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceFabricsUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of service fabrics. All other properties will be ignored. + * + * @summary Allows modifying tags of service fabrics. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Update.json + */ +async function serviceFabricsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const serviceFabric = { + tags: { tagName1: "tagValue1" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.update( + resourceGroupName, + labName, + userName, + name, + serviceFabric + ); + console.log(result); +} + +serviceFabricsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceRunnersCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceRunnersCreateOrUpdateSample.js new file mode 100644 index 000000000000..ff4db01a117b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceRunnersCreateOrUpdateSample.js @@ -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. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing service runner. + * + * @summary Create or replace an existing service runner. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_CreateOrUpdate.json + */ +async function serviceRunnersCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{servicerunnerName}"; + const serviceRunner = { + identity: { + type: "{identityType}", + clientSecretUrl: "{identityClientSecretUrl}", + principalId: "{identityPrincipalId}", + tenantId: "{identityTenantId}", + }, + location: "{location}", + tags: { tagName1: "tagValue1" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceRunners.createOrUpdate( + resourceGroupName, + labName, + name, + serviceRunner + ); + console.log(result); +} + +serviceRunnersCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceRunnersDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceRunnersDeleteSample.js new file mode 100644 index 000000000000..950729073af1 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceRunnersDeleteSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete service runner. + * + * @summary Delete service runner. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Delete.json + */ +async function serviceRunnersDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{servicerunnerName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceRunners.delete(resourceGroupName, labName, name); + console.log(result); +} + +serviceRunnersDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceRunnersGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceRunnersGetSample.js new file mode 100644 index 000000000000..8c19cbee9193 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/serviceRunnersGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get service runner. + * + * @summary Get service runner. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Get.json + */ +async function serviceRunnersGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{servicerunnerName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceRunners.get(resourceGroupName, labName, name); + console.log(result); +} + +serviceRunnersGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersCreateOrUpdateSample.js new file mode 100644 index 000000000000..8790566f7847 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersCreateOrUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing user profile. This operation can take a while to complete. + * + * @summary Create or replace an existing user profile. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_CreateOrUpdate.json + */ +async function usersCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{userName}"; + const user = { + identity: { + appId: "{appId}", + objectId: "{objectId}", + principalId: "{principalId}", + principalName: "{principalName}", + tenantId: "{tenantId}", + }, + location: "{location}", + secretStore: { keyVaultId: "{keyVaultId}", keyVaultUri: "{keyVaultUri}" }, + tags: { tagName1: "tagValue1" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.users.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + user + ); + console.log(result); +} + +usersCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersDeleteSample.js new file mode 100644 index 000000000000..b8e62ef9b824 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersDeleteSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete user profile. This operation can take a while to complete. + * + * @summary Delete user profile. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Delete.json + */ +async function usersDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{userName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.users.beginDeleteAndWait(resourceGroupName, labName, name); + console.log(result); +} + +usersDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersGetSample.js new file mode 100644 index 000000000000..6c9a51288f9e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get user profile. + * + * @summary Get user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Get.json + */ +async function usersGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{userName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.users.get(resourceGroupName, labName, name); + console.log(result); +} + +usersGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersListSample.js new file mode 100644 index 000000000000..a43e5595598a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List user profiles in a given lab. + * + * @summary List user profiles in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_List.json + */ +async function usersList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.users.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +usersList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersUpdateSample.js new file mode 100644 index 000000000000..9f54ff7634b9 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/usersUpdateSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of user profiles. All other properties will be ignored. + * + * @summary Allows modifying tags of user profiles. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Update.json + */ +async function usersUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{userName}"; + const user = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.users.update(resourceGroupName, labName, name, user); + console.log(result); +} + +usersUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesCreateOrUpdateSample.js new file mode 100644 index 000000000000..ed015b835595 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesCreateOrUpdateSample.js @@ -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. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing schedule. + * + * @summary Create or replace an existing schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_CreateOrUpdate.json + */ +async function virtualMachineSchedulesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const schedule = { + dailyRecurrence: { time: "1900" }, + hourlyRecurrence: { minute: 30 }, + location: "{location}", + notificationSettings: { + emailRecipient: "{email}", + notificationLocale: "EN", + status: "Enabled", + timeInMinutes: 30, + webhookUrl: "{webhookUrl}", + }, + status: "Enabled", + tags: { tagName1: "tagValue1" }, + targetResourceId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualMachines/{vmName}", + taskType: "LabVmsShutdownTask", + timeZoneId: "Pacific Standard Time", + weeklyRecurrence: { + time: "1700", + weekdays: ["Friday", "Saturday", "Sunday"], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.createOrUpdate( + resourceGroupName, + labName, + virtualMachineName, + name, + schedule + ); + console.log(result); +} + +virtualMachineSchedulesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesDeleteSample.js new file mode 100644 index 000000000000..3b6edc33b5b7 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesDeleteSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete schedule. + * + * @summary Delete schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Delete.json + */ +async function virtualMachineSchedulesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.delete( + resourceGroupName, + labName, + virtualMachineName, + name + ); + console.log(result); +} + +virtualMachineSchedulesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesExecuteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesExecuteSample.js new file mode 100644 index 000000000000..57e91081de31 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesExecuteSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Execute a schedule. This operation can take a while to complete. + * + * @summary Execute a schedule. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Execute.json + */ +async function virtualMachineSchedulesExecute() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.beginExecuteAndWait( + resourceGroupName, + labName, + virtualMachineName, + name + ); + console.log(result); +} + +virtualMachineSchedulesExecute().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesGetSample.js new file mode 100644 index 000000000000..6cea262a5c49 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesGetSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get schedule. + * + * @summary Get schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Get.json + */ +async function virtualMachineSchedulesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.get( + resourceGroupName, + labName, + virtualMachineName, + name + ); + console.log(result); +} + +virtualMachineSchedulesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesListSample.js new file mode 100644 index 000000000000..b1c08ae4a002 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesListSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List schedules in a given virtual machine. + * + * @summary List schedules in a given virtual machine. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_List.json + */ +async function virtualMachineSchedulesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualMachineSchedules.list( + resourceGroupName, + labName, + virtualMachineName + )) { + resArray.push(item); + } + console.log(resArray); +} + +virtualMachineSchedulesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesUpdateSample.js new file mode 100644 index 000000000000..eec6f345e3c4 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachineSchedulesUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of schedules. All other properties will be ignored. + * + * @summary Allows modifying tags of schedules. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Update.json + */ +async function virtualMachineSchedulesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const schedule = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.update( + resourceGroupName, + labName, + virtualMachineName, + name, + schedule + ); + console.log(result); +} + +virtualMachineSchedulesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesAddDataDiskSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesAddDataDiskSample.js new file mode 100644 index 000000000000..ffe4e00eeb57 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesAddDataDiskSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @summary Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_AddDataDisk.json + */ +async function virtualMachinesAddDataDisk() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualMachineName}"; + const dataDiskProperties = { + attachNewDataDiskOptions: { + diskName: "{diskName}", + diskSizeGiB: 127, + diskType: "{diskType}", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginAddDataDiskAndWait( + resourceGroupName, + labName, + name, + dataDiskProperties + ); + console.log(result); +} + +virtualMachinesAddDataDisk().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesApplyArtifactsSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesApplyArtifactsSample.js new file mode 100644 index 000000000000..ea2f2ce06e19 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesApplyArtifactsSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @summary Apply artifacts to virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ApplyArtifacts.json + */ +async function virtualMachinesApplyArtifacts() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const applyArtifactsRequest = { + artifacts: [ + { + artifactId: + "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/artifactSources/public repo/artifacts/windows-restart", + }, + ], + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginApplyArtifactsAndWait( + resourceGroupName, + labName, + name, + applyArtifactsRequest + ); + console.log(result); +} + +virtualMachinesApplyArtifacts().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesClaimSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesClaimSample.js new file mode 100644 index 000000000000..61836fe50f01 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesClaimSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @summary Take ownership of an existing virtual machine This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Claim.json + */ +async function virtualMachinesClaim() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginClaimAndWait(resourceGroupName, labName, name); + console.log(result); +} + +virtualMachinesClaim().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesCreateOrUpdateSample.js new file mode 100644 index 000000000000..154fe211a9a6 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesCreateOrUpdateSample.js @@ -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. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @summary Create or replace an existing virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_CreateOrUpdate.json + */ +async function virtualMachinesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const labVirtualMachine = { + allowClaim: true, + disallowPublicIpAddress: true, + galleryImageReference: { + offer: "UbuntuServer", + osType: "Linux", + publisher: "Canonical", + sku: "16.04-LTS", + version: "Latest", + }, + labSubnetName: "{virtualNetworkName}Subnet", + labVirtualNetworkId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualnetworks/{virtualNetworkName}", + location: "{location}", + password: "{userPassword}", + size: "Standard_A2_v2", + storageType: "Standard", + tags: { tagName1: "tagValue1" }, + userName: "{userName}", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + labVirtualMachine + ); + console.log(result); +} + +virtualMachinesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesDeleteSample.js new file mode 100644 index 000000000000..b41a446ad9d4 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesDeleteSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete virtual machine. This operation can take a while to complete. + * + * @summary Delete virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Delete.json + */ +async function virtualMachinesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginDeleteAndWait(resourceGroupName, labName, name); + console.log(result); +} + +virtualMachinesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesDetachDataDiskSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesDetachDataDiskSample.js new file mode 100644 index 000000000000..776f8aa1edc9 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesDetachDataDiskSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @summary Detach the specified disk from the virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_DetachDataDisk.json + */ +async function virtualMachinesDetachDataDisk() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualMachineName}"; + const detachDataDiskProperties = { + existingLabDiskId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{virtualMachineName}", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginDetachDataDiskAndWait( + resourceGroupName, + labName, + name, + detachDataDiskProperties + ); + console.log(result); +} + +virtualMachinesDetachDataDisk().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesGetRdpFileContentsSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesGetRdpFileContentsSample.js new file mode 100644 index 000000000000..a2fab25504d4 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesGetRdpFileContentsSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets a string that represents the contents of the RDP file for the virtual machine + * + * @summary Gets a string that represents the contents of the RDP file for the virtual machine + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_GetRdpFileContents.json + */ +async function virtualMachinesGetRdpFileContents() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.getRdpFileContents(resourceGroupName, labName, name); + console.log(result); +} + +virtualMachinesGetRdpFileContents().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesGetSample.js new file mode 100644 index 000000000000..5ef289bd254b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get virtual machine. + * + * @summary Get virtual machine. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Get.json + */ +async function virtualMachinesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.get(resourceGroupName, labName, name); + console.log(result); +} + +virtualMachinesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesListApplicableSchedulesSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesListApplicableSchedulesSample.js new file mode 100644 index 000000000000..b7aa3b9a0359 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesListApplicableSchedulesSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists the applicable start/stop schedules, if any. + * + * @summary Lists the applicable start/stop schedules, if any. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ListApplicableSchedules.json + */ +async function virtualMachinesListApplicableSchedules() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.listApplicableSchedules( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesListApplicableSchedules().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesListSample.js new file mode 100644 index 000000000000..da5d1ccd6fd0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List virtual machines in a given lab. + * + * @summary List virtual machines in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_List.json + */ +async function virtualMachinesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualMachines.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +virtualMachinesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesRedeploySample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesRedeploySample.js new file mode 100644 index 000000000000..4f086e94d564 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesRedeploySample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Redeploy a virtual machine This operation can take a while to complete. + * + * @summary Redeploy a virtual machine This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Redeploy.json + */ +async function virtualMachinesRedeploy() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginRedeployAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesRedeploy().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesResizeSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesResizeSample.js new file mode 100644 index 000000000000..65b3ba46d76c --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesResizeSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Resize Virtual Machine. This operation can take a while to complete. + * + * @summary Resize Virtual Machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Resize.json + */ +async function virtualMachinesResize() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const resizeLabVirtualMachineProperties = { + size: "Standard_A4_v2", + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginResizeAndWait( + resourceGroupName, + labName, + name, + resizeLabVirtualMachineProperties + ); + console.log(result); +} + +virtualMachinesResize().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesRestartSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesRestartSample.js new file mode 100644 index 000000000000..f43906a3ac51 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesRestartSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Restart a virtual machine. This operation can take a while to complete. + * + * @summary Restart a virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Restart.json + */ +async function virtualMachinesRestart() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginRestartAndWait(resourceGroupName, labName, name); + console.log(result); +} + +virtualMachinesRestart().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesStartSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesStartSample.js new file mode 100644 index 000000000000..298f3f6a56de --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesStartSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Start a virtual machine. This operation can take a while to complete. + * + * @summary Start a virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Start.json + */ +async function virtualMachinesStart() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginStartAndWait(resourceGroupName, labName, name); + console.log(result); +} + +virtualMachinesStart().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesStopSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesStopSample.js new file mode 100644 index 000000000000..debc62b4fb41 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesStopSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Stop a virtual machine This operation can take a while to complete. + * + * @summary Stop a virtual machine This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Stop.json + */ +async function virtualMachinesStop() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginStopAndWait(resourceGroupName, labName, name); + console.log(result); +} + +virtualMachinesStop().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesTransferDisksSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesTransferDisksSample.js new file mode 100644 index 000000000000..180d86ae3b80 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesTransferDisksSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. + * + * @summary Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_TransferDisks.json + */ +async function virtualMachinesTransferDisks() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualmachineName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginTransferDisksAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesTransferDisks().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesUnClaimSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesUnClaimSample.js new file mode 100644 index 000000000000..c5b98c855c7f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesUnClaimSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @summary Release ownership of an existing virtual machine This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_UnClaim.json + */ +async function virtualMachinesUnClaim() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginUnClaimAndWait(resourceGroupName, labName, name); + console.log(result); +} + +virtualMachinesUnClaim().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesUpdateSample.js new file mode 100644 index 000000000000..05025d3e2e35 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualMachinesUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of virtual machines. All other properties will be ignored. + * + * @summary Allows modifying tags of virtual machines. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Update.json + */ +async function virtualMachinesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const labVirtualMachine = {}; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.update( + resourceGroupName, + labName, + name, + labVirtualMachine + ); + console.log(result); +} + +virtualMachinesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksCreateOrUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksCreateOrUpdateSample.js new file mode 100644 index 000000000000..8d7f31997c78 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksCreateOrUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or replace an existing virtual network. This operation can take a while to complete. + * + * @summary Create or replace an existing virtual network. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_CreateOrUpdate.json + */ +async function virtualNetworksCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualNetworkName}"; + const virtualNetwork = { + location: "{location}", + tags: { tagName1: "tagValue1" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualNetworks.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + virtualNetwork + ); + console.log(result); +} + +virtualNetworksCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksDeleteSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksDeleteSample.js new file mode 100644 index 000000000000..4ddf9e1f906a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksDeleteSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete virtual network. This operation can take a while to complete. + * + * @summary Delete virtual network. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Delete.json + */ +async function virtualNetworksDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualNetworkName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualNetworks.beginDeleteAndWait(resourceGroupName, labName, name); + console.log(result); +} + +virtualNetworksDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksGetSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksGetSample.js new file mode 100644 index 000000000000..55fd1f30caed --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get virtual network. + * + * @summary Get virtual network. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Get.json + */ +async function virtualNetworksGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualNetworkName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualNetworks.get(resourceGroupName, labName, name); + console.log(result); +} + +virtualNetworksGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksListSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksListSample.js new file mode 100644 index 000000000000..c53d19e13242 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List virtual networks in a given lab. + * + * @summary List virtual networks in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_List.json + */ +async function virtualNetworksList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualNetworks.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +virtualNetworksList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksUpdateSample.js b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksUpdateSample.js new file mode 100644 index 000000000000..fdeae00c87c3 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/javascript/virtualNetworksUpdateSample.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 { DevTestLabsClient } = require("@azure/arm-devtestlabs"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Allows modifying tags of virtual networks. All other properties will be ignored. + * + * @summary Allows modifying tags of virtual networks. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Update.json + */ +async function virtualNetworksUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualNetworkName}"; + const virtualNetwork = { + tags: { tagName1: "tagValue1" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualNetworks.update( + resourceGroupName, + labName, + name, + virtualNetwork + ); + console.log(result); +} + +virtualNetworksUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/README.md b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/README.md new file mode 100644 index 000000000000..ef2bc2a6a03f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/README.md @@ -0,0 +1,325 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [armTemplatesGetSample.ts][armtemplatesgetsample] | Get azure resource manager template. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_Get.json | +| [armTemplatesListSample.ts][armtemplateslistsample] | List azure resource manager templates in a given artifact source. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_List.json | +| [artifactSourcesCreateOrUpdateSample.ts][artifactsourcescreateorupdatesample] | Create or replace an existing artifact source. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_CreateOrUpdate.json | +| [artifactSourcesDeleteSample.ts][artifactsourcesdeletesample] | Delete artifact source. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Delete.json | +| [artifactSourcesGetSample.ts][artifactsourcesgetsample] | Get artifact source. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Get.json | +| [artifactSourcesListSample.ts][artifactsourceslistsample] | List artifact sources in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_List.json | +| [artifactSourcesUpdateSample.ts][artifactsourcesupdatesample] | Allows modifying tags of artifact sources. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Update.json | +| [artifactsGenerateArmTemplateSample.ts][artifactsgeneratearmtemplatesample] | Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_GenerateArmTemplate.json | +| [artifactsGetSample.ts][artifactsgetsample] | Get artifact. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_Get.json | +| [artifactsListSample.ts][artifactslistsample] | List artifacts in a given artifact source. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_List.json | +| [costsCreateOrUpdateSample.ts][costscreateorupdatesample] | Create or replace an existing cost. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_CreateOrUpdate.json | +| [costsGetSample.ts][costsgetsample] | Get cost. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_Get.json | +| [customImagesCreateOrUpdateSample.ts][customimagescreateorupdatesample] | Create or replace an existing custom image. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_CreateOrUpdate.json | +| [customImagesDeleteSample.ts][customimagesdeletesample] | Delete custom image. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Delete.json | +| [customImagesGetSample.ts][customimagesgetsample] | Get custom image. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Get.json | +| [customImagesListSample.ts][customimageslistsample] | List custom images in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_List.json | +| [customImagesUpdateSample.ts][customimagesupdatesample] | Allows modifying tags of custom images. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Update.json | +| [disksAttachSample.ts][disksattachsample] | Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Attach.json | +| [disksCreateOrUpdateSample.ts][diskscreateorupdatesample] | Create or replace an existing disk. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_CreateOrUpdate.json | +| [disksDeleteSample.ts][disksdeletesample] | Delete disk. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Delete.json | +| [disksDetachSample.ts][disksdetachsample] | Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Detach.json | +| [disksGetSample.ts][disksgetsample] | Get disk. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Get.json | +| [disksListSample.ts][diskslistsample] | List disks in a given user profile. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_List.json | +| [disksUpdateSample.ts][disksupdatesample] | Allows modifying tags of disks. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Update.json | +| [environmentsCreateOrUpdateSample.ts][environmentscreateorupdatesample] | Create or replace an existing environment. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_CreateOrUpdate.json | +| [environmentsDeleteSample.ts][environmentsdeletesample] | Delete environment. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Delete.json | +| [environmentsGetSample.ts][environmentsgetsample] | Get environment. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Get.json | +| [environmentsListSample.ts][environmentslistsample] | List environments in a given user profile. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_List.json | +| [environmentsUpdateSample.ts][environmentsupdatesample] | Allows modifying tags of environments. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Update.json | +| [formulasCreateOrUpdateSample.ts][formulascreateorupdatesample] | Create or replace an existing formula. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_CreateOrUpdate.json | +| [formulasDeleteSample.ts][formulasdeletesample] | Delete formula. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Delete.json | +| [formulasGetSample.ts][formulasgetsample] | Get formula. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Get.json | +| [formulasListSample.ts][formulaslistsample] | List formulas in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_List.json | +| [formulasUpdateSample.ts][formulasupdatesample] | Allows modifying tags of formulas. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Update.json | +| [galleryImagesListSample.ts][galleryimageslistsample] | List gallery images in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GalleryImages_List.json | +| [globalSchedulesCreateOrUpdateSample.ts][globalschedulescreateorupdatesample] | Create or replace an existing schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_CreateOrUpdate.json | +| [globalSchedulesDeleteSample.ts][globalschedulesdeletesample] | Delete schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Delete.json | +| [globalSchedulesExecuteSample.ts][globalschedulesexecutesample] | Execute a schedule. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Execute.json | +| [globalSchedulesGetSample.ts][globalschedulesgetsample] | Get schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Get.json | +| [globalSchedulesListByResourceGroupSample.ts][globalscheduleslistbyresourcegroupsample] | List schedules in a resource group. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListByResourceGroup.json | +| [globalSchedulesListBySubscriptionSample.ts][globalscheduleslistbysubscriptionsample] | List schedules in a subscription. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListBySubscription.json | +| [globalSchedulesRetargetSample.ts][globalschedulesretargetsample] | Updates a schedule's target resource Id. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Retarget.json | +| [globalSchedulesUpdateSample.ts][globalschedulesupdatesample] | Allows modifying tags of schedules. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Update.json | +| [labsClaimAnyVMSample.ts][labsclaimanyvmsample] | Claim a random claimable virtual machine in the lab. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ClaimAnyVm.json | +| [labsCreateEnvironmentSample.ts][labscreateenvironmentsample] | Create virtual machines in a lab. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateEnvironment.json | +| [labsCreateOrUpdateSample.ts][labscreateorupdatesample] | Create or replace an existing lab. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateOrUpdate.json | +| [labsDeleteSample.ts][labsdeletesample] | Delete lab. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Delete.json | +| [labsExportResourceUsageSample.ts][labsexportresourceusagesample] | Exports the lab resource usage into a storage account This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ExportResourceUsage.json | +| [labsGenerateUploadUriSample.ts][labsgenerateuploadurisample] | Generate a URI for uploading custom disk images to a Lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_GenerateUploadUri.json | +| [labsGetSample.ts][labsgetsample] | Get lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Get.json | +| [labsImportVirtualMachineSample.ts][labsimportvirtualmachinesample] | Import a virtual machine into a different lab. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ImportVirtualMachine.json | +| [labsListByResourceGroupSample.ts][labslistbyresourcegroupsample] | List labs in a resource group. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListByResourceGroup.json | +| [labsListBySubscriptionSample.ts][labslistbysubscriptionsample] | List labs in a subscription. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListBySubscription.json | +| [labsListVhdsSample.ts][labslistvhdssample] | List disk images available for custom image creation. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListVhds.json | +| [labsUpdateSample.ts][labsupdatesample] | Allows modifying tags of labs. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Update.json | +| [notificationChannelsCreateOrUpdateSample.ts][notificationchannelscreateorupdatesample] | Create or replace an existing notification channel. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_CreateOrUpdate.json | +| [notificationChannelsDeleteSample.ts][notificationchannelsdeletesample] | Delete notification channel. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Delete.json | +| [notificationChannelsGetSample.ts][notificationchannelsgetsample] | Get notification channel. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Get.json | +| [notificationChannelsListSample.ts][notificationchannelslistsample] | List notification channels in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_List.json | +| [notificationChannelsNotifySample.ts][notificationchannelsnotifysample] | Send notification to provided channel. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Notify.json | +| [notificationChannelsUpdateSample.ts][notificationchannelsupdatesample] | Allows modifying tags of notification channels. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Update.json | +| [operationsGetSample.ts][operationsgetsample] | Get operation. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Operations_Get.json | +| [policiesCreateOrUpdateSample.ts][policiescreateorupdatesample] | Create or replace an existing policy. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_CreateOrUpdate.json | +| [policiesDeleteSample.ts][policiesdeletesample] | Delete policy. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Delete.json | +| [policiesGetSample.ts][policiesgetsample] | Get policy. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Get.json | +| [policiesListSample.ts][policieslistsample] | List policies in a given policy set. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_List.json | +| [policiesUpdateSample.ts][policiesupdatesample] | Allows modifying tags of policies. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Update.json | +| [policySetsEvaluatePoliciesSample.ts][policysetsevaluatepoliciessample] | Evaluates lab policy. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/PolicySets_EvaluatePolicies.json | +| [providerOperationsListSample.ts][provideroperationslistsample] | Result of the request to list REST API operations x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ProviderOperations_List.json | +| [schedulesCreateOrUpdateSample.ts][schedulescreateorupdatesample] | Create or replace an existing schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_CreateOrUpdate.json | +| [schedulesDeleteSample.ts][schedulesdeletesample] | Delete schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Delete.json | +| [schedulesExecuteSample.ts][schedulesexecutesample] | Execute a schedule. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Execute.json | +| [schedulesGetSample.ts][schedulesgetsample] | Get schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Get.json | +| [schedulesListApplicableSample.ts][scheduleslistapplicablesample] | Lists all applicable schedules x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_ListApplicable.json | +| [schedulesListSample.ts][scheduleslistsample] | List schedules in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_List.json | +| [schedulesUpdateSample.ts][schedulesupdatesample] | Allows modifying tags of schedules. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Update.json | +| [secretsCreateOrUpdateSample.ts][secretscreateorupdatesample] | Create or replace an existing secret. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_CreateOrUpdate.json | +| [secretsDeleteSample.ts][secretsdeletesample] | Delete secret. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Delete.json | +| [secretsGetSample.ts][secretsgetsample] | Get secret. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Get.json | +| [secretsListSample.ts][secretslistsample] | List secrets in a given user profile. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_List.json | +| [secretsUpdateSample.ts][secretsupdatesample] | Allows modifying tags of secrets. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Update.json | +| [serviceFabricSchedulesCreateOrUpdateSample.ts][servicefabricschedulescreateorupdatesample] | Create or replace an existing schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_CreateOrUpdate.json | +| [serviceFabricSchedulesDeleteSample.ts][servicefabricschedulesdeletesample] | Delete schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Delete.json | +| [serviceFabricSchedulesExecuteSample.ts][servicefabricschedulesexecutesample] | Execute a schedule. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Execute.json | +| [serviceFabricSchedulesGetSample.ts][servicefabricschedulesgetsample] | Get schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Get.json | +| [serviceFabricSchedulesListSample.ts][servicefabricscheduleslistsample] | List schedules in a given service fabric. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_List.json | +| [serviceFabricSchedulesUpdateSample.ts][servicefabricschedulesupdatesample] | Allows modifying tags of schedules. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Update.json | +| [serviceFabricsCreateOrUpdateSample.ts][servicefabricscreateorupdatesample] | Create or replace an existing service fabric. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_CreateOrUpdate.json | +| [serviceFabricsDeleteSample.ts][servicefabricsdeletesample] | Delete service fabric. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Delete.json | +| [serviceFabricsGetSample.ts][servicefabricsgetsample] | Get service fabric. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Get.json | +| [serviceFabricsListApplicableSchedulesSample.ts][servicefabricslistapplicableschedulessample] | Lists the applicable start/stop schedules, if any. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_ListApplicableSchedules.json | +| [serviceFabricsListSample.ts][servicefabricslistsample] | List service fabrics in a given user profile. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_List.json | +| [serviceFabricsStartSample.ts][servicefabricsstartsample] | Start a service fabric. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Start.json | +| [serviceFabricsStopSample.ts][servicefabricsstopsample] | Stop a service fabric This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Stop.json | +| [serviceFabricsUpdateSample.ts][servicefabricsupdatesample] | Allows modifying tags of service fabrics. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Update.json | +| [serviceRunnersCreateOrUpdateSample.ts][servicerunnerscreateorupdatesample] | Create or replace an existing service runner. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_CreateOrUpdate.json | +| [serviceRunnersDeleteSample.ts][servicerunnersdeletesample] | Delete service runner. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Delete.json | +| [serviceRunnersGetSample.ts][servicerunnersgetsample] | Get service runner. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Get.json | +| [usersCreateOrUpdateSample.ts][userscreateorupdatesample] | Create or replace an existing user profile. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_CreateOrUpdate.json | +| [usersDeleteSample.ts][usersdeletesample] | Delete user profile. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Delete.json | +| [usersGetSample.ts][usersgetsample] | Get user profile. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Get.json | +| [usersListSample.ts][userslistsample] | List user profiles in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_List.json | +| [usersUpdateSample.ts][usersupdatesample] | Allows modifying tags of user profiles. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Update.json | +| [virtualMachineSchedulesCreateOrUpdateSample.ts][virtualmachineschedulescreateorupdatesample] | Create or replace an existing schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_CreateOrUpdate.json | +| [virtualMachineSchedulesDeleteSample.ts][virtualmachineschedulesdeletesample] | Delete schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Delete.json | +| [virtualMachineSchedulesExecuteSample.ts][virtualmachineschedulesexecutesample] | Execute a schedule. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Execute.json | +| [virtualMachineSchedulesGetSample.ts][virtualmachineschedulesgetsample] | Get schedule. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Get.json | +| [virtualMachineSchedulesListSample.ts][virtualmachinescheduleslistsample] | List schedules in a given virtual machine. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_List.json | +| [virtualMachineSchedulesUpdateSample.ts][virtualmachineschedulesupdatesample] | Allows modifying tags of schedules. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Update.json | +| [virtualMachinesAddDataDiskSample.ts][virtualmachinesadddatadisksample] | Attach a new or existing data disk to virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_AddDataDisk.json | +| [virtualMachinesApplyArtifactsSample.ts][virtualmachinesapplyartifactssample] | Apply artifacts to virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ApplyArtifacts.json | +| [virtualMachinesClaimSample.ts][virtualmachinesclaimsample] | Take ownership of an existing virtual machine This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Claim.json | +| [virtualMachinesCreateOrUpdateSample.ts][virtualmachinescreateorupdatesample] | Create or replace an existing virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_CreateOrUpdate.json | +| [virtualMachinesDeleteSample.ts][virtualmachinesdeletesample] | Delete virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Delete.json | +| [virtualMachinesDetachDataDiskSample.ts][virtualmachinesdetachdatadisksample] | Detach the specified disk from the virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_DetachDataDisk.json | +| [virtualMachinesGetRdpFileContentsSample.ts][virtualmachinesgetrdpfilecontentssample] | Gets a string that represents the contents of the RDP file for the virtual machine x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_GetRdpFileContents.json | +| [virtualMachinesGetSample.ts][virtualmachinesgetsample] | Get virtual machine. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Get.json | +| [virtualMachinesListApplicableSchedulesSample.ts][virtualmachineslistapplicableschedulessample] | Lists the applicable start/stop schedules, if any. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ListApplicableSchedules.json | +| [virtualMachinesListSample.ts][virtualmachineslistsample] | List virtual machines in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_List.json | +| [virtualMachinesRedeploySample.ts][virtualmachinesredeploysample] | Redeploy a virtual machine This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Redeploy.json | +| [virtualMachinesResizeSample.ts][virtualmachinesresizesample] | Resize Virtual Machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Resize.json | +| [virtualMachinesRestartSample.ts][virtualmachinesrestartsample] | Restart a virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Restart.json | +| [virtualMachinesStartSample.ts][virtualmachinesstartsample] | Start a virtual machine. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Start.json | +| [virtualMachinesStopSample.ts][virtualmachinesstopsample] | Stop a virtual machine This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Stop.json | +| [virtualMachinesTransferDisksSample.ts][virtualmachinestransferdiskssample] | Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_TransferDisks.json | +| [virtualMachinesUnClaimSample.ts][virtualmachinesunclaimsample] | Release ownership of an existing virtual machine This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_UnClaim.json | +| [virtualMachinesUpdateSample.ts][virtualmachinesupdatesample] | Allows modifying tags of virtual machines. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Update.json | +| [virtualNetworksCreateOrUpdateSample.ts][virtualnetworkscreateorupdatesample] | Create or replace an existing virtual network. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_CreateOrUpdate.json | +| [virtualNetworksDeleteSample.ts][virtualnetworksdeletesample] | Delete virtual network. This operation can take a while to complete. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Delete.json | +| [virtualNetworksGetSample.ts][virtualnetworksgetsample] | Get virtual network. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Get.json | +| [virtualNetworksListSample.ts][virtualnetworkslistsample] | List virtual networks in a given lab. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_List.json | +| [virtualNetworksUpdateSample.ts][virtualnetworksupdatesample] | Allows modifying tags of virtual networks. All other properties will be ignored. x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Update.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +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/armTemplatesGetSample.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 node dist/armTemplatesGetSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[armtemplatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/armTemplatesGetSample.ts +[armtemplateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/armTemplatesListSample.ts +[artifactsourcescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesCreateOrUpdateSample.ts +[artifactsourcesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesDeleteSample.ts +[artifactsourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesGetSample.ts +[artifactsourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesListSample.ts +[artifactsourcesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesUpdateSample.ts +[artifactsgeneratearmtemplatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactsGenerateArmTemplateSample.ts +[artifactsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactsGetSample.ts +[artifactslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactsListSample.ts +[costscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/costsCreateOrUpdateSample.ts +[costsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/costsGetSample.ts +[customimagescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesCreateOrUpdateSample.ts +[customimagesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesDeleteSample.ts +[customimagesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesGetSample.ts +[customimageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesListSample.ts +[customimagesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesUpdateSample.ts +[disksattachsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksAttachSample.ts +[diskscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksCreateOrUpdateSample.ts +[disksdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksDeleteSample.ts +[disksdetachsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksDetachSample.ts +[disksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksGetSample.ts +[diskslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksListSample.ts +[disksupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksUpdateSample.ts +[environmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsCreateOrUpdateSample.ts +[environmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsDeleteSample.ts +[environmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsGetSample.ts +[environmentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsListSample.ts +[environmentsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsUpdateSample.ts +[formulascreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasCreateOrUpdateSample.ts +[formulasdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasDeleteSample.ts +[formulasgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasGetSample.ts +[formulaslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasListSample.ts +[formulasupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasUpdateSample.ts +[galleryimageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/galleryImagesListSample.ts +[globalschedulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesCreateOrUpdateSample.ts +[globalschedulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesDeleteSample.ts +[globalschedulesexecutesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesExecuteSample.ts +[globalschedulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesGetSample.ts +[globalscheduleslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesListByResourceGroupSample.ts +[globalscheduleslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesListBySubscriptionSample.ts +[globalschedulesretargetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesRetargetSample.ts +[globalschedulesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesUpdateSample.ts +[labsclaimanyvmsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsClaimAnyVMSample.ts +[labscreateenvironmentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsCreateEnvironmentSample.ts +[labscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsCreateOrUpdateSample.ts +[labsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsDeleteSample.ts +[labsexportresourceusagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsExportResourceUsageSample.ts +[labsgenerateuploadurisample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsGenerateUploadUriSample.ts +[labsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsGetSample.ts +[labsimportvirtualmachinesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsImportVirtualMachineSample.ts +[labslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsListByResourceGroupSample.ts +[labslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsListBySubscriptionSample.ts +[labslistvhdssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsListVhdsSample.ts +[labsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsUpdateSample.ts +[notificationchannelscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsCreateOrUpdateSample.ts +[notificationchannelsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsDeleteSample.ts +[notificationchannelsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsGetSample.ts +[notificationchannelslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsListSample.ts +[notificationchannelsnotifysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsNotifySample.ts +[notificationchannelsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsUpdateSample.ts +[operationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/operationsGetSample.ts +[policiescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesCreateOrUpdateSample.ts +[policiesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesDeleteSample.ts +[policiesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesGetSample.ts +[policieslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesListSample.ts +[policiesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesUpdateSample.ts +[policysetsevaluatepoliciessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policySetsEvaluatePoliciesSample.ts +[provideroperationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/providerOperationsListSample.ts +[schedulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesCreateOrUpdateSample.ts +[schedulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesDeleteSample.ts +[schedulesexecutesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesExecuteSample.ts +[schedulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesGetSample.ts +[scheduleslistapplicablesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesListApplicableSample.ts +[scheduleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesListSample.ts +[schedulesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesUpdateSample.ts +[secretscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsCreateOrUpdateSample.ts +[secretsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsDeleteSample.ts +[secretsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsGetSample.ts +[secretslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsListSample.ts +[secretsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsUpdateSample.ts +[servicefabricschedulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesCreateOrUpdateSample.ts +[servicefabricschedulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesDeleteSample.ts +[servicefabricschedulesexecutesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesExecuteSample.ts +[servicefabricschedulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesGetSample.ts +[servicefabricscheduleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesListSample.ts +[servicefabricschedulesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesUpdateSample.ts +[servicefabricscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsCreateOrUpdateSample.ts +[servicefabricsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsDeleteSample.ts +[servicefabricsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsGetSample.ts +[servicefabricslistapplicableschedulessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsListApplicableSchedulesSample.ts +[servicefabricslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsListSample.ts +[servicefabricsstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsStartSample.ts +[servicefabricsstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsStopSample.ts +[servicefabricsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsUpdateSample.ts +[servicerunnerscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceRunnersCreateOrUpdateSample.ts +[servicerunnersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceRunnersDeleteSample.ts +[servicerunnersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceRunnersGetSample.ts +[userscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersCreateOrUpdateSample.ts +[usersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersDeleteSample.ts +[usersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersGetSample.ts +[userslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersListSample.ts +[usersupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersUpdateSample.ts +[virtualmachineschedulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesCreateOrUpdateSample.ts +[virtualmachineschedulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesDeleteSample.ts +[virtualmachineschedulesexecutesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesExecuteSample.ts +[virtualmachineschedulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesGetSample.ts +[virtualmachinescheduleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesListSample.ts +[virtualmachineschedulesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesUpdateSample.ts +[virtualmachinesadddatadisksample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesAddDataDiskSample.ts +[virtualmachinesapplyartifactssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesApplyArtifactsSample.ts +[virtualmachinesclaimsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesClaimSample.ts +[virtualmachinescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesCreateOrUpdateSample.ts +[virtualmachinesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesDeleteSample.ts +[virtualmachinesdetachdatadisksample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesDetachDataDiskSample.ts +[virtualmachinesgetrdpfilecontentssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesGetRdpFileContentsSample.ts +[virtualmachinesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesGetSample.ts +[virtualmachineslistapplicableschedulessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesListApplicableSchedulesSample.ts +[virtualmachineslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesListSample.ts +[virtualmachinesredeploysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesRedeploySample.ts +[virtualmachinesresizesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesResizeSample.ts +[virtualmachinesrestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesRestartSample.ts +[virtualmachinesstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesStartSample.ts +[virtualmachinesstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesStopSample.ts +[virtualmachinestransferdiskssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesTransferDisksSample.ts +[virtualmachinesunclaimsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesUnClaimSample.ts +[virtualmachinesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesUpdateSample.ts +[virtualnetworkscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksCreateOrUpdateSample.ts +[virtualnetworksdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksDeleteSample.ts +[virtualnetworksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksGetSample.ts +[virtualnetworkslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksListSample.ts +[virtualnetworksupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksUpdateSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-devtestlabs?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/devtestlabs/arm-devtestlabs/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/package.json b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/package.json new file mode 100644 index 000000000000..c9f0c06a1f15 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-devtestlabs-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/devtestlabs/arm-devtestlabs" + }, + "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/devtestlabs/arm-devtestlabs", + "dependencies": { + "@azure/arm-devtestlabs": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/sample.env b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/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/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/armTemplatesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/armTemplatesGetSample.ts new file mode 100644 index 000000000000..b85a58d849b0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/armTemplatesGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get azure resource manager template. + * + * @summary Get azure resource manager template. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_Get.json + */ +async function armTemplatesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const name = "{armTemplateName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.armTemplates.get( + resourceGroupName, + labName, + artifactSourceName, + name + ); + console.log(result); +} + +armTemplatesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/armTemplatesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/armTemplatesListSample.ts new file mode 100644 index 000000000000..7106b31bd4ef --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/armTemplatesListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List azure resource manager templates in a given artifact source. + * + * @summary List azure resource manager templates in a given artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_List.json + */ +async function armTemplatesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.armTemplates.list( + resourceGroupName, + labName, + artifactSourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +armTemplatesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..20bd3b43a213 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesCreateOrUpdateSample.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 { ArtifactSource, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing artifact source. + * + * @summary Create or replace an existing artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_CreateOrUpdate.json + */ +async function artifactSourcesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{artifactSourceName}"; + const artifactSource: ArtifactSource = { + armTemplateFolderPath: "{armTemplateFolderPath}", + branchRef: "{branchRef}", + displayName: "{displayName}", + folderPath: "{folderPath}", + securityToken: "{securityToken}", + sourceType: "{VsoGit|GitHub|StorageAccount}", + status: "{Enabled|Disabled}", + tags: { tagName1: "tagValue1" }, + uri: "{artifactSourceUri}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifactSources.createOrUpdate( + resourceGroupName, + labName, + name, + artifactSource + ); + console.log(result); +} + +artifactSourcesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesDeleteSample.ts new file mode 100644 index 000000000000..0b47bf8ed448 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete artifact source. + * + * @summary Delete artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Delete.json + */ +async function artifactSourcesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{artifactSourceName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifactSources.delete( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +artifactSourcesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesGetSample.ts new file mode 100644 index 000000000000..b7df9206c35e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get artifact source. + * + * @summary Get artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Get.json + */ +async function artifactSourcesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{artifactSourceName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifactSources.get( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +artifactSourcesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesListSample.ts new file mode 100644 index 000000000000..b03e109aea03 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List artifact sources in a given lab. + * + * @summary List artifact sources in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_List.json + */ +async function artifactSourcesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.artifactSources.list( + resourceGroupName, + labName + )) { + resArray.push(item); + } + console.log(resArray); +} + +artifactSourcesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesUpdateSample.ts new file mode 100644 index 000000000000..c21d01524963 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactSourcesUpdateSample.ts @@ -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. +import { + ArtifactSourceFragment, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of artifact sources. All other properties will be ignored. + * + * @summary Allows modifying tags of artifact sources. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Update.json + */ +async function artifactSourcesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{artifactSourceName}"; + const artifactSource: ArtifactSourceFragment = { + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifactSources.update( + resourceGroupName, + labName, + name, + artifactSource + ); + console.log(result); +} + +artifactSourcesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactsGenerateArmTemplateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactsGenerateArmTemplateSample.ts new file mode 100644 index 000000000000..5aee02dbcad9 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactsGenerateArmTemplateSample.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 { + GenerateArmTemplateRequest, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. + * + * @summary Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_GenerateArmTemplate.json + */ +async function artifactsGenerateArmTemplate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const name = "{artifactName}"; + const generateArmTemplateRequest: GenerateArmTemplateRequest = { + fileUploadOptions: "None", + location: "{location}", + virtualMachineName: "{vmName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifacts.generateArmTemplate( + resourceGroupName, + labName, + artifactSourceName, + name, + generateArmTemplateRequest + ); + console.log(result); +} + +artifactsGenerateArmTemplate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactsGetSample.ts new file mode 100644 index 000000000000..eb726eed213b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactsGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get artifact. + * + * @summary Get artifact. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_Get.json + */ +async function artifactsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const name = "{artifactName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.artifacts.get( + resourceGroupName, + labName, + artifactSourceName, + name + ); + console.log(result); +} + +artifactsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactsListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactsListSample.ts new file mode 100644 index 000000000000..743c77ebcf10 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/artifactsListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List artifacts in a given artifact source. + * + * @summary List artifacts in a given artifact source. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_List.json + */ +async function artifactsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const artifactSourceName = "{artifactSourceName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.artifacts.list( + resourceGroupName, + labName, + artifactSourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +artifactsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/costsCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/costsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..dac39cef2ad1 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/costsCreateOrUpdateSample.ts @@ -0,0 +1,80 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { LabCost, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing cost. + * + * @summary Create or replace an existing cost. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_CreateOrUpdate.json + */ +async function costsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "targetCost"; + const labCost: LabCost = { + currencyCode: "USD", + endDateTime: new Date("2020-12-31T23:59:59Z"), + startDateTime: new Date("2020-12-01T00:00:00Z"), + targetCost: { + costThresholds: [ + { + displayOnChart: "Disabled", + percentageThreshold: { thresholdValue: 25 }, + sendNotificationWhenExceeded: "Disabled", + thresholdId: "00000000-0000-0000-0000-000000000001" + }, + { + displayOnChart: "Enabled", + percentageThreshold: { thresholdValue: 50 }, + sendNotificationWhenExceeded: "Enabled", + thresholdId: "00000000-0000-0000-0000-000000000002" + }, + { + displayOnChart: "Disabled", + percentageThreshold: { thresholdValue: 75 }, + sendNotificationWhenExceeded: "Disabled", + thresholdId: "00000000-0000-0000-0000-000000000003" + }, + { + displayOnChart: "Disabled", + percentageThreshold: { thresholdValue: 100 }, + sendNotificationWhenExceeded: "Disabled", + thresholdId: "00000000-0000-0000-0000-000000000004" + }, + { + displayOnChart: "Disabled", + percentageThreshold: { thresholdValue: 125 }, + sendNotificationWhenExceeded: "Disabled", + thresholdId: "00000000-0000-0000-0000-000000000005" + } + ], + cycleEndDateTime: new Date("2020-12-31T00:00:00.000Z"), + cycleStartDateTime: new Date("2020-12-01T00:00:00.000Z"), + cycleType: "CalendarMonth", + status: "Enabled", + target: 100 + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.costs.createOrUpdate( + resourceGroupName, + labName, + name, + labCost + ); + console.log(result); +} + +costsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/costsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/costsGetSample.ts new file mode 100644 index 000000000000..5a616a22e531 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/costsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get cost. + * + * @summary Get cost. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_Get.json + */ +async function costsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "targetCost"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.costs.get(resourceGroupName, labName, name); + console.log(result); +} + +costsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..194cc8a509ab --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesCreateOrUpdateSample.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 { CustomImage, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing custom image. This operation can take a while to complete. + * + * @summary Create or replace an existing custom image. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_CreateOrUpdate.json + */ +async function customImagesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{customImageName}"; + const customImage: CustomImage = { + description: "My Custom Image", + tags: { tagName1: "tagValue1" }, + vm: { + linuxOsInfo: { linuxOsState: "NonDeprovisioned" }, + sourceVmId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{vmName}" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.customImages.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + customImage + ); + console.log(result); +} + +customImagesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesDeleteSample.ts new file mode 100644 index 000000000000..b3502ee98bc9 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete custom image. This operation can take a while to complete. + * + * @summary Delete custom image. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Delete.json + */ +async function customImagesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{customImageName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.customImages.beginDeleteAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +customImagesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesGetSample.ts new file mode 100644 index 000000000000..282148d3755d --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get custom image. + * + * @summary Get custom image. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Get.json + */ +async function customImagesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{customImageName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.customImages.get( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +customImagesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesListSample.ts new file mode 100644 index 000000000000..d650a6e0f7fd --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List custom images in a given lab. + * + * @summary List custom images in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_List.json + */ +async function customImagesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.customImages.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +customImagesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesUpdateSample.ts new file mode 100644 index 000000000000..0456af65cb2e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/customImagesUpdateSample.ts @@ -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. +import { CustomImageFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of custom images. All other properties will be ignored. + * + * @summary Allows modifying tags of custom images. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Update.json + */ +async function customImagesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{customImageName}"; + const customImage: CustomImageFragment = { tags: { tagName1: "tagValue2" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.customImages.update( + resourceGroupName, + labName, + name, + customImage + ); + console.log(result); +} + +customImagesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksAttachSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksAttachSample.ts new file mode 100644 index 000000000000..7038414c28f1 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksAttachSample.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 { + AttachDiskProperties, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @summary Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Attach.json + */ +async function disksAttach() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userId}"; + const name = "{diskName}"; + const attachDiskProperties: AttachDiskProperties = { + leasedByLabVmId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{vmName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.beginAttachAndWait( + resourceGroupName, + labName, + userName, + name, + attachDiskProperties + ); + console.log(result); +} + +disksAttach().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksCreateOrUpdateSample.ts new file mode 100644 index 000000000000..0a38a52c0546 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksCreateOrUpdateSample.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 { Disk, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing disk. This operation can take a while to complete. + * + * @summary Create or replace an existing disk. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_CreateOrUpdate.json + */ +async function disksCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userId}"; + const name = "{diskName}"; + const disk: Disk = { + diskSizeGiB: 1023, + diskType: "Standard", + leasedByLabVmId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/vmName" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + userName, + name, + disk + ); + console.log(result); +} + +disksCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksDeleteSample.ts new file mode 100644 index 000000000000..479b199492e9 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksDeleteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete disk. This operation can take a while to complete. + * + * @summary Delete disk. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Delete.json + */ +async function disksDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userId}"; + const name = "{diskName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.beginDeleteAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +disksDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksDetachSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksDetachSample.ts new file mode 100644 index 000000000000..a3fe7a030f43 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksDetachSample.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 { + DetachDiskProperties, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @summary Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Detach.json + */ +async function disksDetach() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userId}"; + const name = "{diskName}"; + const detachDiskProperties: DetachDiskProperties = { + leasedByLabVmId: + "/subscriptions/{subscriptionId}/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{vmName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.beginDetachAndWait( + resourceGroupName, + labName, + userName, + name, + detachDiskProperties + ); + console.log(result); +} + +disksDetach().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksGetSample.ts new file mode 100644 index 000000000000..2f78b0c3dbfd --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get disk. + * + * @summary Get disk. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Get.json + */ +async function disksGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{diskName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.get( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +disksGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksListSample.ts new file mode 100644 index 000000000000..674ca8ddc1de --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List disks in a given user profile. + * + * @summary List disks in a given user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_List.json + */ +async function disksList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.disks.list( + resourceGroupName, + labName, + userName + )) { + resArray.push(item); + } + console.log(resArray); +} + +disksList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksUpdateSample.ts new file mode 100644 index 000000000000..017445ff2147 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/disksUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DiskFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of disks. All other properties will be ignored. + * + * @summary Allows modifying tags of disks. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Update.json + */ +async function disksUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "diskName"; + const disk: DiskFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.disks.update( + resourceGroupName, + labName, + userName, + name, + disk + ); + console.log(result); +} + +disksUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..9d5b2e0e4c97 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsCreateOrUpdateSample.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 { DtlEnvironment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing environment. This operation can take a while to complete. + * + * @summary Create or replace an existing environment. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_CreateOrUpdate.json + */ +async function environmentsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{environmentName}"; + const dtlEnvironment: DtlEnvironment = { + deploymentProperties: { + armTemplateId: + "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/artifactSources/{artifactSourceName}/armTemplates/{armTemplateName}", + parameters: [] + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.environments.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + userName, + name, + dtlEnvironment + ); + console.log(result); +} + +environmentsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsDeleteSample.ts new file mode 100644 index 000000000000..177754a4d2e0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsDeleteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete environment. This operation can take a while to complete. + * + * @summary Delete environment. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Delete.json + */ +async function environmentsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{environmentName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.environments.beginDeleteAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +environmentsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsGetSample.ts new file mode 100644 index 000000000000..44af7b8383b0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get environment. + * + * @summary Get environment. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Get.json + */ +async function environmentsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{environmentName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.environments.get( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +environmentsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsListSample.ts new file mode 100644 index 000000000000..1fee8ae2e166 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List environments in a given user profile. + * + * @summary List environments in a given user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_List.json + */ +async function environmentsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.environments.list( + resourceGroupName, + labName, + userName + )) { + resArray.push(item); + } + console.log(resArray); +} + +environmentsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsUpdateSample.ts new file mode 100644 index 000000000000..b9aa4c2fee5e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/environmentsUpdateSample.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 { + DtlEnvironmentFragment, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of environments. All other properties will be ignored. + * + * @summary Allows modifying tags of environments. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Update.json + */ +async function environmentsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const name = "{environmentName}"; + const dtlEnvironment: DtlEnvironmentFragment = { + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.environments.update( + resourceGroupName, + labName, + userName, + name, + dtlEnvironment + ); + console.log(result); +} + +environmentsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasCreateOrUpdateSample.ts new file mode 100644 index 000000000000..0b0647db0ba5 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasCreateOrUpdateSample.ts @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { Formula, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing formula. This operation can take a while to complete. + * + * @summary Create or replace an existing formula. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_CreateOrUpdate.json + */ +async function formulasCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{formulaName}"; + const formula: Formula = { + description: "Formula using a Linux base", + formulaContent: { + allowClaim: false, + artifacts: [ + { + artifactId: + "/artifactsources/{artifactSourceName}/artifacts/linux-install-nodejs", + parameters: [] + } + ], + disallowPublicIpAddress: true, + galleryImageReference: { + offer: "0001-com-ubuntu-server-groovy", + osType: "Linux", + publisher: "canonical", + sku: "20_10", + version: "latest" + }, + isAuthenticationWithSshKey: false, + labSubnetName: "Dtl{labName}Subnet", + labVirtualNetworkId: "/virtualnetworks/dtl{labName}", + location: "{location}", + networkInterface: { + sharedPublicIpAddressConfiguration: { + inboundNatRules: [{ backendPort: 22, transportProtocol: "Tcp" }] + } + }, + notes: "Ubuntu Server 20.10", + size: "Standard_B1ms", + storageType: "Standard", + userName: "user" + }, + location: "{location}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.formulas.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + formula + ); + console.log(result); +} + +formulasCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasDeleteSample.ts new file mode 100644 index 000000000000..f8631aeeb6ac --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasDeleteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete formula. + * + * @summary Delete formula. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Delete.json + */ +async function formulasDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{formulaName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.formulas.delete(resourceGroupName, labName, name); + console.log(result); +} + +formulasDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasGetSample.ts new file mode 100644 index 000000000000..59d6dbdf2b35 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get formula. + * + * @summary Get formula. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Get.json + */ +async function formulasGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{formulaName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.formulas.get(resourceGroupName, labName, name); + console.log(result); +} + +formulasGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasListSample.ts new file mode 100644 index 000000000000..51b67145d512 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List formulas in a given lab. + * + * @summary List formulas in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_List.json + */ +async function formulasList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.formulas.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +formulasList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasUpdateSample.ts new file mode 100644 index 000000000000..74e04d82a5f4 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/formulasUpdateSample.ts @@ -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. +import { FormulaFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of formulas. All other properties will be ignored. + * + * @summary Allows modifying tags of formulas. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Update.json + */ +async function formulasUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{formulaName}"; + const formula: FormulaFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.formulas.update( + resourceGroupName, + labName, + name, + formula + ); + console.log(result); +} + +formulasUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/galleryImagesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/galleryImagesListSample.ts new file mode 100644 index 000000000000..23c4f806811c --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/galleryImagesListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List gallery images in a given lab. + * + * @summary List gallery images in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GalleryImages_List.json + */ +async function galleryImagesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.galleryImages.list( + resourceGroupName, + labName + )) { + resArray.push(item); + } + console.log(resArray); +} + +galleryImagesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..3d348cef2423 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesCreateOrUpdateSample.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { Schedule, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing schedule. + * + * @summary Create or replace an existing schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_CreateOrUpdate.json + */ +async function globalSchedulesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const schedule: Schedule = { + status: "Enabled", + taskType: "LabVmsStartupTask", + timeZoneId: "Hawaiian Standard Time", + weeklyRecurrence: { + time: "0700", + weekdays: [ + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.createOrUpdate( + resourceGroupName, + name, + schedule + ); + console.log(result); +} + +globalSchedulesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesDeleteSample.ts new file mode 100644 index 000000000000..06f66963b61b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesDeleteSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete schedule. + * + * @summary Delete schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Delete.json + */ +async function globalSchedulesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.delete(resourceGroupName, name); + console.log(result); +} + +globalSchedulesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesExecuteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesExecuteSample.ts new file mode 100644 index 000000000000..cb631ef20c8f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesExecuteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Execute a schedule. This operation can take a while to complete. + * + * @summary Execute a schedule. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Execute.json + */ +async function globalSchedulesExecute() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.beginExecuteAndWait( + resourceGroupName, + name + ); + console.log(result); +} + +globalSchedulesExecute().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesGetSample.ts new file mode 100644 index 000000000000..a7a12eb2de38 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get schedule. + * + * @summary Get schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Get.json + */ +async function globalSchedulesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.get(resourceGroupName, name); + console.log(result); +} + +globalSchedulesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesListByResourceGroupSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesListByResourceGroupSample.ts new file mode 100644 index 000000000000..a440a800cc4a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List schedules in a resource group. + * + * @summary List schedules in a resource group. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListByResourceGroup.json + */ +async function globalSchedulesListByResourceGroup() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.globalSchedules.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +globalSchedulesListByResourceGroup().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesListBySubscriptionSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesListBySubscriptionSample.ts new file mode 100644 index 000000000000..25300a85b7f4 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List schedules in a subscription. + * + * @summary List schedules in a subscription. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListBySubscription.json + */ +async function globalSchedulesListBySubscription() { + const subscriptionId = "{subscriptionId}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.globalSchedules.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +globalSchedulesListBySubscription().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesRetargetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesRetargetSample.ts new file mode 100644 index 000000000000..662af51065e3 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesRetargetSample.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 { + RetargetScheduleProperties, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @summary Updates a schedule's target resource Id. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Retarget.json + */ +async function globalSchedulesRetarget() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{scheduleName}"; + const retargetScheduleProperties: RetargetScheduleProperties = { + currentResourceId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{targetLab}", + targetResourceId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{currentLab}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.beginRetargetAndWait( + resourceGroupName, + name, + retargetScheduleProperties + ); + console.log(result); +} + +globalSchedulesRetarget().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesUpdateSample.ts new file mode 100644 index 000000000000..da47903e5224 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/globalSchedulesUpdateSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { ScheduleFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of schedules. All other properties will be ignored. + * + * @summary Allows modifying tags of schedules. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Update.json + */ +async function globalSchedulesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "labvmautostart"; + const schedule: ScheduleFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.globalSchedules.update( + resourceGroupName, + name, + schedule + ); + console.log(result); +} + +globalSchedulesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsClaimAnyVMSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsClaimAnyVMSample.ts new file mode 100644 index 000000000000..8ed9a16f281b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsClaimAnyVMSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @summary Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ClaimAnyVm.json + */ +async function labsClaimAnyVM() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginClaimAnyVmAndWait( + resourceGroupName, + name + ); + console.log(result); +} + +labsClaimAnyVM().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsCreateEnvironmentSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsCreateEnvironmentSample.ts new file mode 100644 index 000000000000..be1b4222199b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsCreateEnvironmentSample.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + LabVirtualMachineCreationParameter, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create virtual machines in a lab. This operation can take a while to complete. + * + * @summary Create virtual machines in a lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateEnvironment.json + */ +async function labsCreateEnvironment() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const labVirtualMachineCreationParameter: LabVirtualMachineCreationParameter = { + name: "{vmName}", + allowClaim: true, + disallowPublicIpAddress: true, + galleryImageReference: { + offer: "UbuntuServer", + osType: "Linux", + publisher: "Canonical", + sku: "16.04-LTS", + version: "Latest" + }, + labSubnetName: "{virtualnetwork-subnet-name}", + labVirtualNetworkId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualnetworks/{virtualNetworkName}", + location: "{location}", + password: "{userPassword}", + size: "Standard_A2_v2", + storageType: "Standard", + tags: { tagName1: "tagValue1" }, + userName: "{userName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginCreateEnvironmentAndWait( + resourceGroupName, + name, + labVirtualMachineCreationParameter + ); + console.log(result); +} + +labsCreateEnvironment().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..2c542735f322 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsCreateOrUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { Lab, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing lab. This operation can take a while to complete. + * + * @summary Create or replace an existing lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateOrUpdate.json + */ +async function labsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const lab: Lab = { + labStorageType: "{Standard|Premium}", + location: "{location}", + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginCreateOrUpdateAndWait( + resourceGroupName, + name, + lab + ); + console.log(result); +} + +labsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsDeleteSample.ts new file mode 100644 index 000000000000..34dd8360f128 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsDeleteSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete lab. This operation can take a while to complete. + * + * @summary Delete lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Delete.json + */ +async function labsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginDeleteAndWait(resourceGroupName, name); + console.log(result); +} + +labsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsExportResourceUsageSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsExportResourceUsageSample.ts new file mode 100644 index 000000000000..fa4dab3d413e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsExportResourceUsageSample.ts @@ -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. +import { + ExportResourceUsageParameters, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @summary Exports the lab resource usage into a storage account This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ExportResourceUsage.json + */ +async function labsExportResourceUsage() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const exportResourceUsageParameters: ExportResourceUsageParameters = { + blobStorageAbsoluteSasUri: + "https://invalid.blob.core.windows.net/export.blob?sv=2015-07-08&sig={sas}&sp=rcw", + usageStartDate: new Date("2020-12-01T00:00:00Z") + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginExportResourceUsageAndWait( + resourceGroupName, + name, + exportResourceUsageParameters + ); + console.log(result); +} + +labsExportResourceUsage().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsGenerateUploadUriSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsGenerateUploadUriSample.ts new file mode 100644 index 000000000000..e75ba6064836 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsGenerateUploadUriSample.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 { + GenerateUploadUriParameter, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Generate a URI for uploading custom disk images to a Lab. + * + * @summary Generate a URI for uploading custom disk images to a Lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_GenerateUploadUri.json + */ +async function labsGenerateUploadUri() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const generateUploadUriParameter: GenerateUploadUriParameter = { + blobName: "{blob-name}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.generateUploadUri( + resourceGroupName, + name, + generateUploadUriParameter + ); + console.log(result); +} + +labsGenerateUploadUri().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsGetSample.ts new file mode 100644 index 000000000000..c19a861d2e88 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get lab. + * + * @summary Get lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Get.json + */ +async function labsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.get(resourceGroupName, name); + console.log(result); +} + +labsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsImportVirtualMachineSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsImportVirtualMachineSample.ts new file mode 100644 index 000000000000..1d276f9e0a1e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsImportVirtualMachineSample.ts @@ -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. +import { + ImportLabVirtualMachineRequest, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @summary Import a virtual machine into a different lab. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ImportVirtualMachine.json + */ +async function labsImportVirtualMachine() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const importLabVirtualMachineRequest: ImportLabVirtualMachineRequest = { + destinationVirtualMachineName: "{vmName}", + sourceVirtualMachineResourceId: + "/subscriptions/{subscriptionId}/resourceGroups/{otherResourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.beginImportVirtualMachineAndWait( + resourceGroupName, + name, + importLabVirtualMachineRequest + ); + console.log(result); +} + +labsImportVirtualMachine().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsListByResourceGroupSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsListByResourceGroupSample.ts new file mode 100644 index 000000000000..b54fc3e98b05 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsListByResourceGroupSample.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List labs in a resource group. + * + * @summary List labs in a resource group. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListByResourceGroup.json + */ +async function labsListByResourceGroup() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.labs.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +labsListByResourceGroup().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsListBySubscriptionSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsListBySubscriptionSample.ts new file mode 100644 index 000000000000..da5950cd9d06 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List labs in a subscription. + * + * @summary List labs in a subscription. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListBySubscription.json + */ +async function labsListBySubscription() { + const subscriptionId = "{subscriptionId}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.labs.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +labsListBySubscription().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsListVhdsSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsListVhdsSample.ts new file mode 100644 index 000000000000..abe8bd2d5163 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsListVhdsSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List disk images available for custom image creation. + * + * @summary List disk images available for custom image creation. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListVhds.json + */ +async function labsListVhds() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.labs.listVhds(resourceGroupName, name)) { + resArray.push(item); + } + console.log(resArray); +} + +labsListVhds().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsUpdateSample.ts new file mode 100644 index 000000000000..d02f4f0aa201 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/labsUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { LabFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of labs. All other properties will be ignored. + * + * @summary Allows modifying tags of labs. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Update.json + */ +async function labsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const name = "{labName}"; + const lab: LabFragment = {}; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.labs.update(resourceGroupName, name, lab); + console.log(result); +} + +labsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..2a747043f718 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsCreateOrUpdateSample.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 { NotificationChannel, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing notification channel. + * + * @summary Create or replace an existing notification channel. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_CreateOrUpdate.json + */ +async function notificationChannelsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const notificationChannel: NotificationChannel = { + description: "Integration configured for auto-shutdown", + emailRecipient: "{email}", + events: [{ eventName: "AutoShutdown" }], + notificationLocale: "en", + webHookUrl: "{webhookUrl}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.createOrUpdate( + resourceGroupName, + labName, + name, + notificationChannel + ); + console.log(result); +} + +notificationChannelsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsDeleteSample.ts new file mode 100644 index 000000000000..3e6692f68c11 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete notification channel. + * + * @summary Delete notification channel. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Delete.json + */ +async function notificationChannelsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.delete( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +notificationChannelsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsGetSample.ts new file mode 100644 index 000000000000..395f02829d5c --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get notification channel. + * + * @summary Get notification channel. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Get.json + */ +async function notificationChannelsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.get( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +notificationChannelsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsListSample.ts new file mode 100644 index 000000000000..f0acfdd6f17b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List notification channels in a given lab. + * + * @summary List notification channels in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_List.json + */ +async function notificationChannelsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.notificationChannels.list( + resourceGroupName, + labName + )) { + resArray.push(item); + } + console.log(resArray); +} + +notificationChannelsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsNotifySample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsNotifySample.ts new file mode 100644 index 000000000000..4d230ee03884 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsNotifySample.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 { NotifyParameters, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Send notification to provided channel. + * + * @summary Send notification to provided channel. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Notify.json + */ +async function notificationChannelsNotify() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const notifyParameters: NotifyParameters = { + eventName: "AutoShutdown", + jsonPayload: + '{"eventType":"AutoShutdown","subscriptionId":"{subscriptionId}","resourceGroupName":"resourceGroupName","labName":"{labName}"}' + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.notify( + resourceGroupName, + labName, + name, + notifyParameters + ); + console.log(result); +} + +notificationChannelsNotify().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsUpdateSample.ts new file mode 100644 index 000000000000..abb22f6d5a1e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/notificationChannelsUpdateSample.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 { + NotificationChannelFragment, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of notification channels. All other properties will be ignored. + * + * @summary Allows modifying tags of notification channels. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Update.json + */ +async function notificationChannelsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{notificationChannelName}"; + const notificationChannel: NotificationChannelFragment = {}; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.notificationChannels.update( + resourceGroupName, + labName, + name, + notificationChannel + ); + console.log(result); +} + +notificationChannelsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/operationsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/operationsGetSample.ts new file mode 100644 index 000000000000..d5cdc7b4a3b2 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/operationsGetSample.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get operation. + * + * @summary Get operation. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Operations_Get.json + */ +async function operationsGet() { + const subscriptionId = "{subscriptionId}"; + const locationName = "{locationName}"; + const name = "{operationName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.operations.get(locationName, name); + console.log(result); +} + +operationsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..b395d803fe7a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesCreateOrUpdateSample.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 { Policy, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing policy. + * + * @summary Create or replace an existing policy. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_CreateOrUpdate.json + */ +async function policiesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const name = "{policyName}"; + const policy: Policy = { + description: "{policyDescription}", + evaluatorType: "{policyEvaluatorType}", + factData: "{policyFactData}", + factName: "{policyFactName}", + location: "{location}", + status: "{policyStatus}", + tags: { tagName1: "tagValue1" }, + threshold: "{policyThreshold}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policies.createOrUpdate( + resourceGroupName, + labName, + policySetName, + name, + policy + ); + console.log(result); +} + +policiesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesDeleteSample.ts new file mode 100644 index 000000000000..1a6b90b23d32 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesDeleteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete policy. + * + * @summary Delete policy. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Delete.json + */ +async function policiesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const name = "{policyName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policies.delete( + resourceGroupName, + labName, + policySetName, + name + ); + console.log(result); +} + +policiesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesGetSample.ts new file mode 100644 index 000000000000..f2ac425eeeee --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get policy. + * + * @summary Get policy. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Get.json + */ +async function policiesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const name = "{policyName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policies.get( + resourceGroupName, + labName, + policySetName, + name + ); + console.log(result); +} + +policiesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesListSample.ts new file mode 100644 index 000000000000..d30d8a34be69 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List policies in a given policy set. + * + * @summary List policies in a given policy set. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_List.json + */ +async function policiesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.policies.list( + resourceGroupName, + labName, + policySetName + )) { + resArray.push(item); + } + console.log(resArray); +} + +policiesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesUpdateSample.ts new file mode 100644 index 000000000000..9a0df9181890 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policiesUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { PolicyFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of policies. All other properties will be ignored. + * + * @summary Allows modifying tags of policies. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Update.json + */ +async function policiesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const policySetName = "{policySetName}"; + const name = "{policyName}"; + const policy: PolicyFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policies.update( + resourceGroupName, + labName, + policySetName, + name, + policy + ); + console.log(result); +} + +policiesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policySetsEvaluatePoliciesSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policySetsEvaluatePoliciesSample.ts new file mode 100644 index 000000000000..1824f64e0b02 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/policySetsEvaluatePoliciesSample.ts @@ -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. +import { + EvaluatePoliciesRequest, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Evaluates lab policy. + * + * @summary Evaluates lab policy. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/PolicySets_EvaluatePolicies.json + */ +async function policySetsEvaluatePolicies() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{policySetName}"; + const evaluatePoliciesRequest: EvaluatePoliciesRequest = { + policies: [{ factName: "LabVmCount", valueOffset: "1" }] + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.policySets.evaluatePolicies( + resourceGroupName, + labName, + name, + evaluatePoliciesRequest + ); + console.log(result); +} + +policySetsEvaluatePolicies().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/providerOperationsListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/providerOperationsListSample.ts new file mode 100644 index 000000000000..f1287bbeb77e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/providerOperationsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Result of the request to list REST API operations + * + * @summary Result of the request to list REST API operations + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ProviderOperations_List.json + */ +async function providerOperationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.providerOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +providerOperationsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..47bd086bcd0a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesCreateOrUpdateSample.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { Schedule, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing schedule. + * + * @summary Create or replace an existing schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_CreateOrUpdate.json + */ +async function schedulesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const schedule: Schedule = { + dailyRecurrence: { time: "{timeOfTheDayTheScheduleWillOccurEveryDay}" }, + hourlyRecurrence: { minute: 30 }, + location: "{location}", + notificationSettings: { + emailRecipient: "{email}", + notificationLocale: "EN", + status: "{Enabled|Disabled}", + timeInMinutes: 15, + webhookUrl: "{webhookUrl}" + }, + status: "{Enabled|Disabled}", + tags: { tagName1: "tagValue1" }, + targetResourceId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}", + taskType: "{myLabVmTaskType}", + timeZoneId: "Pacific Standard Time", + weeklyRecurrence: { + time: "{timeOfTheDayTheScheduleWillOccurOnThoseDays}", + weekdays: ["Monday", "Wednesday", "Friday"] + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.createOrUpdate( + resourceGroupName, + labName, + name, + schedule + ); + console.log(result); +} + +schedulesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesDeleteSample.ts new file mode 100644 index 000000000000..a8de9f113e45 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete schedule. + * + * @summary Delete schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Delete.json + */ +async function schedulesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.delete( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +schedulesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesExecuteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesExecuteSample.ts new file mode 100644 index 000000000000..0a937cc2f2c0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesExecuteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Execute a schedule. This operation can take a while to complete. + * + * @summary Execute a schedule. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Execute.json + */ +async function schedulesExecute() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.beginExecuteAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +schedulesExecute().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesGetSample.ts new file mode 100644 index 000000000000..ebf4944cf158 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get schedule. + * + * @summary Get schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Get.json + */ +async function schedulesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.get(resourceGroupName, labName, name); + console.log(result); +} + +schedulesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesListApplicableSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesListApplicableSample.ts new file mode 100644 index 000000000000..3c92265b4d10 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesListApplicableSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all applicable schedules + * + * @summary Lists all applicable schedules + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_ListApplicable.json + */ +async function schedulesListApplicable() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schedules.listApplicable( + resourceGroupName, + labName, + name + )) { + resArray.push(item); + } + console.log(resArray); +} + +schedulesListApplicable().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesListSample.ts new file mode 100644 index 000000000000..e0934e29e15a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List schedules in a given lab. + * + * @summary List schedules in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_List.json + */ +async function schedulesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schedules.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +schedulesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesUpdateSample.ts new file mode 100644 index 000000000000..5271092dfb1a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/schedulesUpdateSample.ts @@ -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. +import { ScheduleFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of schedules. All other properties will be ignored. + * + * @summary Allows modifying tags of schedules. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Update.json + */ +async function schedulesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{scheduleName}"; + const schedule: ScheduleFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.schedules.update( + resourceGroupName, + labName, + name, + schedule + ); + console.log(result); +} + +schedulesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..1e6b79a526b7 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsCreateOrUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { Secret, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing secret. This operation can take a while to complete. + * + * @summary Create or replace an existing secret. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_CreateOrUpdate.json + */ +async function secretsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{secretName}"; + const secret: Secret = { value: "{secret}" }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.secrets.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + userName, + name, + secret + ); + console.log(result); +} + +secretsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsDeleteSample.ts new file mode 100644 index 000000000000..f2e53917fbb7 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsDeleteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete secret. + * + * @summary Delete secret. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Delete.json + */ +async function secretsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{secretName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.secrets.delete( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +secretsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsGetSample.ts new file mode 100644 index 000000000000..35fe8ad6d01b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get secret. + * + * @summary Get secret. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Get.json + */ +async function secretsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{secretName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.secrets.get( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +secretsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsListSample.ts new file mode 100644 index 000000000000..b2e98311283f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List secrets in a given user profile. + * + * @summary List secrets in a given user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_List.json + */ +async function secretsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.secrets.list( + resourceGroupName, + labName, + userName + )) { + resArray.push(item); + } + console.log(resArray); +} + +secretsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsUpdateSample.ts new file mode 100644 index 000000000000..f79059d24203 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/secretsUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { SecretFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of secrets. All other properties will be ignored. + * + * @summary Allows modifying tags of secrets. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Update.json + */ +async function secretsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{secretName}"; + const secret: SecretFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.secrets.update( + resourceGroupName, + labName, + userName, + name, + secret + ); + console.log(result); +} + +secretsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ad6e805d3503 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesCreateOrUpdateSample.ts @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { Schedule, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing schedule. + * + * @summary Create or replace an existing schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_CreateOrUpdate.json + */ +async function serviceFabricSchedulesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const schedule: Schedule = { + dailyRecurrence: { time: "19:00" }, + hourlyRecurrence: { minute: 0 }, + location: "{location}", + notificationSettings: { + emailRecipient: "{email}", + notificationLocale: "EN", + status: "{Enabled|Disabled}", + timeInMinutes: 15, + webhookUrl: "{webhoolUrl}" + }, + status: "{Enabled|Disabled}", + tags: { tagName1: "tagValue1" }, + targetResourceId: + "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/users/{uniqueIdentifier}/servicefabrics/{serviceFrabicName}", + taskType: + "{Unknown|LabVmsShutdownTask|LabVmsStartupTask|LabVmReclamationTask|ComputeVmShutdownTask}", + timeZoneId: "Pacific Standard Time", + weeklyRecurrence: { + time: "19:00", + weekdays: [ + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday" + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.createOrUpdate( + resourceGroupName, + labName, + userName, + serviceFabricName, + name, + schedule + ); + console.log(result); +} + +serviceFabricSchedulesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesDeleteSample.ts new file mode 100644 index 000000000000..339e0da8cd71 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesDeleteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete schedule. + * + * @summary Delete schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Delete.json + */ +async function serviceFabricSchedulesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.delete( + resourceGroupName, + labName, + userName, + serviceFabricName, + name + ); + console.log(result); +} + +serviceFabricSchedulesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesExecuteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesExecuteSample.ts new file mode 100644 index 000000000000..7e77788be160 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesExecuteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Execute a schedule. This operation can take a while to complete. + * + * @summary Execute a schedule. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Execute.json + */ +async function serviceFabricSchedulesExecute() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.beginExecuteAndWait( + resourceGroupName, + labName, + userName, + serviceFabricName, + name + ); + console.log(result); +} + +serviceFabricSchedulesExecute().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesGetSample.ts new file mode 100644 index 000000000000..01af49d6ee8a --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get schedule. + * + * @summary Get schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Get.json + */ +async function serviceFabricSchedulesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.get( + resourceGroupName, + labName, + userName, + serviceFabricName, + name + ); + console.log(result); +} + +serviceFabricSchedulesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesListSample.ts new file mode 100644 index 000000000000..42aa8b3fb358 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesListSample.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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List schedules in a given service fabric. + * + * @summary List schedules in a given service fabric. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_List.json + */ +async function serviceFabricSchedulesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serviceFabricSchedules.list( + resourceGroupName, + labName, + userName, + serviceFabricName + )) { + resArray.push(item); + } + console.log(resArray); +} + +serviceFabricSchedulesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesUpdateSample.ts new file mode 100644 index 000000000000..e6fba344c41e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricSchedulesUpdateSample.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 { ScheduleFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of schedules. All other properties will be ignored. + * + * @summary Allows modifying tags of schedules. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Update.json + */ +async function serviceFabricSchedulesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "@me"; + const serviceFabricName = "{serviceFrabicName}"; + const name = "{scheduleName}"; + const schedule: ScheduleFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabricSchedules.update( + resourceGroupName, + labName, + userName, + serviceFabricName, + name, + schedule + ); + console.log(result); +} + +serviceFabricSchedulesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..a797ace8c1e2 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsCreateOrUpdateSample.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 { ServiceFabric, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing service fabric. This operation can take a while to complete. + * + * @summary Create or replace an existing service fabric. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_CreateOrUpdate.json + */ +async function serviceFabricsCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const serviceFabric: ServiceFabric = { + environmentId: "{environmentId}", + externalServiceFabricId: "{serviceFabricId}", + location: "{location}", + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + userName, + name, + serviceFabric + ); + console.log(result); +} + +serviceFabricsCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsDeleteSample.ts new file mode 100644 index 000000000000..18a4530876ee --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsDeleteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete service fabric. This operation can take a while to complete. + * + * @summary Delete service fabric. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Delete.json + */ +async function serviceFabricsDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.beginDeleteAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsGetSample.ts new file mode 100644 index 000000000000..c977d00b71df --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get service fabric. + * + * @summary Get service fabric. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Get.json + */ +async function serviceFabricsGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.get( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsListApplicableSchedulesSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsListApplicableSchedulesSample.ts new file mode 100644 index 000000000000..dad7bac35e69 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsListApplicableSchedulesSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the applicable start/stop schedules, if any. + * + * @summary Lists the applicable start/stop schedules, if any. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_ListApplicableSchedules.json + */ +async function serviceFabricsListApplicableSchedules() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.listApplicableSchedules( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsListApplicableSchedules().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsListSample.ts new file mode 100644 index 000000000000..292da634250b --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List service fabrics in a given user profile. + * + * @summary List service fabrics in a given user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_List.json + */ +async function serviceFabricsList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serviceFabrics.list( + resourceGroupName, + labName, + userName + )) { + resArray.push(item); + } + console.log(resArray); +} + +serviceFabricsList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsStartSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsStartSample.ts new file mode 100644 index 000000000000..eaaac5158b21 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsStartSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Start a service fabric. This operation can take a while to complete. + * + * @summary Start a service fabric. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Start.json + */ +async function serviceFabricsStart() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.beginStartAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsStart().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsStopSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsStopSample.ts new file mode 100644 index 000000000000..af30e289527d --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsStopSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Stop a service fabric This operation can take a while to complete. + * + * @summary Stop a service fabric This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Stop.json + */ +async function serviceFabricsStop() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.beginStopAndWait( + resourceGroupName, + labName, + userName, + name + ); + console.log(result); +} + +serviceFabricsStop().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsUpdateSample.ts new file mode 100644 index 000000000000..58950edeaade --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceFabricsUpdateSample.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 { + ServiceFabricFragment, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of service fabrics. All other properties will be ignored. + * + * @summary Allows modifying tags of service fabrics. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Update.json + */ +async function serviceFabricsUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const userName = "{userName}"; + const name = "{serviceFabricName}"; + const serviceFabric: ServiceFabricFragment = { + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceFabrics.update( + resourceGroupName, + labName, + userName, + name, + serviceFabric + ); + console.log(result); +} + +serviceFabricsUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceRunnersCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceRunnersCreateOrUpdateSample.ts new file mode 100644 index 000000000000..f8f0fd7a16c3 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceRunnersCreateOrUpdateSample.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 { ServiceRunner, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing service runner. + * + * @summary Create or replace an existing service runner. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_CreateOrUpdate.json + */ +async function serviceRunnersCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{servicerunnerName}"; + const serviceRunner: ServiceRunner = { + identity: { + type: "{identityType}", + clientSecretUrl: "{identityClientSecretUrl}", + principalId: "{identityPrincipalId}", + tenantId: "{identityTenantId}" + }, + location: "{location}", + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceRunners.createOrUpdate( + resourceGroupName, + labName, + name, + serviceRunner + ); + console.log(result); +} + +serviceRunnersCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceRunnersDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceRunnersDeleteSample.ts new file mode 100644 index 000000000000..7b21791bcb6e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceRunnersDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete service runner. + * + * @summary Delete service runner. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Delete.json + */ +async function serviceRunnersDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{servicerunnerName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceRunners.delete( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +serviceRunnersDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceRunnersGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceRunnersGetSample.ts new file mode 100644 index 000000000000..326f7b162ec4 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/serviceRunnersGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get service runner. + * + * @summary Get service runner. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Get.json + */ +async function serviceRunnersGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{servicerunnerName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.serviceRunners.get( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +serviceRunnersGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersCreateOrUpdateSample.ts new file mode 100644 index 000000000000..00617395040d --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersCreateOrUpdateSample.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 { User, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing user profile. This operation can take a while to complete. + * + * @summary Create or replace an existing user profile. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_CreateOrUpdate.json + */ +async function usersCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{userName}"; + const user: User = { + identity: { + appId: "{appId}", + objectId: "{objectId}", + principalId: "{principalId}", + principalName: "{principalName}", + tenantId: "{tenantId}" + }, + location: "{location}", + secretStore: { keyVaultId: "{keyVaultId}", keyVaultUri: "{keyVaultUri}" }, + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.users.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + user + ); + console.log(result); +} + +usersCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersDeleteSample.ts new file mode 100644 index 000000000000..69280320d33e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete user profile. This operation can take a while to complete. + * + * @summary Delete user profile. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Delete.json + */ +async function usersDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{userName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.users.beginDeleteAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +usersDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersGetSample.ts new file mode 100644 index 000000000000..cab83ae39cef --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get user profile. + * + * @summary Get user profile. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Get.json + */ +async function usersGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{userName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.users.get(resourceGroupName, labName, name); + console.log(result); +} + +usersGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersListSample.ts new file mode 100644 index 000000000000..d66fddf696c1 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersListSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List user profiles in a given lab. + * + * @summary List user profiles in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_List.json + */ +async function usersList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.users.list(resourceGroupName, labName)) { + resArray.push(item); + } + console.log(resArray); +} + +usersList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersUpdateSample.ts new file mode 100644 index 000000000000..85a12f626feb --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/usersUpdateSample.ts @@ -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. +import { UserFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of user profiles. All other properties will be ignored. + * + * @summary Allows modifying tags of user profiles. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Update.json + */ +async function usersUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{devtestlabName}"; + const name = "{userName}"; + const user: UserFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.users.update( + resourceGroupName, + labName, + name, + user + ); + console.log(result); +} + +usersUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..bd238f6fc331 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesCreateOrUpdateSample.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 { Schedule, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing schedule. + * + * @summary Create or replace an existing schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_CreateOrUpdate.json + */ +async function virtualMachineSchedulesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const schedule: Schedule = { + dailyRecurrence: { time: "1900" }, + hourlyRecurrence: { minute: 30 }, + location: "{location}", + notificationSettings: { + emailRecipient: "{email}", + notificationLocale: "EN", + status: "Enabled", + timeInMinutes: 30, + webhookUrl: "{webhookUrl}" + }, + status: "Enabled", + tags: { tagName1: "tagValue1" }, + targetResourceId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualMachines/{vmName}", + taskType: "LabVmsShutdownTask", + timeZoneId: "Pacific Standard Time", + weeklyRecurrence: { + time: "1700", + weekdays: ["Friday", "Saturday", "Sunday"] + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.createOrUpdate( + resourceGroupName, + labName, + virtualMachineName, + name, + schedule + ); + console.log(result); +} + +virtualMachineSchedulesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesDeleteSample.ts new file mode 100644 index 000000000000..b4f8ea7e4f40 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesDeleteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete schedule. + * + * @summary Delete schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Delete.json + */ +async function virtualMachineSchedulesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.delete( + resourceGroupName, + labName, + virtualMachineName, + name + ); + console.log(result); +} + +virtualMachineSchedulesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesExecuteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesExecuteSample.ts new file mode 100644 index 000000000000..2dbd0deecbae --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesExecuteSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Execute a schedule. This operation can take a while to complete. + * + * @summary Execute a schedule. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Execute.json + */ +async function virtualMachineSchedulesExecute() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.beginExecuteAndWait( + resourceGroupName, + labName, + virtualMachineName, + name + ); + console.log(result); +} + +virtualMachineSchedulesExecute().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesGetSample.ts new file mode 100644 index 000000000000..c25efe87c4a0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesGetSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get schedule. + * + * @summary Get schedule. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Get.json + */ +async function virtualMachineSchedulesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.get( + resourceGroupName, + labName, + virtualMachineName, + name + ); + console.log(result); +} + +virtualMachineSchedulesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesListSample.ts new file mode 100644 index 000000000000..ced846c49565 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List schedules in a given virtual machine. + * + * @summary List schedules in a given virtual machine. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_List.json + */ +async function virtualMachineSchedulesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualMachineSchedules.list( + resourceGroupName, + labName, + virtualMachineName + )) { + resArray.push(item); + } + console.log(resArray); +} + +virtualMachineSchedulesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesUpdateSample.ts new file mode 100644 index 000000000000..6c8e0f26c08c --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachineSchedulesUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ScheduleFragment, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of schedules. All other properties will be ignored. + * + * @summary Allows modifying tags of schedules. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Update.json + */ +async function virtualMachineSchedulesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const virtualMachineName = "{vmName}"; + const name = "LabVmsShutdown"; + const schedule: ScheduleFragment = { tags: { tagName1: "tagValue1" } }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachineSchedules.update( + resourceGroupName, + labName, + virtualMachineName, + name, + schedule + ); + console.log(result); +} + +virtualMachineSchedulesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesAddDataDiskSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesAddDataDiskSample.ts new file mode 100644 index 000000000000..17f7d54f9da2 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesAddDataDiskSample.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 { DataDiskProperties, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @summary Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_AddDataDisk.json + */ +async function virtualMachinesAddDataDisk() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualMachineName}"; + const dataDiskProperties: DataDiskProperties = { + attachNewDataDiskOptions: { + diskName: "{diskName}", + diskSizeGiB: 127, + diskType: "{diskType}" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginAddDataDiskAndWait( + resourceGroupName, + labName, + name, + dataDiskProperties + ); + console.log(result); +} + +virtualMachinesAddDataDisk().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesApplyArtifactsSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesApplyArtifactsSample.ts new file mode 100644 index 000000000000..46af4e1c56be --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesApplyArtifactsSample.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 { + ApplyArtifactsRequest, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @summary Apply artifacts to virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ApplyArtifacts.json + */ +async function virtualMachinesApplyArtifacts() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const applyArtifactsRequest: ApplyArtifactsRequest = { + artifacts: [ + { + artifactId: + "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/artifactSources/public repo/artifacts/windows-restart" + } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginApplyArtifactsAndWait( + resourceGroupName, + labName, + name, + applyArtifactsRequest + ); + console.log(result); +} + +virtualMachinesApplyArtifacts().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesClaimSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesClaimSample.ts new file mode 100644 index 000000000000..29d584a8c3dd --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesClaimSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @summary Take ownership of an existing virtual machine This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Claim.json + */ +async function virtualMachinesClaim() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginClaimAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesClaim().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ae39939e6ce9 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesCreateOrUpdateSample.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 { LabVirtualMachine, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @summary Create or replace an existing virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_CreateOrUpdate.json + */ +async function virtualMachinesCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const labVirtualMachine: LabVirtualMachine = { + allowClaim: true, + disallowPublicIpAddress: true, + galleryImageReference: { + offer: "UbuntuServer", + osType: "Linux", + publisher: "Canonical", + sku: "16.04-LTS", + version: "Latest" + }, + labSubnetName: "{virtualNetworkName}Subnet", + labVirtualNetworkId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualnetworks/{virtualNetworkName}", + location: "{location}", + password: "{userPassword}", + size: "Standard_A2_v2", + storageType: "Standard", + tags: { tagName1: "tagValue1" }, + userName: "{userName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + labVirtualMachine + ); + console.log(result); +} + +virtualMachinesCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesDeleteSample.ts new file mode 100644 index 000000000000..34c5650f050f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete virtual machine. This operation can take a while to complete. + * + * @summary Delete virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Delete.json + */ +async function virtualMachinesDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginDeleteAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesDetachDataDiskSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesDetachDataDiskSample.ts new file mode 100644 index 000000000000..b4278a5dbf2e --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesDetachDataDiskSample.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 { + DetachDataDiskProperties, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @summary Detach the specified disk from the virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_DetachDataDisk.json + */ +async function virtualMachinesDetachDataDisk() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualMachineName}"; + const detachDataDiskProperties: DetachDataDiskProperties = { + existingLabDiskId: + "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{virtualMachineName}" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginDetachDataDiskAndWait( + resourceGroupName, + labName, + name, + detachDataDiskProperties + ); + console.log(result); +} + +virtualMachinesDetachDataDisk().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesGetRdpFileContentsSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesGetRdpFileContentsSample.ts new file mode 100644 index 000000000000..6e4ba9c8d91f --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesGetRdpFileContentsSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets a string that represents the contents of the RDP file for the virtual machine + * + * @summary Gets a string that represents the contents of the RDP file for the virtual machine + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_GetRdpFileContents.json + */ +async function virtualMachinesGetRdpFileContents() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.getRdpFileContents( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesGetRdpFileContents().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesGetSample.ts new file mode 100644 index 000000000000..45cbb51e14a8 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get virtual machine. + * + * @summary Get virtual machine. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Get.json + */ +async function virtualMachinesGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.get( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesListApplicableSchedulesSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesListApplicableSchedulesSample.ts new file mode 100644 index 000000000000..d212ed4bb8c3 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesListApplicableSchedulesSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the applicable start/stop schedules, if any. + * + * @summary Lists the applicable start/stop schedules, if any. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ListApplicableSchedules.json + */ +async function virtualMachinesListApplicableSchedules() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.listApplicableSchedules( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesListApplicableSchedules().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesListSample.ts new file mode 100644 index 000000000000..9d11a4cdb952 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List virtual machines in a given lab. + * + * @summary List virtual machines in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_List.json + */ +async function virtualMachinesList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualMachines.list( + resourceGroupName, + labName + )) { + resArray.push(item); + } + console.log(resArray); +} + +virtualMachinesList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesRedeploySample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesRedeploySample.ts new file mode 100644 index 000000000000..4c42727536af --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesRedeploySample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Redeploy a virtual machine This operation can take a while to complete. + * + * @summary Redeploy a virtual machine This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Redeploy.json + */ +async function virtualMachinesRedeploy() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginRedeployAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesRedeploy().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesResizeSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesResizeSample.ts new file mode 100644 index 000000000000..744aaa6b7aeb --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesResizeSample.ts @@ -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. +import { + ResizeLabVirtualMachineProperties, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Resize Virtual Machine. This operation can take a while to complete. + * + * @summary Resize Virtual Machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Resize.json + */ +async function virtualMachinesResize() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const resizeLabVirtualMachineProperties: ResizeLabVirtualMachineProperties = { + size: "Standard_A4_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginResizeAndWait( + resourceGroupName, + labName, + name, + resizeLabVirtualMachineProperties + ); + console.log(result); +} + +virtualMachinesResize().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesRestartSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesRestartSample.ts new file mode 100644 index 000000000000..1dab79d87e94 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesRestartSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Restart a virtual machine. This operation can take a while to complete. + * + * @summary Restart a virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Restart.json + */ +async function virtualMachinesRestart() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginRestartAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesRestart().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesStartSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesStartSample.ts new file mode 100644 index 000000000000..0edfed3036bd --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesStartSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Start a virtual machine. This operation can take a while to complete. + * + * @summary Start a virtual machine. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Start.json + */ +async function virtualMachinesStart() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginStartAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesStart().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesStopSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesStopSample.ts new file mode 100644 index 000000000000..5f1442c1e466 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesStopSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Stop a virtual machine This operation can take a while to complete. + * + * @summary Stop a virtual machine This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Stop.json + */ +async function virtualMachinesStop() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginStopAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesStop().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesTransferDisksSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesTransferDisksSample.ts new file mode 100644 index 000000000000..d1ab33525b18 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesTransferDisksSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. + * + * @summary Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_TransferDisks.json + */ +async function virtualMachinesTransferDisks() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualmachineName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginTransferDisksAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesTransferDisks().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesUnClaimSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesUnClaimSample.ts new file mode 100644 index 000000000000..b41fb78c38ee --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesUnClaimSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @summary Release ownership of an existing virtual machine This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_UnClaim.json + */ +async function virtualMachinesUnClaim() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.beginUnClaimAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualMachinesUnClaim().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesUpdateSample.ts new file mode 100644 index 000000000000..5f6f8c5b78be --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualMachinesUpdateSample.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 { + LabVirtualMachineFragment, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of virtual machines. All other properties will be ignored. + * + * @summary Allows modifying tags of virtual machines. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Update.json + */ +async function virtualMachinesUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{vmName}"; + const labVirtualMachine: LabVirtualMachineFragment = {}; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualMachines.update( + resourceGroupName, + labName, + name, + labVirtualMachine + ); + console.log(result); +} + +virtualMachinesUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksCreateOrUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksCreateOrUpdateSample.ts new file mode 100644 index 000000000000..e71686aa7575 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksCreateOrUpdateSample.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 { VirtualNetwork, DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or replace an existing virtual network. This operation can take a while to complete. + * + * @summary Create or replace an existing virtual network. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_CreateOrUpdate.json + */ +async function virtualNetworksCreateOrUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualNetworkName}"; + const virtualNetwork: VirtualNetwork = { + location: "{location}", + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualNetworks.beginCreateOrUpdateAndWait( + resourceGroupName, + labName, + name, + virtualNetwork + ); + console.log(result); +} + +virtualNetworksCreateOrUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksDeleteSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksDeleteSample.ts new file mode 100644 index 000000000000..08fed1271dfc --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete virtual network. This operation can take a while to complete. + * + * @summary Delete virtual network. This operation can take a while to complete. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Delete.json + */ +async function virtualNetworksDelete() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualNetworkName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualNetworks.beginDeleteAndWait( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualNetworksDelete().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksGetSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksGetSample.ts new file mode 100644 index 000000000000..43581b280e56 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get virtual network. + * + * @summary Get virtual network. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Get.json + */ +async function virtualNetworksGet() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualNetworkName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualNetworks.get( + resourceGroupName, + labName, + name + ); + console.log(result); +} + +virtualNetworksGet().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksListSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksListSample.ts new file mode 100644 index 000000000000..01e41cc303a0 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksListSample.ts @@ -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. +import { DevTestLabsClient } from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List virtual networks in a given lab. + * + * @summary List virtual networks in a given lab. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_List.json + */ +async function virtualNetworksList() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualNetworks.list( + resourceGroupName, + labName + )) { + resArray.push(item); + } + console.log(resArray); +} + +virtualNetworksList().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksUpdateSample.ts b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksUpdateSample.ts new file mode 100644 index 000000000000..79df7641a8f6 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/src/virtualNetworksUpdateSample.ts @@ -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. +import { + VirtualNetworkFragment, + DevTestLabsClient +} from "@azure/arm-devtestlabs"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Allows modifying tags of virtual networks. All other properties will be ignored. + * + * @summary Allows modifying tags of virtual networks. All other properties will be ignored. + * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Update.json + */ +async function virtualNetworksUpdate() { + const subscriptionId = "{subscriptionId}"; + const resourceGroupName = "resourceGroupName"; + const labName = "{labName}"; + const name = "{virtualNetworkName}"; + const virtualNetwork: VirtualNetworkFragment = { + tags: { tagName1: "tagValue1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DevTestLabsClient(credential, subscriptionId); + const result = await client.virtualNetworks.update( + resourceGroupName, + labName, + name, + virtualNetwork + ); + console.log(result); +} + +virtualNetworksUpdate().catch(console.error); diff --git a/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/tsconfig.json b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/tsconfig.json new file mode 100644 index 000000000000..416c2dd82e00 --- /dev/null +++ b/sdk/devtestlabs/arm-devtestlabs/samples/v4/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "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/devtestlabs/arm-devtestlabs/src/devTestLabsClient.ts b/sdk/devtestlabs/arm-devtestlabs/src/devTestLabsClient.ts index 681ca33f8040..cf13c33077af 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/devTestLabsClient.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/devTestLabsClient.ts @@ -7,6 +7,7 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { ProviderOperationsImpl, @@ -96,7 +97,7 @@ export class DevTestLabsClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-devtestlabs/4.0.0`; + const packageDetails = `azsdk-js-arm-devtestlabs/4.0.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -111,9 +112,33 @@ export class DevTestLabsClient extends coreClient.ServiceClient { userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint || "https://management.azure.com" + baseUri: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + } // Parameter assignments this.subscriptionId = subscriptionId; diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/customImages.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/customImages.ts index 3269fb975298..34fbf0b73364 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/customImages.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/customImages.ts @@ -202,10 +202,12 @@ export class CustomImagesImpl implements CustomImages { { resourceGroupName, labName, name, customImage, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -290,10 +292,12 @@ export class CustomImagesImpl implements CustomImages { { resourceGroupName, labName, name, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/disks.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/disks.ts index 5de1e8715e0a..3567a8078ac2 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/disks.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/disks.ts @@ -233,10 +233,12 @@ export class DisksImpl implements Disks { { resourceGroupName, labName, userName, name, disk, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -326,10 +328,12 @@ export class DisksImpl implements Disks { { resourceGroupName, labName, userName, name, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -449,10 +453,12 @@ export class DisksImpl implements Disks { }, attachOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -553,10 +559,12 @@ export class DisksImpl implements Disks { }, detachOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/environments.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/environments.ts index b82fc0b9b083..72542d9f9106 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/environments.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/environments.ts @@ -229,10 +229,12 @@ export class EnvironmentsImpl implements Environments { { resourceGroupName, labName, userName, name, dtlEnvironment, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -322,10 +324,12 @@ export class EnvironmentsImpl implements Environments { { resourceGroupName, labName, userName, name, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/formulas.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/formulas.ts index 0b227407f302..50a90edb39be 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/formulas.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/formulas.ts @@ -202,10 +202,12 @@ export class FormulasImpl implements Formulas { { resourceGroupName, labName, name, formula, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/globalSchedules.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/globalSchedules.ts index f49e96d12d22..4e3c7047395c 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/globalSchedules.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/globalSchedules.ts @@ -300,10 +300,12 @@ export class GlobalSchedulesImpl implements GlobalSchedules { { resourceGroupName, name, options }, executeOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -378,10 +380,12 @@ export class GlobalSchedulesImpl implements GlobalSchedules { { resourceGroupName, name, retargetScheduleProperties, options }, retargetOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/labs.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/labs.ts index e5c96c218f5e..0635f17d6970 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/labs.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/labs.ts @@ -323,10 +323,12 @@ export class LabsImpl implements Labs { { resourceGroupName, name, lab, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -406,10 +408,12 @@ export class LabsImpl implements Labs { { resourceGroupName, name, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -501,10 +505,12 @@ export class LabsImpl implements Labs { { resourceGroupName, name, options }, claimAnyVmOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -579,10 +585,12 @@ export class LabsImpl implements Labs { { resourceGroupName, name, labVirtualMachineCreationParameter, options }, createEnvironmentOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -664,10 +672,12 @@ export class LabsImpl implements Labs { { resourceGroupName, name, exportResourceUsageParameters, options }, exportResourceUsageOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -769,10 +779,12 @@ export class LabsImpl implements Labs { { resourceGroupName, name, importLabVirtualMachineRequest, options }, importVirtualMachineOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/schedules.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/schedules.ts index 3cc3c2f41436..d5473bfb49f4 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/schedules.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/schedules.ts @@ -341,10 +341,12 @@ export class SchedulesImpl implements Schedules { { resourceGroupName, labName, name, options }, executeOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/secrets.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/secrets.ts index f4852f62e573..af9e276fb74e 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/secrets.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/secrets.ts @@ -229,10 +229,12 @@ export class SecretsImpl implements Secrets { { resourceGroupName, labName, userName, name, secret, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/serviceFabricSchedules.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/serviceFabricSchedules.ts index 0f9d3649f893..f862d384bb78 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/serviceFabricSchedules.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/serviceFabricSchedules.ts @@ -348,10 +348,12 @@ export class ServiceFabricSchedulesImpl implements ServiceFabricSchedules { }, executeOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/serviceFabrics.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/serviceFabrics.ts index d52efc06271c..36fa9c460293 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/serviceFabrics.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/serviceFabrics.ts @@ -233,10 +233,12 @@ export class ServiceFabricsImpl implements ServiceFabrics { { resourceGroupName, labName, userName, name, serviceFabric, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -326,10 +328,12 @@ export class ServiceFabricsImpl implements ServiceFabrics { { resourceGroupName, labName, userName, name, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -460,10 +464,12 @@ export class ServiceFabricsImpl implements ServiceFabrics { { resourceGroupName, labName, userName, name, options }, startOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -550,10 +556,12 @@ export class ServiceFabricsImpl implements ServiceFabrics { { resourceGroupName, labName, userName, name, options }, stopOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/users.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/users.ts index baf95bb9603b..fd257f22cdec 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/users.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/users.ts @@ -202,10 +202,12 @@ export class UsersImpl implements Users { { resourceGroupName, labName, name, user, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -290,10 +292,12 @@ export class UsersImpl implements Users { { resourceGroupName, labName, name, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/virtualMachineSchedules.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/virtualMachineSchedules.ts index d909b07947f9..4c1928e23a7c 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/virtualMachineSchedules.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/virtualMachineSchedules.ts @@ -304,10 +304,12 @@ export class VirtualMachineSchedulesImpl implements VirtualMachineSchedules { { resourceGroupName, labName, virtualMachineName, name, options }, executeOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/virtualMachines.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/virtualMachines.ts index 7e82cf7ded65..56bc74425597 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/virtualMachines.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/virtualMachines.ts @@ -221,10 +221,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, labName, name, labVirtualMachine, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -309,10 +311,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, labName, name, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -417,10 +421,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, labName, name, dataDiskProperties, options }, addDataDiskOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -507,10 +513,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, labName, name, applyArtifactsRequest, options }, applyArtifactsOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -595,10 +603,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, labName, name, options }, claimOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -682,10 +692,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, labName, name, detachDataDiskProperties, options }, detachDataDiskOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -808,10 +820,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, labName, name, options }, redeployOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -901,10 +915,12 @@ export class VirtualMachinesImpl implements VirtualMachines { }, resizeOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -989,10 +1005,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, labName, name, options }, restartOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1074,10 +1092,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, labName, name, options }, startOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1159,10 +1179,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, labName, name, options }, stopOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1245,10 +1267,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, labName, name, options }, transferDisksOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1331,10 +1355,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, labName, name, options }, unClaimOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/src/operations/virtualNetworks.ts b/sdk/devtestlabs/arm-devtestlabs/src/operations/virtualNetworks.ts index c8e518f67082..0616a4bda0f8 100644 --- a/sdk/devtestlabs/arm-devtestlabs/src/operations/virtualNetworks.ts +++ b/sdk/devtestlabs/arm-devtestlabs/src/operations/virtualNetworks.ts @@ -202,10 +202,12 @@ export class VirtualNetworksImpl implements VirtualNetworks { { resourceGroupName, labName, name, virtualNetwork, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -290,10 +292,12 @@ export class VirtualNetworksImpl implements VirtualNetworks { { resourceGroupName, labName, name, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/devtestlabs/arm-devtestlabs/tsconfig.json b/sdk/devtestlabs/arm-devtestlabs/tsconfig.json index 6e3251194117..dfb857b4542c 100644 --- a/sdk/devtestlabs/arm-devtestlabs/tsconfig.json +++ b/sdk/devtestlabs/arm-devtestlabs/tsconfig.json @@ -9,11 +9,25 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true + "importHelpers": true, + "paths": { + "@azure/arm-devtestlabs": [ + "./src/index" + ] + } }, - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "exclude": ["node_modules"] -} + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/devtestlabs/ci.mgmt.yml b/sdk/devtestlabs/ci.mgmt.yml index 319028940157..dc4ccbf34cda 100644 --- a/sdk/devtestlabs/ci.mgmt.yml +++ b/sdk/devtestlabs/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -9,7 +9,7 @@ trigger: paths: include: - sdk/devtestlabs/ci.mgmt.yml - - sdk/devtestlabs/arm-devtestlabs/ + - sdk/devtestlabs/arm-devtestlabs pr: branches: include: @@ -22,12 +22,11 @@ pr: paths: include: - sdk/devtestlabs/ci.mgmt.yml - - sdk/devtestlabs/arm-devtestlabs/ - + - sdk/devtestlabs/arm-devtestlabs extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: devtestlabs Artifacts: - name: azure-arm-devtestlabs - safeName: azurearmdevtestlabs \ No newline at end of file + safeName: azurearmdevtestlabs