Родитель
a8543fc22a
Коммит
db18b89c7b
|
@ -41,6 +41,7 @@ specifiers:
|
|||
'@rush-temp/arm-cdn': file:./projects/arm-cdn.tgz
|
||||
'@rush-temp/arm-changeanalysis': file:./projects/arm-changeanalysis.tgz
|
||||
'@rush-temp/arm-changes': file:./projects/arm-changes.tgz
|
||||
'@rush-temp/arm-chaos': file:./projects/arm-chaos.tgz
|
||||
'@rush-temp/arm-cognitiveservices': file:./projects/arm-cognitiveservices.tgz
|
||||
'@rush-temp/arm-commerce': file:./projects/arm-commerce.tgz
|
||||
'@rush-temp/arm-commerce-profile-2020-09-01-hybrid': file:./projects/arm-commerce-profile-2020-09-01-hybrid.tgz
|
||||
|
@ -349,6 +350,7 @@ dependencies:
|
|||
'@rush-temp/arm-cdn': file:projects/arm-cdn.tgz
|
||||
'@rush-temp/arm-changeanalysis': file:projects/arm-changeanalysis.tgz
|
||||
'@rush-temp/arm-changes': file:projects/arm-changes.tgz
|
||||
'@rush-temp/arm-chaos': file:projects/arm-chaos.tgz
|
||||
'@rush-temp/arm-cognitiveservices': file:projects/arm-cognitiveservices.tgz
|
||||
'@rush-temp/arm-commerce': file:projects/arm-commerce.tgz
|
||||
'@rush-temp/arm-commerce-profile-2020-09-01-hybrid': file:projects/arm-commerce-profile-2020-09-01-hybrid.tgz
|
||||
|
@ -10787,6 +10789,33 @@ packages:
|
|||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-chaos.tgz:
|
||||
resolution: {integrity: sha512-MsUqKhZRz/N+z9NC1YYRwfPG2mSfZ4aUMCk9SGJrfJFGkShEp0UD3ElcLfi5AabL1ZXPT0L4EZKOT5PfvxC3bg==, tarball: file:projects/arm-chaos.tgz}
|
||||
name: '@rush-temp/arm-chaos'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@azure/identity': 2.1.0
|
||||
'@microsoft/api-extractor': 7.18.11
|
||||
'@rollup/plugin-commonjs': 21.1.0_rollup@2.79.0
|
||||
'@rollup/plugin-json': 4.1.0_rollup@2.79.0
|
||||
'@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.0
|
||||
'@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.0
|
||||
'@types/chai': 4.3.3
|
||||
chai: 4.3.6
|
||||
cross-env: 7.0.3
|
||||
mkdirp: 1.0.4
|
||||
mocha: 7.2.0
|
||||
rimraf: 3.0.2
|
||||
rollup: 2.79.0
|
||||
rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.0
|
||||
tslib: 2.4.0
|
||||
typescript: 4.6.4
|
||||
uglify-js: 3.17.0
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-cognitiveservices.tgz:
|
||||
resolution: {integrity: sha512-IxneKd92NTUdT3T+Jy0JpMWMWRnXNq7aec0WpBc9o6MJP8wVDw4tlRK47ZliW8/y4xr6uGQW9G4lm4Tx1G376g==, tarball: file:projects/arm-cognitiveservices.tgz}
|
||||
name: '@rush-temp/arm-cognitiveservices'
|
||||
|
|
|
@ -22,4 +22,5 @@ https://docs.microsoft.com/javascript/api/@azure/arm-connectedvmware?view=azure-
|
|||
https://docs.microsoft.com/javascript/api/@azure/arm-nginx
|
||||
https://docs.microsoft.com/javascript/api/@azure/arm-nginx?view=azure-node-preview
|
||||
https://docs.microsoft.com/javascript/api/@azure/arm-agrifood?view=azure-node-preview
|
||||
https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/personalizer/ai-personalizer-rest/samples
|
||||
https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/personalizer/ai-personalizer-rest/samples
|
||||
https://docs.microsoft.com/javascript/api/@azure/arm-chaos?view=azure-node-preview
|
||||
|
|
|
@ -1850,6 +1850,11 @@
|
|||
"packageName": "@azure/arm-agrifood",
|
||||
"projectFolder": "sdk/agrifood/arm-agrifood",
|
||||
"versionPolicyName": "management"
|
||||
},
|
||||
{
|
||||
"packageName": "@azure/arm-chaos",
|
||||
"projectFolder": "sdk/chaos/arm-chaos",
|
||||
"versionPolicyName": "management"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
# Release History
|
||||
|
||||
## 1.0.0-beta.1 (2022-09-13)
|
||||
|
||||
The package of @azure/arm-chaos is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart).
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022 Microsoft
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
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.
|
|
@ -0,0 +1,109 @@
|
|||
# Azure ChaosManagement client library for JavaScript
|
||||
|
||||
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure ChaosManagement client.
|
||||
|
||||
Chaos Management Client
|
||||
|
||||
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/chaos/arm-chaos) |
|
||||
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-chaos) |
|
||||
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-chaos?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://nodejs.org/about/releases/)
|
||||
- Latest versions of Safari, Chrome, Edge and Firefox.
|
||||
|
||||
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- An [Azure subscription][azure_sub].
|
||||
|
||||
### Install the `@azure/arm-chaos` package
|
||||
|
||||
Install the Azure ChaosManagement client library for JavaScript with `npm`:
|
||||
|
||||
```bash
|
||||
npm install @azure/arm-chaos
|
||||
```
|
||||
|
||||
### Create and authenticate a `ChaosManagementClient`
|
||||
|
||||
To create a client object to access the Azure ChaosManagement API, you will need the `endpoint` of your Azure ChaosManagement resource and a `credential`. The Azure ChaosManagement client can use Azure Active Directory credentials to authenticate.
|
||||
You can find the endpoint for your Azure ChaosManagement 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 ChaosManagement** 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 { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
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 ChaosManagementClient(new DefaultAzureCredential(), subscriptionId);
|
||||
|
||||
// For client-side applications running in the browser, use this code instead:
|
||||
// const credential = new InteractiveBrowserCredential({
|
||||
// tenantId: "<YOUR_TENANT_ID>",
|
||||
// clientId: "<YOUR_CLIENT_ID>"
|
||||
// });
|
||||
// const client = new ChaosManagementClient(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
|
||||
|
||||
### ChaosManagementClient
|
||||
|
||||
`ChaosManagementClient` is the primary interface for developers using the Azure ChaosManagement client library. Explore the methods on this client object to understand the different features of the Azure ChaosManagement 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%2Fchaos%2Farm-chaos%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
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"commit": "2acf276d94cf6a8767aaa21b3b6038685eadf20b",
|
||||
"readme": "specification/chaos/resource-manager/readme.md",
|
||||
"autorest_command": "autorest --version=3.8.4 --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\\chaos\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.1.20220727.1 --generate-sample=true",
|
||||
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
|
||||
"release_tool": "@azure-tools/js-sdk-release-tools@2.4.2",
|
||||
"use": "@autorest/typescript@6.0.0-rc.1.20220727.1"
|
||||
}
|
|
@ -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-chaos.d.ts"
|
||||
},
|
||||
"messages": {
|
||||
"tsdocMessageReporting": {
|
||||
"default": {
|
||||
"logLevel": "none"
|
||||
}
|
||||
},
|
||||
"extractorMessageReporting": {
|
||||
"ae-missing-release-tag": {
|
||||
"logLevel": "none"
|
||||
},
|
||||
"ae-unresolved-link": {
|
||||
"logLevel": "none"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
{
|
||||
"name": "@azure/arm-chaos",
|
||||
"sdk-type": "mgmt",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "A generated SDK for ChaosManagementClient.",
|
||||
"version": "1.0.0-beta.1",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@azure/core-paging": "^1.2.0",
|
||||
"@azure/core-client": "^1.5.0",
|
||||
"@azure/core-auth": "^1.3.0",
|
||||
"@azure/core-rest-pipeline": "^1.8.0",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"keywords": [
|
||||
"node",
|
||||
"azure",
|
||||
"typescript",
|
||||
"browser",
|
||||
"isomorphic"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist-esm/src/index.js",
|
||||
"types": "./types/arm-chaos.d.ts",
|
||||
"devDependencies": {
|
||||
"@microsoft/api-extractor": "7.18.11",
|
||||
"@rollup/plugin-commonjs": "^21.0.1",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-multi-entry": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.1.3",
|
||||
"mkdirp": "^1.0.4",
|
||||
"rollup": "^2.66.1",
|
||||
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||
"typescript": "~4.6.0",
|
||||
"uglify-js": "^3.4.9",
|
||||
"rimraf": "^3.0.0",
|
||||
"@azure/identity": "^2.0.1",
|
||||
"@azure-tools/test-recorder": "^2.0.0",
|
||||
"@azure-tools/test-credential": "^1.0.0",
|
||||
"mocha": "^7.1.1",
|
||||
"@types/chai": "^4.2.8",
|
||||
"chai": "^4.2.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"@azure/dev-tool": "^1.0.0",
|
||||
"@azure/arm-cosmosdb": "^15.2.0"
|
||||
},
|
||||
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/chaos/arm-chaos",
|
||||
"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/chaosManagementClient.ts",
|
||||
"prefix": "packageDetails"
|
||||
}
|
||||
]
|
||||
},
|
||||
"autoPublish": true,
|
||||
"//sampleConfiguration": {
|
||||
"productName": "",
|
||||
"productSlugs": [
|
||||
"azure"
|
||||
],
|
||||
"disableDocsMs": true,
|
||||
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-chaos?view=azure-node-preview"
|
||||
}
|
||||
}
|
4963
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_chaos_dependence_create.json
сгенерированный
Normal file
4963
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_chaos_dependence_create.json
сгенерированный
Normal file
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
17199
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_chaos_dependence_delete_test.json
сгенерированный
Normal file
17199
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_chaos_dependence_delete_test.json
сгенерированный
Normal file
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
136
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_experiment_create_test.json
сгенерированный
Normal file
136
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_experiment_create_test.json
сгенерированный
Normal file
|
@ -0,0 +1,136 @@
|
|||
{
|
||||
"Entries": [
|
||||
{
|
||||
"RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.Chaos/experiments/exampleExperiment?api-version=2022-07-01-preview",
|
||||
"RequestMethod": "PUT",
|
||||
"RequestHeaders": {
|
||||
"Accept": "application/json",
|
||||
"Accept-Encoding": "gzip,deflate",
|
||||
"Authorization": "Sanitized",
|
||||
"Connection": "keep-alive",
|
||||
"Content-Length": "577",
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": "azsdk-js-arm-chaos/1.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)",
|
||||
"x-ms-client-request-id": "79a21687-a3b0-424d-843b-8e0a667f2ca3"
|
||||
},
|
||||
"RequestBody": {
|
||||
"location": "eastus",
|
||||
"identity": {
|
||||
"type": "SystemAssigned"
|
||||
},
|
||||
"properties": {
|
||||
"steps": [
|
||||
{
|
||||
"name": "step1",
|
||||
"branches": [
|
||||
{
|
||||
"name": "branch1",
|
||||
"actions": [
|
||||
{
|
||||
"type": "continuous",
|
||||
"name": "urn:csci:microsoft:cosmosDB:failover/1.0",
|
||||
"duration": "PT10M",
|
||||
"parameters": [
|
||||
{
|
||||
"key": "readRegion",
|
||||
"value": "East US"
|
||||
}
|
||||
],
|
||||
"selectorId": "f15dd483-3281-4e95-bcbe-cbf535d0de98"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"selectors": [
|
||||
{
|
||||
"type": "List",
|
||||
"id": "f15dd483-3281-4e95-bcbe-cbf535d0de98",
|
||||
"targets": [
|
||||
{
|
||||
"type": "ChaosTarget",
|
||||
"id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DocumentDB/databaseAccounts/test-123aa"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"StatusCode": 200,
|
||||
"ResponseHeaders": {
|
||||
"api-supported-versions": "2021-07-01-preview, 2021-07-05-preview, 2021-08-11-preview, 2021-09-15-preview, 2022-07-01-preview",
|
||||
"Cache-Control": "no-cache",
|
||||
"Content-Encoding": "gzip",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Date": "Wed, 14 Sep 2022 01:31:59 GMT",
|
||||
"Expires": "-1",
|
||||
"Pragma": "no-cache",
|
||||
"Request-Context": "appId=",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
||||
"Transfer-Encoding": "chunked",
|
||||
"Vary": "Accept-Encoding",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"x-ms-correlation-request-id": "a77200b6-3f8a-4ef1-b872-8ce42c03590c",
|
||||
"x-ms-ratelimit-remaining-subscription-resource-requests": "99",
|
||||
"x-ms-request-id": "a77200b6-3f8a-4ef1-b872-8ce42c03590c",
|
||||
"x-ms-routing-request-id": "SOUTHEASTASIA:20220914T013159Z:a77200b6-3f8a-4ef1-b872-8ce42c03590c"
|
||||
},
|
||||
"ResponseBody": {
|
||||
"type": "Microsoft.Chaos/experiments",
|
||||
"id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.Chaos/experiments/exampleExperiment",
|
||||
"name": "exampleExperiment",
|
||||
"systemData": {
|
||||
"createdAt": "2022-09-14T01:31:58.1427439\u002B00:00",
|
||||
"lastModifiedAt": "2022-09-14T01:31:58.1427439\u002B00:00",
|
||||
"createdByType": "User"
|
||||
},
|
||||
"identity": {
|
||||
"type": "SystemAssigned",
|
||||
"principalId": "78ee16c5-d8d8-40ae-aa57-36e2184b86fb",
|
||||
"tenantId": "88888888-8888-8888-8888-888888888888"
|
||||
},
|
||||
"location": "eastus",
|
||||
"properties": {
|
||||
"selectors": [
|
||||
{
|
||||
"type": "List",
|
||||
"id": "f15dd483-3281-4e95-bcbe-cbf535d0de98",
|
||||
"targets": [
|
||||
{
|
||||
"id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DocumentDB/databaseAccounts/test-123aa",
|
||||
"type": "ChaosTarget"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"name": "step1",
|
||||
"branches": [
|
||||
{
|
||||
"name": "branch1",
|
||||
"actions": [
|
||||
{
|
||||
"type": "continuous",
|
||||
"selectorId": "f15dd483-3281-4e95-bcbe-cbf535d0de98",
|
||||
"duration": "PT10M",
|
||||
"parameters": [
|
||||
{
|
||||
"key": "readRegion",
|
||||
"value": "East US"
|
||||
}
|
||||
],
|
||||
"name": "urn:csci:microsoft:cosmosDB:failover/1.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Variables": {}
|
||||
}
|
68
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_experiment_delete_test.json
сгенерированный
Normal file
68
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_experiment_delete_test.json
сгенерированный
Normal file
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"Entries": [
|
||||
{
|
||||
"RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.Chaos/experiments/exampleExperiment?api-version=2022-07-01-preview",
|
||||
"RequestMethod": "DELETE",
|
||||
"RequestHeaders": {
|
||||
"Accept": "application/json",
|
||||
"Accept-Encoding": "gzip,deflate",
|
||||
"Authorization": "Sanitized",
|
||||
"Connection": "keep-alive",
|
||||
"User-Agent": "azsdk-js-arm-chaos/1.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)",
|
||||
"x-ms-client-request-id": "b05498d4-1b5c-4eff-ac09-5b893cb9ffa0"
|
||||
},
|
||||
"RequestBody": null,
|
||||
"StatusCode": 200,
|
||||
"ResponseHeaders": {
|
||||
"api-supported-versions": "2021-07-01-preview, 2021-07-05-preview, 2021-08-11-preview, 2021-09-15-preview, 2022-07-01-preview",
|
||||
"Cache-Control": "no-cache",
|
||||
"Content-Length": "0",
|
||||
"Date": "Wed, 14 Sep 2022 01:32:08 GMT",
|
||||
"Expires": "-1",
|
||||
"Pragma": "no-cache",
|
||||
"Request-Context": "appId=",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"x-ms-correlation-request-id": "ea227d64-c4be-4ca1-ae61-3488ad6c2293",
|
||||
"x-ms-ratelimit-remaining-subscription-resource-requests": "99",
|
||||
"x-ms-request-id": "ea227d64-c4be-4ca1-ae61-3488ad6c2293",
|
||||
"x-ms-routing-request-id": "SOUTHEASTASIA:20220914T013208Z:ea227d64-c4be-4ca1-ae61-3488ad6c2293"
|
||||
},
|
||||
"ResponseBody": null
|
||||
},
|
||||
{
|
||||
"RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.Chaos/experiments?api-version=2022-07-01-preview",
|
||||
"RequestMethod": "GET",
|
||||
"RequestHeaders": {
|
||||
"Accept": "application/json",
|
||||
"Accept-Encoding": "gzip,deflate",
|
||||
"Authorization": "Sanitized",
|
||||
"Connection": "keep-alive",
|
||||
"User-Agent": "azsdk-js-arm-chaos/1.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)",
|
||||
"x-ms-client-request-id": "a2473e0a-41b7-45f5-8d6c-d0b1f4380b39"
|
||||
},
|
||||
"RequestBody": null,
|
||||
"StatusCode": 200,
|
||||
"ResponseHeaders": {
|
||||
"Cache-Control": "no-cache",
|
||||
"Content-Encoding": "gzip",
|
||||
"Content-Length": "12",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Date": "Wed, 14 Sep 2022 01:32:08 GMT",
|
||||
"Expires": "-1",
|
||||
"Pragma": "no-cache",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
||||
"Vary": "Accept-Encoding",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"x-ms-correlation-request-id": "582430b7-d5f3-4366-b76e-7e0458ea04ed",
|
||||
"x-ms-ratelimit-remaining-subscription-resource-requests": "297",
|
||||
"x-ms-request-id": "582430b7-d5f3-4366-b76e-7e0458ea04ed",
|
||||
"x-ms-routing-request-id": "SOUTHEASTASIA:20220914T013208Z:582430b7-d5f3-4366-b76e-7e0458ea04ed"
|
||||
},
|
||||
"ResponseBody": {
|
||||
"value": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"Variables": {}
|
||||
}
|
91
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_experiment_get_test.json
сгенерированный
Normal file
91
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_experiment_get_test.json
сгенерированный
Normal file
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
"Entries": [
|
||||
{
|
||||
"RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.Chaos/experiments/exampleExperiment?api-version=2022-07-01-preview",
|
||||
"RequestMethod": "GET",
|
||||
"RequestHeaders": {
|
||||
"Accept": "application/json",
|
||||
"Accept-Encoding": "gzip,deflate",
|
||||
"Authorization": "Sanitized",
|
||||
"Connection": "keep-alive",
|
||||
"User-Agent": "azsdk-js-arm-chaos/1.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)",
|
||||
"x-ms-client-request-id": "eab4eb93-5dc5-41eb-8f16-d5f308c9e4e3"
|
||||
},
|
||||
"RequestBody": null,
|
||||
"StatusCode": 200,
|
||||
"ResponseHeaders": {
|
||||
"api-supported-versions": "2021-07-01-preview, 2021-07-05-preview, 2021-08-11-preview, 2021-09-15-preview, 2022-07-01-preview",
|
||||
"Cache-Control": "no-cache",
|
||||
"Content-Encoding": "gzip",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Date": "Wed, 14 Sep 2022 01:32:01 GMT",
|
||||
"Expires": "-1",
|
||||
"Pragma": "no-cache",
|
||||
"Request-Context": "appId=",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
||||
"Transfer-Encoding": "chunked",
|
||||
"Vary": "Accept-Encoding",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"x-ms-correlation-request-id": "37b98253-9a70-41f7-88de-1c3d51813ce3",
|
||||
"x-ms-ratelimit-remaining-subscription-resource-requests": "299",
|
||||
"x-ms-request-id": "37b98253-9a70-41f7-88de-1c3d51813ce3",
|
||||
"x-ms-routing-request-id": "SOUTHEASTASIA:20220914T013201Z:37b98253-9a70-41f7-88de-1c3d51813ce3"
|
||||
},
|
||||
"ResponseBody": {
|
||||
"type": "Microsoft.Chaos/experiments",
|
||||
"id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.Chaos/experiments/exampleExperiment",
|
||||
"name": "exampleExperiment",
|
||||
"systemData": {
|
||||
"createdAt": "2022-09-14T01:31:58.1427439\u002B00:00",
|
||||
"lastModifiedAt": "2022-09-14T01:31:58.1427439\u002B00:00",
|
||||
"createdByType": "User"
|
||||
},
|
||||
"identity": {
|
||||
"type": "SystemAssigned",
|
||||
"principalId": "78ee16c5-d8d8-40ae-aa57-36e2184b86fb",
|
||||
"tenantId": "88888888-8888-8888-8888-888888888888"
|
||||
},
|
||||
"location": "eastus",
|
||||
"properties": {
|
||||
"selectors": [
|
||||
{
|
||||
"type": "List",
|
||||
"id": "f15dd483-3281-4e95-bcbe-cbf535d0de98",
|
||||
"targets": [
|
||||
{
|
||||
"id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DocumentDB/databaseAccounts/test-123aa",
|
||||
"type": "ChaosTarget"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"name": "step1",
|
||||
"branches": [
|
||||
{
|
||||
"name": "branch1",
|
||||
"actions": [
|
||||
{
|
||||
"type": "continuous",
|
||||
"selectorId": "f15dd483-3281-4e95-bcbe-cbf535d0de98",
|
||||
"duration": "PT10M",
|
||||
"parameters": [
|
||||
{
|
||||
"key": "readRegion",
|
||||
"value": "East US"
|
||||
}
|
||||
],
|
||||
"name": "urn:csci:microsoft:cosmosDB:failover/1.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Variables": {}
|
||||
}
|
91
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_experiment_list_test.json
сгенерированный
Normal file
91
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_experiment_list_test.json
сгенерированный
Normal file
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
"Entries": [
|
||||
{
|
||||
"RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.Chaos/experiments?api-version=2022-07-01-preview",
|
||||
"RequestMethod": "GET",
|
||||
"RequestHeaders": {
|
||||
"Accept": "application/json",
|
||||
"Accept-Encoding": "gzip,deflate",
|
||||
"Authorization": "Sanitized",
|
||||
"Connection": "keep-alive",
|
||||
"User-Agent": "azsdk-js-arm-chaos/1.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)",
|
||||
"x-ms-client-request-id": "1b817fd1-bfca-4edb-bc17-06222bee0351"
|
||||
},
|
||||
"RequestBody": null,
|
||||
"StatusCode": 200,
|
||||
"ResponseHeaders": {
|
||||
"api-supported-versions": "2021-07-01-preview, 2021-07-05-preview, 2021-08-11-preview, 2021-09-15-preview, 2022-07-01-preview",
|
||||
"Cache-Control": "no-cache",
|
||||
"Content-Encoding": "gzip",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Date": "Wed, 14 Sep 2022 01:32:03 GMT",
|
||||
"Expires": "-1",
|
||||
"Pragma": "no-cache",
|
||||
"Request-Context": "appId=",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
||||
"Transfer-Encoding": "chunked",
|
||||
"Vary": "Accept-Encoding",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"x-ms-correlation-request-id": "258913a6-d399-4391-81a9-164456c00246",
|
||||
"x-ms-ratelimit-remaining-subscription-resource-requests": "298",
|
||||
"x-ms-request-id": "258913a6-d399-4391-81a9-164456c00246",
|
||||
"x-ms-routing-request-id": "SOUTHEASTASIA:20220914T013203Z:258913a6-d399-4391-81a9-164456c00246"
|
||||
},
|
||||
"ResponseBody": {
|
||||
"value": [
|
||||
{
|
||||
"type": "Microsoft.Chaos/experiments",
|
||||
"id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.Chaos/experiments/exampleExperiment",
|
||||
"name": "exampleExperiment",
|
||||
"systemData": {
|
||||
"createdAt": "2022-09-14T01:31:58.1427439\u002B00:00",
|
||||
"lastModifiedAt": "2022-09-14T01:31:58.1427439\u002B00:00",
|
||||
"createdByType": "User"
|
||||
},
|
||||
"location": "eastus",
|
||||
"properties": {
|
||||
"selectors": [
|
||||
{
|
||||
"type": "List",
|
||||
"id": "f15dd483-3281-4e95-bcbe-cbf535d0de98",
|
||||
"targets": [
|
||||
{
|
||||
"id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DocumentDB/databaseAccounts/test-123aa",
|
||||
"type": "ChaosTarget"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"name": "step1",
|
||||
"branches": [
|
||||
{
|
||||
"name": "branch1",
|
||||
"actions": [
|
||||
{
|
||||
"type": "continuous",
|
||||
"selectorId": "f15dd483-3281-4e95-bcbe-cbf535d0de98",
|
||||
"duration": "PT10M",
|
||||
"parameters": [
|
||||
{
|
||||
"key": "readRegion",
|
||||
"value": "East US"
|
||||
}
|
||||
],
|
||||
"name": "urn:csci:microsoft:cosmosDB:failover/1.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"nextLink": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"Variables": {}
|
||||
}
|
62
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_target_create_test.json
сгенерированный
Normal file
62
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_target_create_test.json
сгенерированный
Normal file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"Entries": [
|
||||
{
|
||||
"RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DocumentDB/databaseAccounts/test-123aa/providers/Microsoft.Chaos/targets/Microsoft-CosmosDB?api-version=2022-07-01-preview",
|
||||
"RequestMethod": "PUT",
|
||||
"RequestHeaders": {
|
||||
"Accept": "application/json",
|
||||
"Accept-Encoding": "gzip,deflate",
|
||||
"Authorization": "Sanitized",
|
||||
"Connection": "keep-alive",
|
||||
"Content-Length": "118",
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": "azsdk-js-arm-chaos/1.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)",
|
||||
"x-ms-client-request-id": "30dd5267-42a7-4a88-9a0d-bb45ca3397ac"
|
||||
},
|
||||
"RequestBody": {
|
||||
"location": "eastus",
|
||||
"properties": {
|
||||
"identities": [
|
||||
{
|
||||
"type": "CertificateSubjectIssuer",
|
||||
"subject": "CN=example.subject"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"StatusCode": 200,
|
||||
"ResponseHeaders": {
|
||||
"api-supported-versions": "2021-07-01-preview, 2021-07-05-preview, 2021-08-11-preview, 2021-09-15-preview, 2022-07-01-preview",
|
||||
"Cache-Control": "no-cache",
|
||||
"Content-Encoding": "gzip",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Date": "Wed, 14 Sep 2022 01:31:52 GMT",
|
||||
"ETag": "\u0022af05d915-0000-0100-0000-63212f070000\u0022",
|
||||
"Expires": "-1",
|
||||
"Pragma": "no-cache",
|
||||
"Request-Context": "appId=",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
||||
"Transfer-Encoding": "chunked",
|
||||
"Vary": "Accept-Encoding",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"x-ms-correlation-request-id": "c2dd67a1-a2a0-43c0-ace7-02eb74f83d25",
|
||||
"x-ms-ratelimit-remaining-subscription-resource-requests": "199",
|
||||
"x-ms-request-id": "c2dd67a1-a2a0-43c0-ace7-02eb74f83d25",
|
||||
"x-ms-routing-request-id": "SOUTHEASTASIA:20220914T013152Z:c2dd67a1-a2a0-43c0-ace7-02eb74f83d25"
|
||||
},
|
||||
"ResponseBody": {
|
||||
"location": "eastus",
|
||||
"id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DocumentDB/databaseAccounts/test-123aa/providers/Microsoft.Chaos/targets/Microsoft-CosmosDB",
|
||||
"name": "Microsoft-CosmosDB",
|
||||
"systemData": {
|
||||
"createdAt": "2022-09-14T01:31:51.9485798\u002B00:00",
|
||||
"lastModifiedAt": "2022-09-14T01:31:51.9485798\u002B00:00",
|
||||
"createdByType": "User"
|
||||
},
|
||||
"type": "Microsoft.Chaos/targets",
|
||||
"properties": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Variables": {}
|
||||
}
|
71
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_target_delete_test.json
сгенерированный
Normal file
71
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_target_delete_test.json
сгенерированный
Normal file
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"Entries": [
|
||||
{
|
||||
"RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DocumentDB/databaseAccounts/test-123aa/providers/Microsoft.Chaos/targets/Microsoft-CosmosDB?api-version=2022-07-01-preview",
|
||||
"RequestMethod": "DELETE",
|
||||
"RequestHeaders": {
|
||||
"Accept": "application/json",
|
||||
"Accept-Encoding": "gzip,deflate",
|
||||
"Authorization": "Sanitized",
|
||||
"Connection": "keep-alive",
|
||||
"User-Agent": "azsdk-js-arm-chaos/1.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)",
|
||||
"x-ms-client-request-id": "c451f14e-d890-48ba-a665-e72d3f082628"
|
||||
},
|
||||
"RequestBody": null,
|
||||
"StatusCode": 200,
|
||||
"ResponseHeaders": {
|
||||
"api-supported-versions": "2021-07-01-preview, 2021-07-05-preview, 2021-08-11-preview, 2021-09-15-preview, 2022-07-01-preview",
|
||||
"Cache-Control": "no-cache",
|
||||
"Content-Length": "0",
|
||||
"Date": "Wed, 14 Sep 2022 01:32:10 GMT",
|
||||
"Expires": "-1",
|
||||
"Pragma": "no-cache",
|
||||
"Request-Context": "appId=",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"x-ms-correlation-request-id": "86a41bc5-0d8d-4ba6-a734-10cdd273e5b9",
|
||||
"x-ms-ratelimit-remaining-subscription-resource-requests": "199",
|
||||
"x-ms-request-id": "86a41bc5-0d8d-4ba6-a734-10cdd273e5b9",
|
||||
"x-ms-routing-request-id": "SOUTHEASTASIA:20220914T013210Z:86a41bc5-0d8d-4ba6-a734-10cdd273e5b9"
|
||||
},
|
||||
"ResponseBody": null
|
||||
},
|
||||
{
|
||||
"RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DocumentDB/databaseAccounts/test-123aa/providers/Microsoft.Chaos/targets?api-version=2022-07-01-preview",
|
||||
"RequestMethod": "GET",
|
||||
"RequestHeaders": {
|
||||
"Accept": "application/json",
|
||||
"Accept-Encoding": "gzip,deflate",
|
||||
"Authorization": "Sanitized",
|
||||
"Connection": "keep-alive",
|
||||
"User-Agent": "azsdk-js-arm-chaos/1.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)",
|
||||
"x-ms-client-request-id": "ce30a67a-ebfe-4499-9934-cd999832c526"
|
||||
},
|
||||
"RequestBody": null,
|
||||
"StatusCode": 200,
|
||||
"ResponseHeaders": {
|
||||
"api-supported-versions": "2021-07-01-preview, 2021-07-05-preview, 2021-08-11-preview, 2021-09-15-preview, 2022-07-01-preview",
|
||||
"Cache-Control": "no-cache",
|
||||
"Content-Encoding": "gzip",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Date": "Wed, 14 Sep 2022 01:32:11 GMT",
|
||||
"Expires": "-1",
|
||||
"Pragma": "no-cache",
|
||||
"Request-Context": "appId=",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
||||
"Transfer-Encoding": "chunked",
|
||||
"Vary": "Accept-Encoding",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"x-ms-correlation-request-id": "dd74927b-a87d-455c-95a3-5bb826832436",
|
||||
"x-ms-ratelimit-remaining-subscription-resource-requests": "597",
|
||||
"x-ms-request-id": "dd74927b-a87d-455c-95a3-5bb826832436",
|
||||
"x-ms-routing-request-id": "SOUTHEASTASIA:20220914T013211Z:dd74927b-a87d-455c-95a3-5bb826832436"
|
||||
},
|
||||
"ResponseBody": {
|
||||
"value": [],
|
||||
"nextLink": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"Variables": {}
|
||||
}
|
50
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_targets_get_test.json
сгенерированный
Normal file
50
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_targets_get_test.json
сгенерированный
Normal file
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
"Entries": [
|
||||
{
|
||||
"RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DocumentDB/databaseAccounts/test-123aa/providers/Microsoft.Chaos/targets/Microsoft-CosmosDB?api-version=2022-07-01-preview",
|
||||
"RequestMethod": "GET",
|
||||
"RequestHeaders": {
|
||||
"Accept": "application/json",
|
||||
"Accept-Encoding": "gzip,deflate",
|
||||
"Authorization": "Sanitized",
|
||||
"Connection": "keep-alive",
|
||||
"User-Agent": "azsdk-js-arm-chaos/1.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)",
|
||||
"x-ms-client-request-id": "e340bc88-ba04-4fde-8e59-4e4f43126a66"
|
||||
},
|
||||
"RequestBody": null,
|
||||
"StatusCode": 200,
|
||||
"ResponseHeaders": {
|
||||
"api-supported-versions": "2021-07-01-preview, 2021-07-05-preview, 2021-08-11-preview, 2021-09-15-preview, 2022-07-01-preview",
|
||||
"Cache-Control": "no-cache",
|
||||
"Content-Encoding": "gzip",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Date": "Wed, 14 Sep 2022 01:32:02 GMT",
|
||||
"ETag": "\u0022af05d915-0000-0100-0000-63212f070000\u0022",
|
||||
"Expires": "-1",
|
||||
"Pragma": "no-cache",
|
||||
"Request-Context": "appId=",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
||||
"Transfer-Encoding": "chunked",
|
||||
"Vary": "Accept-Encoding",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"x-ms-correlation-request-id": "7bdbb293-2726-406f-b954-12a52281374c",
|
||||
"x-ms-ratelimit-remaining-subscription-resource-requests": "599",
|
||||
"x-ms-request-id": "7bdbb293-2726-406f-b954-12a52281374c",
|
||||
"x-ms-routing-request-id": "SOUTHEASTASIA:20220914T013202Z:7bdbb293-2726-406f-b954-12a52281374c"
|
||||
},
|
||||
"ResponseBody": {
|
||||
"location": "eastus",
|
||||
"id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DocumentDB/databaseAccounts/test-123aa/providers/Microsoft.Chaos/targets/Microsoft-CosmosDB",
|
||||
"name": "Microsoft-CosmosDB",
|
||||
"systemData": {
|
||||
"createdAt": "2022-09-14T01:31:51.9485798\u002B00:00",
|
||||
"lastModifiedAt": "2022-09-14T01:31:51.9485798\u002B00:00",
|
||||
"createdByType": "User"
|
||||
},
|
||||
"type": "Microsoft.Chaos/targets",
|
||||
"properties": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Variables": {}
|
||||
}
|
54
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_targets_list_test.json
сгенерированный
Normal file
54
sdk/chaos/arm-chaos/recordings/node/chaos_test/recording_targets_list_test.json
сгенерированный
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"Entries": [
|
||||
{
|
||||
"RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DocumentDB/databaseAccounts/test-123aa/providers/Microsoft.Chaos/targets?api-version=2022-07-01-preview",
|
||||
"RequestMethod": "GET",
|
||||
"RequestHeaders": {
|
||||
"Accept": "application/json",
|
||||
"Accept-Encoding": "gzip,deflate",
|
||||
"Authorization": "Sanitized",
|
||||
"Connection": "keep-alive",
|
||||
"User-Agent": "azsdk-js-arm-chaos/1.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)",
|
||||
"x-ms-client-request-id": "5ba7ab5d-a0aa-48b5-8cdf-d031e3296428"
|
||||
},
|
||||
"RequestBody": null,
|
||||
"StatusCode": 200,
|
||||
"ResponseHeaders": {
|
||||
"api-supported-versions": "2021-07-01-preview, 2021-07-05-preview, 2021-08-11-preview, 2021-09-15-preview, 2022-07-01-preview",
|
||||
"Cache-Control": "no-cache",
|
||||
"Content-Encoding": "gzip",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Date": "Wed, 14 Sep 2022 01:32:04 GMT",
|
||||
"Expires": "-1",
|
||||
"Pragma": "no-cache",
|
||||
"Request-Context": "appId=",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
||||
"Transfer-Encoding": "chunked",
|
||||
"Vary": "Accept-Encoding",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"x-ms-correlation-request-id": "ef943367-a9b5-4bbe-b217-fc342f703b3b",
|
||||
"x-ms-ratelimit-remaining-subscription-resource-requests": "598",
|
||||
"x-ms-request-id": "ef943367-a9b5-4bbe-b217-fc342f703b3b",
|
||||
"x-ms-routing-request-id": "SOUTHEASTASIA:20220914T013204Z:ef943367-a9b5-4bbe-b217-fc342f703b3b"
|
||||
},
|
||||
"ResponseBody": {
|
||||
"value": [
|
||||
{
|
||||
"location": "eastus",
|
||||
"id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DocumentDB/databaseAccounts/test-123aa/providers/Microsoft.Chaos/targets/Microsoft-CosmosDB",
|
||||
"name": "Microsoft-CosmosDB",
|
||||
"systemData": {
|
||||
"createdAt": "2022-09-14T01:31:51.9485798\u002B00:00",
|
||||
"lastModifiedAt": "2022-09-14T01:31:51.9485798\u002B00:00",
|
||||
"createdByType": "User"
|
||||
},
|
||||
"type": "Microsoft.Chaos/targets",
|
||||
"properties": {}
|
||||
}
|
||||
],
|
||||
"nextLink": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"Variables": {}
|
||||
}
|
|
@ -0,0 +1,682 @@
|
|||
## API Report File for "@azure/arm-chaos"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
|
||||
import * as coreAuth from '@azure/core-auth';
|
||||
import * as coreClient from '@azure/core-client';
|
||||
import { PagedAsyncIterableIterator } from '@azure/core-paging';
|
||||
|
||||
// @public
|
||||
export interface Action {
|
||||
name: string;
|
||||
type: "delay" | "discrete" | "continuous";
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ActionStatus {
|
||||
readonly actionId?: string;
|
||||
readonly actionName?: string;
|
||||
readonly endTime?: Date;
|
||||
readonly startTime?: Date;
|
||||
readonly status?: string;
|
||||
readonly targets?: ExperimentExecutionActionTargetDetailsProperties[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ActionType = string;
|
||||
|
||||
// @public (undocumented)
|
||||
export type ActionUnion = Action | DelayAction | DiscreteAction | ContinuousAction;
|
||||
|
||||
// @public
|
||||
export interface Branch {
|
||||
actions: ActionUnion[];
|
||||
name: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface BranchStatus {
|
||||
readonly actions?: ActionStatus[];
|
||||
readonly branchId?: string;
|
||||
readonly branchName?: string;
|
||||
readonly status?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface Capabilities {
|
||||
createOrUpdate(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, capabilityName: string, capability: Capability, options?: CapabilitiesCreateOrUpdateOptionalParams): Promise<CapabilitiesCreateOrUpdateResponse>;
|
||||
delete(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, capabilityName: string, options?: CapabilitiesDeleteOptionalParams): Promise<void>;
|
||||
get(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, capabilityName: string, options?: CapabilitiesGetOptionalParams): Promise<CapabilitiesGetResponse>;
|
||||
list(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, options?: CapabilitiesListOptionalParams): PagedAsyncIterableIterator<Capability>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CapabilitiesCreateOrUpdateOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type CapabilitiesCreateOrUpdateResponse = Capability;
|
||||
|
||||
// @public
|
||||
export interface CapabilitiesDeleteOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CapabilitiesGetOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type CapabilitiesGetResponse = Capability;
|
||||
|
||||
// @public
|
||||
export interface CapabilitiesListNextOptionalParams extends coreClient.OperationOptions {
|
||||
continuationToken?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type CapabilitiesListNextResponse = CapabilityListResult;
|
||||
|
||||
// @public
|
||||
export interface CapabilitiesListOptionalParams extends coreClient.OperationOptions {
|
||||
continuationToken?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type CapabilitiesListResponse = CapabilityListResult;
|
||||
|
||||
// @public
|
||||
export interface Capability extends Resource {
|
||||
readonly description?: string;
|
||||
readonly parametersSchema?: string;
|
||||
readonly publisher?: string;
|
||||
readonly systemData?: SystemData;
|
||||
readonly targetType?: string;
|
||||
readonly urn?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CapabilityListResult {
|
||||
readonly nextLink?: string;
|
||||
readonly value?: Capability[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CapabilityType extends Resource {
|
||||
readonly description?: string;
|
||||
readonly displayName?: string;
|
||||
readonly kind?: string;
|
||||
location?: string;
|
||||
readonly parametersSchema?: string;
|
||||
readonly publisher?: string;
|
||||
runtimeProperties?: CapabilityTypePropertiesRuntimeProperties;
|
||||
readonly systemData?: SystemData;
|
||||
readonly targetType?: string;
|
||||
readonly urn?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CapabilityTypeListResult {
|
||||
readonly nextLink?: string;
|
||||
readonly value?: CapabilityType[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CapabilityTypePropertiesRuntimeProperties {
|
||||
readonly kind?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CapabilityTypes {
|
||||
get(locationName: string, targetTypeName: string, capabilityTypeName: string, options?: CapabilityTypesGetOptionalParams): Promise<CapabilityTypesGetResponse>;
|
||||
list(locationName: string, targetTypeName: string, options?: CapabilityTypesListOptionalParams): PagedAsyncIterableIterator<CapabilityType>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CapabilityTypesGetOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type CapabilityTypesGetResponse = CapabilityType;
|
||||
|
||||
// @public
|
||||
export interface CapabilityTypesListNextOptionalParams extends coreClient.OperationOptions {
|
||||
continuationToken?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type CapabilityTypesListNextResponse = CapabilityTypeListResult;
|
||||
|
||||
// @public
|
||||
export interface CapabilityTypesListOptionalParams extends coreClient.OperationOptions {
|
||||
continuationToken?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type CapabilityTypesListResponse = CapabilityTypeListResult;
|
||||
|
||||
// @public (undocumented)
|
||||
export class ChaosManagementClient extends coreClient.ServiceClient {
|
||||
// (undocumented)
|
||||
$host: string;
|
||||
constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ChaosManagementClientOptionalParams);
|
||||
// (undocumented)
|
||||
apiVersion: string;
|
||||
// (undocumented)
|
||||
capabilities: Capabilities;
|
||||
// (undocumented)
|
||||
capabilityTypes: CapabilityTypes;
|
||||
// (undocumented)
|
||||
experiments: Experiments;
|
||||
// (undocumented)
|
||||
operations: Operations;
|
||||
// (undocumented)
|
||||
subscriptionId: string;
|
||||
// (undocumented)
|
||||
targets: Targets;
|
||||
// (undocumented)
|
||||
targetTypes: TargetTypes;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ChaosManagementClientOptionalParams extends coreClient.ServiceClientOptions {
|
||||
$host?: string;
|
||||
apiVersion?: string;
|
||||
endpoint?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ContinuousAction extends Action {
|
||||
duration: string;
|
||||
parameters: KeyValuePair[];
|
||||
selectorId: string;
|
||||
type: "continuous";
|
||||
}
|
||||
|
||||
// @public
|
||||
export type CreatedByType = string;
|
||||
|
||||
// @public
|
||||
export interface DelayAction extends Action {
|
||||
duration: string;
|
||||
type: "delay";
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface DiscreteAction extends Action {
|
||||
parameters: KeyValuePair[];
|
||||
selectorId: string;
|
||||
type: "discrete";
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ErrorAdditionalInfo {
|
||||
readonly info?: Record<string, unknown>;
|
||||
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 interface Experiment extends TrackedResource {
|
||||
identity?: ResourceIdentity;
|
||||
selectors: Selector[];
|
||||
startOnCreation?: boolean;
|
||||
steps: Step[];
|
||||
readonly systemData?: SystemData;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ExperimentCancelOperationResult {
|
||||
readonly name?: string;
|
||||
readonly statusUrl?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ExperimentExecutionActionTargetDetailsError {
|
||||
readonly code?: string;
|
||||
readonly message?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ExperimentExecutionActionTargetDetailsProperties {
|
||||
readonly error?: ExperimentExecutionActionTargetDetailsError;
|
||||
readonly status?: string;
|
||||
readonly target?: string;
|
||||
readonly targetCompletedTime?: Date;
|
||||
readonly targetFailedTime?: Date;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ExperimentExecutionDetails {
|
||||
readonly createdDateTime?: Date;
|
||||
readonly experimentId?: string;
|
||||
readonly failureReason?: string;
|
||||
readonly id?: string;
|
||||
readonly lastActionDateTime?: Date;
|
||||
readonly name?: string;
|
||||
readonly runInformation?: ExperimentExecutionDetailsPropertiesRunInformation;
|
||||
readonly startDateTime?: Date;
|
||||
readonly status?: string;
|
||||
readonly stopDateTime?: Date;
|
||||
readonly type?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ExperimentExecutionDetailsListResult {
|
||||
readonly nextLink?: string;
|
||||
readonly value?: ExperimentExecutionDetails[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ExperimentExecutionDetailsPropertiesRunInformation {
|
||||
readonly steps?: StepStatus[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ExperimentListResult {
|
||||
readonly nextLink?: string;
|
||||
readonly value?: Experiment[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface Experiments {
|
||||
cancel(resourceGroupName: string, experimentName: string, options?: ExperimentsCancelOptionalParams): Promise<ExperimentsCancelResponse>;
|
||||
createOrUpdate(resourceGroupName: string, experimentName: string, experiment: Experiment, options?: ExperimentsCreateOrUpdateOptionalParams): Promise<ExperimentsCreateOrUpdateResponse>;
|
||||
delete(resourceGroupName: string, experimentName: string, options?: ExperimentsDeleteOptionalParams): Promise<void>;
|
||||
get(resourceGroupName: string, experimentName: string, options?: ExperimentsGetOptionalParams): Promise<ExperimentsGetResponse>;
|
||||
getExecutionDetails(resourceGroupName: string, experimentName: string, executionDetailsId: string, options?: ExperimentsGetExecutionDetailsOptionalParams): Promise<ExperimentsGetExecutionDetailsResponse>;
|
||||
getStatus(resourceGroupName: string, experimentName: string, statusId: string, options?: ExperimentsGetStatusOptionalParams): Promise<ExperimentsGetStatusResponse>;
|
||||
list(resourceGroupName: string, options?: ExperimentsListOptionalParams): PagedAsyncIterableIterator<Experiment>;
|
||||
listAll(options?: ExperimentsListAllOptionalParams): PagedAsyncIterableIterator<Experiment>;
|
||||
listAllStatuses(resourceGroupName: string, experimentName: string, options?: ExperimentsListAllStatusesOptionalParams): PagedAsyncIterableIterator<ExperimentStatus>;
|
||||
listExecutionDetails(resourceGroupName: string, experimentName: string, options?: ExperimentsListExecutionDetailsOptionalParams): PagedAsyncIterableIterator<ExperimentExecutionDetails>;
|
||||
start(resourceGroupName: string, experimentName: string, options?: ExperimentsStartOptionalParams): Promise<ExperimentsStartResponse>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ExperimentsCancelOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsCancelResponse = ExperimentCancelOperationResult;
|
||||
|
||||
// @public
|
||||
export interface ExperimentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsCreateOrUpdateResponse = Experiment;
|
||||
|
||||
// @public
|
||||
export interface ExperimentsDeleteOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ExperimentsGetExecutionDetailsOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsGetExecutionDetailsResponse = ExperimentExecutionDetails;
|
||||
|
||||
// @public
|
||||
export interface ExperimentsGetOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsGetResponse = Experiment;
|
||||
|
||||
// @public
|
||||
export interface ExperimentsGetStatusOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsGetStatusResponse = ExperimentStatus;
|
||||
|
||||
// @public
|
||||
export interface ExperimentsListAllNextOptionalParams extends coreClient.OperationOptions {
|
||||
continuationToken?: string;
|
||||
running?: boolean;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsListAllNextResponse = ExperimentListResult;
|
||||
|
||||
// @public
|
||||
export interface ExperimentsListAllOptionalParams extends coreClient.OperationOptions {
|
||||
continuationToken?: string;
|
||||
running?: boolean;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsListAllResponse = ExperimentListResult;
|
||||
|
||||
// @public
|
||||
export interface ExperimentsListAllStatusesNextOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsListAllStatusesNextResponse = ExperimentStatusListResult;
|
||||
|
||||
// @public
|
||||
export interface ExperimentsListAllStatusesOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsListAllStatusesResponse = ExperimentStatusListResult;
|
||||
|
||||
// @public
|
||||
export interface ExperimentsListExecutionDetailsNextOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsListExecutionDetailsNextResponse = ExperimentExecutionDetailsListResult;
|
||||
|
||||
// @public
|
||||
export interface ExperimentsListExecutionDetailsOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsListExecutionDetailsResponse = ExperimentExecutionDetailsListResult;
|
||||
|
||||
// @public
|
||||
export interface ExperimentsListNextOptionalParams extends coreClient.OperationOptions {
|
||||
continuationToken?: string;
|
||||
running?: boolean;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsListNextResponse = ExperimentListResult;
|
||||
|
||||
// @public
|
||||
export interface ExperimentsListOptionalParams extends coreClient.OperationOptions {
|
||||
continuationToken?: string;
|
||||
running?: boolean;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsListResponse = ExperimentListResult;
|
||||
|
||||
// @public
|
||||
export interface ExperimentsStartOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ExperimentsStartResponse = ExperimentStartOperationResult;
|
||||
|
||||
// @public
|
||||
export interface ExperimentStartOperationResult {
|
||||
readonly name?: string;
|
||||
readonly statusUrl?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ExperimentStatus {
|
||||
readonly createdDateUtc?: Date;
|
||||
readonly endDateUtc?: Date;
|
||||
readonly id?: string;
|
||||
readonly name?: string;
|
||||
readonly status?: string;
|
||||
readonly type?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ExperimentStatusListResult {
|
||||
readonly nextLink?: string;
|
||||
readonly value?: ExperimentStatus[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface KeyValuePair {
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export enum KnownActionType {
|
||||
Internal = "Internal"
|
||||
}
|
||||
|
||||
// @public
|
||||
export enum KnownCreatedByType {
|
||||
Application = "Application",
|
||||
Key = "Key",
|
||||
ManagedIdentity = "ManagedIdentity",
|
||||
User = "User"
|
||||
}
|
||||
|
||||
// @public
|
||||
export enum KnownOrigin {
|
||||
System = "system",
|
||||
User = "user",
|
||||
UserSystem = "user,system"
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface Operation {
|
||||
readonly actionType?: ActionType;
|
||||
display?: OperationDisplay;
|
||||
readonly isDataAction?: boolean;
|
||||
readonly name?: string;
|
||||
readonly origin?: Origin;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface OperationDisplay {
|
||||
readonly description?: string;
|
||||
readonly operation?: string;
|
||||
readonly provider?: string;
|
||||
readonly resource?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface OperationListResult {
|
||||
readonly nextLink?: string;
|
||||
readonly value?: Operation[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface Operations {
|
||||
listAll(options?: OperationsListAllOptionalParams): PagedAsyncIterableIterator<Operation>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface OperationsListAllNextOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type OperationsListAllNextResponse = OperationListResult;
|
||||
|
||||
// @public
|
||||
export interface OperationsListAllOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type OperationsListAllResponse = OperationListResult;
|
||||
|
||||
// @public
|
||||
export type Origin = string;
|
||||
|
||||
// @public
|
||||
export interface Resource {
|
||||
readonly id?: string;
|
||||
readonly name?: string;
|
||||
readonly type?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ResourceIdentity {
|
||||
readonly principalId?: string;
|
||||
readonly tenantId?: string;
|
||||
type: ResourceIdentityType;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ResourceIdentityType = "None" | "SystemAssigned";
|
||||
|
||||
// @public
|
||||
export interface Selector {
|
||||
id: string;
|
||||
targets: TargetReference[];
|
||||
type: SelectorType;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type SelectorType = "Percent" | "Random" | "Tag" | "List";
|
||||
|
||||
// @public
|
||||
export interface Step {
|
||||
branches: Branch[];
|
||||
name: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface StepStatus {
|
||||
readonly branches?: BranchStatus[];
|
||||
readonly status?: string;
|
||||
readonly stepId?: string;
|
||||
readonly stepName?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface SystemData {
|
||||
createdAt?: Date;
|
||||
createdBy?: string;
|
||||
createdByType?: CreatedByType;
|
||||
lastModifiedAt?: Date;
|
||||
lastModifiedBy?: string;
|
||||
lastModifiedByType?: CreatedByType;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface Target extends Resource {
|
||||
location?: string;
|
||||
properties: {
|
||||
[propertyName: string]: any;
|
||||
};
|
||||
readonly systemData?: SystemData;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface TargetListResult {
|
||||
readonly nextLink?: string;
|
||||
readonly value?: Target[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface TargetReference {
|
||||
id: string;
|
||||
type: "ChaosTarget";
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface Targets {
|
||||
createOrUpdate(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, target: Target, options?: TargetsCreateOrUpdateOptionalParams): Promise<TargetsCreateOrUpdateResponse>;
|
||||
delete(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, options?: TargetsDeleteOptionalParams): Promise<void>;
|
||||
get(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, options?: TargetsGetOptionalParams): Promise<TargetsGetResponse>;
|
||||
list(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, options?: TargetsListOptionalParams): PagedAsyncIterableIterator<Target>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface TargetsCreateOrUpdateOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type TargetsCreateOrUpdateResponse = Target;
|
||||
|
||||
// @public
|
||||
export interface TargetsDeleteOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface TargetsGetOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type TargetsGetResponse = Target;
|
||||
|
||||
// @public
|
||||
export interface TargetsListNextOptionalParams extends coreClient.OperationOptions {
|
||||
continuationToken?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type TargetsListNextResponse = TargetListResult;
|
||||
|
||||
// @public
|
||||
export interface TargetsListOptionalParams extends coreClient.OperationOptions {
|
||||
continuationToken?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type TargetsListResponse = TargetListResult;
|
||||
|
||||
// @public
|
||||
export interface TargetType extends Resource {
|
||||
readonly description?: string;
|
||||
readonly displayName?: string;
|
||||
location?: string;
|
||||
readonly propertiesSchema?: string;
|
||||
readonly resourceTypes?: string[];
|
||||
readonly systemData?: SystemData;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface TargetTypeListResult {
|
||||
readonly nextLink?: string;
|
||||
readonly value?: TargetType[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface TargetTypes {
|
||||
get(locationName: string, targetTypeName: string, options?: TargetTypesGetOptionalParams): Promise<TargetTypesGetResponse>;
|
||||
list(locationName: string, options?: TargetTypesListOptionalParams): PagedAsyncIterableIterator<TargetType>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface TargetTypesGetOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type TargetTypesGetResponse = TargetType;
|
||||
|
||||
// @public
|
||||
export interface TargetTypesListNextOptionalParams extends coreClient.OperationOptions {
|
||||
continuationToken?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type TargetTypesListNextResponse = TargetTypeListResult;
|
||||
|
||||
// @public
|
||||
export interface TargetTypesListOptionalParams extends coreClient.OperationOptions {
|
||||
continuationToken?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type TargetTypesListResponse = TargetTypeListResult;
|
||||
|
||||
// @public
|
||||
export interface TrackedResource extends Resource {
|
||||
location: string;
|
||||
tags?: {
|
||||
[propertyName: string]: string;
|
||||
};
|
||||
}
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
|
||||
```
|
|
@ -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"));
|
|
@ -0,0 +1,4 @@
|
|||
# App registration secret for AAD authentication
|
||||
AZURE_CLIENT_SECRET=
|
||||
AZURE_CLIENT_ID=
|
||||
AZURE_TENANT_ID=
|
|
@ -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 { Capability, ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create or update a Capability resource that extends a Target resource.
|
||||
*
|
||||
* @summary Create or update a Capability resource that extends a Target resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateACapability.json
|
||||
*/
|
||||
async function createOrUpdateACapabilityThatExtendsAVirtualMachineTargetResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-VirtualMachine";
|
||||
const capabilityName = "Shutdown-1.0";
|
||||
const capability: Capability = {};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.capabilities.createOrUpdate(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName,
|
||||
capabilityName,
|
||||
capability
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createOrUpdateACapabilityThatExtendsAVirtualMachineTargetResource().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Delete a Capability that extends a Target resource.
|
||||
*
|
||||
* @summary Delete a Capability that extends a Target resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteACapability.json
|
||||
*/
|
||||
async function deleteACapabilityThatExtendsAVirtualMachineTargetResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-VirtualMachine";
|
||||
const capabilityName = "Shutdown-1.0";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.capabilities.delete(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName,
|
||||
capabilityName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteACapabilityThatExtendsAVirtualMachineTargetResource().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Capability resource that extends a Target resource.
|
||||
*
|
||||
* @summary Get a Capability resource that extends a Target resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetACapability.json
|
||||
*/
|
||||
async function getACapabilityThatExtendsAVirtualMachineTargetResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-VirtualMachine";
|
||||
const capabilityName = "Shutdown-1.0";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.capabilities.get(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName,
|
||||
capabilityName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getACapabilityThatExtendsAVirtualMachineTargetResource().catch(console.error);
|
|
@ -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 { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Capability resources that extend a Target resource..
|
||||
*
|
||||
* @summary Get a list of Capability resources that extend a Target resource..
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListCapabilities.json
|
||||
*/
|
||||
async function listAllCapabilitiesThatExtendAVirtualMachineTargetResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-VirtualMachine";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.capabilities.list(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllCapabilitiesThatExtendAVirtualMachineTargetResource().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Capability Type resource for given Target Type and location.
|
||||
*
|
||||
* @summary Get a Capability Type resource for given Target Type and location.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetACapabilityType.json
|
||||
*/
|
||||
async function getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const locationName = "westus2";
|
||||
const targetTypeName = "Microsoft-VirtualMachine";
|
||||
const capabilityTypeName = "Shutdown-1.0";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.capabilityTypes.get(
|
||||
locationName,
|
||||
targetTypeName,
|
||||
capabilityTypeName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Capability Type resources for given Target Type and location.
|
||||
*
|
||||
* @summary Get a list of Capability Type resources for given Target Type and location.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListCapabilityTypes.json
|
||||
*/
|
||||
async function listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const locationName = "westus2";
|
||||
const targetTypeName = "Microsoft-VirtualMachine";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.capabilityTypes.list(
|
||||
locationName,
|
||||
targetTypeName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Cancel a running Experiment resource.
|
||||
*
|
||||
* @summary Cancel a running Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CancelAExperiment.json
|
||||
*/
|
||||
async function cancelARunningExperiment() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.cancel(
|
||||
resourceGroupName,
|
||||
experimentName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
cancelARunningExperiment().catch(console.error);
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { Experiment, ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create or update a Experiment resource.
|
||||
*
|
||||
* @summary Create or update a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateAExperiment.json
|
||||
*/
|
||||
async function createOrUpdateAExperimentInAResourceGroup() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const experiment: Experiment = {
|
||||
identity: { type: "SystemAssigned" },
|
||||
location: "centraluseuap",
|
||||
selectors: [
|
||||
{
|
||||
type: "List",
|
||||
id: "selector1",
|
||||
targets: [
|
||||
{
|
||||
type: "ChaosTarget",
|
||||
id:
|
||||
"/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
steps: [
|
||||
{
|
||||
name: "step1",
|
||||
branches: [
|
||||
{
|
||||
name: "branch1",
|
||||
actions: [
|
||||
{
|
||||
name: "urn:csci:provider:providername:Shutdown/1.0",
|
||||
type: "continuous",
|
||||
duration: "PT10M",
|
||||
parameters: [{ key: "abruptShutdown", value: "false" }],
|
||||
selectorId: "selector1"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.createOrUpdate(
|
||||
resourceGroupName,
|
||||
experimentName,
|
||||
experiment
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createOrUpdateAExperimentInAResourceGroup().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Delete a Experiment resource.
|
||||
*
|
||||
* @summary Delete a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteAExperiment.json
|
||||
*/
|
||||
async function deleteAExperimentInAResourceGroup() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.delete(
|
||||
resourceGroupName,
|
||||
experimentName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteAExperimentInAResourceGroup().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get an execution detail of a Experiment resource.
|
||||
*
|
||||
* @summary Get an execution detail of a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperimentExecutionDetails.json
|
||||
*/
|
||||
async function getExperimentExecutionDetails() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const executionDetailsId = "f24500ad-744e-4a26-864b-b76199eac333";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.getExecutionDetails(
|
||||
resourceGroupName,
|
||||
experimentName,
|
||||
executionDetailsId
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getExperimentExecutionDetails().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Experiment resource.
|
||||
*
|
||||
* @summary Get a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperiment.json
|
||||
*/
|
||||
async function getAExperimentInAResourceGroup() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.get(
|
||||
resourceGroupName,
|
||||
experimentName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getAExperimentInAResourceGroup().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a status of a Experiment resource.
|
||||
*
|
||||
* @summary Get a status of a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperimentStatus.json
|
||||
*/
|
||||
async function getTheStatusOfAExperiment() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const statusId = "50734542-2e64-4e08-814c-cc0e7475f7e4";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.getStatus(
|
||||
resourceGroupName,
|
||||
experimentName,
|
||||
statusId
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getTheStatusOfAExperiment().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import {
|
||||
ExperimentsListAllOptionalParams,
|
||||
ChaosManagementClient
|
||||
} from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Experiment resources in a subscription.
|
||||
*
|
||||
* @summary Get a list of Experiment resources in a subscription.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentsInASubscription.json
|
||||
*/
|
||||
async function listAllExperimentsInASubscription() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const continuationToken = undefined;
|
||||
const options: ExperimentsListAllOptionalParams = { continuationToken };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.experiments.listAll(options)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllExperimentsInASubscription().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of statuses of a Experiment resource.
|
||||
*
|
||||
* @summary Get a list of statuses of a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentStatuses.json
|
||||
*/
|
||||
async function listAllStatusesOfAExperiment() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.experiments.listAllStatuses(
|
||||
resourceGroupName,
|
||||
experimentName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllStatusesOfAExperiment().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of execution details of a Experiment resource.
|
||||
*
|
||||
* @summary Get a list of execution details of a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentExecutionsDetails.json
|
||||
*/
|
||||
async function listExperimentExecutionsDetails() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.experiments.listExecutionDetails(
|
||||
resourceGroupName,
|
||||
experimentName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listExperimentExecutionsDetails().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import {
|
||||
ExperimentsListOptionalParams,
|
||||
ChaosManagementClient
|
||||
} from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Experiment resources in a resource group.
|
||||
*
|
||||
* @summary Get a list of Experiment resources in a resource group.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentsInAResourceGroup.json
|
||||
*/
|
||||
async function listAllExperimentsInAResourceGroup() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const continuationToken = undefined;
|
||||
const options: ExperimentsListOptionalParams = { continuationToken };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.experiments.list(resourceGroupName, options)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllExperimentsInAResourceGroup().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Start a Experiment resource.
|
||||
*
|
||||
* @summary Start a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/StartAExperiment.json
|
||||
*/
|
||||
async function startAExperiment() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.start(
|
||||
resourceGroupName,
|
||||
experimentName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
startAExperiment().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Target Type resources for given location.
|
||||
*
|
||||
* @summary Get a Target Type resources for given location.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetATargetType.json
|
||||
*/
|
||||
async function getATargetTypeForWestus2Location() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const locationName = "westus2";
|
||||
const targetTypeName = "Microsoft-Agent";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.targetTypes.get(locationName, targetTypeName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getATargetTypeForWestus2Location().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import {
|
||||
TargetTypesListOptionalParams,
|
||||
ChaosManagementClient
|
||||
} from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Target Type resources for given location.
|
||||
*
|
||||
* @summary Get a list of Target Type resources for given location.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListTargetTypes.json
|
||||
*/
|
||||
async function listAllTargetTypesForWestus2Location() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const locationName = "westus2";
|
||||
const continuationToken = undefined;
|
||||
const options: TargetTypesListOptionalParams = { continuationToken };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.targetTypes.list(locationName, options)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllTargetTypesForWestus2Location().catch(console.error);
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { Target, ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create or update a Target resource that extends a tracked regional resource.
|
||||
*
|
||||
* @summary Create or update a Target resource that extends a tracked regional resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateATarget.json
|
||||
*/
|
||||
async function createOrUpdateATargetThatExtendsAVirtualMachineResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-Agent";
|
||||
const target: Target = {
|
||||
properties: {
|
||||
identities: [
|
||||
{ type: "CertificateSubjectIssuer", subject: "CN=example.subject" }
|
||||
]
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.targets.createOrUpdate(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName,
|
||||
target
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createOrUpdateATargetThatExtendsAVirtualMachineResource().catch(console.error);
|
|
@ -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 { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Delete a Target resource that extends a tracked regional resource.
|
||||
*
|
||||
* @summary Delete a Target resource that extends a tracked regional resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteATarget.json
|
||||
*/
|
||||
async function deleteATargetThatExtendsAVirtualMachineResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-Agent";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.targets.delete(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteATargetThatExtendsAVirtualMachineResource().catch(console.error);
|
|
@ -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 { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Target resource that extends a tracked regional resource.
|
||||
*
|
||||
* @summary Get a Target resource that extends a tracked regional resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetATarget.json
|
||||
*/
|
||||
async function getATargetThatExtendsAVirtualMachineResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-Agent";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.targets.get(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getATargetThatExtendsAVirtualMachineResource().catch(console.error);
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import {
|
||||
TargetsListOptionalParams,
|
||||
ChaosManagementClient
|
||||
} from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Target resources that extend a tracked regional resource.
|
||||
*
|
||||
* @summary Get a list of Target resources that extend a tracked regional resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListTargets.json
|
||||
*/
|
||||
async function listAllTargetsThatExtendAVirtualMachineResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const continuationToken = undefined;
|
||||
const options: TargetsListOptionalParams = { continuationToken };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.targets.list(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
options
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllTargetsThatExtendAVirtualMachineResource().catch(console.error);
|
|
@ -0,0 +1,94 @@
|
|||
# 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** |
|
||||
| --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [capabilitiesCreateOrUpdateSample.js][capabilitiescreateorupdatesample] | Create or update a Capability resource that extends a Target resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateACapability.json |
|
||||
| [capabilitiesDeleteSample.js][capabilitiesdeletesample] | Delete a Capability that extends a Target resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteACapability.json |
|
||||
| [capabilitiesGetSample.js][capabilitiesgetsample] | Get a Capability resource that extends a Target resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetACapability.json |
|
||||
| [capabilitiesListSample.js][capabilitieslistsample] | Get a list of Capability resources that extend a Target resource.. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListCapabilities.json |
|
||||
| [capabilityTypesGetSample.js][capabilitytypesgetsample] | Get a Capability Type resource for given Target Type and location. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetACapabilityType.json |
|
||||
| [capabilityTypesListSample.js][capabilitytypeslistsample] | Get a list of Capability Type resources for given Target Type and location. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListCapabilityTypes.json |
|
||||
| [experimentsCancelSample.js][experimentscancelsample] | Cancel a running Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CancelAExperiment.json |
|
||||
| [experimentsCreateOrUpdateSample.js][experimentscreateorupdatesample] | Create or update a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateAExperiment.json |
|
||||
| [experimentsDeleteSample.js][experimentsdeletesample] | Delete a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteAExperiment.json |
|
||||
| [experimentsGetExecutionDetailsSample.js][experimentsgetexecutiondetailssample] | Get an execution detail of a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperimentExecutionDetails.json |
|
||||
| [experimentsGetSample.js][experimentsgetsample] | Get a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperiment.json |
|
||||
| [experimentsGetStatusSample.js][experimentsgetstatussample] | Get a status of a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperimentStatus.json |
|
||||
| [experimentsListAllSample.js][experimentslistallsample] | Get a list of Experiment resources in a subscription. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentsInASubscription.json |
|
||||
| [experimentsListAllStatusesSample.js][experimentslistallstatusessample] | Get a list of statuses of a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentStatuses.json |
|
||||
| [experimentsListExecutionDetailsSample.js][experimentslistexecutiondetailssample] | Get a list of execution details of a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentExecutionsDetails.json |
|
||||
| [experimentsListSample.js][experimentslistsample] | Get a list of Experiment resources in a resource group. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentsInAResourceGroup.json |
|
||||
| [experimentsStartSample.js][experimentsstartsample] | Start a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/StartAExperiment.json |
|
||||
| [targetTypesGetSample.js][targettypesgetsample] | Get a Target Type resources for given location. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetATargetType.json |
|
||||
| [targetTypesListSample.js][targettypeslistsample] | Get a list of Target Type resources for given location. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListTargetTypes.json |
|
||||
| [targetsCreateOrUpdateSample.js][targetscreateorupdatesample] | Create or update a Target resource that extends a tracked regional resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateATarget.json |
|
||||
| [targetsDeleteSample.js][targetsdeletesample] | Delete a Target resource that extends a tracked regional resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteATarget.json |
|
||||
| [targetsGetSample.js][targetsgetsample] | Get a Target resource that extends a tracked regional resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetATarget.json |
|
||||
| [targetsListSample.js][targetslistsample] | Get a list of Target resources that extend a tracked regional resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListTargets.json |
|
||||
|
||||
## Prerequisites
|
||||
|
||||
The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/).
|
||||
|
||||
You need [an Azure subscription][freesub] to run these sample programs.
|
||||
|
||||
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
|
||||
|
||||
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
|
||||
|
||||
## Setup
|
||||
|
||||
To run the samples using the published version of the package:
|
||||
|
||||
1. Install the dependencies using `npm`:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
|
||||
|
||||
3. Run whichever samples you like (note that some samples may require additional setup, see the table above):
|
||||
|
||||
```bash
|
||||
node capabilitiesCreateOrUpdateSample.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 capabilitiesCreateOrUpdateSample.js
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
|
||||
|
||||
[capabilitiescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/capabilitiesCreateOrUpdateSample.js
|
||||
[capabilitiesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/capabilitiesDeleteSample.js
|
||||
[capabilitiesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/capabilitiesGetSample.js
|
||||
[capabilitieslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/capabilitiesListSample.js
|
||||
[capabilitytypesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/capabilityTypesGetSample.js
|
||||
[capabilitytypeslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/capabilityTypesListSample.js
|
||||
[experimentscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/experimentsCancelSample.js
|
||||
[experimentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/experimentsCreateOrUpdateSample.js
|
||||
[experimentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/experimentsDeleteSample.js
|
||||
[experimentsgetexecutiondetailssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/experimentsGetExecutionDetailsSample.js
|
||||
[experimentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/experimentsGetSample.js
|
||||
[experimentsgetstatussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/experimentsGetStatusSample.js
|
||||
[experimentslistallsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/experimentsListAllSample.js
|
||||
[experimentslistallstatusessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/experimentsListAllStatusesSample.js
|
||||
[experimentslistexecutiondetailssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/experimentsListExecutionDetailsSample.js
|
||||
[experimentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/experimentsListSample.js
|
||||
[experimentsstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/experimentsStartSample.js
|
||||
[targettypesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/targetTypesGetSample.js
|
||||
[targettypeslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/targetTypesListSample.js
|
||||
[targetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/targetsCreateOrUpdateSample.js
|
||||
[targetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/targetsDeleteSample.js
|
||||
[targetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/targetsGetSample.js
|
||||
[targetslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/javascript/targetsListSample.js
|
||||
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-chaos?view=azure-node-preview
|
||||
[freesub]: https://azure.microsoft.com/free/
|
||||
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/chaos/arm-chaos/README.md
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create or update a Capability resource that extends a Target resource.
|
||||
*
|
||||
* @summary Create or update a Capability resource that extends a Target resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateACapability.json
|
||||
*/
|
||||
async function createOrUpdateACapabilityThatExtendsAVirtualMachineTargetResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-VirtualMachine";
|
||||
const capabilityName = "Shutdown-1.0";
|
||||
const capability = {};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.capabilities.createOrUpdate(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName,
|
||||
capabilityName,
|
||||
capability
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createOrUpdateACapabilityThatExtendsAVirtualMachineTargetResource().catch(console.error);
|
|
@ -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 { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Delete a Capability that extends a Target resource.
|
||||
*
|
||||
* @summary Delete a Capability that extends a Target resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteACapability.json
|
||||
*/
|
||||
async function deleteACapabilityThatExtendsAVirtualMachineTargetResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-VirtualMachine";
|
||||
const capabilityName = "Shutdown-1.0";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.capabilities.delete(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName,
|
||||
capabilityName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteACapabilityThatExtendsAVirtualMachineTargetResource().catch(console.error);
|
|
@ -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 { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Capability resource that extends a Target resource.
|
||||
*
|
||||
* @summary Get a Capability resource that extends a Target resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetACapability.json
|
||||
*/
|
||||
async function getACapabilityThatExtendsAVirtualMachineTargetResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-VirtualMachine";
|
||||
const capabilityName = "Shutdown-1.0";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.capabilities.get(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName,
|
||||
capabilityName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getACapabilityThatExtendsAVirtualMachineTargetResource().catch(console.error);
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Capability resources that extend a Target resource..
|
||||
*
|
||||
* @summary Get a list of Capability resources that extend a Target resource..
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListCapabilities.json
|
||||
*/
|
||||
async function listAllCapabilitiesThatExtendAVirtualMachineTargetResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-VirtualMachine";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.capabilities.list(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllCapabilitiesThatExtendAVirtualMachineTargetResource().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Capability Type resource for given Target Type and location.
|
||||
*
|
||||
* @summary Get a Capability Type resource for given Target Type and location.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetACapabilityType.json
|
||||
*/
|
||||
async function getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const locationName = "westus2";
|
||||
const targetTypeName = "Microsoft-VirtualMachine";
|
||||
const capabilityTypeName = "Shutdown-1.0";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.capabilityTypes.get(locationName, targetTypeName, capabilityTypeName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Capability Type resources for given Target Type and location.
|
||||
*
|
||||
* @summary Get a list of Capability Type resources for given Target Type and location.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListCapabilityTypes.json
|
||||
*/
|
||||
async function listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const locationName = "westus2";
|
||||
const targetTypeName = "Microsoft-VirtualMachine";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.capabilityTypes.list(locationName, targetTypeName)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Cancel a running Experiment resource.
|
||||
*
|
||||
* @summary Cancel a running Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CancelAExperiment.json
|
||||
*/
|
||||
async function cancelARunningExperiment() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.cancel(resourceGroupName, experimentName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
cancelARunningExperiment().catch(console.error);
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create or update a Experiment resource.
|
||||
*
|
||||
* @summary Create or update a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateAExperiment.json
|
||||
*/
|
||||
async function createOrUpdateAExperimentInAResourceGroup() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const experiment = {
|
||||
identity: { type: "SystemAssigned" },
|
||||
location: "centraluseuap",
|
||||
selectors: [
|
||||
{
|
||||
type: "List",
|
||||
id: "selector1",
|
||||
targets: [
|
||||
{
|
||||
type: "ChaosTarget",
|
||||
id: "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
steps: [
|
||||
{
|
||||
name: "step1",
|
||||
branches: [
|
||||
{
|
||||
name: "branch1",
|
||||
actions: [
|
||||
{
|
||||
name: "urn:csci:provider:providername:Shutdown/1.0",
|
||||
type: "continuous",
|
||||
duration: "PT10M",
|
||||
parameters: [{ key: "abruptShutdown", value: "false" }],
|
||||
selectorId: "selector1",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.createOrUpdate(
|
||||
resourceGroupName,
|
||||
experimentName,
|
||||
experiment
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createOrUpdateAExperimentInAResourceGroup().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Delete a Experiment resource.
|
||||
*
|
||||
* @summary Delete a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteAExperiment.json
|
||||
*/
|
||||
async function deleteAExperimentInAResourceGroup() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.delete(resourceGroupName, experimentName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteAExperimentInAResourceGroup().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get an execution detail of a Experiment resource.
|
||||
*
|
||||
* @summary Get an execution detail of a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperimentExecutionDetails.json
|
||||
*/
|
||||
async function getExperimentExecutionDetails() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const executionDetailsId = "f24500ad-744e-4a26-864b-b76199eac333";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.getExecutionDetails(
|
||||
resourceGroupName,
|
||||
experimentName,
|
||||
executionDetailsId
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getExperimentExecutionDetails().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Experiment resource.
|
||||
*
|
||||
* @summary Get a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperiment.json
|
||||
*/
|
||||
async function getAExperimentInAResourceGroup() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.get(resourceGroupName, experimentName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getAExperimentInAResourceGroup().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a status of a Experiment resource.
|
||||
*
|
||||
* @summary Get a status of a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperimentStatus.json
|
||||
*/
|
||||
async function getTheStatusOfAExperiment() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const statusId = "50734542-2e64-4e08-814c-cc0e7475f7e4";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.getStatus(resourceGroupName, experimentName, statusId);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getTheStatusOfAExperiment().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Experiment resources in a subscription.
|
||||
*
|
||||
* @summary Get a list of Experiment resources in a subscription.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentsInASubscription.json
|
||||
*/
|
||||
async function listAllExperimentsInASubscription() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const continuationToken = undefined;
|
||||
const options = { continuationToken };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.experiments.listAll(options)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllExperimentsInASubscription().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of statuses of a Experiment resource.
|
||||
*
|
||||
* @summary Get a list of statuses of a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentStatuses.json
|
||||
*/
|
||||
async function listAllStatusesOfAExperiment() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.experiments.listAllStatuses(resourceGroupName, experimentName)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllStatusesOfAExperiment().catch(console.error);
|
|
@ -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 { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of execution details of a Experiment resource.
|
||||
*
|
||||
* @summary Get a list of execution details of a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentExecutionsDetails.json
|
||||
*/
|
||||
async function listExperimentExecutionsDetails() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.experiments.listExecutionDetails(
|
||||
resourceGroupName,
|
||||
experimentName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listExperimentExecutionsDetails().catch(console.error);
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Experiment resources in a resource group.
|
||||
*
|
||||
* @summary Get a list of Experiment resources in a resource group.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentsInAResourceGroup.json
|
||||
*/
|
||||
async function listAllExperimentsInAResourceGroup() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const continuationToken = undefined;
|
||||
const options = { continuationToken };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.experiments.list(resourceGroupName, options)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllExperimentsInAResourceGroup().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Start a Experiment resource.
|
||||
*
|
||||
* @summary Start a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/StartAExperiment.json
|
||||
*/
|
||||
async function startAExperiment() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.start(resourceGroupName, experimentName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
startAExperiment().catch(console.error);
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "@azure-samples/arm-chaos-js-beta",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"description": " client library samples for JavaScript (Beta)",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
|
||||
"directory": "sdk/chaos/arm-chaos"
|
||||
},
|
||||
"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/chaos/arm-chaos",
|
||||
"dependencies": {
|
||||
"@azure/arm-chaos": "next",
|
||||
"dotenv": "latest",
|
||||
"@azure/identity": "^2.0.1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
# App registration secret for AAD authentication
|
||||
AZURE_CLIENT_SECRET=
|
||||
AZURE_CLIENT_ID=
|
||||
AZURE_TENANT_ID=
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Target Type resources for given location.
|
||||
*
|
||||
* @summary Get a Target Type resources for given location.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetATargetType.json
|
||||
*/
|
||||
async function getATargetTypeForWestus2Location() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const locationName = "westus2";
|
||||
const targetTypeName = "Microsoft-Agent";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.targetTypes.get(locationName, targetTypeName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getATargetTypeForWestus2Location().catch(console.error);
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Target Type resources for given location.
|
||||
*
|
||||
* @summary Get a list of Target Type resources for given location.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListTargetTypes.json
|
||||
*/
|
||||
async function listAllTargetTypesForWestus2Location() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const locationName = "westus2";
|
||||
const continuationToken = undefined;
|
||||
const options = { continuationToken };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.targetTypes.list(locationName, options)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllTargetTypesForWestus2Location().catch(console.error);
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create or update a Target resource that extends a tracked regional resource.
|
||||
*
|
||||
* @summary Create or update a Target resource that extends a tracked regional resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateATarget.json
|
||||
*/
|
||||
async function createOrUpdateATargetThatExtendsAVirtualMachineResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-Agent";
|
||||
const target = {
|
||||
properties: {
|
||||
identities: [{ type: "CertificateSubjectIssuer", subject: "CN=example.subject" }],
|
||||
},
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.targets.createOrUpdate(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName,
|
||||
target
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createOrUpdateATargetThatExtendsAVirtualMachineResource().catch(console.error);
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Delete a Target resource that extends a tracked regional resource.
|
||||
*
|
||||
* @summary Delete a Target resource that extends a tracked regional resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteATarget.json
|
||||
*/
|
||||
async function deleteATargetThatExtendsAVirtualMachineResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-Agent";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.targets.delete(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteATargetThatExtendsAVirtualMachineResource().catch(console.error);
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Target resource that extends a tracked regional resource.
|
||||
*
|
||||
* @summary Get a Target resource that extends a tracked regional resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetATarget.json
|
||||
*/
|
||||
async function getATargetThatExtendsAVirtualMachineResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-Agent";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.targets.get(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getATargetThatExtendsAVirtualMachineResource().catch(console.error);
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { ChaosManagementClient } = require("@azure/arm-chaos");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Target resources that extend a tracked regional resource.
|
||||
*
|
||||
* @summary Get a list of Target resources that extend a tracked regional resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListTargets.json
|
||||
*/
|
||||
async function listAllTargetsThatExtendAVirtualMachineResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const continuationToken = undefined;
|
||||
const options = { continuationToken };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.targets.list(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
options
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllTargetsThatExtendAVirtualMachineResource().catch(console.error);
|
|
@ -0,0 +1,107 @@
|
|||
# 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** |
|
||||
| --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [capabilitiesCreateOrUpdateSample.ts][capabilitiescreateorupdatesample] | Create or update a Capability resource that extends a Target resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateACapability.json |
|
||||
| [capabilitiesDeleteSample.ts][capabilitiesdeletesample] | Delete a Capability that extends a Target resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteACapability.json |
|
||||
| [capabilitiesGetSample.ts][capabilitiesgetsample] | Get a Capability resource that extends a Target resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetACapability.json |
|
||||
| [capabilitiesListSample.ts][capabilitieslistsample] | Get a list of Capability resources that extend a Target resource.. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListCapabilities.json |
|
||||
| [capabilityTypesGetSample.ts][capabilitytypesgetsample] | Get a Capability Type resource for given Target Type and location. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetACapabilityType.json |
|
||||
| [capabilityTypesListSample.ts][capabilitytypeslistsample] | Get a list of Capability Type resources for given Target Type and location. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListCapabilityTypes.json |
|
||||
| [experimentsCancelSample.ts][experimentscancelsample] | Cancel a running Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CancelAExperiment.json |
|
||||
| [experimentsCreateOrUpdateSample.ts][experimentscreateorupdatesample] | Create or update a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateAExperiment.json |
|
||||
| [experimentsDeleteSample.ts][experimentsdeletesample] | Delete a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteAExperiment.json |
|
||||
| [experimentsGetExecutionDetailsSample.ts][experimentsgetexecutiondetailssample] | Get an execution detail of a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperimentExecutionDetails.json |
|
||||
| [experimentsGetSample.ts][experimentsgetsample] | Get a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperiment.json |
|
||||
| [experimentsGetStatusSample.ts][experimentsgetstatussample] | Get a status of a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperimentStatus.json |
|
||||
| [experimentsListAllSample.ts][experimentslistallsample] | Get a list of Experiment resources in a subscription. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentsInASubscription.json |
|
||||
| [experimentsListAllStatusesSample.ts][experimentslistallstatusessample] | Get a list of statuses of a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentStatuses.json |
|
||||
| [experimentsListExecutionDetailsSample.ts][experimentslistexecutiondetailssample] | Get a list of execution details of a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentExecutionsDetails.json |
|
||||
| [experimentsListSample.ts][experimentslistsample] | Get a list of Experiment resources in a resource group. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentsInAResourceGroup.json |
|
||||
| [experimentsStartSample.ts][experimentsstartsample] | Start a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/StartAExperiment.json |
|
||||
| [targetTypesGetSample.ts][targettypesgetsample] | Get a Target Type resources for given location. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetATargetType.json |
|
||||
| [targetTypesListSample.ts][targettypeslistsample] | Get a list of Target Type resources for given location. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListTargetTypes.json |
|
||||
| [targetsCreateOrUpdateSample.ts][targetscreateorupdatesample] | Create or update a Target resource that extends a tracked regional resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateATarget.json |
|
||||
| [targetsDeleteSample.ts][targetsdeletesample] | Delete a Target resource that extends a tracked regional resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteATarget.json |
|
||||
| [targetsGetSample.ts][targetsgetsample] | Get a Target resource that extends a tracked regional resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetATarget.json |
|
||||
| [targetsListSample.ts][targetslistsample] | Get a list of Target resources that extend a tracked regional resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListTargets.json |
|
||||
|
||||
## Prerequisites
|
||||
|
||||
The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/).
|
||||
|
||||
Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using:
|
||||
|
||||
```bash
|
||||
npm install -g typescript
|
||||
```
|
||||
|
||||
You need [an Azure subscription][freesub] to run these sample programs.
|
||||
|
||||
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
|
||||
|
||||
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
|
||||
|
||||
## Setup
|
||||
|
||||
To run the samples using the published version of the package:
|
||||
|
||||
1. Install the dependencies using `npm`:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
2. Compile the samples:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
|
||||
|
||||
4. Run whichever samples you like (note that some samples may require additional setup, see the table above):
|
||||
|
||||
```bash
|
||||
node dist/capabilitiesCreateOrUpdateSample.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/capabilitiesCreateOrUpdateSample.js
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
|
||||
|
||||
[capabilitiescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/capabilitiesCreateOrUpdateSample.ts
|
||||
[capabilitiesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/capabilitiesDeleteSample.ts
|
||||
[capabilitiesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/capabilitiesGetSample.ts
|
||||
[capabilitieslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/capabilitiesListSample.ts
|
||||
[capabilitytypesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/capabilityTypesGetSample.ts
|
||||
[capabilitytypeslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/capabilityTypesListSample.ts
|
||||
[experimentscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/experimentsCancelSample.ts
|
||||
[experimentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/experimentsCreateOrUpdateSample.ts
|
||||
[experimentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/experimentsDeleteSample.ts
|
||||
[experimentsgetexecutiondetailssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/experimentsGetExecutionDetailsSample.ts
|
||||
[experimentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/experimentsGetSample.ts
|
||||
[experimentsgetstatussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/experimentsGetStatusSample.ts
|
||||
[experimentslistallsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/experimentsListAllSample.ts
|
||||
[experimentslistallstatusessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/experimentsListAllStatusesSample.ts
|
||||
[experimentslistexecutiondetailssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/experimentsListExecutionDetailsSample.ts
|
||||
[experimentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/experimentsListSample.ts
|
||||
[experimentsstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/experimentsStartSample.ts
|
||||
[targettypesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/targetTypesGetSample.ts
|
||||
[targettypeslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/targetTypesListSample.ts
|
||||
[targetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/targetsCreateOrUpdateSample.ts
|
||||
[targetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/targetsDeleteSample.ts
|
||||
[targetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/targetsGetSample.ts
|
||||
[targetslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1-beta/typescript/src/targetsListSample.ts
|
||||
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-chaos?view=azure-node-preview
|
||||
[freesub]: https://azure.microsoft.com/free/
|
||||
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/chaos/arm-chaos/README.md
|
||||
[typescript]: https://www.typescriptlang.org/docs/home.html
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "@azure-samples/arm-chaos-ts-beta",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"description": " client library samples for TypeScript (Beta)",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"prebuild": "rimraf dist/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
|
||||
"directory": "sdk/chaos/arm-chaos"
|
||||
},
|
||||
"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/chaos/arm-chaos",
|
||||
"dependencies": {
|
||||
"@azure/arm-chaos": "next",
|
||||
"dotenv": "latest",
|
||||
"@azure/identity": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.0",
|
||||
"typescript": "~4.6.0",
|
||||
"rimraf": "latest"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
# App registration secret for AAD authentication
|
||||
AZURE_CLIENT_SECRET=
|
||||
AZURE_CLIENT_ID=
|
||||
AZURE_TENANT_ID=
|
|
@ -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 { Capability, ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create or update a Capability resource that extends a Target resource.
|
||||
*
|
||||
* @summary Create or update a Capability resource that extends a Target resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateACapability.json
|
||||
*/
|
||||
async function createOrUpdateACapabilityThatExtendsAVirtualMachineTargetResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-VirtualMachine";
|
||||
const capabilityName = "Shutdown-1.0";
|
||||
const capability: Capability = {};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.capabilities.createOrUpdate(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName,
|
||||
capabilityName,
|
||||
capability
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createOrUpdateACapabilityThatExtendsAVirtualMachineTargetResource().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Delete a Capability that extends a Target resource.
|
||||
*
|
||||
* @summary Delete a Capability that extends a Target resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteACapability.json
|
||||
*/
|
||||
async function deleteACapabilityThatExtendsAVirtualMachineTargetResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-VirtualMachine";
|
||||
const capabilityName = "Shutdown-1.0";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.capabilities.delete(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName,
|
||||
capabilityName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteACapabilityThatExtendsAVirtualMachineTargetResource().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Capability resource that extends a Target resource.
|
||||
*
|
||||
* @summary Get a Capability resource that extends a Target resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetACapability.json
|
||||
*/
|
||||
async function getACapabilityThatExtendsAVirtualMachineTargetResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-VirtualMachine";
|
||||
const capabilityName = "Shutdown-1.0";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.capabilities.get(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName,
|
||||
capabilityName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getACapabilityThatExtendsAVirtualMachineTargetResource().catch(console.error);
|
|
@ -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 { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Capability resources that extend a Target resource..
|
||||
*
|
||||
* @summary Get a list of Capability resources that extend a Target resource..
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListCapabilities.json
|
||||
*/
|
||||
async function listAllCapabilitiesThatExtendAVirtualMachineTargetResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-VirtualMachine";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.capabilities.list(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllCapabilitiesThatExtendAVirtualMachineTargetResource().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Capability Type resource for given Target Type and location.
|
||||
*
|
||||
* @summary Get a Capability Type resource for given Target Type and location.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetACapabilityType.json
|
||||
*/
|
||||
async function getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const locationName = "westus2";
|
||||
const targetTypeName = "Microsoft-VirtualMachine";
|
||||
const capabilityTypeName = "Shutdown-1.0";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.capabilityTypes.get(
|
||||
locationName,
|
||||
targetTypeName,
|
||||
capabilityTypeName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Capability Type resources for given Target Type and location.
|
||||
*
|
||||
* @summary Get a list of Capability Type resources for given Target Type and location.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListCapabilityTypes.json
|
||||
*/
|
||||
async function listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const locationName = "westus2";
|
||||
const targetTypeName = "Microsoft-VirtualMachine";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.capabilityTypes.list(
|
||||
locationName,
|
||||
targetTypeName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Cancel a running Experiment resource.
|
||||
*
|
||||
* @summary Cancel a running Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CancelAExperiment.json
|
||||
*/
|
||||
async function cancelARunningExperiment() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.cancel(
|
||||
resourceGroupName,
|
||||
experimentName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
cancelARunningExperiment().catch(console.error);
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { Experiment, ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create or update a Experiment resource.
|
||||
*
|
||||
* @summary Create or update a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateAExperiment.json
|
||||
*/
|
||||
async function createOrUpdateAExperimentInAResourceGroup() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const experiment: Experiment = {
|
||||
identity: { type: "SystemAssigned" },
|
||||
location: "centraluseuap",
|
||||
selectors: [
|
||||
{
|
||||
type: "List",
|
||||
id: "selector1",
|
||||
targets: [
|
||||
{
|
||||
type: "ChaosTarget",
|
||||
id:
|
||||
"/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
steps: [
|
||||
{
|
||||
name: "step1",
|
||||
branches: [
|
||||
{
|
||||
name: "branch1",
|
||||
actions: [
|
||||
{
|
||||
name: "urn:csci:provider:providername:Shutdown/1.0",
|
||||
type: "continuous",
|
||||
duration: "PT10M",
|
||||
parameters: [{ key: "abruptShutdown", value: "false" }],
|
||||
selectorId: "selector1"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.createOrUpdate(
|
||||
resourceGroupName,
|
||||
experimentName,
|
||||
experiment
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createOrUpdateAExperimentInAResourceGroup().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Delete a Experiment resource.
|
||||
*
|
||||
* @summary Delete a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteAExperiment.json
|
||||
*/
|
||||
async function deleteAExperimentInAResourceGroup() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.delete(
|
||||
resourceGroupName,
|
||||
experimentName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteAExperimentInAResourceGroup().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get an execution detail of a Experiment resource.
|
||||
*
|
||||
* @summary Get an execution detail of a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperimentExecutionDetails.json
|
||||
*/
|
||||
async function getExperimentExecutionDetails() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const executionDetailsId = "f24500ad-744e-4a26-864b-b76199eac333";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.getExecutionDetails(
|
||||
resourceGroupName,
|
||||
experimentName,
|
||||
executionDetailsId
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getExperimentExecutionDetails().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Experiment resource.
|
||||
*
|
||||
* @summary Get a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperiment.json
|
||||
*/
|
||||
async function getAExperimentInAResourceGroup() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.get(
|
||||
resourceGroupName,
|
||||
experimentName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getAExperimentInAResourceGroup().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a status of a Experiment resource.
|
||||
*
|
||||
* @summary Get a status of a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetAExperimentStatus.json
|
||||
*/
|
||||
async function getTheStatusOfAExperiment() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const statusId = "50734542-2e64-4e08-814c-cc0e7475f7e4";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.getStatus(
|
||||
resourceGroupName,
|
||||
experimentName,
|
||||
statusId
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getTheStatusOfAExperiment().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import {
|
||||
ExperimentsListAllOptionalParams,
|
||||
ChaosManagementClient
|
||||
} from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Experiment resources in a subscription.
|
||||
*
|
||||
* @summary Get a list of Experiment resources in a subscription.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentsInASubscription.json
|
||||
*/
|
||||
async function listAllExperimentsInASubscription() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const continuationToken = undefined;
|
||||
const options: ExperimentsListAllOptionalParams = { continuationToken };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.experiments.listAll(options)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllExperimentsInASubscription().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of statuses of a Experiment resource.
|
||||
*
|
||||
* @summary Get a list of statuses of a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentStatuses.json
|
||||
*/
|
||||
async function listAllStatusesOfAExperiment() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.experiments.listAllStatuses(
|
||||
resourceGroupName,
|
||||
experimentName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllStatusesOfAExperiment().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of execution details of a Experiment resource.
|
||||
*
|
||||
* @summary Get a list of execution details of a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentExecutionsDetails.json
|
||||
*/
|
||||
async function listExperimentExecutionsDetails() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.experiments.listExecutionDetails(
|
||||
resourceGroupName,
|
||||
experimentName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listExperimentExecutionsDetails().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import {
|
||||
ExperimentsListOptionalParams,
|
||||
ChaosManagementClient
|
||||
} from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Experiment resources in a resource group.
|
||||
*
|
||||
* @summary Get a list of Experiment resources in a resource group.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListExperimentsInAResourceGroup.json
|
||||
*/
|
||||
async function listAllExperimentsInAResourceGroup() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const continuationToken = undefined;
|
||||
const options: ExperimentsListOptionalParams = { continuationToken };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.experiments.list(resourceGroupName, options)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllExperimentsInAResourceGroup().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Start a Experiment resource.
|
||||
*
|
||||
* @summary Start a Experiment resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/StartAExperiment.json
|
||||
*/
|
||||
async function startAExperiment() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const experimentName = "exampleExperiment";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.experiments.start(
|
||||
resourceGroupName,
|
||||
experimentName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
startAExperiment().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Target Type resources for given location.
|
||||
*
|
||||
* @summary Get a Target Type resources for given location.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetATargetType.json
|
||||
*/
|
||||
async function getATargetTypeForWestus2Location() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const locationName = "westus2";
|
||||
const targetTypeName = "Microsoft-Agent";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.targetTypes.get(locationName, targetTypeName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getATargetTypeForWestus2Location().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import {
|
||||
TargetTypesListOptionalParams,
|
||||
ChaosManagementClient
|
||||
} from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Target Type resources for given location.
|
||||
*
|
||||
* @summary Get a list of Target Type resources for given location.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListTargetTypes.json
|
||||
*/
|
||||
async function listAllTargetTypesForWestus2Location() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const locationName = "westus2";
|
||||
const continuationToken = undefined;
|
||||
const options: TargetTypesListOptionalParams = { continuationToken };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.targetTypes.list(locationName, options)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllTargetTypesForWestus2Location().catch(console.error);
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { Target, ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create or update a Target resource that extends a tracked regional resource.
|
||||
*
|
||||
* @summary Create or update a Target resource that extends a tracked regional resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/CreateOrUpdateATarget.json
|
||||
*/
|
||||
async function createOrUpdateATargetThatExtendsAVirtualMachineResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-Agent";
|
||||
const target: Target = {
|
||||
properties: {
|
||||
identities: [
|
||||
{ type: "CertificateSubjectIssuer", subject: "CN=example.subject" }
|
||||
]
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.targets.createOrUpdate(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName,
|
||||
target
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createOrUpdateATargetThatExtendsAVirtualMachineResource().catch(console.error);
|
|
@ -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 { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Delete a Target resource that extends a tracked regional resource.
|
||||
*
|
||||
* @summary Delete a Target resource that extends a tracked regional resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/DeleteATarget.json
|
||||
*/
|
||||
async function deleteATargetThatExtendsAVirtualMachineResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-Agent";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.targets.delete(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteATargetThatExtendsAVirtualMachineResource().catch(console.error);
|
|
@ -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 { ChaosManagementClient } from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a Target resource that extends a tracked regional resource.
|
||||
*
|
||||
* @summary Get a Target resource that extends a tracked regional resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/GetATarget.json
|
||||
*/
|
||||
async function getATargetThatExtendsAVirtualMachineResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const targetName = "Microsoft-Agent";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const result = await client.targets.get(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
targetName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getATargetThatExtendsAVirtualMachineResource().catch(console.error);
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import {
|
||||
TargetsListOptionalParams,
|
||||
ChaosManagementClient
|
||||
} from "@azure/arm-chaos";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get a list of Target resources that extend a tracked regional resource.
|
||||
*
|
||||
* @summary Get a list of Target resources that extend a tracked regional resource.
|
||||
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-07-01-preview/examples/ListTargets.json
|
||||
*/
|
||||
async function listAllTargetsThatExtendAVirtualMachineResource() {
|
||||
const subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
|
||||
const resourceGroupName = "exampleRG";
|
||||
const parentProviderNamespace = "Microsoft.Compute";
|
||||
const parentResourceType = "virtualMachines";
|
||||
const parentResourceName = "exampleVM";
|
||||
const continuationToken = undefined;
|
||||
const options: TargetsListOptionalParams = { continuationToken };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new ChaosManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.targets.list(
|
||||
resourceGroupName,
|
||||
parentProviderNamespace,
|
||||
parentResourceType,
|
||||
parentResourceName,
|
||||
options
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAllTargetsThatExtendAVirtualMachineResource().catch(console.error);
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2018",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"alwaysStrict": true,
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": [
|
||||
"src/**.ts"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the 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 {
|
||||
CapabilitiesImpl,
|
||||
ExperimentsImpl,
|
||||
OperationsImpl,
|
||||
TargetsImpl,
|
||||
TargetTypesImpl,
|
||||
CapabilityTypesImpl
|
||||
} from "./operations";
|
||||
import {
|
||||
Capabilities,
|
||||
Experiments,
|
||||
Operations,
|
||||
Targets,
|
||||
TargetTypes,
|
||||
CapabilityTypes
|
||||
} from "./operationsInterfaces";
|
||||
import { ChaosManagementClientOptionalParams } from "./models";
|
||||
|
||||
export class ChaosManagementClient extends coreClient.ServiceClient {
|
||||
$host: string;
|
||||
apiVersion: string;
|
||||
subscriptionId: string;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the ChaosManagementClient class.
|
||||
* @param credentials Subscription credentials which uniquely identify client subscription.
|
||||
* @param subscriptionId GUID that represents an Azure subscription ID.
|
||||
* @param options The parameter options
|
||||
*/
|
||||
constructor(
|
||||
credentials: coreAuth.TokenCredential,
|
||||
subscriptionId: string,
|
||||
options?: ChaosManagementClientOptionalParams
|
||||
) {
|
||||
if (credentials === undefined) {
|
||||
throw new Error("'credentials' cannot be null");
|
||||
}
|
||||
if (subscriptionId === undefined) {
|
||||
throw new Error("'subscriptionId' cannot be null");
|
||||
}
|
||||
|
||||
// Initializing default values for options
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
const defaults: ChaosManagementClientOptionalParams = {
|
||||
requestContentType: "application/json; charset=utf-8",
|
||||
credential: credentials
|
||||
};
|
||||
|
||||
const packageDetails = `azsdk-js-arm-chaos/1.0.0-beta.1`;
|
||||
const userAgentPrefix =
|
||||
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
||||
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
||||
: `${packageDetails}`;
|
||||
|
||||
if (!options.credentialScopes) {
|
||||
options.credentialScopes = ["https://management.azure.com/.default"];
|
||||
}
|
||||
const optionsWithDefaults = {
|
||||
...defaults,
|
||||
...options,
|
||||
userAgentOptions: {
|
||||
userAgentPrefix
|
||||
},
|
||||
baseUri:
|
||||
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}`,
|
||||
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-07-01-preview";
|
||||
this.capabilities = new CapabilitiesImpl(this);
|
||||
this.experiments = new ExperimentsImpl(this);
|
||||
this.operations = new OperationsImpl(this);
|
||||
this.targets = new TargetsImpl(this);
|
||||
this.targetTypes = new TargetTypesImpl(this);
|
||||
this.capabilityTypes = new CapabilityTypesImpl(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<PipelineResponse> {
|
||||
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);
|
||||
}
|
||||
|
||||
capabilities: Capabilities;
|
||||
experiments: Experiments;
|
||||
operations: Operations;
|
||||
targets: Targets;
|
||||
targetTypes: TargetTypes;
|
||||
capabilityTypes: CapabilityTypes;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
/// <reference lib="esnext.asynciterable" />
|
||||
export * from "./models";
|
||||
export { ChaosManagementClient } from "./chaosManagementClient";
|
||||
export * from "./operationsInterfaces";
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче