diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c2611eb29d55..b5a2d8e38fe6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -723,6 +723,10 @@ /sdk/resourcehealth/arm-resourcehealth/ @qiaozha @MaryGao /sdk/resourcehealth/ci.mgmt.yml @qiaozha @MaryGao +# PRLabel: %Mgmt +/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/ @qiaozha @MaryGao +/sdk/resourcesdeploymentstacks/ci.mgmt.yml @qiaozha @MaryGao + # PRLabel: %Mgmt /sdk/resourcemover/arm-resourcemover/ @qiaozha @MaryGao /sdk/resourcemover/ci.mgmt.yml @qiaozha @MaryGao diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index c202931d82c5..dcf4d08a1464 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -190,6 +190,7 @@ specifiers: '@rush-temp/arm-resources': file:./projects/arm-resources.tgz '@rush-temp/arm-resources-profile-2020-09-01-hybrid': file:./projects/arm-resources-profile-2020-09-01-hybrid.tgz '@rush-temp/arm-resources-subscriptions': file:./projects/arm-resources-subscriptions.tgz + '@rush-temp/arm-resourcesdeploymentstacks': file:./projects/arm-resourcesdeploymentstacks.tgz '@rush-temp/arm-scvmm': file:./projects/arm-scvmm.tgz '@rush-temp/arm-search': file:./projects/arm-search.tgz '@rush-temp/arm-security': file:./projects/arm-security.tgz @@ -550,6 +551,7 @@ dependencies: '@rush-temp/arm-resources': file:projects/arm-resources.tgz '@rush-temp/arm-resources-profile-2020-09-01-hybrid': file:projects/arm-resources-profile-2020-09-01-hybrid.tgz '@rush-temp/arm-resources-subscriptions': file:projects/arm-resources-subscriptions.tgz + '@rush-temp/arm-resourcesdeploymentstacks': file:projects/arm-resourcesdeploymentstacks.tgz '@rush-temp/arm-scvmm': file:projects/arm-scvmm.tgz '@rush-temp/arm-search': file:projects/arm-search.tgz '@rush-temp/arm-security': file:projects/arm-security.tgz @@ -4088,7 +4090,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.3.0-dev.20230824 + typescript: 5.3.0-dev.20230825 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8657,8 +8659,8 @@ packages: hasBin: true dev: false - /typescript/5.3.0-dev.20230824: - resolution: {integrity: sha512-iiUWxGibzrRHEBLDJfVymsvpPKflf3cMrw0oQTMQoguFS2ikNlVlfQWAsYeHqGpRQc77nSQkzsE9rAHNHqvIjw==} + /typescript/5.3.0-dev.20230825: + resolution: {integrity: sha512-LbxxB17+nHqe7e6oA/240Ha1kOhtrgmLz98Dq3Nbm1sEdkqOnsv3j9XbI0tqd+RWtC/5pgnljHmZRHk/qUeKpQ==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -15238,6 +15240,37 @@ packages: - supports-color dev: false + file:projects/arm-resourcesdeploymentstacks.tgz: + resolution: {integrity: sha512-p16puIbqDXPmBD2qKJIWamOShrGypt1f474OMvs/dhlPs1gcFVq84e5SQnNH7rwwh78wmt7ZaWbNv2DobDugoQ==, tarball: file:projects/arm-resourcesdeploymentstacks.tgz} + name: '@rush-temp/arm-resourcesdeploymentstacks' + version: 0.0.0 + dependencies: + '@azure/identity': 2.1.0 + '@microsoft/api-extractor': 7.36.4_@types+node@14.18.54 + '@rollup/plugin-commonjs': 24.1.0_rollup@2.79.1 + '@rollup/plugin-json': 6.0.0_rollup@2.79.1 + '@rollup/plugin-multi-entry': 6.0.0_rollup@2.79.1 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.5 + '@types/node': 14.18.54 + chai: 4.3.7 + cross-env: 7.0.3 + dotenv: 16.3.1 + mkdirp: 2.1.6 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.79.1 + rollup-plugin-sourcemaps: 0.6.3_dmbj5memikchm63lpeyt6ukdau + ts-node: 10.9.1_n7tz6hmpirns3flqdptizaxofa + tslib: 2.6.2 + typescript: 5.0.4 + uglify-js: 3.17.4 + transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' + - supports-color + dev: false + file:projects/arm-scvmm.tgz: resolution: {integrity: sha512-fIaEOvjvdHr0mm48Baa516AKY8eJMVC5T7Cvs5qWv3KEwIJBCE0iM2r3H54UbE1OS9zXW5Y2Ob9ZeelcqGoY3g==, tarball: file:projects/arm-scvmm.tgz} name: '@rush-temp/arm-scvmm' diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index 0d834ed7708a..e44757dba6a6 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -28,4 +28,5 @@ https://docs.microsoft.com/javascript/api/@azure/arm-quantum?view=azure-node-pre https://docs.microsoft.com/javascript/api/@azure/arm-sphere?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-apicenter?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-defendereasm?view=azure-node-preview +https://docs.microsoft.com/javascript/api/@azure/arm-resourcesdeploymentstacks?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-hdinsightcontainers?view=azure-node-preview diff --git a/rush.json b/rush.json index feba112d1106..d4c8745d6d97 100644 --- a/rush.json +++ b/rush.json @@ -2065,6 +2065,11 @@ "projectFolder": "sdk/sphere/arm-sphere", "versionPolicyName": "management" }, + { + "packageName": "@azure/arm-resourcesdeploymentstacks", + "projectFolder": "sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks", + "versionPolicyName": "management" + }, { "packageName": "@azure/arm-apicenter", "projectFolder": "sdk/apicenter/arm-apicenter", diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/CHANGELOG.md b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/CHANGELOG.md new file mode 100644 index 000000000000..264beb01f009 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-08-21) + +The package of @azure/arm-resourcesdeploymentstacks is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/LICENSE b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/LICENSE new file mode 100644 index 000000000000..3a1d9b6f24f7 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/README.md b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/README.md new file mode 100644 index 000000000000..0f21b63ce0a5 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/README.md @@ -0,0 +1,109 @@ +# Azure DeploymentStacks client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure DeploymentStacks client. + +The APIs listed in this specification can be used to manage deployment stack resources through the Azure Resource Manager. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-resourcesdeploymentstacks) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-resourcesdeploymentstacks?view=azure-node-preview) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-resourcesdeploymentstacks` package + +Install the Azure DeploymentStacks client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-resourcesdeploymentstacks +``` + +### Create and authenticate a `DeploymentStacksClient` + +To create a client object to access the Azure DeploymentStacks API, you will need the `endpoint` of your Azure DeploymentStacks resource and a `credential`. The Azure DeploymentStacks client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure DeploymentStacks resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure DeploymentStacks** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +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 DeploymentStacksClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new DeploymentStacksClient(credential, subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### DeploymentStacksClient + +`DeploymentStacksClient` is the primary interface for developers using the Azure DeploymentStacks client library. Explore the methods on this client object to understand the different features of the Azure DeploymentStacks service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fresourcesdeploymentstacks%2Farm-resourcesdeploymentstacks%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/_meta.json b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/_meta.json new file mode 100644 index 000000000000..2e8969094762 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "90e96702622e3cdd2a51701157a37b96b895383b", + "readme": "specification/resources/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\resources\\resource-manager\\readme.md --use=@autorest/typescript@6.0.8 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.0", + "use": "@autorest/typescript@6.0.8" +} \ No newline at end of file diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/api-extractor.json b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/api-extractor.json new file mode 100644 index 000000000000..a6aef8d34614 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-resourcesdeploymentstacks.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/assets.json b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/assets.json new file mode 100644 index 000000000000..692e8c2e107a --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "js", + "TagPrefix": "js/resourcesdeploymentstacks/arm-resourcesdeploymentstacks", + "Tag": "js/resourcesdeploymentstacks/arm-resourcesdeploymentstacks_2f2bdaf7a6" +} diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/package.json b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/package.json new file mode 100644 index 000000000000..7ab8aa102d8b --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/package.json @@ -0,0 +1,124 @@ +{ + "name": "@azure/arm-resourcesdeploymentstacks", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for DeploymentStacksClient.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=14.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.5.4", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.12.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-resourcesdeploymentstacks.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-multi-entry": "^6.0.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^2.1.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~5.0.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "dotenv": "^16.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^7.1.1", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^14.0.0", + "ts-node": "^10.0.0", + "@azure/dev-tool": "^1.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/deploymentStacksClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks", + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-resourcesdeploymentstacks?view=azure-node-preview" + } +} \ No newline at end of file diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/review/arm-resourcesdeploymentstacks.api.md b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/review/arm-resourcesdeploymentstacks.api.md new file mode 100644 index 000000000000..5453d902d96f --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/review/arm-resourcesdeploymentstacks.api.md @@ -0,0 +1,469 @@ +## API Report File for "@azure/arm-resourcesdeploymentstacks" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { SimplePollerLike } from '@azure/core-lro'; + +// @public +export interface AzureResourceBase { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export type CreatedByType = string; + +// @public +export interface DenySettings { + applyToChildScopes?: boolean; + excludedActions?: string[]; + excludedPrincipals?: string[]; + mode: DenySettingsMode; +} + +// @public +export type DenySettingsMode = string; + +// @public +export type DenyStatusMode = string; + +// @public +export interface DeploymentStack extends AzureResourceBase { + actionOnUnmanage?: DeploymentStackPropertiesActionOnUnmanage; + debugSetting?: DeploymentStacksDebugSetting; + readonly deletedResources?: ResourceReference[]; + denySettings?: DenySettings; + readonly deploymentId?: string; + deploymentScope?: string; + description?: string; + readonly detachedResources?: ResourceReference[]; + readonly duration?: string; + error?: ErrorResponse; + readonly failedResources?: ResourceReferenceExtended[]; + location?: string; + readonly outputs?: Record; + parameters?: Record; + parametersLink?: DeploymentStacksParametersLink; + readonly provisioningState?: DeploymentStackProvisioningState; + readonly resources?: ManagedResourceReference[]; + tags?: { + [propertyName: string]: string; + }; + template?: Record; + templateLink?: DeploymentStacksTemplateLink; +} + +// @public +export interface DeploymentStackListResult { + readonly nextLink?: string; + value?: DeploymentStack[]; +} + +// @public +export interface DeploymentStackProperties extends DeploymentStacksError { + actionOnUnmanage: DeploymentStackPropertiesActionOnUnmanage; + debugSetting?: DeploymentStacksDebugSetting; + readonly deletedResources?: ResourceReference[]; + denySettings: DenySettings; + readonly deploymentId?: string; + deploymentScope?: string; + description?: string; + readonly detachedResources?: ResourceReference[]; + readonly duration?: string; + readonly failedResources?: ResourceReferenceExtended[]; + readonly outputs?: Record; + parameters?: Record; + parametersLink?: DeploymentStacksParametersLink; + readonly provisioningState?: DeploymentStackProvisioningState; + readonly resources?: ManagedResourceReference[]; + template?: Record; + templateLink?: DeploymentStacksTemplateLink; +} + +// @public +export interface DeploymentStackPropertiesActionOnUnmanage { + managementGroups?: DeploymentStacksDeleteDetachEnum; + resourceGroups?: DeploymentStacksDeleteDetachEnum; + resources: DeploymentStacksDeleteDetachEnum; +} + +// @public +export type DeploymentStackProvisioningState = string; + +// @public +export interface DeploymentStacks { + beginCreateOrUpdateAtManagementGroup(managementGroupId: string, deploymentStackName: string, deploymentStack: DeploymentStack, options?: DeploymentStacksCreateOrUpdateAtManagementGroupOptionalParams): Promise, DeploymentStacksCreateOrUpdateAtManagementGroupResponse>>; + beginCreateOrUpdateAtManagementGroupAndWait(managementGroupId: string, deploymentStackName: string, deploymentStack: DeploymentStack, options?: DeploymentStacksCreateOrUpdateAtManagementGroupOptionalParams): Promise; + beginCreateOrUpdateAtResourceGroup(resourceGroupName: string, deploymentStackName: string, deploymentStack: DeploymentStack, options?: DeploymentStacksCreateOrUpdateAtResourceGroupOptionalParams): Promise, DeploymentStacksCreateOrUpdateAtResourceGroupResponse>>; + beginCreateOrUpdateAtResourceGroupAndWait(resourceGroupName: string, deploymentStackName: string, deploymentStack: DeploymentStack, options?: DeploymentStacksCreateOrUpdateAtResourceGroupOptionalParams): Promise; + beginCreateOrUpdateAtSubscription(deploymentStackName: string, deploymentStack: DeploymentStack, options?: DeploymentStacksCreateOrUpdateAtSubscriptionOptionalParams): Promise, DeploymentStacksCreateOrUpdateAtSubscriptionResponse>>; + beginCreateOrUpdateAtSubscriptionAndWait(deploymentStackName: string, deploymentStack: DeploymentStack, options?: DeploymentStacksCreateOrUpdateAtSubscriptionOptionalParams): Promise; + beginDeleteAtManagementGroup(managementGroupId: string, deploymentStackName: string, options?: DeploymentStacksDeleteAtManagementGroupOptionalParams): Promise, void>>; + beginDeleteAtManagementGroupAndWait(managementGroupId: string, deploymentStackName: string, options?: DeploymentStacksDeleteAtManagementGroupOptionalParams): Promise; + beginDeleteAtResourceGroup(resourceGroupName: string, deploymentStackName: string, options?: DeploymentStacksDeleteAtResourceGroupOptionalParams): Promise, void>>; + beginDeleteAtResourceGroupAndWait(resourceGroupName: string, deploymentStackName: string, options?: DeploymentStacksDeleteAtResourceGroupOptionalParams): Promise; + beginDeleteAtSubscription(deploymentStackName: string, options?: DeploymentStacksDeleteAtSubscriptionOptionalParams): Promise, void>>; + beginDeleteAtSubscriptionAndWait(deploymentStackName: string, options?: DeploymentStacksDeleteAtSubscriptionOptionalParams): Promise; + exportTemplateAtManagementGroup(managementGroupId: string, deploymentStackName: string, options?: DeploymentStacksExportTemplateAtManagementGroupOptionalParams): Promise; + exportTemplateAtResourceGroup(resourceGroupName: string, deploymentStackName: string, options?: DeploymentStacksExportTemplateAtResourceGroupOptionalParams): Promise; + exportTemplateAtSubscription(deploymentStackName: string, options?: DeploymentStacksExportTemplateAtSubscriptionOptionalParams): Promise; + getAtManagementGroup(managementGroupId: string, deploymentStackName: string, options?: DeploymentStacksGetAtManagementGroupOptionalParams): Promise; + getAtResourceGroup(resourceGroupName: string, deploymentStackName: string, options?: DeploymentStacksGetAtResourceGroupOptionalParams): Promise; + getAtSubscription(deploymentStackName: string, options?: DeploymentStacksGetAtSubscriptionOptionalParams): Promise; + listAtManagementGroup(managementGroupId: string, options?: DeploymentStacksListAtManagementGroupOptionalParams): PagedAsyncIterableIterator; + listAtResourceGroup(resourceGroupName: string, options?: DeploymentStacksListAtResourceGroupOptionalParams): PagedAsyncIterableIterator; + listAtSubscription(options?: DeploymentStacksListAtSubscriptionOptionalParams): PagedAsyncIterableIterator; +} + +// @public (undocumented) +export class DeploymentStacksClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: DeploymentStacksClientOptionalParams); + constructor(credentials: coreAuth.TokenCredential, options?: DeploymentStacksClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + deploymentStacks: DeploymentStacks; + // (undocumented) + subscriptionId?: string; +} + +// @public +export interface DeploymentStacksClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface DeploymentStacksCreateOrUpdateAtManagementGroupOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DeploymentStacksCreateOrUpdateAtManagementGroupResponse = DeploymentStack; + +// @public +export interface DeploymentStacksCreateOrUpdateAtResourceGroupOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DeploymentStacksCreateOrUpdateAtResourceGroupResponse = DeploymentStack; + +// @public +export interface DeploymentStacksCreateOrUpdateAtSubscriptionOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DeploymentStacksCreateOrUpdateAtSubscriptionResponse = DeploymentStack; + +// @public +export interface DeploymentStacksDebugSetting { + detailLevel?: string; +} + +// @public +export interface DeploymentStacksDeleteAtManagementGroupHeaders { + // (undocumented) + location?: string; +} + +// @public +export interface DeploymentStacksDeleteAtManagementGroupOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + unmanageActionManagementGroups?: UnmanageActionManagementGroupMode; + unmanageActionResourceGroups?: UnmanageActionResourceGroupMode; + unmanageActionResources?: UnmanageActionResourceMode; + updateIntervalInMs?: number; +} + +// @public +export interface DeploymentStacksDeleteAtResourceGroupHeaders { + // (undocumented) + location?: string; +} + +// @public +export interface DeploymentStacksDeleteAtResourceGroupOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + unmanageActionResourceGroups?: UnmanageActionResourceGroupMode; + unmanageActionResources?: UnmanageActionResourceMode; + updateIntervalInMs?: number; +} + +// @public +export interface DeploymentStacksDeleteAtSubscriptionHeaders { + // (undocumented) + location?: string; +} + +// @public +export interface DeploymentStacksDeleteAtSubscriptionOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + unmanageActionResourceGroups?: UnmanageActionResourceGroupMode; + unmanageActionResources?: UnmanageActionResourceMode; + updateIntervalInMs?: number; +} + +// @public +export type DeploymentStacksDeleteDetachEnum = string; + +// @public +export interface DeploymentStacksError { + error?: ErrorResponse; +} + +// @public +export interface DeploymentStacksExportTemplateAtManagementGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentStacksExportTemplateAtManagementGroupResponse = DeploymentStackTemplateDefinition; + +// @public +export interface DeploymentStacksExportTemplateAtResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentStacksExportTemplateAtResourceGroupResponse = DeploymentStackTemplateDefinition; + +// @public +export interface DeploymentStacksExportTemplateAtSubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentStacksExportTemplateAtSubscriptionResponse = DeploymentStackTemplateDefinition; + +// @public +export interface DeploymentStacksGetAtManagementGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentStacksGetAtManagementGroupResponse = DeploymentStack; + +// @public +export interface DeploymentStacksGetAtResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentStacksGetAtResourceGroupResponse = DeploymentStack; + +// @public +export interface DeploymentStacksGetAtSubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentStacksGetAtSubscriptionResponse = DeploymentStack; + +// @public +export interface DeploymentStacksListAtManagementGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentStacksListAtManagementGroupNextResponse = DeploymentStackListResult; + +// @public +export interface DeploymentStacksListAtManagementGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentStacksListAtManagementGroupResponse = DeploymentStackListResult; + +// @public +export interface DeploymentStacksListAtResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentStacksListAtResourceGroupNextResponse = DeploymentStackListResult; + +// @public +export interface DeploymentStacksListAtResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentStacksListAtResourceGroupResponse = DeploymentStackListResult; + +// @public +export interface DeploymentStacksListAtSubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentStacksListAtSubscriptionNextResponse = DeploymentStackListResult; + +// @public +export interface DeploymentStacksListAtSubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentStacksListAtSubscriptionResponse = DeploymentStackListResult; + +// @public +export interface DeploymentStacksParametersLink { + contentVersion?: string; + uri: string; +} + +// @public +export interface DeploymentStacksTemplateLink { + contentVersion?: string; + id?: string; + queryString?: string; + relativePath?: string; + uri?: string; +} + +// @public +export interface DeploymentStackTemplateDefinition { + template?: Record; + templateLink?: DeploymentStacksTemplateLink; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownDenySettingsMode { + DenyDelete = "denyDelete", + DenyWriteAndDelete = "denyWriteAndDelete", + None = "none" +} + +// @public +export enum KnownDenyStatusMode { + DenyDelete = "denyDelete", + DenyWriteAndDelete = "denyWriteAndDelete", + Inapplicable = "inapplicable", + None = "None", + NotSupported = "notSupported", + RemovedBySystem = "removedBySystem" +} + +// @public +export enum KnownDeploymentStackProvisioningState { + Canceled = "Canceled", + Canceling = "Canceling", + Creating = "Creating", + Deleting = "Deleting", + DeletingResources = "DeletingResources", + Deploying = "Deploying", + Failed = "Failed", + Locking = "Locking", + Succeeded = "Succeeded", + Validating = "Validating", + Waiting = "Waiting" +} + +// @public +export enum KnownDeploymentStacksDeleteDetachEnum { + Delete = "delete", + Detach = "detach" +} + +// @public +export enum KnownResourceStatusMode { + DeleteFailed = "deleteFailed", + Managed = "Managed", + None = "None", + RemoveDenyFailed = "removeDenyFailed" +} + +// @public +export enum KnownUnmanageActionManagementGroupMode { + Delete = "delete", + Detach = "detach" +} + +// @public +export enum KnownUnmanageActionResourceGroupMode { + Delete = "delete", + Detach = "detach" +} + +// @public +export enum KnownUnmanageActionResourceMode { + Delete = "delete", + Detach = "detach" +} + +// @public +export interface ManagedResourceReference extends ResourceReference { + denyStatus?: DenyStatusMode; + status?: ResourceStatusMode; +} + +// @public +export interface ResourceReference { + readonly id?: string; +} + +// @public +export interface ResourceReferenceExtended extends ResourceReference, DeploymentStacksError { +} + +// @public +export type ResourceStatusMode = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export type UnmanageActionManagementGroupMode = string; + +// @public +export type UnmanageActionResourceGroupMode = string; + +// @public +export type UnmanageActionResourceMode = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/rollup.config.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/rollup.config.js @@ -0,0 +1,122 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs(), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/sample.env b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/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/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksCreateOrUpdateAtManagementGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksCreateOrUpdateAtManagementGroupSample.ts new file mode 100644 index 000000000000..dc1834eff75e --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksCreateOrUpdateAtManagementGroupSample.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 { + DeploymentStack, + DeploymentStacksClient +} from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a Deployment Stack. + * + * @summary Creates or updates a Deployment Stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupCreate.json + */ +async function deploymentStacksCreateOrUpdate() { + const managementGroupId = "myMg"; + const deploymentStackName = "simpleDeploymentStack"; + const deploymentStack: DeploymentStack = { + actionOnUnmanage: { + managementGroups: "detach", + resourceGroups: "delete", + resources: "delete" + }, + denySettings: { + applyToChildScopes: false, + excludedActions: ["action"], + excludedPrincipals: ["principal"], + mode: "denyDelete" + }, + location: "eastus", + parameters: { parameter1: { value: "a string" } }, + tags: { tagkey: "tagVal" } + }; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const result = await client.deploymentStacks.beginCreateOrUpdateAtManagementGroupAndWait( + managementGroupId, + deploymentStackName, + deploymentStack + ); + console.log(result); +} + +async function main() { + deploymentStacksCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksCreateOrUpdateAtResourceGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksCreateOrUpdateAtResourceGroupSample.ts new file mode 100644 index 000000000000..351991915d27 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksCreateOrUpdateAtResourceGroupSample.ts @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + DeploymentStack, + DeploymentStacksClient +} from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a Deployment Stack. + * + * @summary Creates or updates a Deployment Stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupCreate.json + */ +async function deploymentStacksCreateOrUpdate() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || + "deploymentStacksRG"; + const deploymentStackName = "simpleDeploymentStack"; + const deploymentStack: DeploymentStack = { + actionOnUnmanage: { + managementGroups: "detach", + resourceGroups: "delete", + resources: "delete" + }, + denySettings: { + applyToChildScopes: false, + excludedActions: ["action"], + excludedPrincipals: ["principal"], + mode: "denyDelete" + }, + location: "eastus", + parameters: { parameter1: { value: "a string" } }, + tags: { tagkey: "tagVal" } + }; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.beginCreateOrUpdateAtResourceGroupAndWait( + resourceGroupName, + deploymentStackName, + deploymentStack + ); + console.log(result); +} + +async function main() { + deploymentStacksCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksCreateOrUpdateAtSubscriptionSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksCreateOrUpdateAtSubscriptionSample.ts new file mode 100644 index 000000000000..dd54f0f5e64c --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksCreateOrUpdateAtSubscriptionSample.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 { + DeploymentStack, + DeploymentStacksClient +} from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a Deployment Stack. + * + * @summary Creates or updates a Deployment Stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionCreate.json + */ +async function deploymentStacksCreateOrUpdate() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const deploymentStackName = "simpleDeploymentStack"; + const deploymentStack: DeploymentStack = { + actionOnUnmanage: { + managementGroups: "detach", + resourceGroups: "delete", + resources: "delete" + }, + denySettings: { + applyToChildScopes: false, + excludedActions: ["action"], + excludedPrincipals: ["principal"], + mode: "denyDelete" + }, + location: "eastus", + parameters: { parameter1: { value: "a string" } }, + tags: { tagkey: "tagVal" } + }; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.beginCreateOrUpdateAtSubscriptionAndWait( + deploymentStackName, + deploymentStack + ); + console.log(result); +} + +async function main() { + deploymentStacksCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksDeleteAtManagementGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksDeleteAtManagementGroupSample.ts new file mode 100644 index 000000000000..34a1019164e8 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksDeleteAtManagementGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * + * @summary Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupDelete.json + */ +async function deploymentStacksDelete() { + const managementGroupId = "myMg"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const result = await client.deploymentStacks.beginDeleteAtManagementGroupAndWait( + managementGroupId, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksDelete(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksDeleteAtResourceGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksDeleteAtResourceGroupSample.ts new file mode 100644 index 000000000000..23c2b17017e8 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksDeleteAtResourceGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * + * @summary Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupDelete.json + */ +async function deploymentStacksDelete() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || + "deploymentStacksRG"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.beginDeleteAtResourceGroupAndWait( + resourceGroupName, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksDelete(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksDeleteAtSubscriptionSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksDeleteAtSubscriptionSample.ts new file mode 100644 index 000000000000..228a921f689d --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksDeleteAtSubscriptionSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * + * @summary Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionDelete.json + */ +async function deploymentStacksDelete() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.beginDeleteAtSubscriptionAndWait( + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksDelete(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksExportTemplateAtManagementGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksExportTemplateAtManagementGroupSample.ts new file mode 100644 index 000000000000..5e806dfc7613 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksExportTemplateAtManagementGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Exports the template used to create the deployment stack. + * + * @summary Exports the template used to create the deployment stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupExportTemplate.json + */ +async function deploymentStacksExportTemplate() { + const managementGroupId = "myMg"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const result = await client.deploymentStacks.exportTemplateAtManagementGroup( + managementGroupId, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksExportTemplate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksExportTemplateAtResourceGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksExportTemplateAtResourceGroupSample.ts new file mode 100644 index 000000000000..f7e5ca88e596 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksExportTemplateAtResourceGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Exports the template used to create the deployment stack. + * + * @summary Exports the template used to create the deployment stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackExportTemplate.json + */ +async function deploymentStacksExportTemplate() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "subscriptions/00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || + "deploymentStacksRG"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.exportTemplateAtResourceGroup( + resourceGroupName, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksExportTemplate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksExportTemplateAtSubscriptionSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksExportTemplateAtSubscriptionSample.ts new file mode 100644 index 000000000000..0b6adb8c508a --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksExportTemplateAtSubscriptionSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Exports the template used to create the deployment stack. + * + * @summary Exports the template used to create the deployment stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionExportTemplate.json + */ +async function deploymentStacksExportTemplate() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "subscriptions/00000000-0000-0000-0000-000000000000"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.exportTemplateAtSubscription( + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksExportTemplate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksGetAtManagementGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksGetAtManagementGroupSample.ts new file mode 100644 index 000000000000..5b303af7c34f --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksGetAtManagementGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Deployment Stack with a given name. + * + * @summary Gets a Deployment Stack with a given name. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupGet.json + */ +async function deploymentStacksGet() { + const managementGroupId = "myMg"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const result = await client.deploymentStacks.getAtManagementGroup( + managementGroupId, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksGetAtResourceGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksGetAtResourceGroupSample.ts new file mode 100644 index 000000000000..0df1b78ff4e9 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksGetAtResourceGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Deployment Stack with a given name. + * + * @summary Gets a Deployment Stack with a given name. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupGet.json + */ +async function deploymentStacksGet() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || + "deploymentStacksRG"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.getAtResourceGroup( + resourceGroupName, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksGetAtSubscriptionSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksGetAtSubscriptionSample.ts new file mode 100644 index 000000000000..8e576651b7a0 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksGetAtSubscriptionSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Deployment Stack with a given name. + * + * @summary Gets a Deployment Stack with a given name. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionGet.json + */ +async function deploymentStacksGet() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.getAtSubscription( + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksListAtManagementGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksListAtManagementGroupSample.ts new file mode 100644 index 000000000000..9af49caa8abf --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksListAtManagementGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the Deployment Stacks within the specified management group. + * + * @summary Lists all the Deployment Stacks within the specified management group. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupList.json + */ +async function deploymentStacksList() { + const managementGroupId = "myMg"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const resArray = new Array(); + for await (let item of client.deploymentStacks.listAtManagementGroup( + managementGroupId + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + deploymentStacksList(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksListAtResourceGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksListAtResourceGroupSample.ts new file mode 100644 index 000000000000..e3e61b90d49a --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksListAtResourceGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the Deployment Stacks within the specified resource group. + * + * @summary Lists all the Deployment Stacks within the specified resource group. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupList.json + */ +async function deploymentStacksList() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || + "deploymentStacksRG"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.deploymentStacks.listAtResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + deploymentStacksList(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksListAtSubscriptionSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksListAtSubscriptionSample.ts new file mode 100644 index 000000000000..c2761c609900 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples-dev/deploymentStacksListAtSubscriptionSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the Deployment Stacks within the specified subscription. + * + * @summary Lists all the Deployment Stacks within the specified subscription. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionList.json + */ +async function deploymentStacksList() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.deploymentStacks.listAtSubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + deploymentStacksList(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/README.md b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/README.md new file mode 100644 index 000000000000..65f99175b5b9 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/README.md @@ -0,0 +1,78 @@ +# 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** | +| ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [deploymentStacksCreateOrUpdateAtManagementGroupSample.js][deploymentstackscreateorupdateatmanagementgroupsample] | Creates or updates a Deployment Stack. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupCreate.json | +| [deploymentStacksCreateOrUpdateAtResourceGroupSample.js][deploymentstackscreateorupdateatresourcegroupsample] | Creates or updates a Deployment Stack. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupCreate.json | +| [deploymentStacksCreateOrUpdateAtSubscriptionSample.js][deploymentstackscreateorupdateatsubscriptionsample] | Creates or updates a Deployment Stack. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionCreate.json | +| [deploymentStacksDeleteAtManagementGroupSample.js][deploymentstacksdeleteatmanagementgroupsample] | Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupDelete.json | +| [deploymentStacksDeleteAtResourceGroupSample.js][deploymentstacksdeleteatresourcegroupsample] | Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupDelete.json | +| [deploymentStacksDeleteAtSubscriptionSample.js][deploymentstacksdeleteatsubscriptionsample] | Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionDelete.json | +| [deploymentStacksExportTemplateAtManagementGroupSample.js][deploymentstacksexporttemplateatmanagementgroupsample] | Exports the template used to create the deployment stack. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupExportTemplate.json | +| [deploymentStacksExportTemplateAtResourceGroupSample.js][deploymentstacksexporttemplateatresourcegroupsample] | Exports the template used to create the deployment stack. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackExportTemplate.json | +| [deploymentStacksExportTemplateAtSubscriptionSample.js][deploymentstacksexporttemplateatsubscriptionsample] | Exports the template used to create the deployment stack. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionExportTemplate.json | +| [deploymentStacksGetAtManagementGroupSample.js][deploymentstacksgetatmanagementgroupsample] | Gets a Deployment Stack with a given name. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupGet.json | +| [deploymentStacksGetAtResourceGroupSample.js][deploymentstacksgetatresourcegroupsample] | Gets a Deployment Stack with a given name. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupGet.json | +| [deploymentStacksGetAtSubscriptionSample.js][deploymentstacksgetatsubscriptionsample] | Gets a Deployment Stack with a given name. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionGet.json | +| [deploymentStacksListAtManagementGroupSample.js][deploymentstackslistatmanagementgroupsample] | Lists all the Deployment Stacks within the specified management group. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupList.json | +| [deploymentStacksListAtResourceGroupSample.js][deploymentstackslistatresourcegroupsample] | Lists all the Deployment Stacks within the specified resource group. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupList.json | +| [deploymentStacksListAtSubscriptionSample.js][deploymentstackslistatsubscriptionsample] | Lists all the Deployment Stacks within the specified subscription. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionList.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node deploymentStacksCreateOrUpdateAtManagementGroupSample.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 deploymentStacksCreateOrUpdateAtManagementGroupSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[deploymentstackscreateorupdateatmanagementgroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksCreateOrUpdateAtManagementGroupSample.js +[deploymentstackscreateorupdateatresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksCreateOrUpdateAtResourceGroupSample.js +[deploymentstackscreateorupdateatsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksCreateOrUpdateAtSubscriptionSample.js +[deploymentstacksdeleteatmanagementgroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksDeleteAtManagementGroupSample.js +[deploymentstacksdeleteatresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksDeleteAtResourceGroupSample.js +[deploymentstacksdeleteatsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksDeleteAtSubscriptionSample.js +[deploymentstacksexporttemplateatmanagementgroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksExportTemplateAtManagementGroupSample.js +[deploymentstacksexporttemplateatresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksExportTemplateAtResourceGroupSample.js +[deploymentstacksexporttemplateatsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksExportTemplateAtSubscriptionSample.js +[deploymentstacksgetatmanagementgroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksGetAtManagementGroupSample.js +[deploymentstacksgetatresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksGetAtResourceGroupSample.js +[deploymentstacksgetatsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksGetAtSubscriptionSample.js +[deploymentstackslistatmanagementgroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksListAtManagementGroupSample.js +[deploymentstackslistatresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksListAtResourceGroupSample.js +[deploymentstackslistatsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksListAtSubscriptionSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-resourcesdeploymentstacks?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/README.md diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksCreateOrUpdateAtManagementGroupSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksCreateOrUpdateAtManagementGroupSample.js new file mode 100644 index 000000000000..88f1cc2e774f --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksCreateOrUpdateAtManagementGroupSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a Deployment Stack. + * + * @summary Creates or updates a Deployment Stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupCreate.json + */ +async function deploymentStacksCreateOrUpdate() { + const managementGroupId = "myMg"; + const deploymentStackName = "simpleDeploymentStack"; + const deploymentStack = { + actionOnUnmanage: { + managementGroups: "detach", + resourceGroups: "delete", + resources: "delete", + }, + denySettings: { + applyToChildScopes: false, + excludedActions: ["action"], + excludedPrincipals: ["principal"], + mode: "denyDelete", + }, + location: "eastus", + parameters: { parameter1: { value: "a string" } }, + tags: { tagkey: "tagVal" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const result = await client.deploymentStacks.beginCreateOrUpdateAtManagementGroupAndWait( + managementGroupId, + deploymentStackName, + deploymentStack + ); + console.log(result); +} + +async function main() { + deploymentStacksCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksCreateOrUpdateAtResourceGroupSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksCreateOrUpdateAtResourceGroupSample.js new file mode 100644 index 000000000000..3761e5807d75 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksCreateOrUpdateAtResourceGroupSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a Deployment Stack. + * + * @summary Creates or updates a Deployment Stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupCreate.json + */ +async function deploymentStacksCreateOrUpdate() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || "deploymentStacksRG"; + const deploymentStackName = "simpleDeploymentStack"; + const deploymentStack = { + actionOnUnmanage: { + managementGroups: "detach", + resourceGroups: "delete", + resources: "delete", + }, + denySettings: { + applyToChildScopes: false, + excludedActions: ["action"], + excludedPrincipals: ["principal"], + mode: "denyDelete", + }, + location: "eastus", + parameters: { parameter1: { value: "a string" } }, + tags: { tagkey: "tagVal" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.beginCreateOrUpdateAtResourceGroupAndWait( + resourceGroupName, + deploymentStackName, + deploymentStack + ); + console.log(result); +} + +async function main() { + deploymentStacksCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksCreateOrUpdateAtSubscriptionSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksCreateOrUpdateAtSubscriptionSample.js new file mode 100644 index 000000000000..1a51c3aa1e0c --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksCreateOrUpdateAtSubscriptionSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a Deployment Stack. + * + * @summary Creates or updates a Deployment Stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionCreate.json + */ +async function deploymentStacksCreateOrUpdate() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const deploymentStackName = "simpleDeploymentStack"; + const deploymentStack = { + actionOnUnmanage: { + managementGroups: "detach", + resourceGroups: "delete", + resources: "delete", + }, + denySettings: { + applyToChildScopes: false, + excludedActions: ["action"], + excludedPrincipals: ["principal"], + mode: "denyDelete", + }, + location: "eastus", + parameters: { parameter1: { value: "a string" } }, + tags: { tagkey: "tagVal" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.beginCreateOrUpdateAtSubscriptionAndWait( + deploymentStackName, + deploymentStack + ); + console.log(result); +} + +async function main() { + deploymentStacksCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksDeleteAtManagementGroupSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksDeleteAtManagementGroupSample.js new file mode 100644 index 000000000000..a81b96a0055a --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksDeleteAtManagementGroupSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * + * @summary Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupDelete.json + */ +async function deploymentStacksDelete() { + const managementGroupId = "myMg"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const result = await client.deploymentStacks.beginDeleteAtManagementGroupAndWait( + managementGroupId, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksDelete(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksDeleteAtResourceGroupSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksDeleteAtResourceGroupSample.js new file mode 100644 index 000000000000..ff8e00ec82af --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksDeleteAtResourceGroupSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * + * @summary Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupDelete.json + */ +async function deploymentStacksDelete() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || "deploymentStacksRG"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.beginDeleteAtResourceGroupAndWait( + resourceGroupName, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksDelete(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksDeleteAtSubscriptionSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksDeleteAtSubscriptionSample.js new file mode 100644 index 000000000000..0737a4dd3ba8 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksDeleteAtSubscriptionSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * + * @summary Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionDelete.json + */ +async function deploymentStacksDelete() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.beginDeleteAtSubscriptionAndWait( + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksDelete(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksExportTemplateAtManagementGroupSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksExportTemplateAtManagementGroupSample.js new file mode 100644 index 000000000000..4555a5caffa1 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksExportTemplateAtManagementGroupSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Exports the template used to create the deployment stack. + * + * @summary Exports the template used to create the deployment stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupExportTemplate.json + */ +async function deploymentStacksExportTemplate() { + const managementGroupId = "myMg"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const result = await client.deploymentStacks.exportTemplateAtManagementGroup( + managementGroupId, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksExportTemplate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksExportTemplateAtResourceGroupSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksExportTemplateAtResourceGroupSample.js new file mode 100644 index 000000000000..5c2229a0061a --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksExportTemplateAtResourceGroupSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Exports the template used to create the deployment stack. + * + * @summary Exports the template used to create the deployment stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackExportTemplate.json + */ +async function deploymentStacksExportTemplate() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "subscriptions/00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || "deploymentStacksRG"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.exportTemplateAtResourceGroup( + resourceGroupName, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksExportTemplate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksExportTemplateAtSubscriptionSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksExportTemplateAtSubscriptionSample.js new file mode 100644 index 000000000000..3831942d03c3 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksExportTemplateAtSubscriptionSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Exports the template used to create the deployment stack. + * + * @summary Exports the template used to create the deployment stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionExportTemplate.json + */ +async function deploymentStacksExportTemplate() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "subscriptions/00000000-0000-0000-0000-000000000000"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.exportTemplateAtSubscription(deploymentStackName); + console.log(result); +} + +async function main() { + deploymentStacksExportTemplate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksGetAtManagementGroupSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksGetAtManagementGroupSample.js new file mode 100644 index 000000000000..1d5c14952198 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksGetAtManagementGroupSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a Deployment Stack with a given name. + * + * @summary Gets a Deployment Stack with a given name. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupGet.json + */ +async function deploymentStacksGet() { + const managementGroupId = "myMg"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const result = await client.deploymentStacks.getAtManagementGroup( + managementGroupId, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksGetAtResourceGroupSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksGetAtResourceGroupSample.js new file mode 100644 index 000000000000..0c5f0a49dda8 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksGetAtResourceGroupSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a Deployment Stack with a given name. + * + * @summary Gets a Deployment Stack with a given name. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupGet.json + */ +async function deploymentStacksGet() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || "deploymentStacksRG"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.getAtResourceGroup( + resourceGroupName, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksGetAtSubscriptionSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksGetAtSubscriptionSample.js new file mode 100644 index 000000000000..fa5505ba2c03 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksGetAtSubscriptionSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a Deployment Stack with a given name. + * + * @summary Gets a Deployment Stack with a given name. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionGet.json + */ +async function deploymentStacksGet() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.getAtSubscription(deploymentStackName); + console.log(result); +} + +async function main() { + deploymentStacksGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksListAtManagementGroupSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksListAtManagementGroupSample.js new file mode 100644 index 000000000000..b3a56f39e631 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksListAtManagementGroupSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all the Deployment Stacks within the specified management group. + * + * @summary Lists all the Deployment Stacks within the specified management group. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupList.json + */ +async function deploymentStacksList() { + const managementGroupId = "myMg"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const resArray = new Array(); + for await (let item of client.deploymentStacks.listAtManagementGroup(managementGroupId)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + deploymentStacksList(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksListAtResourceGroupSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksListAtResourceGroupSample.js new file mode 100644 index 000000000000..9118b9615cb9 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksListAtResourceGroupSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all the Deployment Stacks within the specified resource group. + * + * @summary Lists all the Deployment Stacks within the specified resource group. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupList.json + */ +async function deploymentStacksList() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || "deploymentStacksRG"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.deploymentStacks.listAtResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + deploymentStacksList(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksListAtSubscriptionSample.js b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksListAtSubscriptionSample.js new file mode 100644 index 000000000000..2cc2036df945 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/deploymentStacksListAtSubscriptionSample.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 { DeploymentStacksClient } = require("@azure/arm-resourcesdeploymentstacks"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all the Deployment Stacks within the specified subscription. + * + * @summary Lists all the Deployment Stacks within the specified subscription. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionList.json + */ +async function deploymentStacksList() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.deploymentStacks.listAtSubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + deploymentStacksList(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/package.json b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/package.json new file mode 100644 index 000000000000..66aed2c8fa96 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-resourcesdeploymentstacks-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks" + }, + "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/resourcesdeploymentstacks/arm-resourcesdeploymentstacks", + "dependencies": { + "@azure/arm-resourcesdeploymentstacks": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/sample.env b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/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/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/README.md b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/README.md new file mode 100644 index 000000000000..dee4e5a92b81 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/README.md @@ -0,0 +1,91 @@ +# 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** | +| ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [deploymentStacksCreateOrUpdateAtManagementGroupSample.ts][deploymentstackscreateorupdateatmanagementgroupsample] | Creates or updates a Deployment Stack. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupCreate.json | +| [deploymentStacksCreateOrUpdateAtResourceGroupSample.ts][deploymentstackscreateorupdateatresourcegroupsample] | Creates or updates a Deployment Stack. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupCreate.json | +| [deploymentStacksCreateOrUpdateAtSubscriptionSample.ts][deploymentstackscreateorupdateatsubscriptionsample] | Creates or updates a Deployment Stack. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionCreate.json | +| [deploymentStacksDeleteAtManagementGroupSample.ts][deploymentstacksdeleteatmanagementgroupsample] | Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupDelete.json | +| [deploymentStacksDeleteAtResourceGroupSample.ts][deploymentstacksdeleteatresourcegroupsample] | Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupDelete.json | +| [deploymentStacksDeleteAtSubscriptionSample.ts][deploymentstacksdeleteatsubscriptionsample] | Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionDelete.json | +| [deploymentStacksExportTemplateAtManagementGroupSample.ts][deploymentstacksexporttemplateatmanagementgroupsample] | Exports the template used to create the deployment stack. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupExportTemplate.json | +| [deploymentStacksExportTemplateAtResourceGroupSample.ts][deploymentstacksexporttemplateatresourcegroupsample] | Exports the template used to create the deployment stack. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackExportTemplate.json | +| [deploymentStacksExportTemplateAtSubscriptionSample.ts][deploymentstacksexporttemplateatsubscriptionsample] | Exports the template used to create the deployment stack. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionExportTemplate.json | +| [deploymentStacksGetAtManagementGroupSample.ts][deploymentstacksgetatmanagementgroupsample] | Gets a Deployment Stack with a given name. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupGet.json | +| [deploymentStacksGetAtResourceGroupSample.ts][deploymentstacksgetatresourcegroupsample] | Gets a Deployment Stack with a given name. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupGet.json | +| [deploymentStacksGetAtSubscriptionSample.ts][deploymentstacksgetatsubscriptionsample] | Gets a Deployment Stack with a given name. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionGet.json | +| [deploymentStacksListAtManagementGroupSample.ts][deploymentstackslistatmanagementgroupsample] | Lists all the Deployment Stacks within the specified management group. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupList.json | +| [deploymentStacksListAtResourceGroupSample.ts][deploymentstackslistatresourcegroupsample] | Lists all the Deployment Stacks within the specified resource group. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupList.json | +| [deploymentStacksListAtSubscriptionSample.ts][deploymentstackslistatsubscriptionsample] | Lists all the Deployment Stacks within the specified subscription. x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionList.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/deploymentStacksCreateOrUpdateAtManagementGroupSample.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/deploymentStacksCreateOrUpdateAtManagementGroupSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[deploymentstackscreateorupdateatmanagementgroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksCreateOrUpdateAtManagementGroupSample.ts +[deploymentstackscreateorupdateatresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksCreateOrUpdateAtResourceGroupSample.ts +[deploymentstackscreateorupdateatsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksCreateOrUpdateAtSubscriptionSample.ts +[deploymentstacksdeleteatmanagementgroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksDeleteAtManagementGroupSample.ts +[deploymentstacksdeleteatresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksDeleteAtResourceGroupSample.ts +[deploymentstacksdeleteatsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksDeleteAtSubscriptionSample.ts +[deploymentstacksexporttemplateatmanagementgroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksExportTemplateAtManagementGroupSample.ts +[deploymentstacksexporttemplateatresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksExportTemplateAtResourceGroupSample.ts +[deploymentstacksexporttemplateatsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksExportTemplateAtSubscriptionSample.ts +[deploymentstacksgetatmanagementgroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksGetAtManagementGroupSample.ts +[deploymentstacksgetatresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksGetAtResourceGroupSample.ts +[deploymentstacksgetatsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksGetAtSubscriptionSample.ts +[deploymentstackslistatmanagementgroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksListAtManagementGroupSample.ts +[deploymentstackslistatresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksListAtResourceGroupSample.ts +[deploymentstackslistatsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksListAtSubscriptionSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-resourcesdeploymentstacks?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/package.json b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/package.json new file mode 100644 index 000000000000..ef0595ab9888 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-resourcesdeploymentstacks-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks" + }, + "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/resourcesdeploymentstacks/arm-resourcesdeploymentstacks", + "dependencies": { + "@azure/arm-resourcesdeploymentstacks": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "typescript": "~5.0.0", + "rimraf": "latest" + } +} diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/sample.env b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/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/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksCreateOrUpdateAtManagementGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksCreateOrUpdateAtManagementGroupSample.ts new file mode 100644 index 000000000000..dc1834eff75e --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksCreateOrUpdateAtManagementGroupSample.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 { + DeploymentStack, + DeploymentStacksClient +} from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a Deployment Stack. + * + * @summary Creates or updates a Deployment Stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupCreate.json + */ +async function deploymentStacksCreateOrUpdate() { + const managementGroupId = "myMg"; + const deploymentStackName = "simpleDeploymentStack"; + const deploymentStack: DeploymentStack = { + actionOnUnmanage: { + managementGroups: "detach", + resourceGroups: "delete", + resources: "delete" + }, + denySettings: { + applyToChildScopes: false, + excludedActions: ["action"], + excludedPrincipals: ["principal"], + mode: "denyDelete" + }, + location: "eastus", + parameters: { parameter1: { value: "a string" } }, + tags: { tagkey: "tagVal" } + }; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const result = await client.deploymentStacks.beginCreateOrUpdateAtManagementGroupAndWait( + managementGroupId, + deploymentStackName, + deploymentStack + ); + console.log(result); +} + +async function main() { + deploymentStacksCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksCreateOrUpdateAtResourceGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksCreateOrUpdateAtResourceGroupSample.ts new file mode 100644 index 000000000000..351991915d27 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksCreateOrUpdateAtResourceGroupSample.ts @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + DeploymentStack, + DeploymentStacksClient +} from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a Deployment Stack. + * + * @summary Creates or updates a Deployment Stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupCreate.json + */ +async function deploymentStacksCreateOrUpdate() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || + "deploymentStacksRG"; + const deploymentStackName = "simpleDeploymentStack"; + const deploymentStack: DeploymentStack = { + actionOnUnmanage: { + managementGroups: "detach", + resourceGroups: "delete", + resources: "delete" + }, + denySettings: { + applyToChildScopes: false, + excludedActions: ["action"], + excludedPrincipals: ["principal"], + mode: "denyDelete" + }, + location: "eastus", + parameters: { parameter1: { value: "a string" } }, + tags: { tagkey: "tagVal" } + }; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.beginCreateOrUpdateAtResourceGroupAndWait( + resourceGroupName, + deploymentStackName, + deploymentStack + ); + console.log(result); +} + +async function main() { + deploymentStacksCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksCreateOrUpdateAtSubscriptionSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksCreateOrUpdateAtSubscriptionSample.ts new file mode 100644 index 000000000000..dd54f0f5e64c --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksCreateOrUpdateAtSubscriptionSample.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 { + DeploymentStack, + DeploymentStacksClient +} from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a Deployment Stack. + * + * @summary Creates or updates a Deployment Stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionCreate.json + */ +async function deploymentStacksCreateOrUpdate() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const deploymentStackName = "simpleDeploymentStack"; + const deploymentStack: DeploymentStack = { + actionOnUnmanage: { + managementGroups: "detach", + resourceGroups: "delete", + resources: "delete" + }, + denySettings: { + applyToChildScopes: false, + excludedActions: ["action"], + excludedPrincipals: ["principal"], + mode: "denyDelete" + }, + location: "eastus", + parameters: { parameter1: { value: "a string" } }, + tags: { tagkey: "tagVal" } + }; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.beginCreateOrUpdateAtSubscriptionAndWait( + deploymentStackName, + deploymentStack + ); + console.log(result); +} + +async function main() { + deploymentStacksCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksDeleteAtManagementGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksDeleteAtManagementGroupSample.ts new file mode 100644 index 000000000000..34a1019164e8 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksDeleteAtManagementGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * + * @summary Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupDelete.json + */ +async function deploymentStacksDelete() { + const managementGroupId = "myMg"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const result = await client.deploymentStacks.beginDeleteAtManagementGroupAndWait( + managementGroupId, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksDelete(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksDeleteAtResourceGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksDeleteAtResourceGroupSample.ts new file mode 100644 index 000000000000..23c2b17017e8 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksDeleteAtResourceGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * + * @summary Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupDelete.json + */ +async function deploymentStacksDelete() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || + "deploymentStacksRG"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.beginDeleteAtResourceGroupAndWait( + resourceGroupName, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksDelete(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksDeleteAtSubscriptionSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksDeleteAtSubscriptionSample.ts new file mode 100644 index 000000000000..228a921f689d --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksDeleteAtSubscriptionSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * + * @summary Deletes a Deployment Stack by name. When operation completes, status code 200 returned without content. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionDelete.json + */ +async function deploymentStacksDelete() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.beginDeleteAtSubscriptionAndWait( + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksDelete(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksExportTemplateAtManagementGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksExportTemplateAtManagementGroupSample.ts new file mode 100644 index 000000000000..5e806dfc7613 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksExportTemplateAtManagementGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Exports the template used to create the deployment stack. + * + * @summary Exports the template used to create the deployment stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupExportTemplate.json + */ +async function deploymentStacksExportTemplate() { + const managementGroupId = "myMg"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const result = await client.deploymentStacks.exportTemplateAtManagementGroup( + managementGroupId, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksExportTemplate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksExportTemplateAtResourceGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksExportTemplateAtResourceGroupSample.ts new file mode 100644 index 000000000000..f7e5ca88e596 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksExportTemplateAtResourceGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Exports the template used to create the deployment stack. + * + * @summary Exports the template used to create the deployment stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackExportTemplate.json + */ +async function deploymentStacksExportTemplate() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "subscriptions/00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || + "deploymentStacksRG"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.exportTemplateAtResourceGroup( + resourceGroupName, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksExportTemplate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksExportTemplateAtSubscriptionSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksExportTemplateAtSubscriptionSample.ts new file mode 100644 index 000000000000..0b6adb8c508a --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksExportTemplateAtSubscriptionSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Exports the template used to create the deployment stack. + * + * @summary Exports the template used to create the deployment stack. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionExportTemplate.json + */ +async function deploymentStacksExportTemplate() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "subscriptions/00000000-0000-0000-0000-000000000000"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.exportTemplateAtSubscription( + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksExportTemplate(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksGetAtManagementGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksGetAtManagementGroupSample.ts new file mode 100644 index 000000000000..5b303af7c34f --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksGetAtManagementGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Deployment Stack with a given name. + * + * @summary Gets a Deployment Stack with a given name. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupGet.json + */ +async function deploymentStacksGet() { + const managementGroupId = "myMg"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const result = await client.deploymentStacks.getAtManagementGroup( + managementGroupId, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksGetAtResourceGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksGetAtResourceGroupSample.ts new file mode 100644 index 000000000000..0df1b78ff4e9 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksGetAtResourceGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Deployment Stack with a given name. + * + * @summary Gets a Deployment Stack with a given name. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupGet.json + */ +async function deploymentStacksGet() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || + "deploymentStacksRG"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.getAtResourceGroup( + resourceGroupName, + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksGetAtSubscriptionSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksGetAtSubscriptionSample.ts new file mode 100644 index 000000000000..8e576651b7a0 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksGetAtSubscriptionSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Deployment Stack with a given name. + * + * @summary Gets a Deployment Stack with a given name. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionGet.json + */ +async function deploymentStacksGet() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const deploymentStackName = "simpleDeploymentStack"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const result = await client.deploymentStacks.getAtSubscription( + deploymentStackName + ); + console.log(result); +} + +async function main() { + deploymentStacksGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksListAtManagementGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksListAtManagementGroupSample.ts new file mode 100644 index 000000000000..9af49caa8abf --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksListAtManagementGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the Deployment Stacks within the specified management group. + * + * @summary Lists all the Deployment Stacks within the specified management group. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackManagementGroupList.json + */ +async function deploymentStacksList() { + const managementGroupId = "myMg"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential); + const resArray = new Array(); + for await (let item of client.deploymentStacks.listAtManagementGroup( + managementGroupId + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + deploymentStacksList(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksListAtResourceGroupSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksListAtResourceGroupSample.ts new file mode 100644 index 000000000000..e3e61b90d49a --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksListAtResourceGroupSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the Deployment Stacks within the specified resource group. + * + * @summary Lists all the Deployment Stacks within the specified resource group. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackResourceGroupList.json + */ +async function deploymentStacksList() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["RESOURCESDEPLOYMENTSTACKS_RESOURCE_GROUP"] || + "deploymentStacksRG"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.deploymentStacks.listAtResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + deploymentStacksList(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksListAtSubscriptionSample.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksListAtSubscriptionSample.ts new file mode 100644 index 000000000000..c2761c609900 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/src/deploymentStacksListAtSubscriptionSample.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 { DeploymentStacksClient } from "@azure/arm-resourcesdeploymentstacks"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the Deployment Stacks within the specified subscription. + * + * @summary Lists all the Deployment Stacks within the specified subscription. + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/preview/2022-08-01-preview/examples/DeploymentStackSubscriptionList.json + */ +async function deploymentStacksList() { + const subscriptionId = + process.env["RESOURCESDEPLOYMENTSTACKS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DeploymentStacksClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.deploymentStacks.listAtSubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + deploymentStacksList(); +} + +main().catch(console.error); diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/tsconfig.json b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..e26ce2a6d8f7 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/samples/v1-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/deploymentStacksClient.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/deploymentStacksClient.ts new file mode 100644 index 000000000000..2deb8f9348be --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/deploymentStacksClient.ts @@ -0,0 +1,154 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; +import * as coreAuth from "@azure/core-auth"; +import { DeploymentStacksImpl } from "./operations"; +import { DeploymentStacks } from "./operationsInterfaces"; +import { DeploymentStacksClientOptionalParams } from "./models"; + +export class DeploymentStacksClient extends coreClient.ServiceClient { + $host: string; + subscriptionId?: string; + apiVersion: string; + + /** + * Initializes a new instance of the DeploymentStacksClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: DeploymentStacksClientOptionalParams + ); + constructor( + credentials: coreAuth.TokenCredential, + options?: DeploymentStacksClientOptionalParams + ); + constructor( + credentials: coreAuth.TokenCredential, + subscriptionIdOrOptions?: DeploymentStacksClientOptionalParams | string, + options?: DeploymentStacksClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + + let subscriptionId: string | undefined; + + if (typeof subscriptionIdOrOptions === "string") { + subscriptionId = subscriptionIdOrOptions; + } else if (typeof subscriptionIdOrOptions === "object") { + options = subscriptionIdOrOptions; + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: DeploymentStacksClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-resourcesdeploymentstacks/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + endpoint: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" + }; + super(optionsWithDefaults); + + let bearerTokenAuthenticationPolicyFound: boolean = false; + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + } + if ( + !options || + !options.pipeline || + options.pipeline.getOrderedPolicies().length == 0 || + !bearerTokenAuthenticationPolicyFound + ) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + credential: credentials, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2022-08-01-preview"; + this.deploymentStacks = new DeploymentStacksImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + deploymentStacks: DeploymentStacks; +} diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/index.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/index.ts new file mode 100644 index 000000000000..1e0bad0ae7c8 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export { getContinuationToken } from "./pagingHelper"; +export * from "./models"; +export { DeploymentStacksClient } from "./deploymentStacksClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/lroImpl.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/lroImpl.ts new file mode 100644 index 000000000000..dd803cd5e28c --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/lroImpl.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 { AbortSignalLike } from "@azure/abort-controller"; +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike } + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal + }); + } + }; +} diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/models/index.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/models/index.ts new file mode 100644 index 000000000000..8e3235e91ab9 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/models/index.ts @@ -0,0 +1,728 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +/** List of deployment stacks. */ +export interface DeploymentStackListResult { + /** An array of deployment stacks. */ + value?: DeploymentStack[]; + /** + * The URL to use for getting the next set of results. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Entity representing the reference to the template. */ +export interface DeploymentStacksTemplateLink { + /** The URI of the template to deploy. Use either the uri or id property, but not both. */ + uri?: string; + /** The resource id of a Template Spec. Use either the id or uri property, but not both. */ + id?: string; + /** The relativePath property can be used to deploy a linked template at a location relative to the parent. If the parent template was linked with a TemplateSpec, this will reference an artifact in the TemplateSpec. If the parent was linked with a URI, the child deployment will be a combination of the parent and relativePath URIs */ + relativePath?: string; + /** The query string (for example, a SAS token) to be used with the templateLink URI. */ + queryString?: string; + /** If included, must match the ContentVersion in the template. */ + contentVersion?: string; +} + +/** Entity representing the reference to the deployment parameters. */ +export interface DeploymentStacksParametersLink { + /** The URI of the parameters file. */ + uri: string; + /** If included, must match the ContentVersion in the template. */ + contentVersion?: string; +} + +/** Defines the behavior of resources that are not managed immediately after the stack is updated. */ +export interface DeploymentStackPropertiesActionOnUnmanage { + /** Specifies the action that should be taken on the resource when the deployment stack is deleted. Delete will attempt to delete the resource from Azure. Detach will leave the resource in it's current state. */ + resources: DeploymentStacksDeleteDetachEnum; + /** Specifies the action that should be taken on the resource when the deployment stack is deleted. Delete will attempt to delete the resource from Azure. Detach will leave the resource in it's current state. */ + resourceGroups?: DeploymentStacksDeleteDetachEnum; + /** Specifies the action that should be taken on the resource when the deployment stack is deleted. Delete will attempt to delete the resource from Azure. Detach will leave the resource in it's current state. */ + managementGroups?: DeploymentStacksDeleteDetachEnum; +} + +/** The debug setting. */ +export interface DeploymentStacksDebugSetting { + /** Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information that is being passed in during deployment. By logging information about the request or response, sensitive data that is retrieved through the deployment operations could potentially be exposed. */ + detailLevel?: string; +} + +/** Defines how resources deployed by the deployment stack are locked. */ +export interface DenySettings { + /** denySettings Mode. */ + mode: DenySettingsMode; + /** List of AAD principal IDs excluded from the lock. Up to 5 principals are permitted. */ + excludedPrincipals?: string[]; + /** List of role-based management operations that are excluded from the denySettings. Up to 200 actions are permitted. If the denySetting mode is set to 'denyWriteAndDelete', then the following actions are automatically appended to 'excludedActions': '*\/read' and 'Microsoft.Authorization/locks/delete'. If the denySetting mode is set to 'denyDelete', then the following actions are automatically appended to 'excludedActions': 'Microsoft.Authorization/locks/delete'. Duplicate actions will be removed. */ + excludedActions?: string[]; + /** DenySettings will be applied to child scopes. */ + applyToChildScopes?: boolean; +} + +/** The resource Id model. */ +export interface ResourceReference { + /** + * The resourceId of a resource managed by the deployment stack. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; +} + +/** Deployment Stacks error response. */ +export interface DeploymentStacksError { + /** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ + error?: ErrorResponse; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** Common properties for all Azure resources. */ +export interface AzureResourceBase { + /** + * String Id used to locate any resource on Azure. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * Name of this resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Type of this resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** Export Template specific properties of the Stack. */ +export interface DeploymentStackTemplateDefinition { + /** The template content. Use this element to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. */ + template?: Record; + /** The URI of the template. Use either the templateLink property or the template property, but not both. */ + templateLink?: DeploymentStacksTemplateLink; +} + +/** The resource Id extended model. */ +export interface ResourceReferenceExtended + extends ResourceReference, + DeploymentStacksError {} + +/** The managed resource model. */ +export interface ManagedResourceReference extends ResourceReference { + /** Current management state of the resource in the deployment stack. */ + status?: ResourceStatusMode; + /** denyAssignment settings applied to the resource. */ + denyStatus?: DenyStatusMode; +} + +/** Deployment stack properties. */ +export interface DeploymentStackProperties extends DeploymentStacksError { + /** The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. */ + template?: Record; + /** The URI of the template. Use either the templateLink property or the template property, but not both. */ + templateLink?: DeploymentStacksTemplateLink; + /** Name and value pairs that define the deployment parameters for the template. Use this element when providing the parameter values directly in the request, rather than linking to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. */ + parameters?: Record; + /** The URI of parameters file. Use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. */ + parametersLink?: DeploymentStacksParametersLink; + /** Defines the behavior of resources that are not managed immediately after the stack is updated. */ + actionOnUnmanage: DeploymentStackPropertiesActionOnUnmanage; + /** The debug setting of the deployment. */ + debugSetting?: DeploymentStacksDebugSetting; + /** The scope at which the initial deployment should be created. If a scope is not specified, it will default to the scope of the deployment stack. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroupId}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'). */ + deploymentScope?: string; + /** Deployment stack description. */ + description?: string; + /** Defines how resources deployed by the stack are locked. */ + denySettings: DenySettings; + /** + * State of the deployment stack. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: DeploymentStackProvisioningState; + /** + * An array of resources that were detached during the most recent update. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly detachedResources?: ResourceReference[]; + /** + * An array of resources that were deleted during the most recent update. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly deletedResources?: ResourceReference[]; + /** + * An array of resources that failed to reach goal state during the most recent update. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly failedResources?: ResourceReferenceExtended[]; + /** + * An array of resources currently managed by the deployment stack. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resources?: ManagedResourceReference[]; + /** + * The resourceId of the deployment resource created by the deployment stack. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly deploymentId?: string; + /** + * The outputs of the underlying deployment. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly outputs?: Record; + /** + * The duration of the deployment stack update. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly duration?: string; +} + +/** Deployment stack object. */ +export interface DeploymentStack extends AzureResourceBase { + /** The location of the deployment stack. It cannot be changed after creation. It must be one of the supported Azure locations. */ + location?: string; + /** Deployment stack resource tags. */ + tags?: { [propertyName: string]: string }; + /** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ + error?: ErrorResponse; + /** The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. */ + template?: Record; + /** The URI of the template. Use either the templateLink property or the template property, but not both. */ + templateLink?: DeploymentStacksTemplateLink; + /** Name and value pairs that define the deployment parameters for the template. Use this element when providing the parameter values directly in the request, rather than linking to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. */ + parameters?: Record; + /** The URI of parameters file. Use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. */ + parametersLink?: DeploymentStacksParametersLink; + /** Defines the behavior of resources that are not managed immediately after the stack is updated. */ + actionOnUnmanage?: DeploymentStackPropertiesActionOnUnmanage; + /** The debug setting of the deployment. */ + debugSetting?: DeploymentStacksDebugSetting; + /** The scope at which the initial deployment should be created. If a scope is not specified, it will default to the scope of the deployment stack. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroupId}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'). */ + deploymentScope?: string; + /** Deployment stack description. */ + description?: string; + /** Defines how resources deployed by the stack are locked. */ + denySettings?: DenySettings; + /** + * State of the deployment stack. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: DeploymentStackProvisioningState; + /** + * An array of resources that were detached during the most recent update. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly detachedResources?: ResourceReference[]; + /** + * An array of resources that were deleted during the most recent update. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly deletedResources?: ResourceReference[]; + /** + * An array of resources that failed to reach goal state during the most recent update. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly failedResources?: ResourceReferenceExtended[]; + /** + * An array of resources currently managed by the deployment stack. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resources?: ManagedResourceReference[]; + /** + * The resourceId of the deployment resource created by the deployment stack. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly deploymentId?: string; + /** + * The outputs of the underlying deployment. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly outputs?: Record; + /** + * The duration of the deployment stack update. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly duration?: string; +} + +/** Defines headers for DeploymentStacks_deleteAtResourceGroup operation. */ +export interface DeploymentStacksDeleteAtResourceGroupHeaders { + location?: string; +} + +/** Defines headers for DeploymentStacks_deleteAtSubscription operation. */ +export interface DeploymentStacksDeleteAtSubscriptionHeaders { + location?: string; +} + +/** Defines headers for DeploymentStacks_deleteAtManagementGroup operation. */ +export interface DeploymentStacksDeleteAtManagementGroupHeaders { + location?: string; +} + +/** Known values of {@link DeploymentStacksDeleteDetachEnum} that the service accepts. */ +export enum KnownDeploymentStacksDeleteDetachEnum { + /** Delete */ + Delete = "delete", + /** Detach */ + Detach = "detach" +} + +/** + * Defines values for DeploymentStacksDeleteDetachEnum. \ + * {@link KnownDeploymentStacksDeleteDetachEnum} can be used interchangeably with DeploymentStacksDeleteDetachEnum, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **delete** \ + * **detach** + */ +export type DeploymentStacksDeleteDetachEnum = string; + +/** Known values of {@link DenySettingsMode} that the service accepts. */ +export enum KnownDenySettingsMode { + /** Authorized users are able to read and modify the resources, but cannot delete. */ + DenyDelete = "denyDelete", + /** Authorized users can only read from a resource, but cannot modify or delete it. */ + DenyWriteAndDelete = "denyWriteAndDelete", + /** No denyAssignments have been applied. */ + None = "none" +} + +/** + * Defines values for DenySettingsMode. \ + * {@link KnownDenySettingsMode} can be used interchangeably with DenySettingsMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **denyDelete**: Authorized users are able to read and modify the resources, but cannot delete. \ + * **denyWriteAndDelete**: Authorized users can only read from a resource, but cannot modify or delete it. \ + * **none**: No denyAssignments have been applied. + */ +export type DenySettingsMode = string; + +/** Known values of {@link DeploymentStackProvisioningState} that the service accepts. */ +export enum KnownDeploymentStackProvisioningState { + /** Creating */ + Creating = "Creating", + /** Validating */ + Validating = "Validating", + /** Waiting */ + Waiting = "Waiting", + /** Deploying */ + Deploying = "Deploying", + /** Canceling */ + Canceling = "Canceling", + /** Locking */ + Locking = "Locking", + /** DeletingResources */ + DeletingResources = "DeletingResources", + /** Succeeded */ + Succeeded = "Succeeded", + /** Failed */ + Failed = "Failed", + /** Canceled */ + Canceled = "Canceled", + /** Deleting */ + Deleting = "Deleting" +} + +/** + * Defines values for DeploymentStackProvisioningState. \ + * {@link KnownDeploymentStackProvisioningState} can be used interchangeably with DeploymentStackProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Creating** \ + * **Validating** \ + * **Waiting** \ + * **Deploying** \ + * **Canceling** \ + * **Locking** \ + * **DeletingResources** \ + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Deleting** + */ +export type DeploymentStackProvisioningState = string; + +/** Known values of {@link ResourceStatusMode} that the service accepts. */ +export enum KnownResourceStatusMode { + /** This resource is managed by the deployment stack. */ + Managed = "Managed", + /** Unable to remove the deny assignment on resource. */ + RemoveDenyFailed = "removeDenyFailed", + /** Unable to delete the resource from Azure. The delete will be retried on the next stack deployment, or can be deleted manually. */ + DeleteFailed = "deleteFailed", + /** No denyAssignments have been applied. */ + None = "None" +} + +/** + * Defines values for ResourceStatusMode. \ + * {@link KnownResourceStatusMode} can be used interchangeably with ResourceStatusMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Managed**: This resource is managed by the deployment stack. \ + * **removeDenyFailed**: Unable to remove the deny assignment on resource. \ + * **deleteFailed**: Unable to delete the resource from Azure. The delete will be retried on the next stack deployment, or can be deleted manually. \ + * **None**: No denyAssignments have been applied. + */ +export type ResourceStatusMode = string; + +/** Known values of {@link DenyStatusMode} that the service accepts. */ +export enum KnownDenyStatusMode { + /** Authorized users are able to read and modify the resources, but cannot delete. */ + DenyDelete = "denyDelete", + /** Resource type does not support denyAssignments. */ + NotSupported = "notSupported", + /** denyAssignments are not supported on resources outside the scope of the deployment stack. */ + Inapplicable = "inapplicable", + /** Authorized users can only read from a resource, but cannot modify or delete it. */ + DenyWriteAndDelete = "denyWriteAndDelete", + /** Deny assignment has been removed by Azure due to a resource management change (management group move, etc.) */ + RemovedBySystem = "removedBySystem", + /** No denyAssignments have been applied. */ + None = "None" +} + +/** + * Defines values for DenyStatusMode. \ + * {@link KnownDenyStatusMode} can be used interchangeably with DenyStatusMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **denyDelete**: Authorized users are able to read and modify the resources, but cannot delete. \ + * **notSupported**: Resource type does not support denyAssignments. \ + * **inapplicable**: denyAssignments are not supported on resources outside the scope of the deployment stack. \ + * **denyWriteAndDelete**: Authorized users can only read from a resource, but cannot modify or delete it. \ + * **removedBySystem**: Deny assignment has been removed by Azure due to a resource management change (management group move, etc.) \ + * **None**: No denyAssignments have been applied. + */ +export type DenyStatusMode = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Known values of {@link UnmanageActionResourceMode} that the service accepts. */ +export enum KnownUnmanageActionResourceMode { + /** Delete */ + Delete = "delete", + /** Detach */ + Detach = "detach" +} + +/** + * Defines values for UnmanageActionResourceMode. \ + * {@link KnownUnmanageActionResourceMode} can be used interchangeably with UnmanageActionResourceMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **delete** \ + * **detach** + */ +export type UnmanageActionResourceMode = string; + +/** Known values of {@link UnmanageActionResourceGroupMode} that the service accepts. */ +export enum KnownUnmanageActionResourceGroupMode { + /** Delete */ + Delete = "delete", + /** Detach */ + Detach = "detach" +} + +/** + * Defines values for UnmanageActionResourceGroupMode. \ + * {@link KnownUnmanageActionResourceGroupMode} can be used interchangeably with UnmanageActionResourceGroupMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **delete** \ + * **detach** + */ +export type UnmanageActionResourceGroupMode = string; + +/** Known values of {@link UnmanageActionManagementGroupMode} that the service accepts. */ +export enum KnownUnmanageActionManagementGroupMode { + /** Delete */ + Delete = "delete", + /** Detach */ + Detach = "detach" +} + +/** + * Defines values for UnmanageActionManagementGroupMode. \ + * {@link KnownUnmanageActionManagementGroupMode} can be used interchangeably with UnmanageActionManagementGroupMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **delete** \ + * **detach** + */ +export type UnmanageActionManagementGroupMode = string; + +/** Optional parameters. */ +export interface DeploymentStacksListAtResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listAtResourceGroup operation. */ +export type DeploymentStacksListAtResourceGroupResponse = DeploymentStackListResult; + +/** Optional parameters. */ +export interface DeploymentStacksListAtSubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listAtSubscription operation. */ +export type DeploymentStacksListAtSubscriptionResponse = DeploymentStackListResult; + +/** Optional parameters. */ +export interface DeploymentStacksListAtManagementGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listAtManagementGroup operation. */ +export type DeploymentStacksListAtManagementGroupResponse = DeploymentStackListResult; + +/** Optional parameters. */ +export interface DeploymentStacksCreateOrUpdateAtResourceGroupOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdateAtResourceGroup operation. */ +export type DeploymentStacksCreateOrUpdateAtResourceGroupResponse = DeploymentStack; + +/** Optional parameters. */ +export interface DeploymentStacksGetAtResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getAtResourceGroup operation. */ +export type DeploymentStacksGetAtResourceGroupResponse = DeploymentStack; + +/** Optional parameters. */ +export interface DeploymentStacksDeleteAtResourceGroupOptionalParams + extends coreClient.OperationOptions { + /** Flag to indicate delete rather than detach for the resources. */ + unmanageActionResources?: UnmanageActionResourceMode; + /** Flag to indicate delete rather than detach for the resource groups. */ + unmanageActionResourceGroups?: UnmanageActionResourceGroupMode; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface DeploymentStacksCreateOrUpdateAtSubscriptionOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdateAtSubscription operation. */ +export type DeploymentStacksCreateOrUpdateAtSubscriptionResponse = DeploymentStack; + +/** Optional parameters. */ +export interface DeploymentStacksGetAtSubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getAtSubscription operation. */ +export type DeploymentStacksGetAtSubscriptionResponse = DeploymentStack; + +/** Optional parameters. */ +export interface DeploymentStacksDeleteAtSubscriptionOptionalParams + extends coreClient.OperationOptions { + /** Flag to indicate delete rather than detach for the resources. */ + unmanageActionResources?: UnmanageActionResourceMode; + /** Flag to indicate delete rather than detach for the resource groups. */ + unmanageActionResourceGroups?: UnmanageActionResourceGroupMode; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface DeploymentStacksCreateOrUpdateAtManagementGroupOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdateAtManagementGroup operation. */ +export type DeploymentStacksCreateOrUpdateAtManagementGroupResponse = DeploymentStack; + +/** Optional parameters. */ +export interface DeploymentStacksGetAtManagementGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getAtManagementGroup operation. */ +export type DeploymentStacksGetAtManagementGroupResponse = DeploymentStack; + +/** Optional parameters. */ +export interface DeploymentStacksDeleteAtManagementGroupOptionalParams + extends coreClient.OperationOptions { + /** Flag to indicate delete rather than detach for the resources. */ + unmanageActionResources?: UnmanageActionResourceMode; + /** Flag to indicate delete rather than detach for the resource groups. */ + unmanageActionResourceGroups?: UnmanageActionResourceGroupMode; + /** Flag to indicate delete rather than detach for the management groups. */ + unmanageActionManagementGroups?: UnmanageActionManagementGroupMode; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface DeploymentStacksExportTemplateAtResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the exportTemplateAtResourceGroup operation. */ +export type DeploymentStacksExportTemplateAtResourceGroupResponse = DeploymentStackTemplateDefinition; + +/** Optional parameters. */ +export interface DeploymentStacksExportTemplateAtSubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the exportTemplateAtSubscription operation. */ +export type DeploymentStacksExportTemplateAtSubscriptionResponse = DeploymentStackTemplateDefinition; + +/** Optional parameters. */ +export interface DeploymentStacksExportTemplateAtManagementGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the exportTemplateAtManagementGroup operation. */ +export type DeploymentStacksExportTemplateAtManagementGroupResponse = DeploymentStackTemplateDefinition; + +/** Optional parameters. */ +export interface DeploymentStacksListAtResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listAtResourceGroupNext operation. */ +export type DeploymentStacksListAtResourceGroupNextResponse = DeploymentStackListResult; + +/** Optional parameters. */ +export interface DeploymentStacksListAtSubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listAtSubscriptionNext operation. */ +export type DeploymentStacksListAtSubscriptionNextResponse = DeploymentStackListResult; + +/** Optional parameters. */ +export interface DeploymentStacksListAtManagementGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listAtManagementGroupNext operation. */ +export type DeploymentStacksListAtManagementGroupNextResponse = DeploymentStackListResult; + +/** Optional parameters. */ +export interface DeploymentStacksClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/models/mappers.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/models/mappers.ts new file mode 100644 index 000000000000..0956116504b9 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/models/mappers.ts @@ -0,0 +1,828 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +export const DeploymentStackListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentStackListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DeploymentStack" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentStacksTemplateLink: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentStacksTemplateLink", + modelProperties: { + uri: { + serializedName: "uri", + type: { + name: "String" + } + }, + id: { + serializedName: "id", + type: { + name: "String" + } + }, + relativePath: { + serializedName: "relativePath", + type: { + name: "String" + } + }, + queryString: { + serializedName: "queryString", + type: { + name: "String" + } + }, + contentVersion: { + serializedName: "contentVersion", + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentStacksParametersLink: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentStacksParametersLink", + modelProperties: { + uri: { + serializedName: "uri", + required: true, + type: { + name: "String" + } + }, + contentVersion: { + serializedName: "contentVersion", + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentStackPropertiesActionOnUnmanage: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentStackPropertiesActionOnUnmanage", + modelProperties: { + resources: { + serializedName: "resources", + required: true, + type: { + name: "String" + } + }, + resourceGroups: { + serializedName: "resourceGroups", + type: { + name: "String" + } + }, + managementGroups: { + serializedName: "managementGroups", + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentStacksDebugSetting: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentStacksDebugSetting", + modelProperties: { + detailLevel: { + serializedName: "detailLevel", + type: { + name: "String" + } + } + } + } +}; + +export const DenySettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DenySettings", + modelProperties: { + mode: { + serializedName: "mode", + required: true, + type: { + name: "String" + } + }, + excludedPrincipals: { + serializedName: "excludedPrincipals", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + excludedActions: { + serializedName: "excludedActions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + applyToChildScopes: { + serializedName: "applyToChildScopes", + type: { + name: "Boolean" + } + } + } + } +}; + +export const ResourceReference: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceReference", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentStacksError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentStacksError", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorResponse" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const AzureResourceBase: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureResourceBase", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const DeploymentStackTemplateDefinition: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentStackTemplateDefinition", + modelProperties: { + template: { + serializedName: "template", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + templateLink: { + serializedName: "templateLink", + type: { + name: "Composite", + className: "DeploymentStacksTemplateLink" + } + } + } + } +}; + +export const ResourceReferenceExtended: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceReferenceExtended", + modelProperties: { + ...ResourceReference.type.modelProperties, + ...DeploymentStacksError.type.modelProperties + } + } +}; + +export const ManagedResourceReference: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedResourceReference", + modelProperties: { + ...ResourceReference.type.modelProperties, + status: { + defaultValue: "None", + serializedName: "status", + type: { + name: "String" + } + }, + denyStatus: { + defaultValue: "None", + serializedName: "denyStatus", + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentStackProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentStackProperties", + modelProperties: { + ...DeploymentStacksError.type.modelProperties, + template: { + serializedName: "template", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + templateLink: { + serializedName: "templateLink", + type: { + name: "Composite", + className: "DeploymentStacksTemplateLink" + } + }, + parameters: { + serializedName: "parameters", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + parametersLink: { + serializedName: "parametersLink", + type: { + name: "Composite", + className: "DeploymentStacksParametersLink" + } + }, + actionOnUnmanage: { + serializedName: "actionOnUnmanage", + type: { + name: "Composite", + className: "DeploymentStackPropertiesActionOnUnmanage" + } + }, + debugSetting: { + serializedName: "debugSetting", + type: { + name: "Composite", + className: "DeploymentStacksDebugSetting" + } + }, + deploymentScope: { + serializedName: "deploymentScope", + type: { + name: "String" + } + }, + description: { + constraints: { + MaxLength: 4096 + }, + serializedName: "description", + type: { + name: "String" + } + }, + denySettings: { + serializedName: "denySettings", + type: { + name: "Composite", + className: "DenySettings" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + detachedResources: { + serializedName: "detachedResources", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceReference" + } + } + } + }, + deletedResources: { + serializedName: "deletedResources", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceReference" + } + } + } + }, + failedResources: { + serializedName: "failedResources", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceReferenceExtended" + } + } + } + }, + resources: { + serializedName: "resources", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ManagedResourceReference" + } + } + } + }, + deploymentId: { + serializedName: "deploymentId", + readOnly: true, + type: { + name: "String" + } + }, + outputs: { + serializedName: "outputs", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + duration: { + serializedName: "duration", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentStack: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentStack", + modelProperties: { + ...AzureResourceBase.type.modelProperties, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + error: { + serializedName: "properties.error", + type: { + name: "Composite", + className: "ErrorResponse" + } + }, + template: { + serializedName: "properties.template", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + templateLink: { + serializedName: "properties.templateLink", + type: { + name: "Composite", + className: "DeploymentStacksTemplateLink" + } + }, + parameters: { + serializedName: "properties.parameters", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + parametersLink: { + serializedName: "properties.parametersLink", + type: { + name: "Composite", + className: "DeploymentStacksParametersLink" + } + }, + actionOnUnmanage: { + serializedName: "properties.actionOnUnmanage", + type: { + name: "Composite", + className: "DeploymentStackPropertiesActionOnUnmanage" + } + }, + debugSetting: { + serializedName: "properties.debugSetting", + type: { + name: "Composite", + className: "DeploymentStacksDebugSetting" + } + }, + deploymentScope: { + serializedName: "properties.deploymentScope", + type: { + name: "String" + } + }, + description: { + constraints: { + MaxLength: 4096 + }, + serializedName: "properties.description", + type: { + name: "String" + } + }, + denySettings: { + serializedName: "properties.denySettings", + type: { + name: "Composite", + className: "DenySettings" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + detachedResources: { + serializedName: "properties.detachedResources", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceReference" + } + } + } + }, + deletedResources: { + serializedName: "properties.deletedResources", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceReference" + } + } + } + }, + failedResources: { + serializedName: "properties.failedResources", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceReferenceExtended" + } + } + } + }, + resources: { + serializedName: "properties.resources", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ManagedResourceReference" + } + } + } + }, + deploymentId: { + serializedName: "properties.deploymentId", + readOnly: true, + type: { + name: "String" + } + }, + outputs: { + serializedName: "properties.outputs", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + duration: { + serializedName: "properties.duration", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentStacksDeleteAtResourceGroupHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentStacksDeleteAtResourceGroupHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentStacksDeleteAtSubscriptionHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentStacksDeleteAtSubscriptionHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentStacksDeleteAtManagementGroupHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentStacksDeleteAtManagementGroupHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/models/parameters.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/models/parameters.ts new file mode 100644 index 000000000000..41f95a3608af --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/models/parameters.ts @@ -0,0 +1,170 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { DeploymentStack as DeploymentStackMapper } from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + constraints: { + MinLength: 1 + }, + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1 + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-08-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const managementGroupId: OperationURLParameter = { + parameterPath: "managementGroupId", + mapper: { + constraints: { + Pattern: new RegExp("^[-\\w\\._\\(\\)]+$"), + MaxLength: 90, + MinLength: 1 + }, + serializedName: "managementGroupId", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const deploymentStack: OperationParameter = { + parameterPath: "deploymentStack", + mapper: DeploymentStackMapper +}; + +export const deploymentStackName: OperationURLParameter = { + parameterPath: "deploymentStackName", + mapper: { + constraints: { + Pattern: new RegExp("^[-\\w\\._\\(\\)]+$"), + MaxLength: 90, + MinLength: 1 + }, + serializedName: "deploymentStackName", + required: true, + type: { + name: "String" + } + } +}; + +export const unmanageActionResources: OperationQueryParameter = { + parameterPath: ["options", "unmanageActionResources"], + mapper: { + serializedName: "unmanageAction.Resources", + type: { + name: "String" + } + } +}; + +export const unmanageActionResourceGroups: OperationQueryParameter = { + parameterPath: ["options", "unmanageActionResourceGroups"], + mapper: { + serializedName: "unmanageAction.ResourceGroups", + type: { + name: "String" + } + } +}; + +export const unmanageActionManagementGroups: OperationQueryParameter = { + parameterPath: ["options", "unmanageActionManagementGroups"], + mapper: { + serializedName: "unmanageAction.ManagementGroups", + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/operations/deploymentStacks.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/operations/deploymentStacks.ts new file mode 100644 index 000000000000..e0de1f8c1509 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/operations/deploymentStacks.ts @@ -0,0 +1,1420 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { DeploymentStacks } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { DeploymentStacksClient } from "../deploymentStacksClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + DeploymentStack, + DeploymentStacksListAtResourceGroupNextOptionalParams, + DeploymentStacksListAtResourceGroupOptionalParams, + DeploymentStacksListAtResourceGroupResponse, + DeploymentStacksListAtSubscriptionNextOptionalParams, + DeploymentStacksListAtSubscriptionOptionalParams, + DeploymentStacksListAtSubscriptionResponse, + DeploymentStacksListAtManagementGroupNextOptionalParams, + DeploymentStacksListAtManagementGroupOptionalParams, + DeploymentStacksListAtManagementGroupResponse, + DeploymentStacksCreateOrUpdateAtResourceGroupOptionalParams, + DeploymentStacksCreateOrUpdateAtResourceGroupResponse, + DeploymentStacksGetAtResourceGroupOptionalParams, + DeploymentStacksGetAtResourceGroupResponse, + DeploymentStacksDeleteAtResourceGroupOptionalParams, + DeploymentStacksCreateOrUpdateAtSubscriptionOptionalParams, + DeploymentStacksCreateOrUpdateAtSubscriptionResponse, + DeploymentStacksGetAtSubscriptionOptionalParams, + DeploymentStacksGetAtSubscriptionResponse, + DeploymentStacksDeleteAtSubscriptionOptionalParams, + DeploymentStacksCreateOrUpdateAtManagementGroupOptionalParams, + DeploymentStacksCreateOrUpdateAtManagementGroupResponse, + DeploymentStacksGetAtManagementGroupOptionalParams, + DeploymentStacksGetAtManagementGroupResponse, + DeploymentStacksDeleteAtManagementGroupOptionalParams, + DeploymentStacksExportTemplateAtResourceGroupOptionalParams, + DeploymentStacksExportTemplateAtResourceGroupResponse, + DeploymentStacksExportTemplateAtSubscriptionOptionalParams, + DeploymentStacksExportTemplateAtSubscriptionResponse, + DeploymentStacksExportTemplateAtManagementGroupOptionalParams, + DeploymentStacksExportTemplateAtManagementGroupResponse, + DeploymentStacksListAtResourceGroupNextResponse, + DeploymentStacksListAtSubscriptionNextResponse, + DeploymentStacksListAtManagementGroupNextResponse +} from "../models"; + +/// +/** Class containing DeploymentStacks operations. */ +export class DeploymentStacksImpl implements DeploymentStacks { + private readonly client: DeploymentStacksClient; + + /** + * Initialize a new instance of the class DeploymentStacks class. + * @param client Reference to the service client + */ + constructor(client: DeploymentStacksClient) { + this.client = client; + } + + /** + * Lists all the Deployment Stacks within the specified resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listAtResourceGroup( + resourceGroupName: string, + options?: DeploymentStacksListAtResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listAtResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listAtResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); + } + }; + } + + private async *listAtResourceGroupPagingPage( + resourceGroupName: string, + options?: DeploymentStacksListAtResourceGroupOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: DeploymentStacksListAtResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listAtResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listAtResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listAtResourceGroupPagingAll( + resourceGroupName: string, + options?: DeploymentStacksListAtResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listAtResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Lists all the Deployment Stacks within the specified subscription. + * @param options The options parameters. + */ + public listAtSubscription( + options?: DeploymentStacksListAtSubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listAtSubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listAtSubscriptionPagingPage(options, settings); + } + }; + } + + private async *listAtSubscriptionPagingPage( + options?: DeploymentStacksListAtSubscriptionOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: DeploymentStacksListAtSubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listAtSubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listAtSubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listAtSubscriptionPagingAll( + options?: DeploymentStacksListAtSubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listAtSubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Lists all the Deployment Stacks within the specified management group. + * @param managementGroupId Management Group. + * @param options The options parameters. + */ + public listAtManagementGroup( + managementGroupId: string, + options?: DeploymentStacksListAtManagementGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listAtManagementGroupPagingAll( + managementGroupId, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listAtManagementGroupPagingPage( + managementGroupId, + options, + settings + ); + } + }; + } + + private async *listAtManagementGroupPagingPage( + managementGroupId: string, + options?: DeploymentStacksListAtManagementGroupOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: DeploymentStacksListAtManagementGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listAtManagementGroup(managementGroupId, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listAtManagementGroupNext( + managementGroupId, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listAtManagementGroupPagingAll( + managementGroupId: string, + options?: DeploymentStacksListAtManagementGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listAtManagementGroupPagingPage( + managementGroupId, + options + )) { + yield* page; + } + } + + /** + * Lists all the Deployment Stacks within the specified resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _listAtResourceGroup( + resourceGroupName: string, + options?: DeploymentStacksListAtResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listAtResourceGroupOperationSpec + ); + } + + /** + * Lists all the Deployment Stacks within the specified subscription. + * @param options The options parameters. + */ + private _listAtSubscription( + options?: DeploymentStacksListAtSubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listAtSubscriptionOperationSpec + ); + } + + /** + * Lists all the Deployment Stacks within the specified management group. + * @param managementGroupId Management Group. + * @param options The options parameters. + */ + private _listAtManagementGroup( + managementGroupId: string, + options?: DeploymentStacksListAtManagementGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { managementGroupId, options }, + listAtManagementGroupOperationSpec + ); + } + + /** + * Creates or updates a Deployment Stack. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentStackName Name of the deployment stack. + * @param deploymentStack Deployment Stack supplied to the operation. + * @param options The options parameters. + */ + async beginCreateOrUpdateAtResourceGroup( + resourceGroupName: string, + deploymentStackName: string, + deploymentStack: DeploymentStack, + options?: DeploymentStacksCreateOrUpdateAtResourceGroupOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeploymentStacksCreateOrUpdateAtResourceGroupResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + deploymentStackName, + deploymentStack, + options + }, + spec: createOrUpdateAtResourceGroupOperationSpec + }); + const poller = await createHttpPoller< + DeploymentStacksCreateOrUpdateAtResourceGroupResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Creates or updates a Deployment Stack. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentStackName Name of the deployment stack. + * @param deploymentStack Deployment Stack supplied to the operation. + * @param options The options parameters. + */ + async beginCreateOrUpdateAtResourceGroupAndWait( + resourceGroupName: string, + deploymentStackName: string, + deploymentStack: DeploymentStack, + options?: DeploymentStacksCreateOrUpdateAtResourceGroupOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdateAtResourceGroup( + resourceGroupName, + deploymentStackName, + deploymentStack, + options + ); + return poller.pollUntilDone(); + } + + /** + * Gets a Deployment Stack with a given name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + getAtResourceGroup( + resourceGroupName: string, + deploymentStackName: string, + options?: DeploymentStacksGetAtResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, deploymentStackName, options }, + getAtResourceGroupOperationSpec + ); + } + + /** + * Deletes a Deployment Stack by name. When operation completes, status code 200 returned without + * content. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + async beginDeleteAtResourceGroup( + resourceGroupName: string, + deploymentStackName: string, + options?: DeploymentStacksDeleteAtResourceGroupOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, deploymentStackName, options }, + spec: deleteAtResourceGroupOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a Deployment Stack by name. When operation completes, status code 200 returned without + * content. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + async beginDeleteAtResourceGroupAndWait( + resourceGroupName: string, + deploymentStackName: string, + options?: DeploymentStacksDeleteAtResourceGroupOptionalParams + ): Promise { + const poller = await this.beginDeleteAtResourceGroup( + resourceGroupName, + deploymentStackName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Creates or updates a Deployment Stack. + * @param deploymentStackName Name of the deployment stack. + * @param deploymentStack Deployment Stack supplied to the operation. + * @param options The options parameters. + */ + async beginCreateOrUpdateAtSubscription( + deploymentStackName: string, + deploymentStack: DeploymentStack, + options?: DeploymentStacksCreateOrUpdateAtSubscriptionOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeploymentStacksCreateOrUpdateAtSubscriptionResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { deploymentStackName, deploymentStack, options }, + spec: createOrUpdateAtSubscriptionOperationSpec + }); + const poller = await createHttpPoller< + DeploymentStacksCreateOrUpdateAtSubscriptionResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Creates or updates a Deployment Stack. + * @param deploymentStackName Name of the deployment stack. + * @param deploymentStack Deployment Stack supplied to the operation. + * @param options The options parameters. + */ + async beginCreateOrUpdateAtSubscriptionAndWait( + deploymentStackName: string, + deploymentStack: DeploymentStack, + options?: DeploymentStacksCreateOrUpdateAtSubscriptionOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdateAtSubscription( + deploymentStackName, + deploymentStack, + options + ); + return poller.pollUntilDone(); + } + + /** + * Gets a Deployment Stack with a given name. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + getAtSubscription( + deploymentStackName: string, + options?: DeploymentStacksGetAtSubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { deploymentStackName, options }, + getAtSubscriptionOperationSpec + ); + } + + /** + * Deletes a Deployment Stack by name. When operation completes, status code 200 returned without + * content. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + async beginDeleteAtSubscription( + deploymentStackName: string, + options?: DeploymentStacksDeleteAtSubscriptionOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { deploymentStackName, options }, + spec: deleteAtSubscriptionOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a Deployment Stack by name. When operation completes, status code 200 returned without + * content. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + async beginDeleteAtSubscriptionAndWait( + deploymentStackName: string, + options?: DeploymentStacksDeleteAtSubscriptionOptionalParams + ): Promise { + const poller = await this.beginDeleteAtSubscription( + deploymentStackName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Creates or updates a Deployment Stack. + * @param managementGroupId Management Group. + * @param deploymentStackName Name of the deployment stack. + * @param deploymentStack Deployment Stack supplied to the operation. + * @param options The options parameters. + */ + async beginCreateOrUpdateAtManagementGroup( + managementGroupId: string, + deploymentStackName: string, + deploymentStack: DeploymentStack, + options?: DeploymentStacksCreateOrUpdateAtManagementGroupOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeploymentStacksCreateOrUpdateAtManagementGroupResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + managementGroupId, + deploymentStackName, + deploymentStack, + options + }, + spec: createOrUpdateAtManagementGroupOperationSpec + }); + const poller = await createHttpPoller< + DeploymentStacksCreateOrUpdateAtManagementGroupResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Creates or updates a Deployment Stack. + * @param managementGroupId Management Group. + * @param deploymentStackName Name of the deployment stack. + * @param deploymentStack Deployment Stack supplied to the operation. + * @param options The options parameters. + */ + async beginCreateOrUpdateAtManagementGroupAndWait( + managementGroupId: string, + deploymentStackName: string, + deploymentStack: DeploymentStack, + options?: DeploymentStacksCreateOrUpdateAtManagementGroupOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdateAtManagementGroup( + managementGroupId, + deploymentStackName, + deploymentStack, + options + ); + return poller.pollUntilDone(); + } + + /** + * Gets a Deployment Stack with a given name. + * @param managementGroupId Management Group. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + getAtManagementGroup( + managementGroupId: string, + deploymentStackName: string, + options?: DeploymentStacksGetAtManagementGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { managementGroupId, deploymentStackName, options }, + getAtManagementGroupOperationSpec + ); + } + + /** + * Deletes a Deployment Stack by name. When operation completes, status code 200 returned without + * content. + * @param managementGroupId Management Group. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + async beginDeleteAtManagementGroup( + managementGroupId: string, + deploymentStackName: string, + options?: DeploymentStacksDeleteAtManagementGroupOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { managementGroupId, deploymentStackName, options }, + spec: deleteAtManagementGroupOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a Deployment Stack by name. When operation completes, status code 200 returned without + * content. + * @param managementGroupId Management Group. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + async beginDeleteAtManagementGroupAndWait( + managementGroupId: string, + deploymentStackName: string, + options?: DeploymentStacksDeleteAtManagementGroupOptionalParams + ): Promise { + const poller = await this.beginDeleteAtManagementGroup( + managementGroupId, + deploymentStackName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Exports the template used to create the deployment stack. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + exportTemplateAtResourceGroup( + resourceGroupName: string, + deploymentStackName: string, + options?: DeploymentStacksExportTemplateAtResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, deploymentStackName, options }, + exportTemplateAtResourceGroupOperationSpec + ); + } + + /** + * Exports the template used to create the deployment stack. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + exportTemplateAtSubscription( + deploymentStackName: string, + options?: DeploymentStacksExportTemplateAtSubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { deploymentStackName, options }, + exportTemplateAtSubscriptionOperationSpec + ); + } + + /** + * Exports the template used to create the deployment stack. + * @param managementGroupId Management Group. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + exportTemplateAtManagementGroup( + managementGroupId: string, + deploymentStackName: string, + options?: DeploymentStacksExportTemplateAtManagementGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { managementGroupId, deploymentStackName, options }, + exportTemplateAtManagementGroupOperationSpec + ); + } + + /** + * ListAtResourceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListAtResourceGroup method. + * @param options The options parameters. + */ + private _listAtResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: DeploymentStacksListAtResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listAtResourceGroupNextOperationSpec + ); + } + + /** + * ListAtSubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListAtSubscription method. + * @param options The options parameters. + */ + private _listAtSubscriptionNext( + nextLink: string, + options?: DeploymentStacksListAtSubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listAtSubscriptionNextOperationSpec + ); + } + + /** + * ListAtManagementGroupNext + * @param managementGroupId Management Group. + * @param nextLink The nextLink from the previous successful call to the ListAtManagementGroup method. + * @param options The options parameters. + */ + private _listAtManagementGroupNext( + managementGroupId: string, + nextLink: string, + options?: DeploymentStacksListAtManagementGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { managementGroupId, nextLink, options }, + listAtManagementGroupNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listAtResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStackListResult + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listAtSubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStackListResult + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listAtManagementGroupOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStackListResult + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.managementGroupId], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateAtResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStack + }, + 201: { + bodyMapper: Mappers.DeploymentStack + }, + 202: { + bodyMapper: Mappers.DeploymentStack + }, + 204: { + bodyMapper: Mappers.DeploymentStack + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + requestBody: Parameters.deploymentStack, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.deploymentStackName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getAtResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStack + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.deploymentStackName + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteAtResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.unmanageActionResources, + Parameters.unmanageActionResourceGroups + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.deploymentStackName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateAtSubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStack + }, + 201: { + bodyMapper: Mappers.DeploymentStack + }, + 202: { + bodyMapper: Mappers.DeploymentStack + }, + 204: { + bodyMapper: Mappers.DeploymentStack + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + requestBody: Parameters.deploymentStack, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.deploymentStackName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getAtSubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStack + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.deploymentStackName + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteAtSubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.unmanageActionResources, + Parameters.unmanageActionResourceGroups + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.deploymentStackName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateAtManagementGroupOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStack + }, + 201: { + bodyMapper: Mappers.DeploymentStack + }, + 202: { + bodyMapper: Mappers.DeploymentStack + }, + 204: { + bodyMapper: Mappers.DeploymentStack + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + requestBody: Parameters.deploymentStack, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.managementGroupId, + Parameters.deploymentStackName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getAtManagementGroupOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStack + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.managementGroupId, + Parameters.deploymentStackName + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteAtManagementGroupOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.unmanageActionResources, + Parameters.unmanageActionResourceGroups, + Parameters.unmanageActionManagementGroups + ], + urlParameters: [ + Parameters.$host, + Parameters.managementGroupId, + Parameters.deploymentStackName + ], + headerParameters: [Parameters.accept], + serializer +}; +const exportTemplateAtResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStackTemplateDefinition + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.deploymentStackName + ], + headerParameters: [Parameters.accept], + serializer +}; +const exportTemplateAtSubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStackTemplateDefinition + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.deploymentStackName + ], + headerParameters: [Parameters.accept], + serializer +}; +const exportTemplateAtManagementGroupOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStackTemplateDefinition + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.managementGroupId, + Parameters.deploymentStackName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listAtResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStackListResult + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listAtSubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStackListResult + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listAtManagementGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStackListResult + }, + default: { + bodyMapper: Mappers.DeploymentStacksError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.managementGroupId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/operations/index.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/operations/index.ts new file mode 100644 index 000000000000..20147805c5dc --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/operations/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./deploymentStacks"; diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/operationsInterfaces/deploymentStacks.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/operationsInterfaces/deploymentStacks.ts new file mode 100644 index 000000000000..0d6d777058fc --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/operationsInterfaces/deploymentStacks.ts @@ -0,0 +1,286 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + DeploymentStack, + DeploymentStacksListAtResourceGroupOptionalParams, + DeploymentStacksListAtSubscriptionOptionalParams, + DeploymentStacksListAtManagementGroupOptionalParams, + DeploymentStacksCreateOrUpdateAtResourceGroupOptionalParams, + DeploymentStacksCreateOrUpdateAtResourceGroupResponse, + DeploymentStacksGetAtResourceGroupOptionalParams, + DeploymentStacksGetAtResourceGroupResponse, + DeploymentStacksDeleteAtResourceGroupOptionalParams, + DeploymentStacksCreateOrUpdateAtSubscriptionOptionalParams, + DeploymentStacksCreateOrUpdateAtSubscriptionResponse, + DeploymentStacksGetAtSubscriptionOptionalParams, + DeploymentStacksGetAtSubscriptionResponse, + DeploymentStacksDeleteAtSubscriptionOptionalParams, + DeploymentStacksCreateOrUpdateAtManagementGroupOptionalParams, + DeploymentStacksCreateOrUpdateAtManagementGroupResponse, + DeploymentStacksGetAtManagementGroupOptionalParams, + DeploymentStacksGetAtManagementGroupResponse, + DeploymentStacksDeleteAtManagementGroupOptionalParams, + DeploymentStacksExportTemplateAtResourceGroupOptionalParams, + DeploymentStacksExportTemplateAtResourceGroupResponse, + DeploymentStacksExportTemplateAtSubscriptionOptionalParams, + DeploymentStacksExportTemplateAtSubscriptionResponse, + DeploymentStacksExportTemplateAtManagementGroupOptionalParams, + DeploymentStacksExportTemplateAtManagementGroupResponse +} from "../models"; + +/// +/** Interface representing a DeploymentStacks. */ +export interface DeploymentStacks { + /** + * Lists all the Deployment Stacks within the specified resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listAtResourceGroup( + resourceGroupName: string, + options?: DeploymentStacksListAtResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists all the Deployment Stacks within the specified subscription. + * @param options The options parameters. + */ + listAtSubscription( + options?: DeploymentStacksListAtSubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists all the Deployment Stacks within the specified management group. + * @param managementGroupId Management Group. + * @param options The options parameters. + */ + listAtManagementGroup( + managementGroupId: string, + options?: DeploymentStacksListAtManagementGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Creates or updates a Deployment Stack. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentStackName Name of the deployment stack. + * @param deploymentStack Deployment Stack supplied to the operation. + * @param options The options parameters. + */ + beginCreateOrUpdateAtResourceGroup( + resourceGroupName: string, + deploymentStackName: string, + deploymentStack: DeploymentStack, + options?: DeploymentStacksCreateOrUpdateAtResourceGroupOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeploymentStacksCreateOrUpdateAtResourceGroupResponse + > + >; + /** + * Creates or updates a Deployment Stack. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentStackName Name of the deployment stack. + * @param deploymentStack Deployment Stack supplied to the operation. + * @param options The options parameters. + */ + beginCreateOrUpdateAtResourceGroupAndWait( + resourceGroupName: string, + deploymentStackName: string, + deploymentStack: DeploymentStack, + options?: DeploymentStacksCreateOrUpdateAtResourceGroupOptionalParams + ): Promise; + /** + * Gets a Deployment Stack with a given name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + getAtResourceGroup( + resourceGroupName: string, + deploymentStackName: string, + options?: DeploymentStacksGetAtResourceGroupOptionalParams + ): Promise; + /** + * Deletes a Deployment Stack by name. When operation completes, status code 200 returned without + * content. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + beginDeleteAtResourceGroup( + resourceGroupName: string, + deploymentStackName: string, + options?: DeploymentStacksDeleteAtResourceGroupOptionalParams + ): Promise, void>>; + /** + * Deletes a Deployment Stack by name. When operation completes, status code 200 returned without + * content. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + beginDeleteAtResourceGroupAndWait( + resourceGroupName: string, + deploymentStackName: string, + options?: DeploymentStacksDeleteAtResourceGroupOptionalParams + ): Promise; + /** + * Creates or updates a Deployment Stack. + * @param deploymentStackName Name of the deployment stack. + * @param deploymentStack Deployment Stack supplied to the operation. + * @param options The options parameters. + */ + beginCreateOrUpdateAtSubscription( + deploymentStackName: string, + deploymentStack: DeploymentStack, + options?: DeploymentStacksCreateOrUpdateAtSubscriptionOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeploymentStacksCreateOrUpdateAtSubscriptionResponse + > + >; + /** + * Creates or updates a Deployment Stack. + * @param deploymentStackName Name of the deployment stack. + * @param deploymentStack Deployment Stack supplied to the operation. + * @param options The options parameters. + */ + beginCreateOrUpdateAtSubscriptionAndWait( + deploymentStackName: string, + deploymentStack: DeploymentStack, + options?: DeploymentStacksCreateOrUpdateAtSubscriptionOptionalParams + ): Promise; + /** + * Gets a Deployment Stack with a given name. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + getAtSubscription( + deploymentStackName: string, + options?: DeploymentStacksGetAtSubscriptionOptionalParams + ): Promise; + /** + * Deletes a Deployment Stack by name. When operation completes, status code 200 returned without + * content. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + beginDeleteAtSubscription( + deploymentStackName: string, + options?: DeploymentStacksDeleteAtSubscriptionOptionalParams + ): Promise, void>>; + /** + * Deletes a Deployment Stack by name. When operation completes, status code 200 returned without + * content. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + beginDeleteAtSubscriptionAndWait( + deploymentStackName: string, + options?: DeploymentStacksDeleteAtSubscriptionOptionalParams + ): Promise; + /** + * Creates or updates a Deployment Stack. + * @param managementGroupId Management Group. + * @param deploymentStackName Name of the deployment stack. + * @param deploymentStack Deployment Stack supplied to the operation. + * @param options The options parameters. + */ + beginCreateOrUpdateAtManagementGroup( + managementGroupId: string, + deploymentStackName: string, + deploymentStack: DeploymentStack, + options?: DeploymentStacksCreateOrUpdateAtManagementGroupOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeploymentStacksCreateOrUpdateAtManagementGroupResponse + > + >; + /** + * Creates or updates a Deployment Stack. + * @param managementGroupId Management Group. + * @param deploymentStackName Name of the deployment stack. + * @param deploymentStack Deployment Stack supplied to the operation. + * @param options The options parameters. + */ + beginCreateOrUpdateAtManagementGroupAndWait( + managementGroupId: string, + deploymentStackName: string, + deploymentStack: DeploymentStack, + options?: DeploymentStacksCreateOrUpdateAtManagementGroupOptionalParams + ): Promise; + /** + * Gets a Deployment Stack with a given name. + * @param managementGroupId Management Group. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + getAtManagementGroup( + managementGroupId: string, + deploymentStackName: string, + options?: DeploymentStacksGetAtManagementGroupOptionalParams + ): Promise; + /** + * Deletes a Deployment Stack by name. When operation completes, status code 200 returned without + * content. + * @param managementGroupId Management Group. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + beginDeleteAtManagementGroup( + managementGroupId: string, + deploymentStackName: string, + options?: DeploymentStacksDeleteAtManagementGroupOptionalParams + ): Promise, void>>; + /** + * Deletes a Deployment Stack by name. When operation completes, status code 200 returned without + * content. + * @param managementGroupId Management Group. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + beginDeleteAtManagementGroupAndWait( + managementGroupId: string, + deploymentStackName: string, + options?: DeploymentStacksDeleteAtManagementGroupOptionalParams + ): Promise; + /** + * Exports the template used to create the deployment stack. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + exportTemplateAtResourceGroup( + resourceGroupName: string, + deploymentStackName: string, + options?: DeploymentStacksExportTemplateAtResourceGroupOptionalParams + ): Promise; + /** + * Exports the template used to create the deployment stack. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + exportTemplateAtSubscription( + deploymentStackName: string, + options?: DeploymentStacksExportTemplateAtSubscriptionOptionalParams + ): Promise; + /** + * Exports the template used to create the deployment stack. + * @param managementGroupId Management Group. + * @param deploymentStackName Name of the deployment stack. + * @param options The options parameters. + */ + exportTemplateAtManagementGroup( + managementGroupId: string, + deploymentStackName: string, + options?: DeploymentStacksExportTemplateAtManagementGroupOptionalParams + ): Promise; +} diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/operationsInterfaces/index.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..20147805c5dc --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/operationsInterfaces/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./deploymentStacks"; diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/pagingHelper.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/test/resourcesdeploymentstacks_operations_test.spec.ts b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/test/resourcesdeploymentstacks_operations_test.spec.ts new file mode 100644 index 000000000000..88b688123c22 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/test/resourcesdeploymentstacks_operations_test.spec.ts @@ -0,0 +1,139 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + Recorder, + RecorderStartOptions, + delay, + isPlaybackMode, +} from "@azure-tools/test-recorder"; +import { createTestCredential } from "@azure-tools/test-credential"; +import { assert } from "chai"; +import { Context } from "mocha"; +import { DeploymentStacksClient } from "../src/deploymentStacksClient"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +export const testPollingOptions = { + updateIntervalInMs: isPlaybackMode() ? 0 : undefined, +}; + +describe("DeploymentStacks test", () => { + let recorder: Recorder; + let subscriptionId: string; + let client: DeploymentStacksClient; + let location: string; + let resourceGroup: string; + let resourcename: string; + + beforeEach(async function (this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + subscriptionId = env.SUBSCRIPTION_ID || ''; + // This is an example of how the environment variables are used + const credential = createTestCredential(); + client = new DeploymentStacksClient(credential, subscriptionId, recorder.configureClientOptions({})); + location = "eastus"; + resourceGroup = "myjstest"; + resourcename = "resourcetest"; + + }); + + afterEach(async function () { + await recorder.stop(); + }); + + it("deploymentStacks create test", async function () { + const res = await client.deploymentStacks.beginCreateOrUpdateAtResourceGroupAndWait( + resourceGroup, + resourcename, + { + actionOnUnmanage: { + resources: "delete" + }, + denySettings: { + applyToChildScopes: false, + excludedActions: ["action"], + excludedPrincipals: ["principal"], + mode: "denyDelete" + }, + template:{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "foo": { + "type": "string", + "defaultValue": "foo", + "metadata": { + "description": "description" + } + }, + "bar": { + "type": "string", + "defaultValue": "bar", + "metadata": { + "description": "description" + } + } + }, + "functions": [], + "variables": { + + }, + "resources": [], + "outputs": { + "foo": { + "type": "string", + "value": "[parameters('foo')]" + }, + "bar": { + "type": "string", + "value": "[parameters('bar')]" + } + } + }, + tags: { tagkey: "tagVal" } + }, + testPollingOptions); + assert.equal(res.name, resourcename); + }); + + it("deploymentStacks get test", async function () { + const res = await client.deploymentStacks.getAtResourceGroup(resourceGroup, + resourcename); + assert.equal(res.name, resourcename); + }); + + it("deploymentStacks list test", async function () { + const resArray = new Array(); + for await (let item of client.deploymentStacks.listAtResourceGroup(resourceGroup)) { + resArray.push(item); + } + assert.equal(resArray.length, 1); + }); + + it("deploymentStacks delete test", async function () { + const resArray = new Array(); + const res = await client.deploymentStacks.beginDeleteAtResourceGroupAndWait(resourceGroup, resourcename +) + for await (let item of client.deploymentStacks.listAtResourceGroup(resourceGroup)) { + resArray.push(item); + } + assert.equal(resArray.length, 0); + }); +}) diff --git a/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/tsconfig.json b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/tsconfig.json new file mode 100644 index 000000000000..322d36191552 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true, + "paths": { + "@azure/arm-resourcesdeploymentstacks": [ + "./src/index" + ] + } + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/resourcesdeploymentstacks/ci.mgmt.yml b/sdk/resourcesdeploymentstacks/ci.mgmt.yml new file mode 100644 index 000000000000..13e6cc070121 --- /dev/null +++ b/sdk/resourcesdeploymentstacks/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks + - sdk/resourcesdeploymentstacks/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks + - sdk/resourcesdeploymentstacks/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: resourcesdeploymentstacks + Artifacts: + - name: azure-arm-resourcesdeploymentstacks + safeName: azurearmresourcesdeploymentstacks + \ No newline at end of file