diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 78d3769a9be2..727d3eb45bbd 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -81,7 +81,7 @@ importers: version: file:projects/arm-agrifood.tgz(@vitest/browser@2.1.8)(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3)) '@rush-temp/arm-analysisservices': specifier: file:./projects/arm-analysisservices.tgz - version: file:projects/arm-analysisservices.tgz(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3))(vite@5.4.11(@types/node@22.7.9)) + version: file:projects/arm-analysisservices.tgz(@vitest/browser@2.1.8)(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3)) '@rush-temp/arm-apicenter': specifier: file:./projects/arm-apicenter.tgz version: file:projects/arm-apicenter.tgz(@vitest/browser@2.1.8)(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3)) @@ -168,7 +168,7 @@ importers: version: file:projects/arm-changes.tgz(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3))(vite@5.4.11(@types/node@22.7.9)) '@rush-temp/arm-chaos': specifier: file:./projects/arm-chaos.tgz - version: file:projects/arm-chaos.tgz + version: file:projects/arm-chaos.tgz(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3))(vite@5.4.11(@types/node@22.7.9)) '@rush-temp/arm-cognitiveservices': specifier: file:./projects/arm-cognitiveservices.tgz version: file:projects/arm-cognitiveservices.tgz @@ -1297,10 +1297,6 @@ packages: resolution: {integrity: sha512-Qk6kxoqMgzOvceUBqD1WTHrPh/iaxlTLQPp241u3iNVOE4FVSTqSzTxjG1tr/UL1rBWGvoLPZExUFddo+Qd5KQ==} engines: {node: '>=18.0.0'} - '@azure/arm-cosmosdb@16.0.0-beta.6': - resolution: {integrity: sha512-Ue4ocP8qCsFDeBZ/MjMNyVt4e9QhU3UgrRfZSw6kWiMzdrCgDePnZvjzZs9PQpjAsXbHGd9HlEIXg9Dl6Y/uww==} - engines: {node: '>=14.0.0'} - '@azure/arm-network@32.2.0': resolution: {integrity: sha512-6QmZ9aGdiz+9u7jPhQEg2zY/Tn8hwJrmjAMuHlWpnqE2kHvSDnKCE3BiNLZsENfi/IeLKBuW0QIdZ5UhbSSA0A==} engines: {node: '>=14.0.0'} @@ -2555,7 +2551,7 @@ packages: version: 0.0.0 '@rush-temp/arm-analysisservices@file:projects/arm-analysisservices.tgz': - resolution: {integrity: sha512-t5nlKA9aERhTLA1FtwaTyPlS1Ipu6zQgMyCVTHhJX42q6FPF/d5XbOMJz+58T5u8UY/JgTgxHuaese/KtbE7hA==, tarball: file:projects/arm-analysisservices.tgz} + resolution: {integrity: sha512-KOPovqzxtFRHWxuynP1VXcwLHtcuPqpQucJ301SHBKEPodN5jM3699wc/Q+ByUL+Rbbda+M9vsTnUA9o4cEPxg==, tarball: file:projects/arm-analysisservices.tgz} version: 0.0.0 '@rush-temp/arm-apicenter@file:projects/arm-apicenter.tgz': @@ -2563,43 +2559,43 @@ packages: version: 0.0.0 '@rush-temp/arm-apimanagement@file:projects/arm-apimanagement.tgz': - resolution: {integrity: sha512-21fUiCFQejze8e2l3PwTiHFc8KDuj3L8nXnEeFExNELM/nS+iCf6rEih+d5pe0+O6rQ3camxDNAA223kC/eBCA==, tarball: file:projects/arm-apimanagement.tgz} + resolution: {integrity: sha512-Oo7NsnCPAlo7YDMq88CdrMM+T3Ul6F7PyjMSQ3BJzua1xVx0Z3ZglwoW4ca7SNdJaPqIjdtInqMltmTdc4V4zw==, tarball: file:projects/arm-apimanagement.tgz} version: 0.0.0 '@rush-temp/arm-appcomplianceautomation@file:projects/arm-appcomplianceautomation.tgz': - resolution: {integrity: sha512-wVhFZffEgVUEVkJ/JXkXAw7AgsKAt9t4YdiDqhT85Os3EHVQCfs9zL2GOYo1TsJW8B94xeB1Q8NR5Gjb6tYUsA==, tarball: file:projects/arm-appcomplianceautomation.tgz} + resolution: {integrity: sha512-zB3KF5bcZVyCGC44uZFL/cNLbx9wHvVSixB+MibWs/vUrYJkSjn/aMAla40Y2ohdvSG0MQErrrykZ6xh0/ZzEQ==, tarball: file:projects/arm-appcomplianceautomation.tgz} version: 0.0.0 '@rush-temp/arm-appconfiguration@file:projects/arm-appconfiguration.tgz': - resolution: {integrity: sha512-X9vtg38hrEXVCKUdUFtZRTnbI4l+PzBGYO9lQYuimnRTxCMiTXc6GGjbOVQTTBzUZGfKwqNh0KH8+tCc2uwlPw==, tarball: file:projects/arm-appconfiguration.tgz} + resolution: {integrity: sha512-Ob7iFm0aHcW5QKlrWG9nT9s6qrr/MMxtZUp6PnTwaa0d5fnCzaeODXaJJuLEOuc3/o1JW5duk3dudzYVq/6OJA==, tarball: file:projects/arm-appconfiguration.tgz} version: 0.0.0 '@rush-temp/arm-appcontainers@file:projects/arm-appcontainers.tgz': - resolution: {integrity: sha512-F6UWTLT88PtbS6bRhWQrh0Sp2yjMRFbtbc6EcTqhkHPcRMVXjzUyOFN1vHHdaJC5mrJIZmWMIKGLeZCb5qQJWQ==, tarball: file:projects/arm-appcontainers.tgz} + resolution: {integrity: sha512-PEgH/7Dtajr6+Cl8EOxtfpPUqAh01KQbma54i5sPT3C3gg5H3JEKl9N0pWeqtVQkuRhjGRHVpuDglai7t7xjOA==, tarball: file:projects/arm-appcontainers.tgz} version: 0.0.0 '@rush-temp/arm-appinsights@file:projects/arm-appinsights.tgz': - resolution: {integrity: sha512-WkCGRJOgMT05ZAwQI/9TO2tMfFvJXNGq7way06YLyR9pQaBWGLigg9I31NJf0wPL0RjiZZCcosvcqDLQvSz7ng==, tarball: file:projects/arm-appinsights.tgz} + resolution: {integrity: sha512-r+9n5vKxjXg9Fcbk4QOD3v0a4bI9uQwKRRFyCmklf+UvOGHHDH4H3KgXLhY0U0MuY03mczERTNZeQ5itA4j6Mw==, tarball: file:projects/arm-appinsights.tgz} version: 0.0.0 '@rush-temp/arm-appplatform@file:projects/arm-appplatform.tgz': - resolution: {integrity: sha512-pYseTBkUlllHoClzDUz/xb69DkVEtB8s8qyu5nIqp6AWSiKH39yq8x2rx+EAFkS6AATaZS2rCAZK6E/3wwTLSQ==, tarball: file:projects/arm-appplatform.tgz} + resolution: {integrity: sha512-MAjDVwNRIa2pRHOTitorR3PglJT0Ba7mnsO0O09njccaS+HrRmQ5NNRuYtUTCgaqDQXwWmsdqW0398Fa91zQxA==, tarball: file:projects/arm-appplatform.tgz} version: 0.0.0 '@rush-temp/arm-appservice-1@file:projects/arm-appservice-1.tgz': - resolution: {integrity: sha512-cXKnHnM33ikSq4OLRXT50p+IkJTOz84gDAwLe0I6lB+4F3vEjk0D5yPI1ldxLeWIEhQM3yO3Xo28daFZpN6ivQ==, tarball: file:projects/arm-appservice-1.tgz} + resolution: {integrity: sha512-I4PTx+1nAQHr10v5BssfNbuvr8uIS0psZxPHDxXq2WjxJcH/SGHK0/o8kxg+Vlc3n9xkKUoc57CKa+HIOLImQA==, tarball: file:projects/arm-appservice-1.tgz} version: 0.0.0 '@rush-temp/arm-appservice-profile-2020-09-01-hybrid@file:projects/arm-appservice-profile-2020-09-01-hybrid.tgz': - resolution: {integrity: sha512-L77qRJyuIeH6JVDT/TJsh8fJkxbKexxjv1D8C/esluBETxmmdwzYzp2uSNjrZJrNMFSxo96tQrJv8m0qlMJCug==, tarball: file:projects/arm-appservice-profile-2020-09-01-hybrid.tgz} + resolution: {integrity: sha512-lDv0cHKSGmSI+X4j0VNvpp2NbMvWbS9a0axsvkBt3IBPOGTc8wFE57AfKaf3L0fcnYMOnJ5gcpffVq4HJrgZyg==, tarball: file:projects/arm-appservice-profile-2020-09-01-hybrid.tgz} version: 0.0.0 '@rush-temp/arm-appservice@file:projects/arm-appservice.tgz': - resolution: {integrity: sha512-lRVoeW9c5u2Wvw3s+Xq8Y7ylNHVXFvmssfojDyemSOPizIFsVyfG4kajrdE1Z+AFwfHyCnVkI4+To4Gyt9uzMQ==, tarball: file:projects/arm-appservice.tgz} + resolution: {integrity: sha512-Gm6IVeuX/G1I/uOsftFAnsBpD6gRm6C6JIPLxTGuChrbgsI9a5jAe1jC9dj9ExIMjFEYvu8zsCcFuFNJTJ1qKg==, tarball: file:projects/arm-appservice.tgz} version: 0.0.0 '@rush-temp/arm-astro@file:projects/arm-astro.tgz': - resolution: {integrity: sha512-RRCkmf0unzqnOt1zUz0Otboh8WHQP5zCVTZCqpBEledvLv6wy4ZHUKQZybIuHrs0uhKP7QFnq5rWKJ0+6Xyzhw==, tarball: file:projects/arm-astro.tgz} + resolution: {integrity: sha512-is0RVAScorqjNo3WmKSVd7HLbrap70UP3wG1tg/hBp5RS3kM6RF8M5oz5GHvFcj0m9l4JUo5+HiYawSUs+E8ow==, tarball: file:projects/arm-astro.tgz} version: 0.0.0 '@rush-temp/arm-attestation@file:projects/arm-attestation.tgz': @@ -2671,7 +2667,7 @@ packages: version: 0.0.0 '@rush-temp/arm-chaos@file:projects/arm-chaos.tgz': - resolution: {integrity: sha512-55gboIlBeU8bjXj/a7mwbUChnuaozfbkLMztpCxXQABI85EYe83ffl9VgVqm7iXy61tF6gUOMphDbeSfKFc4RQ==, tarball: file:projects/arm-chaos.tgz} + resolution: {integrity: sha512-zhIQPP5RX/D5xIyloAvJFbrPCyp6mX7KsHjQLYaz2c1J8/CncDzpYRJMsiQz1mOwsc7VozJlSaAXnyk4dE6m1Q==, tarball: file:projects/arm-chaos.tgz} version: 0.0.0 '@rush-temp/arm-cognitiveservices@file:projects/arm-cognitiveservices.tgz': @@ -3643,7 +3639,7 @@ packages: version: 0.0.0 '@rush-temp/core-lro@file:projects/core-lro.tgz': - resolution: {integrity: sha512-JVRq/adT3XVwGXBVhK42yFSTQ+sGrXfQTYCUyzj1c/nbaVSPfj3K38eKQHfTLSAs/UiwdUz9rFkxuo6CQvbkjQ==, tarball: file:projects/core-lro.tgz} + resolution: {integrity: sha512-iITKW8T3h/YUBSQw1PH/UMAsGAtT9EctavUtctF18L5P0PdhwVzI4RSItZq8ZS0ON2tEsZa6lriGDSeuNx8+7w==, tarball: file:projects/core-lro.tgz} version: 0.0.0 '@rush-temp/core-paging@file:projects/core-paging.tgz': @@ -8338,18 +8334,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@azure/arm-cosmosdb@16.0.0-beta.6': - dependencies: - '@azure/abort-controller': 1.1.0 - '@azure/core-auth': 1.9.0 - '@azure/core-client': 1.9.2 - '@azure/core-lro': 2.7.2 - '@azure/core-paging': 1.6.2 - '@azure/core-rest-pipeline': 1.18.1 - tslib: 2.8.1 - transitivePeerDependencies: - - supports-color - '@azure/arm-network@32.2.0': dependencies: '@azure/abort-controller': 1.1.0 @@ -10477,36 +10461,29 @@ snapshots: - supports-color - terser - '@rush-temp/arm-analysisservices@file:projects/arm-analysisservices.tgz(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3))(vite@5.4.11(@types/node@22.7.9))': + '@rush-temp/arm-analysisservices@file:projects/arm-analysisservices.tgz(@vitest/browser@2.1.8)(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3))': dependencies: - '@azure/abort-controller': 1.1.0 '@azure/core-lro': 2.7.2 '@types/node': 18.19.70 - '@vitest/browser': 2.1.8(@types/node@18.19.70)(playwright@1.49.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.7.9))(vitest@2.1.8) '@vitest/coverage-istanbul': 2.1.8(vitest@2.1.8) - playwright: 1.49.1 tslib: 2.8.1 typescript: 5.7.2 vitest: 2.1.8(@types/node@18.19.70)(@vitest/browser@2.1.8)(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3)) transitivePeerDependencies: - '@edge-runtime/vm' + - '@vitest/browser' - '@vitest/ui' - - bufferutil - happy-dom - jsdom - less - lightningcss - msw - - safaridriver - sass - sass-embedded - stylus - sugarss - supports-color - terser - - utf-8-validate - - vite - - webdriverio '@rush-temp/arm-apicenter@file:projects/arm-apicenter.tgz(@vitest/browser@2.1.8)(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3))': dependencies: @@ -10560,7 +10537,6 @@ snapshots: '@rush-temp/arm-appcomplianceautomation@file:projects/arm-appcomplianceautomation.tgz(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3))(vite@5.4.11(@types/node@22.7.9))': dependencies: - '@azure/abort-controller': 1.1.0 '@azure/core-lro': 2.7.2 '@types/node': 18.19.70 '@vitest/browser': 2.1.8(@types/node@18.19.70)(playwright@1.49.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.7.9))(vitest@2.1.8) @@ -10568,7 +10544,6 @@ snapshots: dotenv: 16.4.7 playwright: 1.49.1 tslib: 2.8.1 - tsx: 4.19.2 typescript: 5.7.2 vitest: 2.1.8(@types/node@18.19.70)(@vitest/browser@2.1.8)(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3)) transitivePeerDependencies: @@ -10598,13 +10573,9 @@ snapshots: '@types/node': 18.19.70 '@vitest/browser': 2.1.8(@types/node@18.19.70)(playwright@1.49.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.7.9))(vitest@2.1.8) '@vitest/coverage-istanbul': 2.1.8(vitest@2.1.8) - cross-env: 7.0.3 dotenv: 16.4.7 - mkdirp: 3.0.1 playwright: 1.49.1 - rimraf: 5.0.10 tslib: 2.8.1 - tsx: 4.19.2 typescript: 5.7.2 vitest: 2.1.8(@types/node@18.19.70)(@vitest/browser@2.1.8)(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3)) transitivePeerDependencies: @@ -10636,7 +10607,6 @@ snapshots: dotenv: 16.4.7 playwright: 1.49.1 tslib: 2.8.1 - tsx: 4.19.2 typescript: 5.7.2 vitest: 2.1.8(@types/node@18.19.70)(@vitest/browser@2.1.8)(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3)) transitivePeerDependencies: @@ -10690,7 +10660,6 @@ snapshots: '@rush-temp/arm-appplatform@file:projects/arm-appplatform.tgz(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3))(vite@5.4.11(@types/node@22.7.9))': dependencies: - '@azure/abort-controller': 1.1.0 '@azure/core-lro': 2.7.2 '@types/node': 18.19.70 '@vitest/browser': 2.1.8(@types/node@18.19.70)(playwright@1.49.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.7.9))(vitest@2.1.8) @@ -10722,7 +10691,6 @@ snapshots: '@rush-temp/arm-appservice-1@file:projects/arm-appservice-1.tgz(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3))(vite@5.4.11(@types/node@22.7.9))': dependencies: - '@azure/abort-controller': 1.1.0 '@azure/core-lro': 2.7.2 '@types/node': 18.19.70 '@vitest/browser': 2.1.8(@types/node@18.19.70)(playwright@1.49.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.7.9))(vitest@2.1.8) @@ -10730,7 +10698,6 @@ snapshots: dotenv: 16.4.7 playwright: 1.49.1 tslib: 2.8.1 - tsx: 4.19.2 typescript: 5.7.2 vitest: 2.1.8(@types/node@18.19.70)(@vitest/browser@2.1.8)(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3)) transitivePeerDependencies: @@ -10755,7 +10722,6 @@ snapshots: '@rush-temp/arm-appservice-profile-2020-09-01-hybrid@file:projects/arm-appservice-profile-2020-09-01-hybrid.tgz(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3))(vite@5.4.11(@types/node@22.7.9))': dependencies: - '@azure/abort-controller': 1.1.0 '@azure/core-lro': 2.7.2 '@types/node': 18.19.70 '@vitest/browser': 2.1.8(@types/node@18.19.70)(playwright@1.49.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.7.9))(vitest@2.1.8) @@ -10787,7 +10753,6 @@ snapshots: '@rush-temp/arm-appservice@file:projects/arm-appservice.tgz(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3))(vite@5.4.11(@types/node@22.7.9))': dependencies: - '@azure-rest/core-client': 1.4.0 '@types/node': 18.19.70 '@vitest/browser': 2.1.8(@types/node@18.19.70)(playwright@1.49.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.7.9))(vitest@2.1.8) '@vitest/coverage-istanbul': 2.1.8(vitest@2.1.8) @@ -10821,7 +10786,6 @@ snapshots: '@rush-temp/arm-astro@file:projects/arm-astro.tgz(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3))(vite@5.4.11(@types/node@22.7.9))': dependencies: - '@azure/abort-controller': 1.1.0 '@azure/core-lro': 2.7.2 '@types/node': 18.19.70 '@vitest/browser': 2.1.8(@types/node@18.19.70)(playwright@1.49.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.7.9))(vitest@2.1.8) @@ -11379,26 +11343,38 @@ snapshots: - vite - webdriverio - '@rush-temp/arm-chaos@file:projects/arm-chaos.tgz': + '@rush-temp/arm-chaos@file:projects/arm-chaos.tgz(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3))(vite@5.4.11(@types/node@22.7.9))': dependencies: - '@azure-tools/test-credential': 1.3.1 - '@azure-tools/test-recorder': 3.5.2 - '@azure/abort-controller': 1.1.0 - '@azure/arm-cosmosdb': 16.0.0-beta.6 - '@azure/core-lro': 2.7.2 - '@types/chai': 4.3.20 - '@types/mocha': 10.0.10 + '@microsoft/api-extractor': 7.48.1(@types/node@18.19.70) '@types/node': 18.19.70 - chai: 4.5.0 + '@vitest/browser': 2.1.8(@types/node@18.19.70)(playwright@1.49.1)(typescript@5.6.3)(vite@5.4.11(@types/node@22.7.9))(vitest@2.1.8) + '@vitest/coverage-istanbul': 2.1.8(vitest@2.1.8) dotenv: 16.4.7 - mocha: 11.1.0 - ts-node: 10.9.2(@types/node@18.19.70)(typescript@5.7.2) + eslint: 9.17.0 + playwright: 1.49.1 tslib: 2.8.1 - typescript: 5.7.2 + typescript: 5.6.3 + vitest: 2.1.8(@types/node@18.19.70)(@vitest/browser@2.1.8)(msw@2.7.0(@types/node@22.7.9)(typescript@5.7.3)) transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' + - '@edge-runtime/vm' + - '@vitest/ui' + - bufferutil + - happy-dom + - jiti + - jsdom + - less + - lightningcss + - msw + - safaridriver + - sass + - sass-embedded + - stylus + - sugarss - supports-color + - terser + - utf-8-validate + - vite + - webdriverio '@rush-temp/arm-cognitiveservices@file:projects/arm-cognitiveservices.tgz': dependencies: diff --git a/sdk/chaos/arm-chaos/CHANGELOG.md b/sdk/chaos/arm-chaos/CHANGELOG.md index da9ea421fa69..41f952a40aa8 100644 --- a/sdk/chaos/arm-chaos/CHANGELOG.md +++ b/sdk/chaos/arm-chaos/CHANGELOG.md @@ -1,15 +1,166 @@ # Release History - -## 1.1.1 (Unreleased) - + +## 2.0.0-beta.1 (2025-01-11) +Compared with version 1.1.0 + ### Features Added -### Breaking Changes + - Added operation group ExperimentExecutionsOperations + - Added operation group PrivateAccessesOperations + - Added operation group PrivateEndpointConnectionsOperations + - Added operation ExperimentsOperations.cancel + - Added operation ExperimentsOperations.createOrUpdate + - Added operation ExperimentsOperations.delete + - Added operation ExperimentsOperations.start + - Added operation ExperimentsOperations.update + - Added operation OperationsOperations.list + - Added Interface CapabilityProperties + - Added Interface CapabilityTypeProperties + - Added Interface CustomerDataStorageProperties + - Added Interface ExperimentExecutionsGetExecutionDetailsOptionalParams + - Added Interface ExperimentExecutionsGetExecutionOptionalParams + - Added Interface ExperimentExecutionsListAllExecutionsOptionalParams + - Added Interface ExperimentProperties + - Added Interface ManagedServiceIdentity + - Added Interface OperationsListOptionalParams + - Added Interface OperationStatusResult + - Added Interface PagedAsyncIterableIterator + - Added Interface PageSettings + - Added Interface PrivateAccess + - Added Interface PrivateAccessesCreateOrUpdateOptionalParams + - Added Interface PrivateAccessesDeleteOptionalParams + - Added Interface PrivateAccessesGetOptionalParams + - Added Interface PrivateAccessesListAllOptionalParams + - Added Interface PrivateAccessesListOptionalParams + - Added Interface PrivateAccessesPrivateLinkResourcesOptionalParams + - Added Interface PrivateAccessesUpdateOptionalParams + - Added Interface PrivateAccessPatch + - Added Interface PrivateAccessProperties + - Added Interface PrivateEndpoint + - Added Interface PrivateEndpointConnection + - Added Interface PrivateEndpointConnectionProperties + - Added Interface PrivateEndpointConnectionsDeleteAPrivateEndpointConnectionOptionalParams + - Added Interface PrivateEndpointConnectionsGetAPrivateEndpointConnectionOptionalParams + - Added Interface PrivateEndpointConnectionsListPrivateEndpointConnectionsOptionalParams + - Added Interface PrivateLinkResource + - Added Interface PrivateLinkResourceProperties + - Added Interface PrivateLinkServiceConnectionState + - Added Interface ProxyResource + - Added Interface RestorePollerOptions + - Added Interface TargetProperties + - Added Interface TargetTypeProperties + - Added Type Alias ContinuablePage + - Added Type Alias ExperimentActionType + - Added Type Alias ManagedServiceIdentityType + - Added Type Alias PrivateEndpointServiceConnectionStatus + - Added Type Alias PublicNetworkAccessOption + - Interface Capability has a new optional parameter properties + - Interface CapabilityType has a new optional parameter properties + - Interface ExperimentExecution has a new optional parameter properties + - Interface ExperimentExecutionDetails has a new optional parameter properties + - Interface ExperimentExecutionDetailsProperties has a new optional parameter startedAt + - Interface ExperimentExecutionDetailsProperties has a new optional parameter status + - Interface ExperimentExecutionDetailsProperties has a new optional parameter stoppedAt + - Interface Resource has a new optional parameter systemData + - Added Enum KnownExperimentActionType + - Added Enum KnownManagedServiceIdentityType + - Added Enum KnownPrivateEndpointServiceConnectionStatus + - Added Enum KnownPublicNetworkAccessOption + - Added Enum KnownVersions + - Enum KnownOrigin has a new value "user,system" + - Enum KnownOrigin has a new value system + - Enum KnownOrigin has a new value user + - Added function restorePoller -### Bugs Fixed - -### Other Changes +### Breaking Changes + - Removed operation Experiments.beginCancel + - Removed operation Experiments.beginCancelAndWait + - Removed operation Experiments.beginCreateOrUpdate + - Removed operation Experiments.beginCreateOrUpdateAndWait + - Removed operation Experiments.beginDelete + - Removed operation Experiments.beginDeleteAndWait + - Removed operation Experiments.beginStart + - Removed operation Experiments.beginStartAndWait + - Removed operation Experiments.beginUpdate + - Removed operation Experiments.beginUpdateAndWait + - Removed operation Experiments.executionDetails + - Removed operation Experiments.getExecution + - Removed operation Experiments.listAllExecutions + - Removed operation Operations.listAll + - Class ChaosManagementClient has a new signature + - Interface Capability no longer has parameter description + - Interface Capability no longer has parameter parametersSchema + - Interface Capability no longer has parameter publisher + - Interface Capability no longer has parameter systemData + - Interface Capability no longer has parameter targetType + - Interface Capability no longer has parameter urn + - Interface CapabilityType no longer has parameter azureRbacActions + - Interface CapabilityType no longer has parameter azureRbacDataActions + - Interface CapabilityType no longer has parameter description + - Interface CapabilityType no longer has parameter displayName + - Interface CapabilityType no longer has parameter kind + - Interface CapabilityType no longer has parameter parametersSchema + - Interface CapabilityType no longer has parameter publisher + - Interface CapabilityType no longer has parameter runtimeProperties + - Interface CapabilityType no longer has parameter systemData + - Interface CapabilityType no longer has parameter targetType + - Interface CapabilityType no longer has parameter urn + - Interface ChaosManagementClientOptionalParams no longer has parameter $host + - Interface ChaosManagementClientOptionalParams no longer has parameter endpoint + - Interface Experiment no longer has parameter provisioningState + - Interface Experiment no longer has parameter selectors + - Interface Experiment no longer has parameter steps + - Interface Experiment no longer has parameter systemData + - Interface ExperimentExecution no longer has parameter id + - Interface ExperimentExecution no longer has parameter name + - Interface ExperimentExecution no longer has parameter startedAt + - Interface ExperimentExecution no longer has parameter status + - Interface ExperimentExecution no longer has parameter stoppedAt + - Interface ExperimentExecution no longer has parameter type + - Interface ExperimentExecutionDetails no longer has parameter failureReason + - Interface ExperimentExecutionDetails no longer has parameter lastActionAt + - Interface ExperimentExecutionDetails no longer has parameter runInformation + - Interface ExperimentExecutionDetails no longer has parameter startedAt + - Interface ExperimentExecutionDetails no longer has parameter status + - Interface ExperimentExecutionDetails no longer has parameter stoppedAt + - Interface ExperimentsCancelOptionalParams no longer has parameter resumeFrom + - Interface ExperimentsCreateOrUpdateOptionalParams no longer has parameter resumeFrom + - Interface ExperimentsDeleteOptionalParams no longer has parameter resumeFrom + - Interface ExperimentsStartOptionalParams no longer has parameter resumeFrom + - Interface ExperimentsUpdateOptionalParams no longer has parameter resumeFrom + - Interface Target no longer has parameter systemData + - Interface TargetType no longer has parameter description + - Interface TargetType no longer has parameter displayName + - Interface TargetType no longer has parameter propertiesSchema + - Interface TargetType no longer has parameter resourceTypes + - Interface TargetType no longer has parameter systemData + - Interface Experiment has a new required parameter properties + - Interface TargetType has a new required parameter properties + - Type of parameter type of interface ChaosExperimentAction is changed from "delay" | "discrete" | "continuous" to ExperimentActionType + - Type of parameter type of interface ChaosTargetFilter is changed from "Simple" to FilterType + - Type of parameter type of interface ChaosTargetSelector is changed from "List" | "Query" to SelectorType + - Type of parameter info of interface ErrorAdditionalInfo is changed from Record to Record + - Type of parameter identity of interface Experiment is changed from ResourceIdentity to ManagedServiceIdentity + - Type of parameter identity of interface ExperimentUpdate is changed from ResourceIdentity to ManagedServiceIdentity + - Type of parameter tags of interface ExperimentUpdate is changed from { + [propertyName: string]: string; + } to Record + - Type of parameter properties of interface Target is changed from { + [propertyName: string]: any; + } to TargetProperties + - Type of parameter tags of interface TrackedResource is changed from { + [propertyName: string]: string; + } to Record + - Class ChaosManagementClient no longer has parameter $host + - Class ChaosManagementClient no longer has parameter apiVersion + - Class ChaosManagementClient no longer has parameter subscriptionId + - Enum KnownOrigin no longer has value System + - Enum KnownOrigin no longer has value User + - Enum KnownOrigin no longer has value UserSystem + - Removed function getContinuationToken + + ## 1.1.0 (2024-03-06) ### Features Added diff --git a/sdk/chaos/arm-chaos/LICENSE b/sdk/chaos/arm-chaos/LICENSE index 7d5934740965..2ad4de7b17f0 100644 --- a/sdk/chaos/arm-chaos/LICENSE +++ b/sdk/chaos/arm-chaos/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/chaos/arm-chaos/README.md b/sdk/chaos/arm-chaos/README.md index d64a5a45be0b..a041391e5400 100644 --- a/sdk/chaos/arm-chaos/README.md +++ b/sdk/chaos/arm-chaos/README.md @@ -4,10 +4,11 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f 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://learn.microsoft.com/javascript/api/@azure/arm-chaos) | -[Samples](https://github.com/Azure-Samples/azure-samples-js-management) +Key links: + +- [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) ## Getting started @@ -30,7 +31,7 @@ Install the Azure ChaosManagement client library for JavaScript with `npm`: npm install @azure/arm-chaos ``` -### Create and authenticate a `ChaosManagementClient` +### Create and authenticate a `ChaosClient` 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]. @@ -44,35 +45,34 @@ 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://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). +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 { ChaosClient } = 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); +const client = new ChaosClient(new DefaultAzureCredential(), subscriptionId); // For client-side applications running in the browser, use this code instead: // const credential = new InteractiveBrowserCredential({ // tenantId: "", // clientId: "" // }); -// const client = new ChaosManagementClient(credential, subscriptionId); +// const client = new ChaosClient(credential, subscriptionId); ``` -### JavaScript Bundle +### 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 +### ChaosClient -`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. +`ChaosClient` 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 @@ -87,9 +87,6 @@ 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 @@ -99,10 +96,6 @@ If you'd like to contribute to this library, please read the [contributing guide - [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://learn.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 diff --git a/sdk/chaos/arm-chaos/_meta.json b/sdk/chaos/arm-chaos/_meta.json deleted file mode 100644 index 58687b1e5e2c..000000000000 --- a/sdk/chaos/arm-chaos/_meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "commit": "0bfc45106eea53d49f1b554c25c509a9fd69b9fa", - "readme": "specification/chaos/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\chaos\\resource-manager\\readme.md --use=@autorest/typescript@6.0.17 --generate-sample=true", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.4", - "use": "@autorest/typescript@6.0.17" -} \ No newline at end of file diff --git a/sdk/chaos/arm-chaos/api-extractor.json b/sdk/chaos/arm-chaos/api-extractor.json index ea7586bb8823..bce93132f81d 100644 --- a/sdk/chaos/arm-chaos/api-extractor.json +++ b/sdk/chaos/arm-chaos/api-extractor.json @@ -1,6 +1,6 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "mainEntryPointFilePath": "dist/esm/index.d.ts", "docModel": { "enabled": true }, @@ -11,7 +11,7 @@ "dtsRollup": { "enabled": true, "untrimmedFilePath": "", - "publicTrimmedFilePath": "./types/arm-chaos.d.ts" + "publicTrimmedFilePath": "dist/arm-chaos.d.ts" }, "messages": { "tsdocMessageReporting": { @@ -28,4 +28,4 @@ } } } -} \ No newline at end of file +} diff --git a/sdk/chaos/arm-chaos/assets.json b/sdk/chaos/arm-chaos/assets.json deleted file mode 100644 index 3f2c780c6fb7..000000000000 --- a/sdk/chaos/arm-chaos/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "js", - "TagPrefix": "js/chaos/arm-chaos", - "Tag": "js/chaos/arm-chaos_82425202d7" -} diff --git a/sdk/chaos/arm-chaos/eslint.config.mjs b/sdk/chaos/arm-chaos/eslint.config.mjs new file mode 100644 index 000000000000..03244d34a19f --- /dev/null +++ b/sdk/chaos/arm-chaos/eslint.config.mjs @@ -0,0 +1,17 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default [ + ...azsdkEslint.configs.recommended, + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-apiextractor-json-types": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-module": "off", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn", + }, + }, +]; diff --git a/sdk/chaos/arm-chaos/package.json b/sdk/chaos/arm-chaos/package.json index d6dc60416aae..ede194740621 100644 --- a/sdk/chaos/arm-chaos/package.json +++ b/sdk/chaos/arm-chaos/package.json @@ -1,114 +1,137 @@ { "name": "@azure/arm-chaos", - "sdk-type": "mgmt", - "author": "Microsoft Corporation", - "description": "A generated SDK for ChaosManagementClient.", - "version": "1.1.1", + "version": "2.0.0-beta.1", + "description": "A generated SDK for ChaosClient.", "engines": { "node": ">=18.0.0" }, - "dependencies": { - "@azure/abort-controller": "^1.0.0", - "@azure/core-auth": "^1.6.0", - "@azure/core-client": "^1.7.0", - "@azure/core-lro": "^2.5.4", - "@azure/core-paging": "^1.2.0", - "@azure/core-rest-pipeline": "^1.14.0", - "tslib": "^2.2.0" + "sideEffects": false, + "autoPublish": false, + "tshy": { + "project": "./tsconfig.src.json", + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + }, + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], + "selfLink": false }, + "type": "module", "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/index.js", - "module": "./dist-esm/src/index.js", - "types": "./types/arm-chaos.d.ts", + "files": [ + "dist/", + "README.md", + "LICENSE", + "review/", + "CHANGELOG.md" + ], + "sdk-type": "mgmt", + "repository": "github:Azure/azure-sdk-for-js", + "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/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/chaosManagementContext.ts", + "prefix": "userAgentInfo" + } + ] + }, + "dependencies": { + "@azure-rest/core-client": "^2.3.1", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.6.0", + "@azure/core-lro": "^3.1.0", + "@azure/core-rest-pipeline": "^1.5.0", + "@azure/core-util": "^1.9.2", + "@azure/logger": "^1.0.0", + "tslib": "^2.6.2" + }, "devDependencies": { - "@azure-tools/test-credential": "^1.0.0", - "@azure-tools/test-recorder": "^3.0.0", - "@azure/arm-cosmosdb": "16.0.0-beta.6", + "@azure-tools/test-credential": "^2.0.0", + "@azure-tools/test-recorder": "^4.1.0", + "@azure-tools/test-utils-vitest": "^1.0.0", "@azure/dev-tool": "^1.0.0", - "@azure/identity": "^4.0.1", - "@types/chai": "^4.2.8", - "@types/mocha": "^10.0.0", + "@azure/eslint-plugin-azure-sdk": "^3.0.0", + "@azure/identity": "^4.2.1", + "@microsoft/api-extractor": "^7.40.3", "@types/node": "^18.0.0", - "chai": "^4.2.0", + "@vitest/browser": "^2.1.8", + "@vitest/coverage-istanbul": "^2.1.8", "dotenv": "^16.0.0", - "mocha": "^11.0.2", - "ts-node": "^10.0.0", - "typescript": "~5.7.2" + "eslint": "^9.9.0", + "playwright": "^1.49.1", + "typescript": "~5.6.2", + "vitest": "^2.1.8" }, - "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", - "tsconfig.json", - "review/*", - "CHANGELOG.md", - "types/*" - ], "scripts": { - "build": "npm run clean && tsc && dev-tool run bundle && npm run minify && dev-tool run vendored mkdirp ./review && npm run extract-api", - "build:browser": "echo skipped", - "build:node": "echo skipped", - "build:samples": "echo skipped.", - "build:test": "echo skipped", - "check-format": "echo skipped", + "build": "npm run clean && dev-tool run build-package && dev-tool run vendored mkdirp ./review && dev-tool run extract-api", + "build:samples": "echo skipped", + "build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test", + "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", "clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "execute:samples": "echo skipped", - "extract-api": "dev-tool run extract-api", - "format": "echo skipped", + "extract-api": "dev-tool run vendored rimraf review && dev-tool run vendored mkdirp ./review && dev-tool run extract-api", + "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", + "generate:client": "echo skipped", "integration-test": "npm run integration-test:node && npm run integration-test:browser", "integration-test:browser": "echo skipped", - "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", - "lint": "echo skipped", + "integration-test:node": "dev-tool run test:vitest --esm", + "lint": "eslint package.json api-extractor.json src test", + "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", "minify": "dev-tool run vendored uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "pack": "npm pack 2>&1", - "prepack": "npm run build", - "test": "npm run integration-test", - "test:browser": "echo skipped", - "test:node": "echo skipped", + "test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", + "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", + "test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node", "unit-test": "npm run unit-test:node && npm run unit-test:browser", - "unit-test:browser": "echo skipped", - "unit-test:node": "dev-tool run vendored cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser", + "unit-test:node": "dev-tool run test:vitest", "update-snippets": "echo skipped" }, - "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/chaosManagementClient.ts", - "prefix": "packageDetails" + "browser": "./dist/browser/index.js", + "react-native": "./dist/react-native/index.js", + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "react-native": { + "types": "./dist/react-native/index.d.ts", + "default": "./dist/react-native/index.js" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" } - ] + } }, - "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/chaos/arm-chaos", - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://learn.microsoft.com/javascript/api/@azure/arm-chaos?view=azure-node-preview" - } + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" } diff --git a/sdk/chaos/arm-chaos/review/arm-chaos.api.md b/sdk/chaos/arm-chaos/review/arm-chaos.api.md index 0e7b43c03af1..924616517722 100644 --- a/sdk/chaos/arm-chaos/review/arm-chaos.api.md +++ b/sdk/chaos/arm-chaos/review/arm-chaos.api.md @@ -4,11 +4,14 @@ ```ts -import * as coreAuth from '@azure/core-auth'; -import * as coreClient from '@azure/core-client'; +import { AbortSignalLike } from '@azure/abort-controller'; +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; import { OperationState } from '@azure/core-lro'; -import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { SimplePollerLike } from '@azure/core-lro'; +import { PathUncheckedResponse } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { PollerLike } from '@azure/core-lro'; +import { TokenCredential } from '@azure/core-auth'; // @public export interface ActionStatus { @@ -32,125 +35,92 @@ export interface BranchStatus { } // @public -export interface Capabilities { - createOrUpdate(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, capabilityName: string, capability: Capability, options?: CapabilitiesCreateOrUpdateOptionalParams): Promise; - delete(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, capabilityName: string, options?: CapabilitiesDeleteOptionalParams): Promise; - get(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, capabilityName: string, options?: CapabilitiesGetOptionalParams): Promise; - list(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, options?: CapabilitiesListOptionalParams): PagedAsyncIterableIterator; +export interface CapabilitiesCreateOrUpdateOptionalParams extends OperationOptions { } // @public -export interface CapabilitiesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +export interface CapabilitiesDeleteOptionalParams extends OperationOptions { } // @public -export type CapabilitiesCreateOrUpdateResponse = Capability; - -// @public -export interface CapabilitiesDeleteOptionalParams extends coreClient.OperationOptions { +export interface CapabilitiesGetOptionalParams extends OperationOptions { } // @public -export interface CapabilitiesGetOptionalParams extends coreClient.OperationOptions { +export interface CapabilitiesListOptionalParams extends OperationOptions { + continuationToken?: string; } // @public -export type CapabilitiesGetResponse = Capability; - -// @public -export interface CapabilitiesListNextOptionalParams extends coreClient.OperationOptions { +export interface CapabilitiesOperations { + createOrUpdate: (resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, capabilityName: string, resource: Capability, options?: CapabilitiesCreateOrUpdateOptionalParams) => Promise; + delete: (resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, capabilityName: string, options?: CapabilitiesDeleteOptionalParams) => Promise; + get: (resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, capabilityName: string, options?: CapabilitiesGetOptionalParams) => Promise; + list: (resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, options?: CapabilitiesListOptionalParams) => PagedAsyncIterableIterator; } // @public -export type CapabilitiesListNextResponse = CapabilityListResult; - -// @public -export interface CapabilitiesListOptionalParams extends coreClient.OperationOptions { - continuationToken?: string; +export interface Capability extends ProxyResource { + properties?: CapabilityProperties; } // @public -export type CapabilitiesListResponse = CapabilityListResult; - -// @public -export interface Capability extends Resource { +export interface CapabilityProperties { 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[]; +export interface CapabilityType extends ProxyResource { + location?: string; + properties?: CapabilityTypeProperties; } // @public -export interface CapabilityType extends Resource { - azureRbacActions?: string[]; - azureRbacDataActions?: string[]; +export interface CapabilityTypeProperties { + readonly azureRbacActions?: string[]; + readonly azureRbacDataActions?: string[]; readonly description?: string; readonly displayName?: string; readonly kind?: string; - location?: string; readonly parametersSchema?: string; readonly publisher?: string; - runtimeProperties?: CapabilityTypePropertiesRuntimeProperties; - readonly systemData?: SystemData; + readonly runtimeProperties?: CapabilityTypePropertiesRuntimeProperties; 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; - list(locationName: string, targetTypeName: string, options?: CapabilityTypesListOptionalParams): PagedAsyncIterableIterator; +export interface CapabilityTypesGetOptionalParams extends OperationOptions { } // @public -export interface CapabilityTypesGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type CapabilityTypesGetResponse = CapabilityType; - -// @public -export interface CapabilityTypesListNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type CapabilityTypesListNextResponse = CapabilityTypeListResult; - -// @public -export interface CapabilityTypesListOptionalParams extends coreClient.OperationOptions { +export interface CapabilityTypesListOptionalParams extends OperationOptions { continuationToken?: string; } // @public -export type CapabilityTypesListResponse = CapabilityTypeListResult; +export interface CapabilityTypesOperations { + get: (location: string, targetTypeName: string, capabilityTypeName: string, options?: CapabilityTypesGetOptionalParams) => Promise; + list: (location: string, targetTypeName: string, options?: CapabilityTypesListOptionalParams) => PagedAsyncIterableIterator; +} // @public export interface ChaosExperimentAction { name: string; - type: "delay" | "discrete" | "continuous"; + type: ExperimentActionType; } -// @public (undocumented) -export type ChaosExperimentActionUnion = ChaosExperimentAction | DelayAction | DiscreteAction | ContinuousAction; +// @public +export type ChaosExperimentActionUnion = ContinuousAction | DelayAction | DiscreteAction | ChaosExperimentAction; // @public export interface ChaosExperimentBranch { @@ -165,45 +135,33 @@ export interface ChaosExperimentStep { } // @public (undocumented) -export class ChaosManagementClient extends coreClient.ServiceClient { - // (undocumented) - $host: string; - constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ChaosManagementClientOptionalParams); - constructor(credentials: coreAuth.TokenCredential, options?: ChaosManagementClientOptionalParams); - // (undocumented) - apiVersion: string; - // (undocumented) - capabilities: Capabilities; - // (undocumented) - capabilityTypes: CapabilityTypes; - // (undocumented) - experiments: Experiments; - // (undocumented) - operations: Operations; - // (undocumented) - operationStatuses: OperationStatuses; - // (undocumented) - subscriptionId?: string; - // (undocumented) - targets: Targets; - // (undocumented) - targetTypes: TargetTypes; -} - -// @public -export interface ChaosManagementClientOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; +export class ChaosManagementClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: ChaosManagementClientOptionalParams); + readonly capabilities: CapabilitiesOperations; + readonly capabilityTypes: CapabilityTypesOperations; + readonly experimentExecutions: ExperimentExecutionsOperations; + readonly experiments: ExperimentsOperations; + readonly operations: OperationsOperations; + readonly operationStatuses: OperationStatusesOperations; + readonly pipeline: Pipeline; + readonly privateAccesses: PrivateAccessesOperations; + readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; + readonly targets: TargetsOperations; + readonly targetTypes: TargetTypesOperations; +} + +// @public +export interface ChaosManagementClientOptionalParams extends ClientOptions { apiVersion?: string; - endpoint?: string; } // @public export interface ChaosTargetFilter { - type: "Simple"; + type: FilterType; } -// @public (undocumented) -export type ChaosTargetFilterUnion = ChaosTargetFilter | ChaosTargetSimpleFilter; +// @public +export type ChaosTargetFilterUnion = ChaosTargetSimpleFilter | ChaosTargetFilter; // @public export interface ChaosTargetListSelector extends ChaosTargetSelector { @@ -220,14 +178,13 @@ export interface ChaosTargetQuerySelector extends ChaosTargetSelector { // @public export interface ChaosTargetSelector { - [property: string]: any; filter?: ChaosTargetFilterUnion; id: string; - type: "List" | "Query"; + type: SelectorType; } -// @public (undocumented) -export type ChaosTargetSelectorUnion = ChaosTargetSelector | ChaosTargetListSelector | ChaosTargetQuerySelector; +// @public +export type ChaosTargetSelectorUnion = ChaosTargetListSelector | ChaosTargetQuerySelector | ChaosTargetSelector; // @public export interface ChaosTargetSimpleFilter extends ChaosTargetFilter { @@ -240,6 +197,11 @@ export interface ChaosTargetSimpleFilterParameters { zones?: string[]; } +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + // @public export interface ContinuousAction extends ChaosExperimentAction { duration: string; @@ -251,6 +213,12 @@ export interface ContinuousAction extends ChaosExperimentAction { // @public export type CreatedByType = string; +// @public +export interface CustomerDataStorageProperties { + blobContainerName?: string; + storageAccountResourceId?: string; +} + // @public export interface DelayAction extends ChaosExperimentAction { duration: string; @@ -266,7 +234,7 @@ export interface DiscreteAction extends ChaosExperimentAction { // @public export interface ErrorAdditionalInfo { - readonly info?: Record; + readonly info?: Record; readonly type?: string; } @@ -280,27 +248,17 @@ export interface ErrorDetail { } // @public -export interface ErrorResponse { - error?: ErrorDetail; +export interface Experiment extends TrackedResource { + identity?: ManagedServiceIdentity; + properties: ExperimentProperties; } // @public -export interface Experiment extends TrackedResource { - identity?: ResourceIdentity; - readonly provisioningState?: ProvisioningState; - selectors: ChaosTargetSelectorUnion[]; - steps: ChaosExperimentStep[]; - readonly systemData?: SystemData; -} +export type ExperimentActionType = string; // @public -export interface ExperimentExecution { - readonly id?: string; - readonly name?: string; - readonly startedAt?: Date; - readonly status?: string; - readonly stoppedAt?: Date; - readonly type?: string; +export interface ExperimentExecution extends ProxyResource { + properties?: ExperimentExecutionProperties; } // @public @@ -320,22 +278,20 @@ export interface ExperimentExecutionActionTargetDetailsProperties { // @public export interface ExperimentExecutionDetails { - readonly failureReason?: string; readonly id?: string; - readonly lastActionAt?: Date; readonly name?: string; - readonly runInformation?: ExperimentExecutionDetailsPropertiesRunInformation; - readonly startedAt?: Date; - readonly status?: string; - readonly stoppedAt?: Date; + readonly properties?: ExperimentExecutionDetailsProperties; readonly type?: string; } // @public -export interface ExperimentExecutionDetailsProperties extends ExperimentExecutionProperties { +export interface ExperimentExecutionDetailsProperties { readonly failureReason?: string; readonly lastActionAt?: Date; readonly runInformation?: ExperimentExecutionDetailsPropertiesRunInformation; + readonly startedAt?: Date; + readonly status?: string; + readonly stoppedAt?: Date; } // @public @@ -343,12 +299,6 @@ export interface ExperimentExecutionDetailsPropertiesRunInformation { readonly steps?: StepStatus[]; } -// @public -export interface ExperimentExecutionListResult { - readonly nextLink?: string; - readonly value?: ExperimentExecution[]; -} - // @public export interface ExperimentExecutionProperties { readonly startedAt?: Date; @@ -357,148 +307,94 @@ export interface ExperimentExecutionProperties { } // @public -export interface ExperimentListResult { - readonly nextLink?: string; - readonly value?: Experiment[]; +export interface ExperimentExecutionsGetExecutionDetailsOptionalParams extends OperationOptions { } // @public -export interface Experiments { - beginCancel(resourceGroupName: string, experimentName: string, options?: ExperimentsCancelOptionalParams): Promise, void>>; - beginCancelAndWait(resourceGroupName: string, experimentName: string, options?: ExperimentsCancelOptionalParams): Promise; - beginCreateOrUpdate(resourceGroupName: string, experimentName: string, experiment: Experiment, options?: ExperimentsCreateOrUpdateOptionalParams): Promise, ExperimentsCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, experimentName: string, experiment: Experiment, options?: ExperimentsCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, experimentName: string, options?: ExperimentsDeleteOptionalParams): Promise, void>>; - beginDeleteAndWait(resourceGroupName: string, experimentName: string, options?: ExperimentsDeleteOptionalParams): Promise; - beginStart(resourceGroupName: string, experimentName: string, options?: ExperimentsStartOptionalParams): Promise, void>>; - beginStartAndWait(resourceGroupName: string, experimentName: string, options?: ExperimentsStartOptionalParams): Promise; - beginUpdate(resourceGroupName: string, experimentName: string, experiment: ExperimentUpdate, options?: ExperimentsUpdateOptionalParams): Promise, ExperimentsUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, experimentName: string, experiment: ExperimentUpdate, options?: ExperimentsUpdateOptionalParams): Promise; - executionDetails(resourceGroupName: string, experimentName: string, executionId: string, options?: ExperimentsExecutionDetailsOptionalParams): Promise; - get(resourceGroupName: string, experimentName: string, options?: ExperimentsGetOptionalParams): Promise; - getExecution(resourceGroupName: string, experimentName: string, executionId: string, options?: ExperimentsGetExecutionOptionalParams): Promise; - list(resourceGroupName: string, options?: ExperimentsListOptionalParams): PagedAsyncIterableIterator; - listAll(options?: ExperimentsListAllOptionalParams): PagedAsyncIterableIterator; - listAllExecutions(resourceGroupName: string, experimentName: string, options?: ExperimentsListAllExecutionsOptionalParams): PagedAsyncIterableIterator; +export interface ExperimentExecutionsGetExecutionOptionalParams extends OperationOptions { } // @public -export interface ExperimentsCancelOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; +export interface ExperimentExecutionsListAllExecutionsOptionalParams extends OperationOptions { } // @public -export interface ExperimentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; +export interface ExperimentExecutionsOperations { + getExecution: (resourceGroupName: string, experimentName: string, executionId: string, options?: ExperimentExecutionsGetExecutionOptionalParams) => Promise; + getExecutionDetails: (resourceGroupName: string, experimentName: string, executionId: string, options?: ExperimentExecutionsGetExecutionDetailsOptionalParams) => Promise; + listAllExecutions: (resourceGroupName: string, experimentName: string, options?: ExperimentExecutionsListAllExecutionsOptionalParams) => PagedAsyncIterableIterator; } // @public -export type ExperimentsCreateOrUpdateResponse = Experiment; - -// @public -export interface ExperimentsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; -} - -// @public -export interface ExperimentsExecutionDetailsOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ExperimentsExecutionDetailsResponse = ExperimentExecutionDetails; - -// @public -export interface ExperimentsGetExecutionOptionalParams extends coreClient.OperationOptions { +export interface ExperimentProperties { + customerDataStorage?: CustomerDataStorageProperties; + readonly provisioningState?: ProvisioningState; + selectors: ChaosTargetSelectorUnion[]; + steps: ChaosExperimentStep[]; } // @public -export type ExperimentsGetExecutionResponse = ExperimentExecution; - -// @public -export interface ExperimentsGetOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsCancelOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export type ExperimentsGetResponse = Experiment; - -// @public -export interface ExperimentsListAllExecutionsNextOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export type ExperimentsListAllExecutionsNextResponse = ExperimentExecutionListResult; - -// @public -export interface ExperimentsListAllExecutionsOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export type ExperimentsListAllExecutionsResponse = ExperimentExecutionListResult; - -// @public -export interface ExperimentsListAllNextOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsGetOptionalParams extends OperationOptions { } // @public -export type ExperimentsListAllNextResponse = ExperimentListResult; - -// @public -export interface ExperimentsListAllOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsListAllOptionalParams extends OperationOptions { continuationToken?: string; running?: boolean; } // @public -export type ExperimentsListAllResponse = ExperimentListResult; - -// @public -export interface ExperimentsListNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ExperimentsListNextResponse = ExperimentListResult; - -// @public -export interface ExperimentsListOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsListOptionalParams extends OperationOptions { continuationToken?: string; running?: boolean; } // @public -export type ExperimentsListResponse = ExperimentListResult; +export interface ExperimentsOperations { + cancel: (resourceGroupName: string, experimentName: string, options?: ExperimentsCancelOptionalParams) => PollerLike, void>; + createOrUpdate: (resourceGroupName: string, experimentName: string, resource: Experiment, options?: ExperimentsCreateOrUpdateOptionalParams) => PollerLike, Experiment>; + delete: (resourceGroupName: string, experimentName: string, options?: ExperimentsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, experimentName: string, options?: ExperimentsGetOptionalParams) => Promise; + list: (resourceGroupName: string, options?: ExperimentsListOptionalParams) => PagedAsyncIterableIterator; + listAll: (options?: ExperimentsListAllOptionalParams) => PagedAsyncIterableIterator; + start: (resourceGroupName: string, experimentName: string, options?: ExperimentsStartOptionalParams) => PollerLike, void>; + update: (resourceGroupName: string, experimentName: string, properties: ExperimentUpdate, options?: ExperimentsUpdateOptionalParams) => PollerLike, Experiment>; +} // @public -export interface ExperimentsStartOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ExperimentsStartOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export interface ExperimentsUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ExperimentsUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type ExperimentsUpdateResponse = Experiment; - // @public export interface ExperimentUpdate { - identity?: ResourceIdentity; - tags?: { - [propertyName: string]: string; - }; + identity?: ManagedServiceIdentity; + tags?: Record; } // @public export type FilterType = string; -// @public -export function getContinuationToken(page: unknown): string | undefined; - // @public export interface KeyValuePair { key: string; @@ -518,16 +414,41 @@ export enum KnownCreatedByType { User = "User" } +// @public +export enum KnownExperimentActionType { + // (undocumented) + continuous = "continuous", + // (undocumented) + delay = "delay", + // (undocumented) + discrete = "discrete" +} + // @public export enum KnownFilterType { Simple = "Simple" } +// @public +export enum KnownManagedServiceIdentityType { + "SystemAssigned,UserAssigned" = "SystemAssigned,UserAssigned", + None = "None", + SystemAssigned = "SystemAssigned", + UserAssigned = "UserAssigned" +} + // @public export enum KnownOrigin { - System = "system", - User = "user", - UserSystem = "user,system" + "user,system" = "user,system", + system = "system", + user = "user" +} + +// @public +export enum KnownPrivateEndpointServiceConnectionStatus { + Approved = "Approved", + Pending = "Pending", + Rejected = "Rejected" } // @public @@ -540,6 +461,12 @@ export enum KnownProvisioningState { Updating = "Updating" } +// @public +export enum KnownPublicNetworkAccessOption { + Disabled = "Disabled", + Enabled = "Enabled" +} + // @public export enum KnownSelectorType { List = "List", @@ -551,6 +478,22 @@ export enum KnownTargetReferenceType { ChaosTarget = "ChaosTarget" } +// @public +export enum KnownVersions { + v2024_11_01_preview = "2024-11-01-preview" +} + +// @public +export interface ManagedServiceIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type: ManagedServiceIdentityType; + userAssignedIdentities?: Record; +} + +// @public +export type ManagedServiceIdentityType = string; + // @public export interface Operation { readonly actionType?: ActionType; @@ -569,76 +512,200 @@ export interface OperationDisplay { } // @public -export interface OperationListResult { - readonly nextLink?: string; - readonly value?: Operation[]; +export interface OperationsListOptionalParams extends OperationOptions { } // @public -export interface Operations { - listAll(options?: OperationsListAllOptionalParams): PagedAsyncIterableIterator; +export interface OperationsOperations { + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; } // @public -export interface OperationsListAllNextOptionalParams extends coreClient.OperationOptions { +export interface OperationStatusesGetOptionalParams extends OperationOptions { } // @public -export type OperationsListAllNextResponse = OperationListResult; +export interface OperationStatusesOperations { + get: (location: string, operationId: string, options?: OperationStatusesGetOptionalParams) => Promise; +} // @public -export interface OperationsListAllOptionalParams extends coreClient.OperationOptions { +export interface OperationStatusResult { + endTime?: Date; + error?: ErrorDetail; + id?: string; + name?: string; + operations?: OperationStatusResult[]; + percentComplete?: number; + readonly resourceId?: string; + startTime?: Date; + status: string; } // @public -export type OperationsListAllResponse = OperationListResult; +export type Origin = string; // @public -export interface OperationStatus extends ErrorResponse { - endTime?: string; - id?: string; - name?: string; - startTime?: string; - status?: string; +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; } // @public -export interface OperationStatuses { - get(location: string, asyncOperationId: string, options?: OperationStatusesGetOptionalParams): Promise; +export interface PageSettings { + continuationToken?: string; } // @public -export interface OperationStatusesGetOptionalParams extends coreClient.OperationOptions { +export interface PrivateAccess extends TrackedResource { + properties: PrivateAccessProperties; } // @public -export type OperationStatusesGetResponse = OperationStatus; +export interface PrivateAccessesCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} // @public -export type Origin = string; +export interface PrivateAccessesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface PrivateAccessesGetOptionalParams extends OperationOptions { +} + +// @public +export interface PrivateAccessesListAllOptionalParams extends OperationOptions { + continuationToken?: string; +} + +// @public +export interface PrivateAccessesListOptionalParams extends OperationOptions { + continuationToken?: string; +} + +// @public +export interface PrivateAccessesOperations { + createOrUpdate: (resourceGroupName: string, privateAccessName: string, resource: PrivateAccess, options?: PrivateAccessesCreateOrUpdateOptionalParams) => PollerLike, PrivateAccess>; + delete: (resourceGroupName: string, privateAccessName: string, options?: PrivateAccessesDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, privateAccessName: string, options?: PrivateAccessesGetOptionalParams) => Promise; + list: (resourceGroupName: string, options?: PrivateAccessesListOptionalParams) => PagedAsyncIterableIterator; + listAll: (options?: PrivateAccessesListAllOptionalParams) => PagedAsyncIterableIterator; + privateLinkResources: (resourceGroupName: string, privateAccessName: string, options?: PrivateAccessesPrivateLinkResourcesOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, privateAccessName: string, properties: PrivateAccessPatch, options?: PrivateAccessesUpdateOptionalParams) => PollerLike, PrivateAccess>; +} + +// @public +export interface PrivateAccessesPrivateLinkResourcesOptionalParams extends OperationOptions { +} + +// @public +export interface PrivateAccessesUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface PrivateAccessPatch { + tags?: Record; +} + +// @public +export interface PrivateAccessProperties { + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + readonly provisioningState?: ProvisioningState; + publicNetworkAccess?: PublicNetworkAccessOption; +} + +// @public +export interface PrivateEndpoint { + readonly id?: string; +} + +// @public +export interface PrivateEndpointConnection extends ProxyResource { + properties?: PrivateEndpointConnectionProperties; +} + +// @public +export interface PrivateEndpointConnectionProperties { + readonly groupIds?: string[]; + privateEndpoint?: PrivateEndpoint; + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface PrivateEndpointConnectionsDeleteAPrivateEndpointConnectionOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface PrivateEndpointConnectionsGetAPrivateEndpointConnectionOptionalParams extends OperationOptions { +} + +// @public +export interface PrivateEndpointConnectionsListPrivateEndpointConnectionsOptionalParams extends OperationOptions { +} + +// @public +export interface PrivateEndpointConnectionsOperations { + deleteAPrivateEndpointConnection: (resourceGroupName: string, privateAccessName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteAPrivateEndpointConnectionOptionalParams) => PollerLike, void>; + getAPrivateEndpointConnection: (resourceGroupName: string, privateAccessName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetAPrivateEndpointConnectionOptionalParams) => Promise; + listPrivateEndpointConnections: (resourceGroupName: string, privateAccessName: string, options?: PrivateEndpointConnectionsListPrivateEndpointConnectionsOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export type PrivateEndpointServiceConnectionStatus = string; + +// @public +export interface PrivateLinkResource extends TrackedResource { + properties: PrivateLinkResourceProperties; +} + +// @public +export interface PrivateLinkResourceProperties { + readonly groupId?: string; + readonly provisioningState?: ProvisioningState; + readonly requiredMembers?: string[]; + requiredZoneNames?: string[]; +} + +// @public +export interface PrivateLinkServiceConnectionState { + actionsRequired?: string; + description?: string; + status?: PrivateEndpointServiceConnectionStatus; +} // @public export type ProvisioningState = string; +// @public +export interface ProxyResource extends Resource { +} + +// @public +export type PublicNetworkAccessOption = string; + // @public export interface Resource { readonly id?: string; readonly name?: string; + readonly systemData?: SystemData; readonly type?: string; } // @public -export interface ResourceIdentity { - readonly principalId?: string; - readonly tenantId?: string; - type: ResourceIdentityType; - userAssignedIdentities?: { - [propertyName: string]: UserAssignedIdentity; - }; -} +export function restorePoller(client: ChaosManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; -// @public -export type ResourceIdentityType = "None" | "SystemAssigned" | "UserAssigned"; +// @public (undocumented) +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; +} // @public export type SelectorType = string; @@ -662,18 +729,13 @@ export interface SystemData { } // @public -export interface Target extends Resource { +export interface Target extends ProxyResource { location?: string; - properties: { - [propertyName: string]: any; - }; - readonly systemData?: SystemData; + properties: TargetProperties; } // @public -export interface TargetListResult { - readonly nextLink?: string; - readonly value?: Target[]; +export interface TargetProperties extends Record { } // @public @@ -686,96 +748,63 @@ export interface TargetReference { export type TargetReferenceType = string; // @public -export interface Targets { - createOrUpdate(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, target: Target, options?: TargetsCreateOrUpdateOptionalParams): Promise; - delete(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, options?: TargetsDeleteOptionalParams): Promise; - get(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, options?: TargetsGetOptionalParams): Promise; - list(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, options?: TargetsListOptionalParams): PagedAsyncIterableIterator; +export interface TargetsCreateOrUpdateOptionalParams extends OperationOptions { } // @public -export interface TargetsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +export interface TargetsDeleteOptionalParams extends OperationOptions { } // @public -export type TargetsCreateOrUpdateResponse = Target; - -// @public -export interface TargetsDeleteOptionalParams extends coreClient.OperationOptions { +export interface TargetsGetOptionalParams extends OperationOptions { } // @public -export interface TargetsGetOptionalParams extends coreClient.OperationOptions { +export interface TargetsListOptionalParams extends OperationOptions { + continuationToken?: string; } // @public -export type TargetsGetResponse = Target; - -// @public -export interface TargetsListNextOptionalParams extends coreClient.OperationOptions { +export interface TargetsOperations { + createOrUpdate: (resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, resource: Target, options?: TargetsCreateOrUpdateOptionalParams) => Promise; + delete: (resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, options?: TargetsDeleteOptionalParams) => Promise; + get: (resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, options?: TargetsGetOptionalParams) => Promise; + list: (resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, options?: TargetsListOptionalParams) => PagedAsyncIterableIterator; } // @public -export type TargetsListNextResponse = TargetListResult; - -// @public -export interface TargetsListOptionalParams extends coreClient.OperationOptions { - continuationToken?: string; +export interface TargetType extends ProxyResource { + location?: string; + properties: TargetTypeProperties; } // @public -export type TargetsListResponse = TargetListResult; - -// @public -export interface TargetType extends Resource { +export interface TargetTypeProperties { 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; - list(locationName: string, options?: TargetTypesListOptionalParams): PagedAsyncIterableIterator; } // @public -export interface TargetTypesGetOptionalParams extends coreClient.OperationOptions { +export interface TargetTypesGetOptionalParams extends OperationOptions { } // @public -export type TargetTypesGetResponse = TargetType; - -// @public -export interface TargetTypesListNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type TargetTypesListNextResponse = TargetTypeListResult; - -// @public -export interface TargetTypesListOptionalParams extends coreClient.OperationOptions { +export interface TargetTypesListOptionalParams extends OperationOptions { continuationToken?: string; } // @public -export type TargetTypesListResponse = TargetTypeListResult; +export interface TargetTypesOperations { + get: (location: string, targetTypeName: string, options?: TargetTypesGetOptionalParams) => Promise; + list: (location: string, options?: TargetTypesListOptionalParams) => PagedAsyncIterableIterator; +} // @public export interface TrackedResource extends Resource { location: string; - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } // @public diff --git a/sdk/chaos/arm-chaos/sample.env b/sdk/chaos/arm-chaos/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/chaos/arm-chaos/sample.env +++ b/sdk/chaos/arm-chaos/sample.env @@ -1,4 +1 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/chaos/arm-chaos/samples-dev/capabilitiesCreateOrUpdateSample.ts b/sdk/chaos/arm-chaos/samples-dev/capabilitiesCreateOrUpdateSample.ts deleted file mode 100644 index 0958fc1634b7..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/capabilitiesCreateOrUpdateSample.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/CreateUpdateCapability.json - */ -async function createOrUpdateACapabilityThatExtendsAVirtualMachineTargetResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - createOrUpdateACapabilityThatExtendsAVirtualMachineTargetResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/capabilitiesDeleteSample.ts b/sdk/chaos/arm-chaos/samples-dev/capabilitiesDeleteSample.ts deleted file mode 100644 index 5968a90a3187..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/capabilitiesDeleteSample.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/DeleteCapability.json - */ -async function deleteACapabilityThatExtendsAVirtualMachineTargetResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - deleteACapabilityThatExtendsAVirtualMachineTargetResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/capabilitiesGetSample.ts b/sdk/chaos/arm-chaos/samples-dev/capabilitiesGetSample.ts deleted file mode 100644 index db94cd289376..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/capabilitiesGetSample.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/GetCapability.json - */ -async function getACapabilityThatExtendsAVirtualMachineTargetResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - getACapabilityThatExtendsAVirtualMachineTargetResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/capabilitiesListSample.ts b/sdk/chaos/arm-chaos/samples-dev/capabilitiesListSample.ts deleted file mode 100644 index 263484ea28ef..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/capabilitiesListSample.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/ListCapabilities.json - */ -async function listAllCapabilitiesThatExtendAVirtualMachineTargetResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - listAllCapabilitiesThatExtendAVirtualMachineTargetResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/capabilityTypesGetSample.ts b/sdk/chaos/arm-chaos/samples-dev/capabilityTypesGetSample.ts deleted file mode 100644 index 1a91c92d7027..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/capabilityTypesGetSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/GetCapabilityType.json - */ -async function getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "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); -} - -async function main() { - getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/capabilityTypesListSample.ts b/sdk/chaos/arm-chaos/samples-dev/capabilityTypesListSample.ts deleted file mode 100644 index 4ff7a6213adf..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/capabilityTypesListSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/ListCapabilityTypes.json - */ -async function listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "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); -} - -async function main() { - listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/experimentsCancelSample.ts b/sdk/chaos/arm-chaos/samples-dev/experimentsCancelSample.ts deleted file mode 100644 index e073dea9699a..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/experimentsCancelSample.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/CancelExperiment.json - */ -async function cancelARunningExperiment() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.beginCancelAndWait( - resourceGroupName, - experimentName, - ); - console.log(result); -} - -async function main() { - cancelARunningExperiment(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/experimentsCreateOrUpdateSample.ts b/sdk/chaos/arm-chaos/samples-dev/experimentsCreateOrUpdateSample.ts deleted file mode 100644 index 22565db561d7..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/experimentsCreateOrUpdateSample.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/CreateUpdateExperiment.json - */ -async function createOrUpdateAExperimentInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const experiment: Experiment = { - identity: { type: "SystemAssigned" }, - location: "eastus2euap", - 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:microsoft:virtualMachine: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.beginCreateOrUpdateAndWait( - resourceGroupName, - experimentName, - experiment, - ); - console.log(result); -} - -async function main() { - createOrUpdateAExperimentInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/experimentsDeleteSample.ts b/sdk/chaos/arm-chaos/samples-dev/experimentsDeleteSample.ts deleted file mode 100644 index d9e873876a65..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/experimentsDeleteSample.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Delete a Experiment resource. - * - * @summary Delete a Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteExperiment.json - */ -async function deleteAExperimentInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.beginDeleteAndWait( - resourceGroupName, - experimentName, - ); - console.log(result); -} - -async function main() { - deleteAExperimentInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/experimentsExecutionDetailsSample.ts b/sdk/chaos/arm-chaos/samples-dev/experimentsExecutionDetailsSample.ts deleted file mode 100644 index cfd5673dc76a..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/experimentsExecutionDetailsSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Execution details of an experiment resource. - * - * @summary Execution details of an experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DetailsExperiment.json - */ -async function getExperimentExecutionDetails() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const executionId = "f24500ad-744e-4a26-864b-b76199eac333"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.executionDetails( - resourceGroupName, - experimentName, - executionId, - ); - console.log(result); -} - -async function main() { - getExperimentExecutionDetails(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/experimentsGetExecutionSample.ts b/sdk/chaos/arm-chaos/samples-dev/experimentsGetExecutionSample.ts deleted file mode 100644 index e45a084b2456..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/experimentsGetExecutionSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get an execution of an Experiment resource. - * - * @summary Get an execution of an Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperimentExecution.json - */ -async function getTheExecutionOfAExperiment() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const executionId = "f24500ad-744e-4a26-864b-b76199eac333"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.getExecution( - resourceGroupName, - experimentName, - executionId, - ); - console.log(result); -} - -async function main() { - getTheExecutionOfAExperiment(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/experimentsGetSample.ts b/sdk/chaos/arm-chaos/samples-dev/experimentsGetSample.ts deleted file mode 100644 index 1fac52bf1364..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/experimentsGetSample.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get a Experiment resource. - * - * @summary Get a Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperiment.json - */ -async function getAExperimentInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - getAExperimentInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/experimentsListAllExecutionsSample.ts b/sdk/chaos/arm-chaos/samples-dev/experimentsListAllExecutionsSample.ts deleted file mode 100644 index 352d507bb2a0..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/experimentsListAllExecutionsSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get a list of executions of an Experiment resource. - * - * @summary Get a list of executions of an Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentExecutions.json - */ -async function listAllExecutionsOfAnExperiment() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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.listAllExecutions( - resourceGroupName, - experimentName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listAllExecutionsOfAnExperiment(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/experimentsListAllSample.ts b/sdk/chaos/arm-chaos/samples-dev/experimentsListAllSample.ts deleted file mode 100644 index bc6b8263697b..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/experimentsListAllSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/ListExperimentsInASubscription.json - */ -async function listAllExperimentsInASubscription() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "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); -} - -async function main() { - listAllExperimentsInASubscription(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/experimentsListSample.ts b/sdk/chaos/arm-chaos/samples-dev/experimentsListSample.ts deleted file mode 100644 index a18cd79f1366..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/experimentsListSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/ListExperimentsInAResourceGroup.json - */ -async function listAllExperimentsInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - listAllExperimentsInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/experimentsStartSample.ts b/sdk/chaos/arm-chaos/samples-dev/experimentsStartSample.ts deleted file mode 100644 index 9a21d046d472..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/experimentsStartSample.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Start a Experiment resource. - * - * @summary Start a Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/StartExperiment.json - */ -async function startAExperiment() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.beginStartAndWait( - resourceGroupName, - experimentName, - ); - console.log(result); -} - -async function main() { - startAExperiment(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/experimentsUpdateSample.ts b/sdk/chaos/arm-chaos/samples-dev/experimentsUpdateSample.ts deleted file mode 100644 index 273e6f714ad3..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/experimentsUpdateSample.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ExperimentUpdate, ChaosManagementClient } from "@azure/arm-chaos"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to The operation to update an experiment. - * - * @summary The operation to update an experiment. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/UpdateExperiment.json - */ -async function updateAnExperimentInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const experiment: ExperimentUpdate = { - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/6b052e1503d34f17B2e1Be7f07588291/resourceGroups/exampleRG/providers/MicrosoftManagedIdentity/userAssignedIdentity/exampleUMI": - {}, - }, - }, - tags: { key1: "value1", key2: "value2" }, - }; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.beginUpdateAndWait( - resourceGroupName, - experimentName, - experiment, - ); - console.log(result); -} - -async function main() { - updateAnExperimentInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/operationStatusesGetSample.ts b/sdk/chaos/arm-chaos/samples-dev/operationStatusesGetSample.ts deleted file mode 100644 index 24cdf86c4006..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/operationStatusesGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get the status of a long running azure asynchronous operation. - * - * @summary Get the status of a long running azure asynchronous operation. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetOperationStatus.json - */ -async function getSpecificOperationStatus() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "613192d7-503f-477a-9cfe-4efc3ee2bd60"; - const location = "West US"; - const asyncOperationId = "713192d7-503f-477a-9cfe-4efc3ee2bd11"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.operationStatuses.get(location, asyncOperationId); - console.log(result); -} - -async function main() { - getSpecificOperationStatus(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/targetTypesGetSample.ts b/sdk/chaos/arm-chaos/samples-dev/targetTypesGetSample.ts deleted file mode 100644 index 6a4692e39e79..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/targetTypesGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/GetTargetType.json - */ -async function getATargetTypeForWestus2Location() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "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); -} - -async function main() { - getATargetTypeForWestus2Location(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/targetTypesListSample.ts b/sdk/chaos/arm-chaos/samples-dev/targetTypesListSample.ts deleted file mode 100644 index b29c7c2be270..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/targetTypesListSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/ListTargetTypes.json - */ -async function listAllTargetTypesForWestus2Location() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "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); -} - -async function main() { - listAllTargetTypesForWestus2Location(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/targetsCreateOrUpdateSample.ts b/sdk/chaos/arm-chaos/samples-dev/targetsCreateOrUpdateSample.ts deleted file mode 100644 index 5fa1524a1d5c..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/targetsCreateOrUpdateSample.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/CreateUpdateTarget.json - */ -async function createOrUpdateATargetThatExtendsAVirtualMachineResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - createOrUpdateATargetThatExtendsAVirtualMachineResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/targetsDeleteSample.ts b/sdk/chaos/arm-chaos/samples-dev/targetsDeleteSample.ts deleted file mode 100644 index 364a53bf9f0e..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/targetsDeleteSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/DeleteTarget.json - */ -async function deleteATargetThatExtendsAVirtualMachineResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - deleteATargetThatExtendsAVirtualMachineResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/targetsGetSample.ts b/sdk/chaos/arm-chaos/samples-dev/targetsGetSample.ts deleted file mode 100644 index 82ecb31268fa..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/targetsGetSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/GetTarget.json - */ -async function getATargetThatExtendsAVirtualMachineResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - getATargetThatExtendsAVirtualMachineResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples-dev/targetsListSample.ts b/sdk/chaos/arm-chaos/samples-dev/targetsListSample.ts deleted file mode 100644 index 24e69aa2d109..000000000000 --- a/sdk/chaos/arm-chaos/samples-dev/targetsListSample.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/ListTargets.json - */ -async function listAllTargetsThatExtendAVirtualMachineResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - listAllTargetsThatExtendAVirtualMachineResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/README.md b/sdk/chaos/arm-chaos/samples/v1/javascript/README.md deleted file mode 100644 index 60fc41149f49..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# client library samples for JavaScript - -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/stable/2024-01-01/examples/CreateUpdateCapability.json | -| [capabilitiesDeleteSample.js][capabilitiesdeletesample] | Delete a Capability that extends a Target resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteCapability.json | -| [capabilitiesGetSample.js][capabilitiesgetsample] | Get a Capability resource that extends a Target resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetCapability.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/stable/2024-01-01/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/stable/2024-01-01/examples/GetCapabilityType.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/stable/2024-01-01/examples/ListCapabilityTypes.json | -| [experimentsCancelSample.js][experimentscancelsample] | Cancel a running Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CancelExperiment.json | -| [experimentsCreateOrUpdateSample.js][experimentscreateorupdatesample] | Create or update a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateExperiment.json | -| [experimentsDeleteSample.js][experimentsdeletesample] | Delete a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteExperiment.json | -| [experimentsExecutionDetailsSample.js][experimentsexecutiondetailssample] | Execution details of an experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DetailsExperiment.json | -| [experimentsGetExecutionSample.js][experimentsgetexecutionsample] | Get an execution of an Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperimentExecution.json | -| [experimentsGetSample.js][experimentsgetsample] | Get a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperiment.json | -| [experimentsListAllExecutionsSample.js][experimentslistallexecutionssample] | Get a list of executions of an Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentExecutions.json | -| [experimentsListAllSample.js][experimentslistallsample] | Get a list of Experiment resources in a subscription. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInASubscription.json | -| [experimentsListSample.js][experimentslistsample] | Get a list of Experiment resources in a resource group. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInAResourceGroup.json | -| [experimentsStartSample.js][experimentsstartsample] | Start a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/StartExperiment.json | -| [experimentsUpdateSample.js][experimentsupdatesample] | The operation to update an experiment. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/UpdateExperiment.json | -| [operationStatusesGetSample.js][operationstatusesgetsample] | Get the status of a long running azure asynchronous operation. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetOperationStatus.json | -| [targetTypesGetSample.js][targettypesgetsample] | Get a Target Type resources for given location. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTargetType.json | -| [targetTypesListSample.js][targettypeslistsample] | Get a list of Target Type resources for given location. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/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/stable/2024-01-01/examples/CreateUpdateTarget.json | -| [targetsDeleteSample.js][targetsdeletesample] | Delete a Target resource that extends a tracked regional resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteTarget.json | -| [targetsGetSample.js][targetsgetsample] | Get a Target resource that extends a tracked regional resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTarget.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/stable/2024-01-01/examples/ListTargets.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -3. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node 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 dev-tool run vendored cross-env CHAOS_SUBSCRIPTION_ID="" CHAOS_RESOURCE_GROUP="" 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/javascript/capabilitiesCreateOrUpdateSample.js -[capabilitiesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesDeleteSample.js -[capabilitiesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesGetSample.js -[capabilitieslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesListSample.js -[capabilitytypesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/capabilityTypesGetSample.js -[capabilitytypeslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/capabilityTypesListSample.js -[experimentscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsCancelSample.js -[experimentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsCreateOrUpdateSample.js -[experimentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsDeleteSample.js -[experimentsexecutiondetailssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsExecutionDetailsSample.js -[experimentsgetexecutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsGetExecutionSample.js -[experimentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsGetSample.js -[experimentslistallexecutionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsListAllExecutionsSample.js -[experimentslistallsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsListAllSample.js -[experimentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsListSample.js -[experimentsstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsStartSample.js -[experimentsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsUpdateSample.js -[operationstatusesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/operationStatusesGetSample.js -[targettypesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/targetTypesGetSample.js -[targettypeslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/targetTypesListSample.js -[targetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/targetsCreateOrUpdateSample.js -[targetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/targetsDeleteSample.js -[targetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/targetsGetSample.js -[targetslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/javascript/targetsListSample.js -[apiref]: https://learn.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 diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesCreateOrUpdateSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesCreateOrUpdateSample.js deleted file mode 100644 index dd1d5bd43bd5..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesCreateOrUpdateSample.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/CreateUpdateCapability.json - */ -async function createOrUpdateACapabilityThatExtendsAVirtualMachineTargetResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - createOrUpdateACapabilityThatExtendsAVirtualMachineTargetResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesDeleteSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesDeleteSample.js deleted file mode 100644 index cabed2820104..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesDeleteSample.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/DeleteCapability.json - */ -async function deleteACapabilityThatExtendsAVirtualMachineTargetResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - deleteACapabilityThatExtendsAVirtualMachineTargetResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesGetSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesGetSample.js deleted file mode 100644 index 4ce7d88ef23b..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesGetSample.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/GetCapability.json - */ -async function getACapabilityThatExtendsAVirtualMachineTargetResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - getACapabilityThatExtendsAVirtualMachineTargetResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesListSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesListSample.js deleted file mode 100644 index 3a557f4d3a1a..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/capabilitiesListSample.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/ListCapabilities.json - */ -async function listAllCapabilitiesThatExtendAVirtualMachineTargetResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - listAllCapabilitiesThatExtendAVirtualMachineTargetResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/capabilityTypesGetSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/capabilityTypesGetSample.js deleted file mode 100644 index 0f118325dc45..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/capabilityTypesGetSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/GetCapabilityType.json - */ -async function getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "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); -} - -async function main() { - getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/capabilityTypesListSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/capabilityTypesListSample.js deleted file mode 100644 index fa1aa0fd69ca..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/capabilityTypesListSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/ListCapabilityTypes.json - */ -async function listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "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); -} - -async function main() { - listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsCancelSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsCancelSample.js deleted file mode 100644 index 1e114eee522c..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsCancelSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/CancelExperiment.json - */ -async function cancelARunningExperiment() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.beginCancelAndWait(resourceGroupName, experimentName); - console.log(result); -} - -async function main() { - cancelARunningExperiment(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsCreateOrUpdateSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsCreateOrUpdateSample.js deleted file mode 100644 index ebde4e94e948..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsCreateOrUpdateSample.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/CreateUpdateExperiment.json - */ -async function createOrUpdateAExperimentInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const experiment = { - identity: { type: "SystemAssigned" }, - location: "eastus2euap", - 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:microsoft:virtualMachine: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.beginCreateOrUpdateAndWait( - resourceGroupName, - experimentName, - experiment, - ); - console.log(result); -} - -async function main() { - createOrUpdateAExperimentInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsDeleteSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsDeleteSample.js deleted file mode 100644 index 467956e43dfa..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsDeleteSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete a Experiment resource. - * - * @summary Delete a Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteExperiment.json - */ -async function deleteAExperimentInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.beginDeleteAndWait(resourceGroupName, experimentName); - console.log(result); -} - -async function main() { - deleteAExperimentInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsExecutionDetailsSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsExecutionDetailsSample.js deleted file mode 100644 index 5e5ec48c2e30..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsExecutionDetailsSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Execution details of an experiment resource. - * - * @summary Execution details of an experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DetailsExperiment.json - */ -async function getExperimentExecutionDetails() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const executionId = "f24500ad-744e-4a26-864b-b76199eac333"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.executionDetails( - resourceGroupName, - experimentName, - executionId, - ); - console.log(result); -} - -async function main() { - getExperimentExecutionDetails(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsGetExecutionSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsGetExecutionSample.js deleted file mode 100644 index e2a82ff2f6af..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsGetExecutionSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get an execution of an Experiment resource. - * - * @summary Get an execution of an Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperimentExecution.json - */ -async function getTheExecutionOfAExperiment() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const executionId = "f24500ad-744e-4a26-864b-b76199eac333"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.getExecution( - resourceGroupName, - experimentName, - executionId, - ); - console.log(result); -} - -async function main() { - getTheExecutionOfAExperiment(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsGetSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsGetSample.js deleted file mode 100644 index 9d30463e5f03..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsGetSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a Experiment resource. - * - * @summary Get a Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperiment.json - */ -async function getAExperimentInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - getAExperimentInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsListAllExecutionsSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsListAllExecutionsSample.js deleted file mode 100644 index bad49ce26826..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsListAllExecutionsSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a list of executions of an Experiment resource. - * - * @summary Get a list of executions of an Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentExecutions.json - */ -async function listAllExecutionsOfAnExperiment() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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.listAllExecutions(resourceGroupName, experimentName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listAllExecutionsOfAnExperiment(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsListAllSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsListAllSample.js deleted file mode 100644 index ac5413955e09..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsListAllSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/ListExperimentsInASubscription.json - */ -async function listAllExperimentsInASubscription() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "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); -} - -async function main() { - listAllExperimentsInASubscription(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsListSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsListSample.js deleted file mode 100644 index ba632b75c444..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsListSample.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/ListExperimentsInAResourceGroup.json - */ -async function listAllExperimentsInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - listAllExperimentsInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsStartSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsStartSample.js deleted file mode 100644 index a82dffd84949..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsStartSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Start a Experiment resource. - * - * @summary Start a Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/StartExperiment.json - */ -async function startAExperiment() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.beginStartAndWait(resourceGroupName, experimentName); - console.log(result); -} - -async function main() { - startAExperiment(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsUpdateSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsUpdateSample.js deleted file mode 100644 index 63e65a738679..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/experimentsUpdateSample.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * This sample demonstrates how to The operation to update an experiment. - * - * @summary The operation to update an experiment. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/UpdateExperiment.json - */ -async function updateAnExperimentInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const experiment = { - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/6b052e1503d34f17B2e1Be7f07588291/resourceGroups/exampleRG/providers/MicrosoftManagedIdentity/userAssignedIdentity/exampleUMI": - {}, - }, - }, - tags: { key1: "value1", key2: "value2" }, - }; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.beginUpdateAndWait( - resourceGroupName, - experimentName, - experiment, - ); - console.log(result); -} - -async function main() { - updateAnExperimentInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/operationStatusesGetSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/operationStatusesGetSample.js deleted file mode 100644 index 9f409c515d43..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/operationStatusesGetSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get the status of a long running azure asynchronous operation. - * - * @summary Get the status of a long running azure asynchronous operation. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetOperationStatus.json - */ -async function getSpecificOperationStatus() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "613192d7-503f-477a-9cfe-4efc3ee2bd60"; - const location = "West US"; - const asyncOperationId = "713192d7-503f-477a-9cfe-4efc3ee2bd11"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.operationStatuses.get(location, asyncOperationId); - console.log(result); -} - -async function main() { - getSpecificOperationStatus(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/package.json b/sdk/chaos/arm-chaos/samples/v1/javascript/package.json deleted file mode 100644 index be228cc44b26..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@azure-samples/arm-chaos-js", - "private": true, - "version": "1.0.0", - "description": " client library samples for JavaScript", - "engines": { - "node": ">=18.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": "latest", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - } -} diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/sample.env b/sdk/chaos/arm-chaos/samples/v1/javascript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/targetTypesGetSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/targetTypesGetSample.js deleted file mode 100644 index 739286d9efa1..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/targetTypesGetSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/GetTargetType.json - */ -async function getATargetTypeForWestus2Location() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "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); -} - -async function main() { - getATargetTypeForWestus2Location(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/targetTypesListSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/targetTypesListSample.js deleted file mode 100644 index 065d155fe38d..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/targetTypesListSample.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/ListTargetTypes.json - */ -async function listAllTargetTypesForWestus2Location() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "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); -} - -async function main() { - listAllTargetTypesForWestus2Location(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/targetsCreateOrUpdateSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/targetsCreateOrUpdateSample.js deleted file mode 100644 index dc96cb8b24a5..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/targetsCreateOrUpdateSample.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/CreateUpdateTarget.json - */ -async function createOrUpdateATargetThatExtendsAVirtualMachineResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - createOrUpdateATargetThatExtendsAVirtualMachineResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/targetsDeleteSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/targetsDeleteSample.js deleted file mode 100644 index 6e4c06eb0cee..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/targetsDeleteSample.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/DeleteTarget.json - */ -async function deleteATargetThatExtendsAVirtualMachineResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - deleteATargetThatExtendsAVirtualMachineResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/targetsGetSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/targetsGetSample.js deleted file mode 100644 index fec7092222c4..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/targetsGetSample.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/GetTarget.json - */ -async function getATargetThatExtendsAVirtualMachineResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - getATargetThatExtendsAVirtualMachineResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/javascript/targetsListSample.js b/sdk/chaos/arm-chaos/samples/v1/javascript/targetsListSample.js deleted file mode 100644 index 55f859eb7325..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/javascript/targetsListSample.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"); -require("dotenv").config(); - -/** - * 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/stable/2024-01-01/examples/ListTargets.json - */ -async function listAllTargetsThatExtendAVirtualMachineResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - listAllTargetsThatExtendAVirtualMachineResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/README.md b/sdk/chaos/arm-chaos/samples/v1/typescript/README.md deleted file mode 100644 index 4fc8618df292..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/README.md +++ /dev/null @@ -1,109 +0,0 @@ -# client library samples for TypeScript - -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/stable/2024-01-01/examples/CreateUpdateCapability.json | -| [capabilitiesDeleteSample.ts][capabilitiesdeletesample] | Delete a Capability that extends a Target resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteCapability.json | -| [capabilitiesGetSample.ts][capabilitiesgetsample] | Get a Capability resource that extends a Target resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetCapability.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/stable/2024-01-01/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/stable/2024-01-01/examples/GetCapabilityType.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/stable/2024-01-01/examples/ListCapabilityTypes.json | -| [experimentsCancelSample.ts][experimentscancelsample] | Cancel a running Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CancelExperiment.json | -| [experimentsCreateOrUpdateSample.ts][experimentscreateorupdatesample] | Create or update a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateExperiment.json | -| [experimentsDeleteSample.ts][experimentsdeletesample] | Delete a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteExperiment.json | -| [experimentsExecutionDetailsSample.ts][experimentsexecutiondetailssample] | Execution details of an experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DetailsExperiment.json | -| [experimentsGetExecutionSample.ts][experimentsgetexecutionsample] | Get an execution of an Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperimentExecution.json | -| [experimentsGetSample.ts][experimentsgetsample] | Get a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperiment.json | -| [experimentsListAllExecutionsSample.ts][experimentslistallexecutionssample] | Get a list of executions of an Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentExecutions.json | -| [experimentsListAllSample.ts][experimentslistallsample] | Get a list of Experiment resources in a subscription. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInASubscription.json | -| [experimentsListSample.ts][experimentslistsample] | Get a list of Experiment resources in a resource group. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInAResourceGroup.json | -| [experimentsStartSample.ts][experimentsstartsample] | Start a Experiment resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/StartExperiment.json | -| [experimentsUpdateSample.ts][experimentsupdatesample] | The operation to update an experiment. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/UpdateExperiment.json | -| [operationStatusesGetSample.ts][operationstatusesgetsample] | Get the status of a long running azure asynchronous operation. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetOperationStatus.json | -| [targetTypesGetSample.ts][targettypesgetsample] | Get a Target Type resources for given location. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTargetType.json | -| [targetTypesListSample.ts][targettypeslistsample] | Get a list of Target Type resources for given location. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/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/stable/2024-01-01/examples/CreateUpdateTarget.json | -| [targetsDeleteSample.ts][targetsdeletesample] | Delete a Target resource that extends a tracked regional resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteTarget.json | -| [targetsGetSample.ts][targetsgetsample] | Get a Target resource that extends a tracked regional resource. x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTarget.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/stable/2024-01-01/examples/ListTargets.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: - -```bash -npm install -g typescript -``` - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Compile the samples: - -```bash -npm run build -``` - -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dist/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 dev-tool run vendored cross-env CHAOS_SUBSCRIPTION_ID="" CHAOS_RESOURCE_GROUP="" 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/typescript/src/capabilitiesCreateOrUpdateSample.ts -[capabilitiesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesDeleteSample.ts -[capabilitiesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesGetSample.ts -[capabilitieslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesListSample.ts -[capabilitytypesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilityTypesGetSample.ts -[capabilitytypeslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilityTypesListSample.ts -[experimentscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsCancelSample.ts -[experimentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsCreateOrUpdateSample.ts -[experimentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsDeleteSample.ts -[experimentsexecutiondetailssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsExecutionDetailsSample.ts -[experimentsgetexecutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsGetExecutionSample.ts -[experimentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsGetSample.ts -[experimentslistallexecutionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsListAllExecutionsSample.ts -[experimentslistallsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsListAllSample.ts -[experimentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsListSample.ts -[experimentsstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsStartSample.ts -[experimentsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsUpdateSample.ts -[operationstatusesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/operationStatusesGetSample.ts -[targettypesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetTypesGetSample.ts -[targettypeslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetTypesListSample.ts -[targetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsCreateOrUpdateSample.ts -[targetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsDeleteSample.ts -[targetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsGetSample.ts -[targetslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsListSample.ts -[apiref]: https://learn.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 diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/package.json b/sdk/chaos/arm-chaos/samples/v1/typescript/package.json deleted file mode 100644 index 14002d21e290..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@azure-samples/arm-chaos-ts", - "private": true, - "version": "1.0.0", - "description": " client library samples for TypeScript", - "engines": { - "node": ">=18.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": "latest", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - }, - "devDependencies": { - "@types/node": "^18.0.0", - "typescript": "~5.7.2", - "rimraf": "latest" - } -} diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/sample.env b/sdk/chaos/arm-chaos/samples/v1/typescript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesCreateOrUpdateSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesCreateOrUpdateSample.ts deleted file mode 100644 index 0958fc1634b7..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesCreateOrUpdateSample.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/CreateUpdateCapability.json - */ -async function createOrUpdateACapabilityThatExtendsAVirtualMachineTargetResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - createOrUpdateACapabilityThatExtendsAVirtualMachineTargetResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesDeleteSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesDeleteSample.ts deleted file mode 100644 index 5968a90a3187..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesDeleteSample.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/DeleteCapability.json - */ -async function deleteACapabilityThatExtendsAVirtualMachineTargetResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - deleteACapabilityThatExtendsAVirtualMachineTargetResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesGetSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesGetSample.ts deleted file mode 100644 index db94cd289376..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesGetSample.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/GetCapability.json - */ -async function getACapabilityThatExtendsAVirtualMachineTargetResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - getACapabilityThatExtendsAVirtualMachineTargetResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesListSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesListSample.ts deleted file mode 100644 index 263484ea28ef..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilitiesListSample.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/ListCapabilities.json - */ -async function listAllCapabilitiesThatExtendAVirtualMachineTargetResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - listAllCapabilitiesThatExtendAVirtualMachineTargetResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilityTypesGetSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilityTypesGetSample.ts deleted file mode 100644 index 1a91c92d7027..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilityTypesGetSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/GetCapabilityType.json - */ -async function getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "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); -} - -async function main() { - getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilityTypesListSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilityTypesListSample.ts deleted file mode 100644 index 4ff7a6213adf..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/capabilityTypesListSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/ListCapabilityTypes.json - */ -async function listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "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); -} - -async function main() { - listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsCancelSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsCancelSample.ts deleted file mode 100644 index e073dea9699a..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsCancelSample.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/CancelExperiment.json - */ -async function cancelARunningExperiment() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.beginCancelAndWait( - resourceGroupName, - experimentName, - ); - console.log(result); -} - -async function main() { - cancelARunningExperiment(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsCreateOrUpdateSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsCreateOrUpdateSample.ts deleted file mode 100644 index 22565db561d7..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsCreateOrUpdateSample.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/CreateUpdateExperiment.json - */ -async function createOrUpdateAExperimentInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const experiment: Experiment = { - identity: { type: "SystemAssigned" }, - location: "eastus2euap", - 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:microsoft:virtualMachine: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.beginCreateOrUpdateAndWait( - resourceGroupName, - experimentName, - experiment, - ); - console.log(result); -} - -async function main() { - createOrUpdateAExperimentInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsDeleteSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsDeleteSample.ts deleted file mode 100644 index d9e873876a65..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsDeleteSample.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Delete a Experiment resource. - * - * @summary Delete a Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteExperiment.json - */ -async function deleteAExperimentInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.beginDeleteAndWait( - resourceGroupName, - experimentName, - ); - console.log(result); -} - -async function main() { - deleteAExperimentInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsExecutionDetailsSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsExecutionDetailsSample.ts deleted file mode 100644 index cfd5673dc76a..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsExecutionDetailsSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Execution details of an experiment resource. - * - * @summary Execution details of an experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DetailsExperiment.json - */ -async function getExperimentExecutionDetails() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const executionId = "f24500ad-744e-4a26-864b-b76199eac333"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.executionDetails( - resourceGroupName, - experimentName, - executionId, - ); - console.log(result); -} - -async function main() { - getExperimentExecutionDetails(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsGetExecutionSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsGetExecutionSample.ts deleted file mode 100644 index e45a084b2456..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsGetExecutionSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get an execution of an Experiment resource. - * - * @summary Get an execution of an Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperimentExecution.json - */ -async function getTheExecutionOfAExperiment() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const executionId = "f24500ad-744e-4a26-864b-b76199eac333"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.getExecution( - resourceGroupName, - experimentName, - executionId, - ); - console.log(result); -} - -async function main() { - getTheExecutionOfAExperiment(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsGetSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsGetSample.ts deleted file mode 100644 index 1fac52bf1364..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsGetSample.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get a Experiment resource. - * - * @summary Get a Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperiment.json - */ -async function getAExperimentInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - getAExperimentInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsListAllExecutionsSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsListAllExecutionsSample.ts deleted file mode 100644 index 352d507bb2a0..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsListAllExecutionsSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get a list of executions of an Experiment resource. - * - * @summary Get a list of executions of an Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentExecutions.json - */ -async function listAllExecutionsOfAnExperiment() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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.listAllExecutions( - resourceGroupName, - experimentName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listAllExecutionsOfAnExperiment(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsListAllSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsListAllSample.ts deleted file mode 100644 index bc6b8263697b..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsListAllSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/ListExperimentsInASubscription.json - */ -async function listAllExperimentsInASubscription() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "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); -} - -async function main() { - listAllExperimentsInASubscription(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsListSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsListSample.ts deleted file mode 100644 index a18cd79f1366..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsListSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/ListExperimentsInAResourceGroup.json - */ -async function listAllExperimentsInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - listAllExperimentsInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsStartSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsStartSample.ts deleted file mode 100644 index 9a21d046d472..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsStartSample.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Start a Experiment resource. - * - * @summary Start a Experiment resource. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/StartExperiment.json - */ -async function startAExperiment() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.beginStartAndWait( - resourceGroupName, - experimentName, - ); - console.log(result); -} - -async function main() { - startAExperiment(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsUpdateSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsUpdateSample.ts deleted file mode 100644 index 273e6f714ad3..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/experimentsUpdateSample.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ExperimentUpdate, ChaosManagementClient } from "@azure/arm-chaos"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to The operation to update an experiment. - * - * @summary The operation to update an experiment. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/UpdateExperiment.json - */ -async function updateAnExperimentInAResourceGroup() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "exampleRG"; - const experimentName = "exampleExperiment"; - const experiment: ExperimentUpdate = { - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/6b052e1503d34f17B2e1Be7f07588291/resourceGroups/exampleRG/providers/MicrosoftManagedIdentity/userAssignedIdentity/exampleUMI": - {}, - }, - }, - tags: { key1: "value1", key2: "value2" }, - }; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.experiments.beginUpdateAndWait( - resourceGroupName, - experimentName, - experiment, - ); - console.log(result); -} - -async function main() { - updateAnExperimentInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/operationStatusesGetSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/operationStatusesGetSample.ts deleted file mode 100644 index 24cdf86c4006..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/operationStatusesGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get the status of a long running azure asynchronous operation. - * - * @summary Get the status of a long running azure asynchronous operation. - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetOperationStatus.json - */ -async function getSpecificOperationStatus() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "613192d7-503f-477a-9cfe-4efc3ee2bd60"; - const location = "West US"; - const asyncOperationId = "713192d7-503f-477a-9cfe-4efc3ee2bd11"; - const credential = new DefaultAzureCredential(); - const client = new ChaosManagementClient(credential, subscriptionId); - const result = await client.operationStatuses.get(location, asyncOperationId); - console.log(result); -} - -async function main() { - getSpecificOperationStatus(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetTypesGetSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetTypesGetSample.ts deleted file mode 100644 index 6a4692e39e79..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetTypesGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/GetTargetType.json - */ -async function getATargetTypeForWestus2Location() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "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); -} - -async function main() { - getATargetTypeForWestus2Location(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetTypesListSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetTypesListSample.ts deleted file mode 100644 index b29c7c2be270..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetTypesListSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/ListTargetTypes.json - */ -async function listAllTargetTypesForWestus2Location() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "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); -} - -async function main() { - listAllTargetTypesForWestus2Location(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsCreateOrUpdateSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsCreateOrUpdateSample.ts deleted file mode 100644 index 5fa1524a1d5c..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsCreateOrUpdateSample.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/CreateUpdateTarget.json - */ -async function createOrUpdateATargetThatExtendsAVirtualMachineResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - createOrUpdateATargetThatExtendsAVirtualMachineResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsDeleteSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsDeleteSample.ts deleted file mode 100644 index 364a53bf9f0e..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsDeleteSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/DeleteTarget.json - */ -async function deleteATargetThatExtendsAVirtualMachineResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - deleteATargetThatExtendsAVirtualMachineResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsGetSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsGetSample.ts deleted file mode 100644 index 82ecb31268fa..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsGetSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/GetTarget.json - */ -async function getATargetThatExtendsAVirtualMachineResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - getATargetThatExtendsAVirtualMachineResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsListSample.ts b/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsListSample.ts deleted file mode 100644 index 24e69aa2d109..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/src/targetsListSample.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * 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"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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/stable/2024-01-01/examples/ListTargets.json - */ -async function listAllTargetsThatExtendAVirtualMachineResource() { - const subscriptionId = - process.env["CHAOS_SUBSCRIPTION_ID"] || - "6b052e15-03d3-4f17-b2e1-be7f07588291"; - const resourceGroupName = process.env["CHAOS_RESOURCE_GROUP"] || "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); -} - -async function main() { - listAllTargetsThatExtendAVirtualMachineResource(); -} - -main().catch(console.error); diff --git a/sdk/chaos/arm-chaos/samples/v1/typescript/tsconfig.json b/sdk/chaos/arm-chaos/samples/v1/typescript/tsconfig.json deleted file mode 100644 index 984eed535aa8..000000000000 --- a/sdk/chaos/arm-chaos/samples/v1/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "alwaysStrict": true, - "outDir": "dist", - "rootDir": "src" - }, - "include": [ - "src/**/*.ts" - ] -} diff --git a/sdk/chaos/arm-chaos/src/api/capabilities/index.ts b/sdk/chaos/arm-chaos/src/api/capabilities/index.ts new file mode 100644 index 000000000000..21e714c18529 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/api/capabilities/index.ts @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + CapabilitiesCreateOrUpdateOptionalParams, + CapabilitiesDeleteOptionalParams, + CapabilitiesGetOptionalParams, + CapabilitiesListOptionalParams, + ChaosManagementContext as Client, +} from "../index.js"; +import { + Capability, + capabilitySerializer, + capabilityDeserializer, + _CapabilityListResult, + _capabilityListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _capabilitiesGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + capabilityName: string, + options: CapabilitiesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}", + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _capabilitiesGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return capabilityDeserializer(result.body); +} + +/** Get a Capability resource that extends a Target resource. */ +export async function capabilitiesGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + capabilityName: string, + options: CapabilitiesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _capabilitiesGetSend( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + options, + ); + return _capabilitiesGetDeserialize(result); +} + +export function _capabilitiesCreateOrUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + capabilityName: string, + resource: Capability, + options: CapabilitiesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}", + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: capabilitySerializer(resource), + }); +} + +export async function _capabilitiesCreateOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return capabilityDeserializer(result.body); +} + +/** Create or update a Capability resource that extends a Target resource. */ +export async function capabilitiesCreateOrUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + capabilityName: string, + resource: Capability, + options: CapabilitiesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _capabilitiesCreateOrUpdateSend( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + resource, + options, + ); + return _capabilitiesCreateOrUpdateDeserialize(result); +} + +export function _capabilitiesDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + capabilityName: string, + options: CapabilitiesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}", + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _capabilitiesDeleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Delete a Capability that extends a Target resource. */ +export async function capabilitiesDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + capabilityName: string, + options: CapabilitiesDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _capabilitiesDeleteSend( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + options, + ); + return _capabilitiesDeleteDeserialize(result); +} + +export function _capabilitiesListSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + options: CapabilitiesListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities", + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + ) + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { continuationToken: options?.continuationToken }, + }); +} + +export async function _capabilitiesListDeserialize( + result: PathUncheckedResponse, +): Promise<_CapabilityListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _capabilityListResultDeserializer(result.body); +} + +/** Get a list of Capability resources that extend a Target resource. */ +export function capabilitiesList( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + options: CapabilitiesListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _capabilitiesListSend( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + options, + ), + _capabilitiesListDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/chaos/arm-chaos/src/api/capabilityTypes/index.ts b/sdk/chaos/arm-chaos/src/api/capabilityTypes/index.ts new file mode 100644 index 000000000000..772009a63ccd --- /dev/null +++ b/sdk/chaos/arm-chaos/src/api/capabilityTypes/index.ts @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + CapabilityTypesGetOptionalParams, + CapabilityTypesListOptionalParams, + ChaosManagementContext as Client, +} from "../index.js"; +import { + CapabilityType, + capabilityTypeDeserializer, + _CapabilityTypeListResult, + _capabilityTypeListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _capabilityTypesGetSend( + context: Client, + subscriptionId: string, + location: string, + targetTypeName: string, + capabilityTypeName: string, + options: CapabilityTypesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}", + subscriptionId, + location, + targetTypeName, + capabilityTypeName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _capabilityTypesGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return capabilityTypeDeserializer(result.body); +} + +/** Get a Capability Type resource for given Target Type and location. */ +export async function capabilityTypesGet( + context: Client, + subscriptionId: string, + location: string, + targetTypeName: string, + capabilityTypeName: string, + options: CapabilityTypesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _capabilityTypesGetSend( + context, + subscriptionId, + location, + targetTypeName, + capabilityTypeName, + options, + ); + return _capabilityTypesGetDeserialize(result); +} + +export function _capabilityTypesListSend( + context: Client, + subscriptionId: string, + location: string, + targetTypeName: string, + options: CapabilityTypesListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}/capabilityTypes", + subscriptionId, + location, + targetTypeName, + ) + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { continuationToken: options?.continuationToken }, + }); +} + +export async function _capabilityTypesListDeserialize( + result: PathUncheckedResponse, +): Promise<_CapabilityTypeListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _capabilityTypeListResultDeserializer(result.body); +} + +/** Get a list of Capability Type resources for given Target Type and location. */ +export function capabilityTypesList( + context: Client, + subscriptionId: string, + location: string, + targetTypeName: string, + options: CapabilityTypesListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _capabilityTypesListSend(context, subscriptionId, location, targetTypeName, options), + _capabilityTypesListDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/chaos/arm-chaos/src/api/chaosManagementContext.ts b/sdk/chaos/arm-chaos/src/api/chaosManagementContext.ts new file mode 100644 index 000000000000..1aed30179947 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/api/chaosManagementContext.ts @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { TokenCredential } from "@azure/core-auth"; + +/** Chaos Management Client */ +export interface ChaosManagementContext extends Client {} + +/** Optional parameters for the client. */ +export interface ChaosManagementClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +/** Chaos Management Client */ +export function createChaosManagement( + credential: TokenCredential, + options: ChaosManagementClientOptionalParams = {}, +): ChaosManagementContext { + const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-chaos/1.0.0-beta.1`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`], + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + const apiVersion = options.apiVersion ?? "2024-11-01-preview"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return clientContext; +} diff --git a/sdk/chaos/arm-chaos/src/api/experimentExecutions/index.ts b/sdk/chaos/arm-chaos/src/api/experimentExecutions/index.ts new file mode 100644 index 000000000000..e3dc35492416 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/api/experimentExecutions/index.ts @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + ChaosManagementContext as Client, + ExperimentExecutionsGetExecutionDetailsOptionalParams, + ExperimentExecutionsGetExecutionOptionalParams, + ExperimentExecutionsListAllExecutionsOptionalParams, +} from "../index.js"; +import { + ExperimentExecution, + experimentExecutionDeserializer, + _ExperimentExecutionListResult, + _experimentExecutionListResultDeserializer, + ExperimentExecutionDetails, + experimentExecutionDetailsDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _experimentExecutionsGetExecutionSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + executionId: string, + options: ExperimentExecutionsGetExecutionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}", + subscriptionId, + resourceGroupName, + experimentName, + executionId, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _experimentExecutionsGetExecutionDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return experimentExecutionDeserializer(result.body); +} + +/** Get an execution of an Experiment resource. */ +export async function experimentExecutionsGetExecution( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + executionId: string, + options: ExperimentExecutionsGetExecutionOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _experimentExecutionsGetExecutionSend( + context, + subscriptionId, + resourceGroupName, + experimentName, + executionId, + options, + ); + return _experimentExecutionsGetExecutionDeserialize(result); +} + +export function _experimentExecutionsListAllExecutionsSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + options: ExperimentExecutionsListAllExecutionsOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions", + subscriptionId, + resourceGroupName, + experimentName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _experimentExecutionsListAllExecutionsDeserialize( + result: PathUncheckedResponse, +): Promise<_ExperimentExecutionListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _experimentExecutionListResultDeserializer(result.body); +} + +/** Get a list of executions of an Experiment resource. */ +export function experimentExecutionsListAllExecutions( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + options: ExperimentExecutionsListAllExecutionsOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _experimentExecutionsListAllExecutionsSend( + context, + subscriptionId, + resourceGroupName, + experimentName, + options, + ), + _experimentExecutionsListAllExecutionsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _experimentExecutionsGetExecutionDetailsSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + executionId: string, + options: ExperimentExecutionsGetExecutionDetailsOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}/getExecutionDetails", + subscriptionId, + resourceGroupName, + experimentName, + executionId, + ) + .post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _experimentExecutionsGetExecutionDetailsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return experimentExecutionDetailsDeserializer(result.body); +} + +/** Execution details of an experiment resource. */ +export async function experimentExecutionsGetExecutionDetails( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + executionId: string, + options: ExperimentExecutionsGetExecutionDetailsOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _experimentExecutionsGetExecutionDetailsSend( + context, + subscriptionId, + resourceGroupName, + experimentName, + executionId, + options, + ); + return _experimentExecutionsGetExecutionDetailsDeserialize(result); +} diff --git a/sdk/chaos/arm-chaos/src/api/experiments/index.ts b/sdk/chaos/arm-chaos/src/api/experiments/index.ts new file mode 100644 index 000000000000..15881f412709 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/api/experiments/index.ts @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + ChaosManagementContext as Client, + ExperimentsCancelOptionalParams, + ExperimentsCreateOrUpdateOptionalParams, + ExperimentsDeleteOptionalParams, + ExperimentsGetOptionalParams, + ExperimentsListAllOptionalParams, + ExperimentsListOptionalParams, + ExperimentsStartOptionalParams, + ExperimentsUpdateOptionalParams, +} from "../index.js"; +import { + Experiment, + experimentSerializer, + experimentDeserializer, + ExperimentUpdate, + experimentUpdateSerializer, + _ExperimentListResult, + _experimentListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _experimentsGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + options: ExperimentsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}", + subscriptionId, + resourceGroupName, + experimentName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _experimentsGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return experimentDeserializer(result.body); +} + +/** Get a Experiment resource. */ +export async function experimentsGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + options: ExperimentsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _experimentsGetSend( + context, + subscriptionId, + resourceGroupName, + experimentName, + options, + ); + return _experimentsGetDeserialize(result); +} + +export function _experimentsCreateOrUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + resource: Experiment, + options: ExperimentsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}", + subscriptionId, + resourceGroupName, + experimentName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: experimentSerializer(resource), + }); +} + +export async function _experimentsCreateOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return experimentDeserializer(result.body); +} + +/** Create or update a Experiment resource. */ +export function experimentsCreateOrUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + resource: Experiment, + options: ExperimentsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Experiment> { + return getLongRunningPoller(context, _experimentsCreateOrUpdateDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _experimentsCreateOrUpdateSend( + context, + subscriptionId, + resourceGroupName, + experimentName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, Experiment>; +} + +export function _experimentsUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + properties: ExperimentUpdate, + options: ExperimentsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}", + subscriptionId, + resourceGroupName, + experimentName, + ) + .patch({ + ...operationOptionsToRequestParameters(options), + body: experimentUpdateSerializer(properties), + }); +} + +export async function _experimentsUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return experimentDeserializer(result.body); +} + +/** The operation to update an experiment. */ +export function experimentsUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + properties: ExperimentUpdate, + options: ExperimentsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Experiment> { + return getLongRunningPoller(context, _experimentsUpdateDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _experimentsUpdateSend( + context, + subscriptionId, + resourceGroupName, + experimentName, + properties, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, Experiment>; +} + +export function _experimentsDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + options: ExperimentsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}", + subscriptionId, + resourceGroupName, + experimentName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _experimentsDeleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Delete a Experiment resource. */ +export function experimentsDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + options: ExperimentsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _experimentsDeleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _experimentsDeleteSend(context, subscriptionId, resourceGroupName, experimentName, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _experimentsListSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: ExperimentsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments", + subscriptionId, + resourceGroupName, + ) + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { + running: options?.running, + continuationToken: options?.continuationToken, + }, + }); +} + +export async function _experimentsListDeserialize( + result: PathUncheckedResponse, +): Promise<_ExperimentListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _experimentListResultDeserializer(result.body); +} + +/** Get a list of Experiment resources in a resource group. */ +export function experimentsList( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: ExperimentsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _experimentsListSend(context, subscriptionId, resourceGroupName, options), + _experimentsListDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _experimentsListAllSend( + context: Client, + subscriptionId: string, + options: ExperimentsListAllOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/experiments", subscriptionId) + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { + running: options?.running, + continuationToken: options?.continuationToken, + }, + }); +} + +export async function _experimentsListAllDeserialize( + result: PathUncheckedResponse, +): Promise<_ExperimentListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _experimentListResultDeserializer(result.body); +} + +/** Get a list of Experiment resources in a subscription. */ +export function experimentsListAll( + context: Client, + subscriptionId: string, + options: ExperimentsListAllOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _experimentsListAllSend(context, subscriptionId, options), + _experimentsListAllDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _experimentsCancelSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + options: ExperimentsCancelOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel", + subscriptionId, + resourceGroupName, + experimentName, + ) + .post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _experimentsCancelDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Cancel a running Experiment resource. */ +export function experimentsCancel( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + options: ExperimentsCancelOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _experimentsCancelDeserialize, ["202", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _experimentsCancelSend(context, subscriptionId, resourceGroupName, experimentName, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _experimentsStartSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + options: ExperimentsStartOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start", + subscriptionId, + resourceGroupName, + experimentName, + ) + .post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _experimentsStartDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Start a Experiment resource. */ +export function experimentsStart( + context: Client, + subscriptionId: string, + resourceGroupName: string, + experimentName: string, + options: ExperimentsStartOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _experimentsStartDeserialize, ["202", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _experimentsStartSend(context, subscriptionId, resourceGroupName, experimentName, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} diff --git a/sdk/chaos/arm-chaos/src/api/index.ts b/sdk/chaos/arm-chaos/src/api/index.ts new file mode 100644 index 000000000000..b69a337f5b43 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/api/index.ts @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + createChaosManagement, + ChaosManagementContext, + ChaosManagementClientOptionalParams, +} from "./chaosManagementContext.js"; +export { + CapabilitiesGetOptionalParams, + CapabilitiesCreateOrUpdateOptionalParams, + CapabilitiesDeleteOptionalParams, + CapabilitiesListOptionalParams, + OperationsListOptionalParams, + TargetsGetOptionalParams, + TargetsCreateOrUpdateOptionalParams, + TargetsDeleteOptionalParams, + TargetsListOptionalParams, + CapabilityTypesGetOptionalParams, + CapabilityTypesListOptionalParams, + ExperimentsGetOptionalParams, + ExperimentsCreateOrUpdateOptionalParams, + ExperimentsUpdateOptionalParams, + ExperimentsDeleteOptionalParams, + ExperimentsListOptionalParams, + ExperimentsListAllOptionalParams, + ExperimentsCancelOptionalParams, + ExperimentsStartOptionalParams, + ExperimentExecutionsGetExecutionOptionalParams, + ExperimentExecutionsListAllExecutionsOptionalParams, + ExperimentExecutionsGetExecutionDetailsOptionalParams, + PrivateAccessesGetOptionalParams, + PrivateAccessesCreateOrUpdateOptionalParams, + PrivateAccessesUpdateOptionalParams, + PrivateAccessesDeleteOptionalParams, + PrivateAccessesListOptionalParams, + PrivateAccessesListAllOptionalParams, + PrivateAccessesPrivateLinkResourcesOptionalParams, + PrivateEndpointConnectionsGetAPrivateEndpointConnectionOptionalParams, + PrivateEndpointConnectionsDeleteAPrivateEndpointConnectionOptionalParams, + PrivateEndpointConnectionsListPrivateEndpointConnectionsOptionalParams, + TargetTypesGetOptionalParams, + TargetTypesListOptionalParams, + OperationStatusesGetOptionalParams, +} from "./options.js"; +export { + capabilitiesGet, + capabilitiesCreateOrUpdate, + capabilitiesDelete, + capabilitiesList, +} from "./capabilities/index.js"; +export { capabilityTypesGet, capabilityTypesList } from "./capabilityTypes/index.js"; +export { + experimentExecutionsGetExecution, + experimentExecutionsListAllExecutions, + experimentExecutionsGetExecutionDetails, +} from "./experimentExecutions/index.js"; +export { + experimentsGet, + experimentsCreateOrUpdate, + experimentsUpdate, + experimentsDelete, + experimentsList, + experimentsListAll, + experimentsCancel, + experimentsStart, +} from "./experiments/index.js"; +export { operationsList } from "./operations/index.js"; +export { operationStatusesGet } from "./operationStatuses/index.js"; +export { + privateAccessesGet, + privateAccessesCreateOrUpdate, + privateAccessesUpdate, + privateAccessesDelete, + privateAccessesList, + privateAccessesListAll, + privateAccessesPrivateLinkResources, +} from "./privateAccesses/index.js"; +export { + privateEndpointConnectionsGetAPrivateEndpointConnection, + privateEndpointConnectionsDeleteAPrivateEndpointConnection, + privateEndpointConnectionsListPrivateEndpointConnections, +} from "./privateEndpointConnections/index.js"; +export { targetsGet, targetsCreateOrUpdate, targetsDelete, targetsList } from "./targets/index.js"; +export { targetTypesGet, targetTypesList } from "./targetTypes/index.js"; diff --git a/sdk/chaos/arm-chaos/src/api/operationStatuses/index.ts b/sdk/chaos/arm-chaos/src/api/operationStatuses/index.ts new file mode 100644 index 000000000000..08ff7a6b1e02 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/api/operationStatuses/index.ts @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ChaosManagementContext as Client, OperationStatusesGetOptionalParams } from "../index.js"; +import { OperationStatusResult, operationStatusResultDeserializer } from "../../models/models.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _operationStatusesGetSend( + context: Client, + subscriptionId: string, + location: string, + operationId: string, + options: OperationStatusesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/operationStatuses/{operationId}", + subscriptionId, + location, + operationId, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationStatusesGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return operationStatusResultDeserializer(result.body); +} + +/** Returns the current status of an async operation. */ +export async function operationStatusesGet( + context: Client, + subscriptionId: string, + location: string, + operationId: string, + options: OperationStatusesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationStatusesGetSend( + context, + subscriptionId, + location, + operationId, + options, + ); + return _operationStatusesGetDeserialize(result); +} diff --git a/sdk/chaos/arm-chaos/src/api/operations/index.ts b/sdk/chaos/arm-chaos/src/api/operations/index.ts new file mode 100644 index 000000000000..1ff11c29b6e7 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/api/operations/index.ts @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ChaosManagementContext as Client, OperationsListOptionalParams } from "../index.js"; +import { + _OperationListResult, + _operationListResultDeserializer, + Operation, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _operationsListSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/providers/Microsoft.Chaos/operations") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsListDeserialize( + result: PathUncheckedResponse, +): Promise<_OperationListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _operationListResultDeserializer(result.body); +} + +/** List the operations for the provider */ +export function operationsList( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _operationsListSend(context, options), + _operationsListDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/chaos/arm-chaos/src/api/options.ts b/sdk/chaos/arm-chaos/src/api/options.ts new file mode 100644 index 000000000000..3e9ef0b6390e --- /dev/null +++ b/sdk/chaos/arm-chaos/src/api/options.ts @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface CapabilitiesGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CapabilitiesCreateOrUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CapabilitiesDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CapabilitiesListOptionalParams extends OperationOptions { + /** String that sets the continuation token. */ + continuationToken?: string; +} + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TargetsGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TargetsCreateOrUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TargetsDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TargetsListOptionalParams extends OperationOptions { + /** String that sets the continuation token. */ + continuationToken?: string; +} + +/** Optional parameters. */ +export interface CapabilityTypesGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CapabilityTypesListOptionalParams extends OperationOptions { + /** String that sets the continuation token. */ + continuationToken?: string; +} + +/** Optional parameters. */ +export interface ExperimentsGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ExperimentsCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ExperimentsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ExperimentsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ExperimentsListOptionalParams extends OperationOptions { + /** Optional value that indicates whether to filter results based on if the Experiment is currently running. If null, then the results will not be filtered. */ + running?: boolean; + /** String that sets the continuation token. */ + continuationToken?: string; +} + +/** Optional parameters. */ +export interface ExperimentsListAllOptionalParams extends OperationOptions { + /** Optional value that indicates whether to filter results based on if the Experiment is currently running. If null, then the results will not be filtered. */ + running?: boolean; + /** String that sets the continuation token. */ + continuationToken?: string; +} + +/** Optional parameters. */ +export interface ExperimentsCancelOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ExperimentsStartOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ExperimentExecutionsGetExecutionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ExperimentExecutionsListAllExecutionsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ExperimentExecutionsGetExecutionDetailsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface PrivateAccessesGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface PrivateAccessesCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface PrivateAccessesUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface PrivateAccessesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface PrivateAccessesListOptionalParams extends OperationOptions { + /** String that sets the continuation token. */ + continuationToken?: string; +} + +/** Optional parameters. */ +export interface PrivateAccessesListAllOptionalParams extends OperationOptions { + /** String that sets the continuation token. */ + continuationToken?: string; +} + +/** Optional parameters. */ +export interface PrivateAccessesPrivateLinkResourcesOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsGetAPrivateEndpointConnectionOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsDeleteAPrivateEndpointConnectionOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsListPrivateEndpointConnectionsOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TargetTypesGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TargetTypesListOptionalParams extends OperationOptions { + /** String that sets the continuation token. */ + continuationToken?: string; +} + +/** Optional parameters. */ +export interface OperationStatusesGetOptionalParams extends OperationOptions {} diff --git a/sdk/chaos/arm-chaos/src/api/privateAccesses/index.ts b/sdk/chaos/arm-chaos/src/api/privateAccesses/index.ts new file mode 100644 index 000000000000..b871f9943eae --- /dev/null +++ b/sdk/chaos/arm-chaos/src/api/privateAccesses/index.ts @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + ChaosManagementContext as Client, + PrivateAccessesCreateOrUpdateOptionalParams, + PrivateAccessesDeleteOptionalParams, + PrivateAccessesGetOptionalParams, + PrivateAccessesListAllOptionalParams, + PrivateAccessesListOptionalParams, + PrivateAccessesPrivateLinkResourcesOptionalParams, + PrivateAccessesUpdateOptionalParams, +} from "../index.js"; +import { + PrivateAccess, + privateAccessSerializer, + privateAccessDeserializer, + PrivateAccessPatch, + privateAccessPatchSerializer, + _PrivateAccessListResult, + _privateAccessListResultDeserializer, + _PrivateLinkResourceListResult, + _privateLinkResourceListResultDeserializer, + PrivateLinkResource, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _privateAccessesGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + options: PrivateAccessesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/privateAccesses/{privateAccessName}", + subscriptionId, + resourceGroupName, + privateAccessName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _privateAccessesGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return privateAccessDeserializer(result.body); +} + +/** Get a private access resource */ +export async function privateAccessesGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + options: PrivateAccessesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _privateAccessesGetSend( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + options, + ); + return _privateAccessesGetDeserialize(result); +} + +export function _privateAccessesCreateOrUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + resource: PrivateAccess, + options: PrivateAccessesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/privateAccesses/{privateAccessName}", + subscriptionId, + resourceGroupName, + privateAccessName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: privateAccessSerializer(resource), + }); +} + +export async function _privateAccessesCreateOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return privateAccessDeserializer(result.body); +} + +/** Create or update a private access */ +export function privateAccessesCreateOrUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + resource: PrivateAccess, + options: PrivateAccessesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, PrivateAccess> { + return getLongRunningPoller(context, _privateAccessesCreateOrUpdateDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _privateAccessesCreateOrUpdateSend( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, PrivateAccess>; +} + +export function _privateAccessesUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + properties: PrivateAccessPatch, + options: PrivateAccessesUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/privateAccesses/{privateAccessName}", + subscriptionId, + resourceGroupName, + privateAccessName, + ) + .patch({ + ...operationOptionsToRequestParameters(options), + body: privateAccessPatchSerializer(properties), + }); +} + +export async function _privateAccessesUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return privateAccessDeserializer(result.body); +} + +/** Patch a private access tags */ +export function privateAccessesUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + properties: PrivateAccessPatch, + options: PrivateAccessesUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, PrivateAccess> { + return getLongRunningPoller(context, _privateAccessesUpdateDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _privateAccessesUpdateSend( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + properties, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, PrivateAccess>; +} + +export function _privateAccessesDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + options: PrivateAccessesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/privateAccesses/{privateAccessName}", + subscriptionId, + resourceGroupName, + privateAccessName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _privateAccessesDeleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Delete a private access */ +export function privateAccessesDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + options: PrivateAccessesDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _privateAccessesDeleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _privateAccessesDeleteSend( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _privateAccessesListSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: PrivateAccessesListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/privateAccesses", + subscriptionId, + resourceGroupName, + ) + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { continuationToken: options?.continuationToken }, + }); +} + +export async function _privateAccessesListDeserialize( + result: PathUncheckedResponse, +): Promise<_PrivateAccessListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _privateAccessListResultDeserializer(result.body); +} + +/** Get a list of private access resources in a resource group. */ +export function privateAccessesList( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: PrivateAccessesListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _privateAccessesListSend(context, subscriptionId, resourceGroupName, options), + _privateAccessesListDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _privateAccessesListAllSend( + context: Client, + subscriptionId: string, + options: PrivateAccessesListAllOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/privateAccesses", + subscriptionId, + ) + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { continuationToken: options?.continuationToken }, + }); +} + +export async function _privateAccessesListAllDeserialize( + result: PathUncheckedResponse, +): Promise<_PrivateAccessListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _privateAccessListResultDeserializer(result.body); +} + +/** Get a list of private access resources in a subscription. */ +export function privateAccessesListAll( + context: Client, + subscriptionId: string, + options: PrivateAccessesListAllOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _privateAccessesListAllSend(context, subscriptionId, options), + _privateAccessesListAllDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _privateAccessesPrivateLinkResourcesSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + options: PrivateAccessesPrivateLinkResourcesOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/privateAccesses/{privateAccessName}/privateLinkResources", + subscriptionId, + resourceGroupName, + privateAccessName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _privateAccessesPrivateLinkResourcesDeserialize( + result: PathUncheckedResponse, +): Promise<_PrivateLinkResourceListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _privateLinkResourceListResultDeserializer(result.body); +} + +/** Gets the private link resources possible under private access resource */ +export function privateAccessesPrivateLinkResources( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + options: PrivateAccessesPrivateLinkResourcesOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _privateAccessesPrivateLinkResourcesSend( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + options, + ), + _privateAccessesPrivateLinkResourcesDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/chaos/arm-chaos/src/api/privateEndpointConnections/index.ts b/sdk/chaos/arm-chaos/src/api/privateEndpointConnections/index.ts new file mode 100644 index 000000000000..ef0b68c51fef --- /dev/null +++ b/sdk/chaos/arm-chaos/src/api/privateEndpointConnections/index.ts @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + ChaosManagementContext as Client, + PrivateEndpointConnectionsDeleteAPrivateEndpointConnectionOptionalParams, + PrivateEndpointConnectionsGetAPrivateEndpointConnectionOptionalParams, + PrivateEndpointConnectionsListPrivateEndpointConnectionsOptionalParams, +} from "../index.js"; +import { + PrivateEndpointConnection, + privateEndpointConnectionDeserializer, + _PrivateEndpointConnectionListResult, + _privateEndpointConnectionListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _privateEndpointConnectionsGetAPrivateEndpointConnectionSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsGetAPrivateEndpointConnectionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/privateAccesses/{privateAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", + subscriptionId, + resourceGroupName, + privateAccessName, + privateEndpointConnectionName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _privateEndpointConnectionsGetAPrivateEndpointConnectionDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return privateEndpointConnectionDeserializer(result.body); +} + +/** Gets information about a private endpoint connection under a private access resource. */ +export async function privateEndpointConnectionsGetAPrivateEndpointConnection( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsGetAPrivateEndpointConnectionOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _privateEndpointConnectionsGetAPrivateEndpointConnectionSend( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + privateEndpointConnectionName, + options, + ); + return _privateEndpointConnectionsGetAPrivateEndpointConnectionDeserialize(result); +} + +export function _privateEndpointConnectionsDeleteAPrivateEndpointConnectionSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsDeleteAPrivateEndpointConnectionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/privateAccesses/{privateAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", + subscriptionId, + resourceGroupName, + privateAccessName, + privateEndpointConnectionName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _privateEndpointConnectionsDeleteAPrivateEndpointConnectionDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Deletes a private endpoint connection under a private access resource. */ +export function privateEndpointConnectionsDeleteAPrivateEndpointConnection( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsDeleteAPrivateEndpointConnectionOptionalParams = { + requestOptions: {}, + }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _privateEndpointConnectionsDeleteAPrivateEndpointConnectionDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _privateEndpointConnectionsDeleteAPrivateEndpointConnectionSend( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + privateEndpointConnectionName, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _privateEndpointConnectionsListPrivateEndpointConnectionsSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + options: PrivateEndpointConnectionsListPrivateEndpointConnectionsOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/privateAccesses/{privateAccessName}/privateEndpointConnections", + subscriptionId, + resourceGroupName, + privateAccessName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _privateEndpointConnectionsListPrivateEndpointConnectionsDeserialize( + result: PathUncheckedResponse, +): Promise<_PrivateEndpointConnectionListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _privateEndpointConnectionListResultDeserializer(result.body); +} + +/** List information about private endpoint connections under a private access resource */ +export function privateEndpointConnectionsListPrivateEndpointConnections( + context: Client, + subscriptionId: string, + resourceGroupName: string, + privateAccessName: string, + options: PrivateEndpointConnectionsListPrivateEndpointConnectionsOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _privateEndpointConnectionsListPrivateEndpointConnectionsSend( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + options, + ), + _privateEndpointConnectionsListPrivateEndpointConnectionsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/chaos/arm-chaos/src/api/targetTypes/index.ts b/sdk/chaos/arm-chaos/src/api/targetTypes/index.ts new file mode 100644 index 000000000000..269b4f0c78d4 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/api/targetTypes/index.ts @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + ChaosManagementContext as Client, + TargetTypesGetOptionalParams, + TargetTypesListOptionalParams, +} from "../index.js"; +import { + TargetType, + targetTypeDeserializer, + _TargetTypeListResult, + _targetTypeListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _targetTypesGetSend( + context: Client, + subscriptionId: string, + location: string, + targetTypeName: string, + options: TargetTypesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}", + subscriptionId, + location, + targetTypeName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _targetTypesGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return targetTypeDeserializer(result.body); +} + +/** Get a Target Type resources for given location. */ +export async function targetTypesGet( + context: Client, + subscriptionId: string, + location: string, + targetTypeName: string, + options: TargetTypesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _targetTypesGetSend( + context, + subscriptionId, + location, + targetTypeName, + options, + ); + return _targetTypesGetDeserialize(result); +} + +export function _targetTypesListSend( + context: Client, + subscriptionId: string, + location: string, + options: TargetTypesListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes", + subscriptionId, + location, + ) + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { continuationToken: options?.continuationToken }, + }); +} + +export async function _targetTypesListDeserialize( + result: PathUncheckedResponse, +): Promise<_TargetTypeListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _targetTypeListResultDeserializer(result.body); +} + +/** Get a list of Target Type resources for given location. */ +export function targetTypesList( + context: Client, + subscriptionId: string, + location: string, + options: TargetTypesListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _targetTypesListSend(context, subscriptionId, location, options), + _targetTypesListDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/chaos/arm-chaos/src/api/targets/index.ts b/sdk/chaos/arm-chaos/src/api/targets/index.ts new file mode 100644 index 000000000000..3c43e141c69e --- /dev/null +++ b/sdk/chaos/arm-chaos/src/api/targets/index.ts @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + ChaosManagementContext as Client, + TargetsCreateOrUpdateOptionalParams, + TargetsDeleteOptionalParams, + TargetsGetOptionalParams, + TargetsListOptionalParams, +} from "../index.js"; +import { + Target, + targetSerializer, + targetDeserializer, + _TargetListResult, + _targetListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _targetsGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + options: TargetsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}", + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _targetsGetDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return targetDeserializer(result.body); +} + +/** Get a Target resource that extends a tracked regional resource. */ +export async function targetsGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + options: TargetsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _targetsGetSend( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + options, + ); + return _targetsGetDeserialize(result); +} + +export function _targetsCreateOrUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + resource: Target, + options: TargetsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}", + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: targetSerializer(resource), + }); +} + +export async function _targetsCreateOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return targetDeserializer(result.body); +} + +/** Create or update a Target resource that extends a tracked regional resource. */ +export async function targetsCreateOrUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + resource: Target, + options: TargetsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _targetsCreateOrUpdateSend( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + resource, + options, + ); + return _targetsCreateOrUpdateDeserialize(result); +} + +export function _targetsDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + options: TargetsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}", + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _targetsDeleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Delete a Target resource that extends a tracked regional resource. */ +export async function targetsDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + options: TargetsDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _targetsDeleteSend( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + options, + ); + return _targetsDeleteDeserialize(result); +} + +export function _targetsListSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + options: TargetsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets", + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + ) + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { continuationToken: options?.continuationToken }, + }); +} + +export async function _targetsListDeserialize( + result: PathUncheckedResponse, +): Promise<_TargetListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _targetListResultDeserializer(result.body); +} + +/** Get a list of Target resources that extend a tracked regional resource. */ +export function targetsList( + context: Client, + subscriptionId: string, + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + options: TargetsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _targetsListSend( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + options, + ), + _targetsListDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/chaos/arm-chaos/src/chaosManagementClient.ts b/sdk/chaos/arm-chaos/src/chaosManagementClient.ts index 2584392268e7..36b9588a65b4 100644 --- a/sdk/chaos/arm-chaos/src/chaosManagementClient.ts +++ b/sdk/chaos/arm-chaos/src/chaosManagementClient.ts @@ -1,183 +1,94 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. -import * as coreClient from "@azure/core-client"; -import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { getCapabilitiesOperations, CapabilitiesOperations } from "./classic/capabilities/index.js"; +import { getOperationsOperations, OperationsOperations } from "./classic/operations/index.js"; +import { getTargetsOperations, TargetsOperations } from "./classic/targets/index.js"; import { - PipelineRequest, - PipelineResponse, - SendRequest, -} from "@azure/core-rest-pipeline"; -import * as coreAuth from "@azure/core-auth"; + getCapabilityTypesOperations, + CapabilityTypesOperations, +} from "./classic/capabilityTypes/index.js"; +import { getExperimentsOperations, ExperimentsOperations } from "./classic/experiments/index.js"; import { - CapabilitiesImpl, - CapabilityTypesImpl, - ExperimentsImpl, - OperationStatusesImpl, - OperationsImpl, - TargetTypesImpl, - TargetsImpl, -} from "./operations"; + getExperimentExecutionsOperations, + ExperimentExecutionsOperations, +} from "./classic/experimentExecutions/index.js"; import { - Capabilities, - CapabilityTypes, - Experiments, - OperationStatuses, - Operations, - TargetTypes, - Targets, -} from "./operationsInterfaces"; -import { ChaosManagementClientOptionalParams } from "./models"; + getPrivateAccessesOperations, + PrivateAccessesOperations, +} from "./classic/privateAccesses/index.js"; +import { + getPrivateEndpointConnectionsOperations, + PrivateEndpointConnectionsOperations, +} from "./classic/privateEndpointConnections/index.js"; +import { getTargetTypesOperations, TargetTypesOperations } from "./classic/targetTypes/index.js"; +import { + getOperationStatusesOperations, + OperationStatusesOperations, +} from "./classic/operationStatuses/index.js"; +import { + createChaosManagement, + ChaosManagementContext, + ChaosManagementClientOptionalParams, +} from "./api/index.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { TokenCredential } from "@azure/core-auth"; + +export { ChaosManagementClientOptionalParams } from "./api/chaosManagementContext.js"; -export class ChaosManagementClient extends coreClient.ServiceClient { - $host: string; - apiVersion: string; - subscriptionId?: string; +export class ChaosManagementClient { + private _client: ChaosManagementContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; - /** - * 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 - */ + /** Chaos Management Client */ constructor( - credentials: coreAuth.TokenCredential, + credential: TokenCredential, subscriptionId: string, - options?: ChaosManagementClientOptionalParams, - ); - constructor( - credentials: coreAuth.TokenCredential, - options?: ChaosManagementClientOptionalParams, - ); - constructor( - credentials: coreAuth.TokenCredential, - subscriptionIdOrOptions?: ChaosManagementClientOptionalParams | string, - options?: ChaosManagementClientOptionalParams, + options: ChaosManagementClientOptionalParams = {}, ) { - if (credentials === undefined) { - throw new Error("'credentials' cannot be null"); - } - - let subscriptionId: string | undefined; - - if (typeof subscriptionIdOrOptions === "string") { - subscriptionId = subscriptionIdOrOptions; - } else if (typeof subscriptionIdOrOptions === "object") { - options = subscriptionIdOrOptions; - } - - // Initializing default values for options - if (!options) { - options = {}; - } - const defaults: ChaosManagementClientOptionalParams = { - requestContentType: "application/json; charset=utf-8", - credential: credentials, - }; - - const packageDetails = `azsdk-js-arm-chaos/1.1.1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; - - const optionsWithDefaults = { - ...defaults, + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createChaosManagement(credential, { ...options, - userAgentOptions: { - userAgentPrefix, - }, - endpoint: - options.endpoint ?? options.baseUri ?? "https://management.azure.com", - }; - super(optionsWithDefaults); - - let bearerTokenAuthenticationPolicyFound: boolean = false; - if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = - options.pipeline.getOrderedPolicies(); - bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( - (pipelinePolicy) => - pipelinePolicy.name === - coreRestPipeline.bearerTokenAuthenticationPolicyName, - ); - } - if ( - !options || - !options.pipeline || - options.pipeline.getOrderedPolicies().length == 0 || - !bearerTokenAuthenticationPolicyFound - ) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName, - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - credential: credentials, - scopes: - optionsWithDefaults.credentialScopes ?? - `${optionsWithDefaults.endpoint}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge, - }, - }), - ); - } - // Parameter assignments - this.subscriptionId = subscriptionId; - - // Assigning values to Constant parameters - this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2024-01-01"; - this.capabilities = new CapabilitiesImpl(this); - this.capabilityTypes = new CapabilityTypesImpl(this); - this.experiments = new ExperimentsImpl(this); - this.operationStatuses = new OperationStatusesImpl(this); - this.operations = new OperationsImpl(this); - this.targetTypes = new TargetTypesImpl(this); - this.targets = new TargetsImpl(this); - this.addCustomApiVersionPolicy(options.apiVersion); - } - - /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ - private addCustomApiVersionPolicy(apiVersion?: string) { - if (!apiVersion) { - return; - } - const apiVersionPolicy = { - name: "CustomApiVersionPolicy", - async sendRequest( - request: PipelineRequest, - next: SendRequest, - ): Promise { - const param = request.url.split("?"); - if (param.length > 1) { - const newParams = param[1].split("&").map((item) => { - if (item.indexOf("api-version") > -1) { - return "api-version=" + apiVersion; - } else { - return item; - } - }); - request.url = param[0] + "?" + newParams.join("&"); - } - return next(request); - }, - }; - this.pipeline.addPolicy(apiVersionPolicy); + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.capabilities = getCapabilitiesOperations(this._client, subscriptionId); + this.operations = getOperationsOperations(this._client); + this.targets = getTargetsOperations(this._client, subscriptionId); + this.capabilityTypes = getCapabilityTypesOperations(this._client, subscriptionId); + this.experiments = getExperimentsOperations(this._client, subscriptionId); + this.experimentExecutions = getExperimentExecutionsOperations(this._client, subscriptionId); + this.privateAccesses = getPrivateAccessesOperations(this._client, subscriptionId); + this.privateEndpointConnections = getPrivateEndpointConnectionsOperations( + this._client, + subscriptionId, + ); + this.targetTypes = getTargetTypesOperations(this._client, subscriptionId); + this.operationStatuses = getOperationStatusesOperations(this._client, subscriptionId); } - capabilities: Capabilities; - capabilityTypes: CapabilityTypes; - experiments: Experiments; - operationStatuses: OperationStatuses; - operations: Operations; - targetTypes: TargetTypes; - targets: Targets; + /** The operation groups for Capabilities */ + public readonly capabilities: CapabilitiesOperations; + /** The operation groups for Operations */ + public readonly operations: OperationsOperations; + /** The operation groups for Targets */ + public readonly targets: TargetsOperations; + /** The operation groups for CapabilityTypes */ + public readonly capabilityTypes: CapabilityTypesOperations; + /** The operation groups for Experiments */ + public readonly experiments: ExperimentsOperations; + /** The operation groups for ExperimentExecutions */ + public readonly experimentExecutions: ExperimentExecutionsOperations; + /** The operation groups for PrivateAccesses */ + public readonly privateAccesses: PrivateAccessesOperations; + /** The operation groups for PrivateEndpointConnections */ + public readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; + /** The operation groups for TargetTypes */ + public readonly targetTypes: TargetTypesOperations; + /** The operation groups for OperationStatuses */ + public readonly operationStatuses: OperationStatusesOperations; } diff --git a/sdk/chaos/arm-chaos/src/classic/capabilities/index.ts b/sdk/chaos/arm-chaos/src/classic/capabilities/index.ts new file mode 100644 index 000000000000..683f33a5779a --- /dev/null +++ b/sdk/chaos/arm-chaos/src/classic/capabilities/index.ts @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ChaosManagementContext } from "../../api/chaosManagementContext.js"; +import { + capabilitiesGet, + capabilitiesCreateOrUpdate, + capabilitiesDelete, + capabilitiesList, +} from "../../api/capabilities/index.js"; +import { Capability } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { + CapabilitiesGetOptionalParams, + CapabilitiesCreateOrUpdateOptionalParams, + CapabilitiesDeleteOptionalParams, + CapabilitiesListOptionalParams, +} from "../../api/options.js"; + +/** Interface representing a Capabilities operations. */ +export interface CapabilitiesOperations { + /** Get a Capability resource that extends a Target resource. */ + get: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + capabilityName: string, + options?: CapabilitiesGetOptionalParams, + ) => Promise; + /** Create or update a Capability resource that extends a Target resource. */ + createOrUpdate: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + capabilityName: string, + resource: Capability, + options?: CapabilitiesCreateOrUpdateOptionalParams, + ) => Promise; + /** Delete a Capability that extends a Target resource. */ + delete: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + capabilityName: string, + options?: CapabilitiesDeleteOptionalParams, + ) => Promise; + /** Get a list of Capability resources that extend a Target resource. */ + list: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + options?: CapabilitiesListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getCapabilities(context: ChaosManagementContext, subscriptionId: string) { + return { + get: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + capabilityName: string, + options?: CapabilitiesGetOptionalParams, + ) => + capabilitiesGet( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + capabilityName: string, + resource: Capability, + options?: CapabilitiesCreateOrUpdateOptionalParams, + ) => + capabilitiesCreateOrUpdate( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + resource, + options, + ), + delete: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + capabilityName: string, + options?: CapabilitiesDeleteOptionalParams, + ) => + capabilitiesDelete( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + options, + ), + list: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + options?: CapabilitiesListOptionalParams, + ) => + capabilitiesList( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + options, + ), + }; +} + +export function getCapabilitiesOperations( + context: ChaosManagementContext, + subscriptionId: string, +): CapabilitiesOperations { + return { + ...getCapabilities(context, subscriptionId), + }; +} diff --git a/sdk/chaos/arm-chaos/src/classic/capabilityTypes/index.ts b/sdk/chaos/arm-chaos/src/classic/capabilityTypes/index.ts new file mode 100644 index 000000000000..e0bc7955ba53 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/classic/capabilityTypes/index.ts @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ChaosManagementContext } from "../../api/chaosManagementContext.js"; +import { capabilityTypesGet, capabilityTypesList } from "../../api/capabilityTypes/index.js"; +import { CapabilityType } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { + CapabilityTypesGetOptionalParams, + CapabilityTypesListOptionalParams, +} from "../../api/options.js"; + +/** Interface representing a CapabilityTypes operations. */ +export interface CapabilityTypesOperations { + /** Get a Capability Type resource for given Target Type and location. */ + get: ( + location: string, + targetTypeName: string, + capabilityTypeName: string, + options?: CapabilityTypesGetOptionalParams, + ) => Promise; + /** Get a list of Capability Type resources for given Target Type and location. */ + list: ( + location: string, + targetTypeName: string, + options?: CapabilityTypesListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getCapabilityTypes(context: ChaosManagementContext, subscriptionId: string) { + return { + get: ( + location: string, + targetTypeName: string, + capabilityTypeName: string, + options?: CapabilityTypesGetOptionalParams, + ) => + capabilityTypesGet( + context, + subscriptionId, + location, + targetTypeName, + capabilityTypeName, + options, + ), + list: (location: string, targetTypeName: string, options?: CapabilityTypesListOptionalParams) => + capabilityTypesList(context, subscriptionId, location, targetTypeName, options), + }; +} + +export function getCapabilityTypesOperations( + context: ChaosManagementContext, + subscriptionId: string, +): CapabilityTypesOperations { + return { + ...getCapabilityTypes(context, subscriptionId), + }; +} diff --git a/sdk/chaos/arm-chaos/src/classic/experimentExecutions/index.ts b/sdk/chaos/arm-chaos/src/classic/experimentExecutions/index.ts new file mode 100644 index 000000000000..73cc38300c2a --- /dev/null +++ b/sdk/chaos/arm-chaos/src/classic/experimentExecutions/index.ts @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ChaosManagementContext } from "../../api/chaosManagementContext.js"; +import { + experimentExecutionsGetExecution, + experimentExecutionsListAllExecutions, + experimentExecutionsGetExecutionDetails, +} from "../../api/experimentExecutions/index.js"; +import { + ExperimentExecutionsGetExecutionOptionalParams, + ExperimentExecutionsListAllExecutionsOptionalParams, + ExperimentExecutionsGetExecutionDetailsOptionalParams, +} from "../../api/options.js"; +import { ExperimentExecution, ExperimentExecutionDetails } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a ExperimentExecutions operations. */ +export interface ExperimentExecutionsOperations { + /** Get an execution of an Experiment resource. */ + getExecution: ( + resourceGroupName: string, + experimentName: string, + executionId: string, + options?: ExperimentExecutionsGetExecutionOptionalParams, + ) => Promise; + /** Get a list of executions of an Experiment resource. */ + listAllExecutions: ( + resourceGroupName: string, + experimentName: string, + options?: ExperimentExecutionsListAllExecutionsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Execution details of an experiment resource. */ + getExecutionDetails: ( + resourceGroupName: string, + experimentName: string, + executionId: string, + options?: ExperimentExecutionsGetExecutionDetailsOptionalParams, + ) => Promise; +} + +export function getExperimentExecutions(context: ChaosManagementContext, subscriptionId: string) { + return { + getExecution: ( + resourceGroupName: string, + experimentName: string, + executionId: string, + options?: ExperimentExecutionsGetExecutionOptionalParams, + ) => + experimentExecutionsGetExecution( + context, + subscriptionId, + resourceGroupName, + experimentName, + executionId, + options, + ), + listAllExecutions: ( + resourceGroupName: string, + experimentName: string, + options?: ExperimentExecutionsListAllExecutionsOptionalParams, + ) => + experimentExecutionsListAllExecutions( + context, + subscriptionId, + resourceGroupName, + experimentName, + options, + ), + getExecutionDetails: ( + resourceGroupName: string, + experimentName: string, + executionId: string, + options?: ExperimentExecutionsGetExecutionDetailsOptionalParams, + ) => + experimentExecutionsGetExecutionDetails( + context, + subscriptionId, + resourceGroupName, + experimentName, + executionId, + options, + ), + }; +} + +export function getExperimentExecutionsOperations( + context: ChaosManagementContext, + subscriptionId: string, +): ExperimentExecutionsOperations { + return { + ...getExperimentExecutions(context, subscriptionId), + }; +} diff --git a/sdk/chaos/arm-chaos/src/classic/experiments/index.ts b/sdk/chaos/arm-chaos/src/classic/experiments/index.ts new file mode 100644 index 000000000000..132f9cee70d3 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/classic/experiments/index.ts @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ChaosManagementContext } from "../../api/chaosManagementContext.js"; +import { + experimentsGet, + experimentsCreateOrUpdate, + experimentsUpdate, + experimentsDelete, + experimentsList, + experimentsListAll, + experimentsCancel, + experimentsStart, +} from "../../api/experiments/index.js"; +import { + ExperimentsGetOptionalParams, + ExperimentsCreateOrUpdateOptionalParams, + ExperimentsUpdateOptionalParams, + ExperimentsDeleteOptionalParams, + ExperimentsListOptionalParams, + ExperimentsListAllOptionalParams, + ExperimentsCancelOptionalParams, + ExperimentsStartOptionalParams, +} from "../../api/options.js"; +import { Experiment, ExperimentUpdate } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Experiments operations. */ +export interface ExperimentsOperations { + /** Get a Experiment resource. */ + get: ( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsGetOptionalParams, + ) => Promise; + /** Create or update a Experiment resource. */ + createOrUpdate: ( + resourceGroupName: string, + experimentName: string, + resource: Experiment, + options?: ExperimentsCreateOrUpdateOptionalParams, + ) => PollerLike, Experiment>; + /** The operation to update an experiment. */ + update: ( + resourceGroupName: string, + experimentName: string, + properties: ExperimentUpdate, + options?: ExperimentsUpdateOptionalParams, + ) => PollerLike, Experiment>; + /** Delete a Experiment resource. */ + delete: ( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsDeleteOptionalParams, + ) => PollerLike, void>; + /** Get a list of Experiment resources in a resource group. */ + list: ( + resourceGroupName: string, + options?: ExperimentsListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get a list of Experiment resources in a subscription. */ + listAll: (options?: ExperimentsListAllOptionalParams) => PagedAsyncIterableIterator; + /** Cancel a running Experiment resource. */ + cancel: ( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsCancelOptionalParams, + ) => PollerLike, void>; + /** Start a Experiment resource. */ + start: ( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsStartOptionalParams, + ) => PollerLike, void>; +} + +export function getExperiments(context: ChaosManagementContext, subscriptionId: string) { + return { + get: ( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsGetOptionalParams, + ) => experimentsGet(context, subscriptionId, resourceGroupName, experimentName, options), + createOrUpdate: ( + resourceGroupName: string, + experimentName: string, + resource: Experiment, + options?: ExperimentsCreateOrUpdateOptionalParams, + ) => + experimentsCreateOrUpdate( + context, + subscriptionId, + resourceGroupName, + experimentName, + resource, + options, + ), + update: ( + resourceGroupName: string, + experimentName: string, + properties: ExperimentUpdate, + options?: ExperimentsUpdateOptionalParams, + ) => + experimentsUpdate( + context, + subscriptionId, + resourceGroupName, + experimentName, + properties, + options, + ), + delete: ( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsDeleteOptionalParams, + ) => experimentsDelete(context, subscriptionId, resourceGroupName, experimentName, options), + list: (resourceGroupName: string, options?: ExperimentsListOptionalParams) => + experimentsList(context, subscriptionId, resourceGroupName, options), + listAll: (options?: ExperimentsListAllOptionalParams) => + experimentsListAll(context, subscriptionId, options), + cancel: ( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsCancelOptionalParams, + ) => experimentsCancel(context, subscriptionId, resourceGroupName, experimentName, options), + start: ( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsStartOptionalParams, + ) => experimentsStart(context, subscriptionId, resourceGroupName, experimentName, options), + }; +} + +export function getExperimentsOperations( + context: ChaosManagementContext, + subscriptionId: string, +): ExperimentsOperations { + return { + ...getExperiments(context, subscriptionId), + }; +} diff --git a/sdk/chaos/arm-chaos/src/classic/index.ts b/sdk/chaos/arm-chaos/src/classic/index.ts new file mode 100644 index 000000000000..0c7d469c5bcd --- /dev/null +++ b/sdk/chaos/arm-chaos/src/classic/index.ts @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { CapabilitiesOperations } from "./capabilities/index.js"; +export { CapabilityTypesOperations } from "./capabilityTypes/index.js"; +export { ExperimentExecutionsOperations } from "./experimentExecutions/index.js"; +export { ExperimentsOperations } from "./experiments/index.js"; +export { OperationsOperations } from "./operations/index.js"; +export { OperationStatusesOperations } from "./operationStatuses/index.js"; +export { PrivateAccessesOperations } from "./privateAccesses/index.js"; +export { PrivateEndpointConnectionsOperations } from "./privateEndpointConnections/index.js"; +export { TargetsOperations } from "./targets/index.js"; +export { TargetTypesOperations } from "./targetTypes/index.js"; diff --git a/sdk/chaos/arm-chaos/src/classic/operationStatuses/index.ts b/sdk/chaos/arm-chaos/src/classic/operationStatuses/index.ts new file mode 100644 index 000000000000..1b14d5d64e69 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/classic/operationStatuses/index.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ChaosManagementContext } from "../../api/chaosManagementContext.js"; +import { operationStatusesGet } from "../../api/operationStatuses/index.js"; +import { OperationStatusesGetOptionalParams } from "../../api/options.js"; +import { OperationStatusResult } from "../../models/models.js"; + +/** Interface representing a OperationStatuses operations. */ +export interface OperationStatusesOperations { + /** Returns the current status of an async operation. */ + get: ( + location: string, + operationId: string, + options?: OperationStatusesGetOptionalParams, + ) => Promise; +} + +export function getOperationStatuses(context: ChaosManagementContext, subscriptionId: string) { + return { + get: (location: string, operationId: string, options?: OperationStatusesGetOptionalParams) => + operationStatusesGet(context, subscriptionId, location, operationId, options), + }; +} + +export function getOperationStatusesOperations( + context: ChaosManagementContext, + subscriptionId: string, +): OperationStatusesOperations { + return { + ...getOperationStatuses(context, subscriptionId), + }; +} diff --git a/sdk/chaos/arm-chaos/src/classic/operations/index.ts b/sdk/chaos/arm-chaos/src/classic/operations/index.ts new file mode 100644 index 000000000000..3598b4439e31 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/classic/operations/index.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ChaosManagementContext } from "../../api/chaosManagementContext.js"; +import { operationsList } from "../../api/operations/index.js"; +import { OperationsListOptionalParams } from "../../api/options.js"; +import { Operation } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Operations operations. */ +export interface OperationsOperations { + /** List the operations for the provider */ + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +export function getOperations(context: ChaosManagementContext) { + return { + list: (options?: OperationsListOptionalParams) => operationsList(context, options), + }; +} + +export function getOperationsOperations(context: ChaosManagementContext): OperationsOperations { + return { + ...getOperations(context), + }; +} diff --git a/sdk/chaos/arm-chaos/src/classic/privateAccesses/index.ts b/sdk/chaos/arm-chaos/src/classic/privateAccesses/index.ts new file mode 100644 index 000000000000..60709b40bd81 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/classic/privateAccesses/index.ts @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ChaosManagementContext } from "../../api/chaosManagementContext.js"; +import { + PrivateAccessesGetOptionalParams, + PrivateAccessesCreateOrUpdateOptionalParams, + PrivateAccessesUpdateOptionalParams, + PrivateAccessesDeleteOptionalParams, + PrivateAccessesListOptionalParams, + PrivateAccessesListAllOptionalParams, + PrivateAccessesPrivateLinkResourcesOptionalParams, +} from "../../api/options.js"; +import { + privateAccessesGet, + privateAccessesCreateOrUpdate, + privateAccessesUpdate, + privateAccessesDelete, + privateAccessesList, + privateAccessesListAll, + privateAccessesPrivateLinkResources, +} from "../../api/privateAccesses/index.js"; +import { PrivateAccess, PrivateAccessPatch, PrivateLinkResource } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a PrivateAccesses operations. */ +export interface PrivateAccessesOperations { + /** Get a private access resource */ + get: ( + resourceGroupName: string, + privateAccessName: string, + options?: PrivateAccessesGetOptionalParams, + ) => Promise; + /** Create or update a private access */ + createOrUpdate: ( + resourceGroupName: string, + privateAccessName: string, + resource: PrivateAccess, + options?: PrivateAccessesCreateOrUpdateOptionalParams, + ) => PollerLike, PrivateAccess>; + /** Patch a private access tags */ + update: ( + resourceGroupName: string, + privateAccessName: string, + properties: PrivateAccessPatch, + options?: PrivateAccessesUpdateOptionalParams, + ) => PollerLike, PrivateAccess>; + /** Delete a private access */ + delete: ( + resourceGroupName: string, + privateAccessName: string, + options?: PrivateAccessesDeleteOptionalParams, + ) => PollerLike, void>; + /** Get a list of private access resources in a resource group. */ + list: ( + resourceGroupName: string, + options?: PrivateAccessesListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get a list of private access resources in a subscription. */ + listAll: ( + options?: PrivateAccessesListAllOptionalParams, + ) => PagedAsyncIterableIterator; + /** Gets the private link resources possible under private access resource */ + privateLinkResources: ( + resourceGroupName: string, + privateAccessName: string, + options?: PrivateAccessesPrivateLinkResourcesOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getPrivateAccesses(context: ChaosManagementContext, subscriptionId: string) { + return { + get: ( + resourceGroupName: string, + privateAccessName: string, + options?: PrivateAccessesGetOptionalParams, + ) => privateAccessesGet(context, subscriptionId, resourceGroupName, privateAccessName, options), + createOrUpdate: ( + resourceGroupName: string, + privateAccessName: string, + resource: PrivateAccess, + options?: PrivateAccessesCreateOrUpdateOptionalParams, + ) => + privateAccessesCreateOrUpdate( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + resource, + options, + ), + update: ( + resourceGroupName: string, + privateAccessName: string, + properties: PrivateAccessPatch, + options?: PrivateAccessesUpdateOptionalParams, + ) => + privateAccessesUpdate( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + properties, + options, + ), + delete: ( + resourceGroupName: string, + privateAccessName: string, + options?: PrivateAccessesDeleteOptionalParams, + ) => + privateAccessesDelete(context, subscriptionId, resourceGroupName, privateAccessName, options), + list: (resourceGroupName: string, options?: PrivateAccessesListOptionalParams) => + privateAccessesList(context, subscriptionId, resourceGroupName, options), + listAll: (options?: PrivateAccessesListAllOptionalParams) => + privateAccessesListAll(context, subscriptionId, options), + privateLinkResources: ( + resourceGroupName: string, + privateAccessName: string, + options?: PrivateAccessesPrivateLinkResourcesOptionalParams, + ) => + privateAccessesPrivateLinkResources( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + options, + ), + }; +} + +export function getPrivateAccessesOperations( + context: ChaosManagementContext, + subscriptionId: string, +): PrivateAccessesOperations { + return { + ...getPrivateAccesses(context, subscriptionId), + }; +} diff --git a/sdk/chaos/arm-chaos/src/classic/privateEndpointConnections/index.ts b/sdk/chaos/arm-chaos/src/classic/privateEndpointConnections/index.ts new file mode 100644 index 000000000000..c492219ab238 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/classic/privateEndpointConnections/index.ts @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ChaosManagementContext } from "../../api/chaosManagementContext.js"; +import { + PrivateEndpointConnectionsGetAPrivateEndpointConnectionOptionalParams, + PrivateEndpointConnectionsDeleteAPrivateEndpointConnectionOptionalParams, + PrivateEndpointConnectionsListPrivateEndpointConnectionsOptionalParams, +} from "../../api/options.js"; +import { + privateEndpointConnectionsGetAPrivateEndpointConnection, + privateEndpointConnectionsDeleteAPrivateEndpointConnection, + privateEndpointConnectionsListPrivateEndpointConnections, +} from "../../api/privateEndpointConnections/index.js"; +import { PrivateEndpointConnection } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a PrivateEndpointConnections operations. */ +export interface PrivateEndpointConnectionsOperations { + /** Gets information about a private endpoint connection under a private access resource. */ + getAPrivateEndpointConnection: ( + resourceGroupName: string, + privateAccessName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetAPrivateEndpointConnectionOptionalParams, + ) => Promise; + /** Deletes a private endpoint connection under a private access resource. */ + deleteAPrivateEndpointConnection: ( + resourceGroupName: string, + privateAccessName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteAPrivateEndpointConnectionOptionalParams, + ) => PollerLike, void>; + /** List information about private endpoint connections under a private access resource */ + listPrivateEndpointConnections: ( + resourceGroupName: string, + privateAccessName: string, + options?: PrivateEndpointConnectionsListPrivateEndpointConnectionsOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getPrivateEndpointConnections( + context: ChaosManagementContext, + subscriptionId: string, +) { + return { + getAPrivateEndpointConnection: ( + resourceGroupName: string, + privateAccessName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetAPrivateEndpointConnectionOptionalParams, + ) => + privateEndpointConnectionsGetAPrivateEndpointConnection( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + privateEndpointConnectionName, + options, + ), + deleteAPrivateEndpointConnection: ( + resourceGroupName: string, + privateAccessName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteAPrivateEndpointConnectionOptionalParams, + ) => + privateEndpointConnectionsDeleteAPrivateEndpointConnection( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + privateEndpointConnectionName, + options, + ), + listPrivateEndpointConnections: ( + resourceGroupName: string, + privateAccessName: string, + options?: PrivateEndpointConnectionsListPrivateEndpointConnectionsOptionalParams, + ) => + privateEndpointConnectionsListPrivateEndpointConnections( + context, + subscriptionId, + resourceGroupName, + privateAccessName, + options, + ), + }; +} + +export function getPrivateEndpointConnectionsOperations( + context: ChaosManagementContext, + subscriptionId: string, +): PrivateEndpointConnectionsOperations { + return { + ...getPrivateEndpointConnections(context, subscriptionId), + }; +} diff --git a/sdk/chaos/arm-chaos/src/classic/targetTypes/index.ts b/sdk/chaos/arm-chaos/src/classic/targetTypes/index.ts new file mode 100644 index 000000000000..c56aa2c60faa --- /dev/null +++ b/sdk/chaos/arm-chaos/src/classic/targetTypes/index.ts @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ChaosManagementContext } from "../../api/chaosManagementContext.js"; +import { TargetTypesGetOptionalParams, TargetTypesListOptionalParams } from "../../api/options.js"; +import { targetTypesGet, targetTypesList } from "../../api/targetTypes/index.js"; +import { TargetType } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a TargetTypes operations. */ +export interface TargetTypesOperations { + /** Get a Target Type resources for given location. */ + get: ( + location: string, + targetTypeName: string, + options?: TargetTypesGetOptionalParams, + ) => Promise; + /** Get a list of Target Type resources for given location. */ + list: ( + location: string, + options?: TargetTypesListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getTargetTypes(context: ChaosManagementContext, subscriptionId: string) { + return { + get: (location: string, targetTypeName: string, options?: TargetTypesGetOptionalParams) => + targetTypesGet(context, subscriptionId, location, targetTypeName, options), + list: (location: string, options?: TargetTypesListOptionalParams) => + targetTypesList(context, subscriptionId, location, options), + }; +} + +export function getTargetTypesOperations( + context: ChaosManagementContext, + subscriptionId: string, +): TargetTypesOperations { + return { + ...getTargetTypes(context, subscriptionId), + }; +} diff --git a/sdk/chaos/arm-chaos/src/classic/targets/index.ts b/sdk/chaos/arm-chaos/src/classic/targets/index.ts new file mode 100644 index 000000000000..2e9afdde20a7 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/classic/targets/index.ts @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ChaosManagementContext } from "../../api/chaosManagementContext.js"; +import { + TargetsGetOptionalParams, + TargetsCreateOrUpdateOptionalParams, + TargetsDeleteOptionalParams, + TargetsListOptionalParams, +} from "../../api/options.js"; +import { + targetsGet, + targetsCreateOrUpdate, + targetsDelete, + targetsList, +} from "../../api/targets/index.js"; +import { Target } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Targets operations. */ +export interface TargetsOperations { + /** Get a Target resource that extends a tracked regional resource. */ + get: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + options?: TargetsGetOptionalParams, + ) => Promise; + /** Create or update a Target resource that extends a tracked regional resource. */ + createOrUpdate: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + resource: Target, + options?: TargetsCreateOrUpdateOptionalParams, + ) => Promise; + /** Delete a Target resource that extends a tracked regional resource. */ + delete: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + options?: TargetsDeleteOptionalParams, + ) => Promise; + /** Get a list of Target resources that extend a tracked regional resource. */ + list: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + options?: TargetsListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getTargets(context: ChaosManagementContext, subscriptionId: string) { + return { + get: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + options?: TargetsGetOptionalParams, + ) => + targetsGet( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + resource: Target, + options?: TargetsCreateOrUpdateOptionalParams, + ) => + targetsCreateOrUpdate( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + resource, + options, + ), + delete: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + targetName: string, + options?: TargetsDeleteOptionalParams, + ) => + targetsDelete( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + options, + ), + list: ( + resourceGroupName: string, + parentProviderNamespace: string, + parentResourceType: string, + parentResourceName: string, + options?: TargetsListOptionalParams, + ) => + targetsList( + context, + subscriptionId, + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + options, + ), + }; +} + +export function getTargetsOperations( + context: ChaosManagementContext, + subscriptionId: string, +): TargetsOperations { + return { + ...getTargets(context, subscriptionId), + }; +} diff --git a/sdk/chaos/arm-chaos/src/helpers/serializerHelpers.ts b/sdk/chaos/arm-chaos/src/helpers/serializerHelpers.ts new file mode 100644 index 000000000000..7518a16c2ee9 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/helpers/serializerHelpers.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export function serializeRecord( + item: Record, +): Record; +export function serializeRecord( + item: Record, + serializer: (item: T) => R, +): Record; +export function serializeRecord( + item: Record, + serializer?: (item: T) => R, +): Record { + return Object.keys(item).reduce( + (acc, key) => { + if (isSupportedRecordType(item[key])) { + acc[key] = item[key] as any; + } else if (serializer) { + const value = item[key]; + if (value !== undefined) { + acc[key] = serializer(value); + } + } else { + console.warn(`Don't know how to serialize ${item[key]}`); + acc[key] = item[key] as any; + } + return acc; + }, + {} as Record, + ); +} + +function isSupportedRecordType(t: any) { + return ["number", "string", "boolean", "null"].includes(typeof t) || t instanceof Date; +} diff --git a/sdk/chaos/arm-chaos/src/index.ts b/sdk/chaos/arm-chaos/src/index.ts index 2e3d61dbe5b3..9e86cad432dd 100644 --- a/sdk/chaos/arm-chaos/src/index.ts +++ b/sdk/chaos/arm-chaos/src/index.ts @@ -1,13 +1,147 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. -/// -export { getContinuationToken } from "./pagingHelper"; -export * from "./models"; -export { ChaosManagementClient } from "./chaosManagementClient"; -export * from "./operationsInterfaces"; +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; + +export { ChaosManagementClient } from "./chaosManagementClient.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + OperationStatusResult, + ErrorDetail, + ErrorAdditionalInfo, + TargetType, + TargetTypeProperties, + ProxyResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + PrivateEndpointConnection, + PrivateEndpointConnectionProperties, + PrivateEndpoint, + PrivateLinkServiceConnectionState, + KnownPrivateEndpointServiceConnectionStatus, + PrivateEndpointServiceConnectionStatus, + KnownProvisioningState, + ProvisioningState, + PrivateAccess, + PrivateAccessProperties, + KnownPublicNetworkAccessOption, + PublicNetworkAccessOption, + TrackedResource, + PrivateAccessPatch, + PrivateLinkResource, + PrivateLinkResourceProperties, + ExperimentExecution, + ExperimentExecutionProperties, + ExperimentExecutionDetails, + ExperimentExecutionDetailsProperties, + ExperimentExecutionDetailsPropertiesRunInformation, + StepStatus, + BranchStatus, + ActionStatus, + ExperimentExecutionActionTargetDetailsProperties, + ExperimentExecutionActionTargetDetailsError, + Experiment, + ManagedServiceIdentity, + KnownManagedServiceIdentityType, + ManagedServiceIdentityType, + UserAssignedIdentity, + ExperimentProperties, + ChaosExperimentStep, + ChaosExperimentBranch, + ChaosExperimentAction, + ChaosExperimentActionUnion, + KnownExperimentActionType, + ExperimentActionType, + ContinuousAction, + KeyValuePair, + DelayAction, + DiscreteAction, + ChaosTargetSelector, + ChaosTargetSelectorUnion, + KnownSelectorType, + SelectorType, + ChaosTargetFilter, + ChaosTargetFilterUnion, + KnownFilterType, + FilterType, + ChaosTargetSimpleFilter, + ChaosTargetSimpleFilterParameters, + ChaosTargetListSelector, + TargetReference, + KnownTargetReferenceType, + TargetReferenceType, + ChaosTargetQuerySelector, + CustomerDataStorageProperties, + ExperimentUpdate, + CapabilityType, + CapabilityTypeProperties, + CapabilityTypePropertiesRuntimeProperties, + Target, + TargetProperties, + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + Capability, + CapabilityProperties, + KnownVersions, +} from "./models/index.js"; +export { + ChaosManagementClientOptionalParams, + CapabilitiesGetOptionalParams, + CapabilitiesCreateOrUpdateOptionalParams, + CapabilitiesDeleteOptionalParams, + CapabilitiesListOptionalParams, + OperationsListOptionalParams, + TargetsGetOptionalParams, + TargetsCreateOrUpdateOptionalParams, + TargetsDeleteOptionalParams, + TargetsListOptionalParams, + CapabilityTypesGetOptionalParams, + CapabilityTypesListOptionalParams, + ExperimentsGetOptionalParams, + ExperimentsCreateOrUpdateOptionalParams, + ExperimentsUpdateOptionalParams, + ExperimentsDeleteOptionalParams, + ExperimentsListOptionalParams, + ExperimentsListAllOptionalParams, + ExperimentsCancelOptionalParams, + ExperimentsStartOptionalParams, + ExperimentExecutionsGetExecutionOptionalParams, + ExperimentExecutionsListAllExecutionsOptionalParams, + ExperimentExecutionsGetExecutionDetailsOptionalParams, + PrivateAccessesGetOptionalParams, + PrivateAccessesCreateOrUpdateOptionalParams, + PrivateAccessesUpdateOptionalParams, + PrivateAccessesDeleteOptionalParams, + PrivateAccessesListOptionalParams, + PrivateAccessesListAllOptionalParams, + PrivateAccessesPrivateLinkResourcesOptionalParams, + PrivateEndpointConnectionsGetAPrivateEndpointConnectionOptionalParams, + PrivateEndpointConnectionsDeleteAPrivateEndpointConnectionOptionalParams, + PrivateEndpointConnectionsListPrivateEndpointConnectionsOptionalParams, + TargetTypesGetOptionalParams, + TargetTypesListOptionalParams, + OperationStatusesGetOptionalParams, +} from "./api/index.js"; +export { + CapabilitiesOperations, + CapabilityTypesOperations, + ExperimentExecutionsOperations, + ExperimentsOperations, + OperationsOperations, + OperationStatusesOperations, + PrivateAccessesOperations, + PrivateEndpointConnectionsOperations, + TargetsOperations, + TargetTypesOperations, +} from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/sdk/chaos/arm-chaos/src/logger.ts b/sdk/chaos/arm-chaos/src/logger.ts new file mode 100644 index 000000000000..d43914f56e0a --- /dev/null +++ b/sdk/chaos/arm-chaos/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-chaos"); diff --git a/sdk/chaos/arm-chaos/src/lroImpl.ts b/sdk/chaos/arm-chaos/src/lroImpl.ts deleted file mode 100644 index 5f88efab981b..000000000000 --- a/sdk/chaos/arm-chaos/src/lroImpl.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { AbortSignalLike } from "@azure/abort-controller"; -import { LongRunningOperation, LroResponse } from "@azure/core-lro"; - -export function createLroSpec(inputs: { - sendOperationFn: (args: any, spec: any) => Promise>; - args: Record; - spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record; -}): LongRunningOperation { - const { args, spec, sendOperationFn } = inputs; - return { - requestMethod: spec.httpMethod, - requestPath: spec.path!, - sendInitialRequest: () => sendOperationFn(args, spec), - sendPollRequest: ( - path: string, - options?: { abortSignal?: AbortSignalLike }, - ) => { - const { requestBody, ...restSpec } = spec; - return sendOperationFn(args, { - ...restSpec, - httpMethod: "GET", - path, - abortSignal: options?.abortSignal, - }); - }, - }; -} diff --git a/sdk/chaos/arm-chaos/src/models/index.ts b/sdk/chaos/arm-chaos/src/models/index.ts index 6ce7ad464c76..3748c3c4bb63 100644 --- a/sdk/chaos/arm-chaos/src/models/index.ts +++ b/sdk/chaos/arm-chaos/src/models/index.ts @@ -1,1265 +1,88 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import * as coreClient from "@azure/core-client"; - -export type ChaosExperimentActionUnion = - | ChaosExperimentAction - | DelayAction - | DiscreteAction - | ContinuousAction; -export type ChaosTargetSelectorUnion = - | ChaosTargetSelector - | ChaosTargetListSelector - | ChaosTargetQuerySelector; -export type ChaosTargetFilterUnion = - | ChaosTargetFilter - | ChaosTargetSimpleFilter; - -/** Model that represents a list of Capability resources and a link for pagination. */ -export interface CapabilityListResult { - /** - * List of Capability resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Capability[]; - /** - * URL to retrieve the next page of Capability resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface Resource { - /** - * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The name of the resource - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; -} - -/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ -export interface ErrorResponse { - /** The error object. */ - error?: ErrorDetail; -} - -/** The error detail. */ -export interface ErrorDetail { - /** - * The error code. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly code?: string; - /** - * The error message. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly message?: string; - /** - * The error target. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly target?: string; - /** - * The error details. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly details?: ErrorDetail[]; - /** - * The error additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly additionalInfo?: ErrorAdditionalInfo[]; -} - -/** The resource management error additional info. */ -export interface ErrorAdditionalInfo { - /** - * The additional info type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * The additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly info?: Record; -} - -/** Model that represents a list of Capability Type resources and a link for pagination. */ -export interface CapabilityTypeListResult { - /** - * List of Capability Type resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: CapabilityType[]; - /** - * URL to retrieve the next page of Capability Type resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Runtime properties of this Capability Type. */ -export interface CapabilityTypePropertiesRuntimeProperties { - /** - * String of the kind of the resource's action type (continuous or discrete). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly kind?: string; -} - -/** Model that represents a list of Experiment resources and a link for pagination. */ -export interface ExperimentListResult { - /** - * List of Experiment resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Experiment[]; - /** - * URL to retrieve the next page of Experiment resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The identity of a resource. */ -export interface ResourceIdentity { - /** String of the resource identity type. */ - type: ResourceIdentityType; - /** The list of user identities associated with the Experiment. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ - userAssignedIdentities?: { [propertyName: string]: UserAssignedIdentity }; - /** - * GUID that represents the principal ID of this resource identity. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly principalId?: string; - /** - * GUID that represents the tenant ID of this resource identity. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly tenantId?: string; -} - -/** User assigned identity properties */ -export interface UserAssignedIdentity { - /** - * The principal ID of the assigned identity. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly principalId?: string; - /** - * The client ID of the assigned identity. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly clientId?: string; -} - -/** Model that represents a step in the Experiment resource. */ -export interface ChaosExperimentStep { - /** String of the step name. */ - name: string; - /** List of branches. */ - branches: ChaosExperimentBranch[]; -} - -/** Model that represents a branch in the step. 9 total per experiment. */ -export interface ChaosExperimentBranch { - /** String of the branch name. */ - name: string; - /** List of actions. */ - actions: ChaosExperimentActionUnion[]; -} - -/** Model that represents the base action model. 9 total per experiment. */ -export interface ChaosExperimentAction { - /** Polymorphic discriminator, which specifies the different types this object can be */ - type: "delay" | "discrete" | "continuous"; - /** String that represents a Capability URN. */ - name: string; -} - -/** Model that represents a selector in the Experiment resource. */ -export interface ChaosTargetSelector { - /** Polymorphic discriminator, which specifies the different types this object can be */ - type: "List" | "Query"; - /** Describes unknown properties. The value of an unknown property can be of "any" type. */ - [property: string]: any; - /** String of the selector ID. */ - id: string; - /** Model that represents available filter types that can be applied to a targets list. */ - filter?: ChaosTargetFilterUnion; -} - -/** Model that represents available filter types that can be applied to a targets list. */ -export interface ChaosTargetFilter { - /** Polymorphic discriminator, which specifies the different types this object can be */ - type: "Simple"; -} - -/** Describes an experiment update. */ -export interface ExperimentUpdate { - /** The identity of the experiment resource. */ - identity?: ResourceIdentity; - /** The tags of the experiment resource. */ - tags?: { [propertyName: string]: string }; -} - -/** Model that represents a list of Experiment executions and a link for pagination. */ -export interface ExperimentExecutionListResult { - /** - * List of Experiment executions. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: ExperimentExecution[]; - /** - * URL to retrieve the next page of Experiment executions. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Model that represents the execution of a Experiment. */ -export interface ExperimentExecution { - /** - * String of the resource type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * String of the fully qualified resource ID. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * String of the resource name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The status of the execution. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: string; - /** - * String that represents the start date time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly startedAt?: Date; - /** - * String that represents the stop date time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly stoppedAt?: Date; -} - -/** Model that represents the execution properties of an Experiment. */ -export interface ExperimentExecutionProperties { - /** - * The status of the execution. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: string; - /** - * String that represents the start date time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly startedAt?: Date; - /** - * String that represents the stop date time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly stoppedAt?: Date; -} - -/** Model that represents the execution details of an Experiment. */ -export interface ExperimentExecutionDetails { - /** - * String of the resource type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * String of the fully qualified resource ID. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * String of the resource name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The status of the execution. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: string; - /** - * String that represents the start date time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly startedAt?: Date; - /** - * String that represents the stop date time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly stoppedAt?: Date; - /** - * The reason why the execution failed. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly failureReason?: string; - /** - * String that represents the last action date time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly lastActionAt?: Date; - /** - * The information of the experiment run. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly runInformation?: ExperimentExecutionDetailsPropertiesRunInformation; -} - -/** The information of the experiment run. */ -export interface ExperimentExecutionDetailsPropertiesRunInformation { - /** - * The steps of the experiment run. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly steps?: StepStatus[]; -} - -/** Model that represents the a list of branches and branch statuses. */ -export interface StepStatus { - /** - * The name of the step. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly stepName?: string; - /** - * The id of the step. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly stepId?: string; - /** - * The value of the status of the step. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: string; - /** - * The array of branches. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly branches?: BranchStatus[]; -} - -/** Model that represents the a list of actions and action statuses. */ -export interface BranchStatus { - /** - * The name of the branch status. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly branchName?: string; - /** - * The id of the branch status. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly branchId?: string; - /** - * The status of the branch. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: string; - /** - * The array of actions. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly actions?: ActionStatus[]; -} - -/** Model that represents the an action and its status. */ -export interface ActionStatus { - /** - * The name of the action status. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly actionName?: string; - /** - * The id of the action status. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly actionId?: string; - /** - * The status of the action. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: string; - /** - * String that represents the start time of the action. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly startTime?: Date; - /** - * String that represents the end time of the action. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly endTime?: Date; - /** - * The array of targets. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly targets?: ExperimentExecutionActionTargetDetailsProperties[]; -} - -/** Model that represents the Experiment action target details properties model. */ -export interface ExperimentExecutionActionTargetDetailsProperties { - /** - * The status of the execution. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: string; - /** - * The target for the action. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly target?: string; - /** - * String that represents the failed date time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly targetFailedTime?: Date; - /** - * String that represents the completed date time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly targetCompletedTime?: Date; - /** - * The error of the action. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly error?: ExperimentExecutionActionTargetDetailsError; -} - -/** Model that represents the Experiment action target details error model. */ -export interface ExperimentExecutionActionTargetDetailsError { - /** - * The error code. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly code?: string; - /** - * The error message - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly message?: string; -} - -/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ -export interface OperationListResult { - /** - * List of operations supported by the resource provider - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Operation[]; - /** - * URL to get the next set of operation list results (if there are any). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Details of a REST API operation, returned from the Resource Provider Operations API */ -export interface Operation { - /** - * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly isDataAction?: boolean; - /** Localized display information for this particular operation. */ - display?: OperationDisplay; - /** - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly origin?: Origin; - /** - * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly actionType?: ActionType; -} - -/** Localized display information for this particular operation. */ -export interface OperationDisplay { - /** - * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provider?: string; - /** - * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly resource?: string; - /** - * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly operation?: string; - /** - * The short, localized friendly description of the operation; suitable for tool tips and detailed views. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; -} - -/** Model that represents a list of Target Type resources and a link for pagination. */ -export interface TargetTypeListResult { - /** - * List of Target Type resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: TargetType[]; - /** - * URL to retrieve the next page of Target Type resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Model that represents a list of Target resources and a link for pagination. */ -export interface TargetListResult { - /** - * List of Target resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Target[]; - /** - * URL to retrieve the next page of Target resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** A map to describe the settings of an action. */ -export interface KeyValuePair { - /** The name of the setting for the action. */ - key: string; - /** The value of the setting for the action. */ - value: string; -} - -/** Model that represents a reference to a Target in the selector. */ -export interface TargetReference { - /** Enum of the Target reference type. */ - type: TargetReferenceType; - /** String of the resource ID of a Target resource. */ - id: string; -} - -/** Model that represents the Simple filter parameters. */ -export interface ChaosTargetSimpleFilterParameters { - /** List of Azure availability zones to filter targets by. */ - zones?: string[]; -} - -/** Model that represents a Capability resource. */ -export interface Capability extends Resource { - /** - * The standard system metadata of a resource type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; - /** - * String of the Publisher that this Capability extends. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly publisher?: string; - /** - * String of the Target Type that this Capability extends. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly targetType?: string; - /** - * Localized string of the description. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; - /** - * URL to retrieve JSON schema of the Capability parameters. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly parametersSchema?: string; - /** - * String of the URN for this Capability Type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly urn?: string; -} - -/** Model that represents a Capability Type resource. */ -export interface CapabilityType extends Resource { - /** - * The system metadata properties of the capability type resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; - /** Location of the Capability Type resource. */ - location?: string; - /** - * String of the Publisher that this Capability Type extends. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly publisher?: string; - /** - * String of the Target Type that this Capability Type extends. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly targetType?: string; - /** - * Localized string of the display name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly displayName?: string; - /** - * Localized string of the description. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; - /** - * URL to retrieve JSON schema of the Capability Type parameters. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly parametersSchema?: string; - /** - * String of the URN for this Capability Type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly urn?: string; - /** - * String of the kind of this Capability Type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly kind?: string; - /** Control plane actions necessary to execute capability type. */ - azureRbacActions?: string[]; - /** Data plane actions necessary to execute capability type. */ - azureRbacDataActions?: string[]; - /** Runtime properties of this Capability Type. */ - runtimeProperties?: CapabilityTypePropertiesRuntimeProperties; -} - -/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ -export interface TrackedResource extends Resource { - /** Resource tags. */ - tags?: { [propertyName: string]: string }; - /** The geo-location where the resource lives */ - location: string; -} - -/** Model that represents a Target Type resource. */ -export interface TargetType extends Resource { - /** - * The system metadata properties of the target type resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; - /** Location of the Target Type resource. */ - location?: string; - /** - * Localized string of the display name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly displayName?: string; - /** - * Localized string of the description. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; - /** - * URL to retrieve JSON schema of the Target Type properties. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly propertiesSchema?: string; - /** - * List of resource types this Target Type can extend. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly resourceTypes?: string[]; -} - -/** Model that represents a Target resource. */ -export interface Target extends Resource { - /** - * The system metadata of the target resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; - /** Location of the target resource. */ - location?: string; - /** The properties of the target resource. */ - properties: { [propertyName: string]: any }; -} - -/** The status of operation. */ -export interface OperationStatus extends ErrorResponse { - /** The operation Id. */ - id?: string; - /** The operation name. */ - name?: string; - /** The start time of the operation. */ - startTime?: string; - /** The end time of the operation. */ - endTime?: string; - /** The status of the operation. */ - status?: string; -} - -/** Model that represents a delay action. */ -export interface DelayAction extends ChaosExperimentAction { - /** Polymorphic discriminator, which specifies the different types this object can be */ - type: "delay"; - /** ISO8601 formatted string that represents a duration. */ - duration: string; -} - -/** Model that represents a discrete action. */ -export interface DiscreteAction extends ChaosExperimentAction { - /** Polymorphic discriminator, which specifies the different types this object can be */ - type: "discrete"; - /** List of key value pairs. */ - parameters: KeyValuePair[]; - /** String that represents a selector. */ - selectorId: string; -} - -/** Model that represents a continuous action. */ -export interface ContinuousAction extends ChaosExperimentAction { - /** Polymorphic discriminator, which specifies the different types this object can be */ - type: "continuous"; - /** ISO8601 formatted string that represents a duration. */ - duration: string; - /** List of key value pairs. */ - parameters: KeyValuePair[]; - /** String that represents a selector. */ - selectorId: string; -} - -/** Model that represents a list selector. */ -export interface ChaosTargetListSelector extends ChaosTargetSelector { - /** Polymorphic discriminator, which specifies the different types this object can be */ - type: "List"; - /** List of Target references. */ - targets: TargetReference[]; -} - -/** Model that represents a query selector. */ -export interface ChaosTargetQuerySelector extends ChaosTargetSelector { - /** Polymorphic discriminator, which specifies the different types this object can be */ - type: "Query"; - /** Azure Resource Graph (ARG) Query Language query for target resources. */ - queryString: string; - /** Subscription id list to scope resource query. */ - subscriptionIds: string[]; -} - -/** Model that represents a simple target filter. */ -export interface ChaosTargetSimpleFilter extends ChaosTargetFilter { - /** Polymorphic discriminator, which specifies the different types this object can be */ - type: "Simple"; - /** Model that represents the Simple filter parameters. */ - parameters?: ChaosTargetSimpleFilterParameters; -} - -/** Model that represents the extended properties of an experiment execution. */ -export interface ExperimentExecutionDetailsProperties - extends ExperimentExecutionProperties { - /** - * The reason why the execution failed. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly failureReason?: string; - /** - * String that represents the last action date time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly lastActionAt?: Date; - /** - * The information of the experiment run. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly runInformation?: ExperimentExecutionDetailsPropertiesRunInformation; -} - -/** Model that represents a Experiment resource. */ -export interface Experiment extends TrackedResource { - /** - * The system metadata of the experiment resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; - /** The identity of the experiment resource. */ - identity?: ResourceIdentity; - /** - * Most recent provisioning state for the given experiment resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; - /** List of steps. */ - steps: ChaosExperimentStep[]; - /** List of selectors. */ - selectors: ChaosTargetSelectorUnion[]; -} - -/** Known values of {@link CreatedByType} that the service accepts. */ -export enum KnownCreatedByType { - /** User */ - User = "User", - /** Application */ - Application = "Application", - /** ManagedIdentity */ - ManagedIdentity = "ManagedIdentity", - /** Key */ - Key = "Key", -} - -/** - * Defines values for CreatedByType. \ - * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User** \ - * **Application** \ - * **ManagedIdentity** \ - * **Key** - */ -export type CreatedByType = string; - -/** Known values of {@link ProvisioningState} that the service accepts. */ -export enum KnownProvisioningState { - /** Succeeded */ - Succeeded = "Succeeded", - /** Failed */ - Failed = "Failed", - /** Canceled */ - Canceled = "Canceled", - /** Creating */ - Creating = "Creating", - /** Updating */ - Updating = "Updating", - /** Deleting */ - Deleting = "Deleting", -} - -/** - * Defines values for ProvisioningState. \ - * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Succeeded** \ - * **Failed** \ - * **Canceled** \ - * **Creating** \ - * **Updating** \ - * **Deleting** - */ -export type ProvisioningState = string; - -/** Known values of {@link SelectorType} that the service accepts. */ -export enum KnownSelectorType { - /** List */ - List = "List", - /** Query */ - Query = "Query", -} - -/** - * Defines values for SelectorType. \ - * {@link KnownSelectorType} can be used interchangeably with SelectorType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **List** \ - * **Query** - */ -export type SelectorType = string; - -/** Known values of {@link FilterType} that the service accepts. */ -export enum KnownFilterType { - /** Simple */ - Simple = "Simple", -} - -/** - * Defines values for FilterType. \ - * {@link KnownFilterType} can be used interchangeably with FilterType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Simple** - */ -export type FilterType = string; - -/** Known values of {@link Origin} that the service accepts. */ -export enum KnownOrigin { - /** User */ - User = "user", - /** System */ - System = "system", - /** UserSystem */ - UserSystem = "user,system", -} - -/** - * Defines values for Origin. \ - * {@link KnownOrigin} can be used interchangeably with Origin, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **user** \ - * **system** \ - * **user,system** - */ -export type Origin = string; - -/** Known values of {@link ActionType} that the service accepts. */ -export enum KnownActionType { - /** Internal */ - Internal = "Internal", -} - -/** - * Defines values for ActionType. \ - * {@link KnownActionType} can be used interchangeably with ActionType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Internal** - */ -export type ActionType = string; - -/** Known values of {@link TargetReferenceType} that the service accepts. */ -export enum KnownTargetReferenceType { - /** ChaosTarget */ - ChaosTarget = "ChaosTarget", -} - -/** - * Defines values for TargetReferenceType. \ - * {@link KnownTargetReferenceType} can be used interchangeably with TargetReferenceType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **ChaosTarget** - */ -export type TargetReferenceType = string; -/** Defines values for ResourceIdentityType. */ -export type ResourceIdentityType = "None" | "SystemAssigned" | "UserAssigned"; - -/** Optional parameters. */ -export interface CapabilitiesListOptionalParams - extends coreClient.OperationOptions { - /** String that sets the continuation token. */ - continuationToken?: string; -} - -/** Contains response data for the list operation. */ -export type CapabilitiesListResponse = CapabilityListResult; - -/** Optional parameters. */ -export interface CapabilitiesGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type CapabilitiesGetResponse = Capability; - -/** Optional parameters. */ -export interface CapabilitiesDeleteOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface CapabilitiesCreateOrUpdateOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the createOrUpdate operation. */ -export type CapabilitiesCreateOrUpdateResponse = Capability; - -/** Optional parameters. */ -export interface CapabilitiesListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type CapabilitiesListNextResponse = CapabilityListResult; - -/** Optional parameters. */ -export interface CapabilityTypesListOptionalParams - extends coreClient.OperationOptions { - /** String that sets the continuation token. */ - continuationToken?: string; -} - -/** Contains response data for the list operation. */ -export type CapabilityTypesListResponse = CapabilityTypeListResult; - -/** Optional parameters. */ -export interface CapabilityTypesGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type CapabilityTypesGetResponse = CapabilityType; - -/** Optional parameters. */ -export interface CapabilityTypesListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type CapabilityTypesListNextResponse = CapabilityTypeListResult; - -/** Optional parameters. */ -export interface ExperimentsListAllOptionalParams - extends coreClient.OperationOptions { - /** String that sets the continuation token. */ - continuationToken?: string; - /** Optional value that indicates whether to filter results based on if the Experiment is currently running. If null, then the results will not be filtered. */ - running?: boolean; -} - -/** Contains response data for the listAll operation. */ -export type ExperimentsListAllResponse = ExperimentListResult; - -/** Optional parameters. */ -export interface ExperimentsListOptionalParams - extends coreClient.OperationOptions { - /** String that sets the continuation token. */ - continuationToken?: string; - /** Optional value that indicates whether to filter results based on if the Experiment is currently running. If null, then the results will not be filtered. */ - running?: boolean; -} - -/** Contains response data for the list operation. */ -export type ExperimentsListResponse = ExperimentListResult; - -/** Optional parameters. */ -export interface ExperimentsDeleteOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Optional parameters. */ -export interface ExperimentsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type ExperimentsGetResponse = Experiment; - -/** Optional parameters. */ -export interface ExperimentsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type ExperimentsCreateOrUpdateResponse = Experiment; - -/** Optional parameters. */ -export interface ExperimentsUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type ExperimentsUpdateResponse = Experiment; - -/** Optional parameters. */ -export interface ExperimentsCancelOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Optional parameters. */ -export interface ExperimentsStartOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Optional parameters. */ -export interface ExperimentsListAllExecutionsOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listAllExecutions operation. */ -export type ExperimentsListAllExecutionsResponse = - ExperimentExecutionListResult; - -/** Optional parameters. */ -export interface ExperimentsGetExecutionOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the getExecution operation. */ -export type ExperimentsGetExecutionResponse = ExperimentExecution; - -/** Optional parameters. */ -export interface ExperimentsExecutionDetailsOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the executionDetails operation. */ -export type ExperimentsExecutionDetailsResponse = ExperimentExecutionDetails; - -/** Optional parameters. */ -export interface ExperimentsListAllNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listAllNext operation. */ -export type ExperimentsListAllNextResponse = ExperimentListResult; - -/** Optional parameters. */ -export interface ExperimentsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type ExperimentsListNextResponse = ExperimentListResult; - -/** Optional parameters. */ -export interface ExperimentsListAllExecutionsNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listAllExecutionsNext operation. */ -export type ExperimentsListAllExecutionsNextResponse = - ExperimentExecutionListResult; - -/** Optional parameters. */ -export interface OperationStatusesGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type OperationStatusesGetResponse = OperationStatus; - -/** Optional parameters. */ -export interface OperationsListAllOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listAll operation. */ -export type OperationsListAllResponse = OperationListResult; - -/** Optional parameters. */ -export interface OperationsListAllNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listAllNext operation. */ -export type OperationsListAllNextResponse = OperationListResult; - -/** Optional parameters. */ -export interface TargetTypesListOptionalParams - extends coreClient.OperationOptions { - /** String that sets the continuation token. */ - continuationToken?: string; -} - -/** Contains response data for the list operation. */ -export type TargetTypesListResponse = TargetTypeListResult; - -/** Optional parameters. */ -export interface TargetTypesGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type TargetTypesGetResponse = TargetType; - -/** Optional parameters. */ -export interface TargetTypesListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type TargetTypesListNextResponse = TargetTypeListResult; - -/** Optional parameters. */ -export interface TargetsListOptionalParams extends coreClient.OperationOptions { - /** String that sets the continuation token. */ - continuationToken?: string; -} - -/** Contains response data for the list operation. */ -export type TargetsListResponse = TargetListResult; - -/** Optional parameters. */ -export interface TargetsGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type TargetsGetResponse = Target; - -/** Optional parameters. */ -export interface TargetsDeleteOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface TargetsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the createOrUpdate operation. */ -export type TargetsCreateOrUpdateResponse = Target; - -/** Optional parameters. */ -export interface TargetsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type TargetsListNextResponse = TargetListResult; - -/** Optional parameters. */ -export interface ChaosManagementClientOptionalParams - extends coreClient.ServiceClientOptions { - /** server parameter */ - $host?: string; - /** Api Version */ - apiVersion?: string; - /** Overrides client endpoint. */ - endpoint?: string; -} +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + OperationStatusResult, + ErrorDetail, + ErrorAdditionalInfo, + TargetType, + TargetTypeProperties, + ProxyResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + PrivateEndpointConnection, + PrivateEndpointConnectionProperties, + PrivateEndpoint, + PrivateLinkServiceConnectionState, + KnownPrivateEndpointServiceConnectionStatus, + PrivateEndpointServiceConnectionStatus, + KnownProvisioningState, + ProvisioningState, + PrivateAccess, + PrivateAccessProperties, + KnownPublicNetworkAccessOption, + PublicNetworkAccessOption, + TrackedResource, + PrivateAccessPatch, + PrivateLinkResource, + PrivateLinkResourceProperties, + ExperimentExecution, + ExperimentExecutionProperties, + ExperimentExecutionDetails, + ExperimentExecutionDetailsProperties, + ExperimentExecutionDetailsPropertiesRunInformation, + StepStatus, + BranchStatus, + ActionStatus, + ExperimentExecutionActionTargetDetailsProperties, + ExperimentExecutionActionTargetDetailsError, + Experiment, + ManagedServiceIdentity, + KnownManagedServiceIdentityType, + ManagedServiceIdentityType, + UserAssignedIdentity, + ExperimentProperties, + ChaosExperimentStep, + ChaosExperimentBranch, + ChaosExperimentAction, + ChaosExperimentActionUnion, + KnownExperimentActionType, + ExperimentActionType, + ContinuousAction, + KeyValuePair, + DelayAction, + DiscreteAction, + ChaosTargetSelector, + ChaosTargetSelectorUnion, + KnownSelectorType, + SelectorType, + ChaosTargetFilter, + ChaosTargetFilterUnion, + KnownFilterType, + FilterType, + ChaosTargetSimpleFilter, + ChaosTargetSimpleFilterParameters, + ChaosTargetListSelector, + TargetReference, + KnownTargetReferenceType, + TargetReferenceType, + ChaosTargetQuerySelector, + CustomerDataStorageProperties, + ExperimentUpdate, + CapabilityType, + CapabilityTypeProperties, + CapabilityTypePropertiesRuntimeProperties, + Target, + TargetProperties, + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + Capability, + CapabilityProperties, + KnownVersions, +} from "./models.js"; diff --git a/sdk/chaos/arm-chaos/src/models/mappers.ts b/sdk/chaos/arm-chaos/src/models/mappers.ts deleted file mode 100644 index ae63f48695b9..000000000000 --- a/sdk/chaos/arm-chaos/src/models/mappers.ts +++ /dev/null @@ -1,1848 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import * as coreClient from "@azure/core-client"; - -export const CapabilityListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CapabilityListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Capability", - }, - }, - }, - }, - nextLink: { - constraints: { - MaxLength: 2048, - }, - serializedName: "nextLink", - readOnly: true, - nullable: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const SystemData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SystemData", - modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String", - }, - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String", - }, - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime", - }, - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String", - }, - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", - type: { - name: "String", - }, - }, - lastModifiedAt: { - serializedName: "lastModifiedAt", - type: { - name: "DateTime", - }, - }, - }, - }, -}; - -export const Resource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Resource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ErrorResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetail", - }, - }, - }, - }, -}; - -export const ErrorDetail: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorDetail", - modelProperties: { - code: { - serializedName: "code", - readOnly: true, - type: { - name: "String", - }, - }, - message: { - serializedName: "message", - readOnly: true, - type: { - name: "String", - }, - }, - target: { - serializedName: "target", - readOnly: true, - type: { - name: "String", - }, - }, - details: { - serializedName: "details", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorDetail", - }, - }, - }, - }, - additionalInfo: { - serializedName: "additionalInfo", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorAdditionalInfo", - }, - }, - }, - }, - }, - }, -}; - -export const ErrorAdditionalInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorAdditionalInfo", - modelProperties: { - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - info: { - serializedName: "info", - readOnly: true, - type: { - name: "Dictionary", - value: { type: { name: "any" } }, - }, - }, - }, - }, -}; - -export const CapabilityTypeListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CapabilityTypeListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "CapabilityType", - }, - }, - }, - }, - nextLink: { - constraints: { - MaxLength: 2048, - }, - serializedName: "nextLink", - readOnly: true, - nullable: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CapabilityTypePropertiesRuntimeProperties: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "CapabilityTypePropertiesRuntimeProperties", - modelProperties: { - kind: { - serializedName: "kind", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, - }; - -export const ExperimentListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExperimentListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Experiment", - }, - }, - }, - }, - nextLink: { - constraints: { - MaxLength: 2048, - }, - serializedName: "nextLink", - readOnly: true, - nullable: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ResourceIdentity: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ResourceIdentity", - modelProperties: { - type: { - serializedName: "type", - required: true, - type: { - name: "Enum", - allowedValues: ["None", "SystemAssigned", "UserAssigned"], - }, - }, - userAssignedIdentities: { - serializedName: "userAssignedIdentities", - type: { - name: "Dictionary", - value: { - type: { name: "Composite", className: "UserAssignedIdentity" }, - }, - }, - }, - principalId: { - constraints: { - Pattern: new RegExp( - "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$", - ), - }, - serializedName: "principalId", - readOnly: true, - type: { - name: "String", - }, - }, - tenantId: { - constraints: { - Pattern: new RegExp( - "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$", - ), - }, - serializedName: "tenantId", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const UserAssignedIdentity: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "UserAssignedIdentity", - modelProperties: { - principalId: { - serializedName: "principalId", - readOnly: true, - type: { - name: "Uuid", - }, - }, - clientId: { - serializedName: "clientId", - readOnly: true, - type: { - name: "Uuid", - }, - }, - }, - }, -}; - -export const ChaosExperimentStep: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ChaosExperimentStep", - modelProperties: { - name: { - constraints: { - MinLength: 1, - }, - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - branches: { - constraints: { - MinItems: 1, - MaxItems: 9, - }, - serializedName: "branches", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ChaosExperimentBranch", - }, - }, - }, - }, - }, - }, -}; - -export const ChaosExperimentBranch: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ChaosExperimentBranch", - modelProperties: { - name: { - constraints: { - MinLength: 1, - }, - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - actions: { - constraints: { - MinItems: 1, - MaxItems: 9, - }, - serializedName: "actions", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ChaosExperimentAction", - }, - }, - }, - }, - }, - }, -}; - -export const ChaosExperimentAction: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ChaosExperimentAction", - uberParent: "ChaosExperimentAction", - polymorphicDiscriminator: { - serializedName: "type", - clientName: "type", - }, - modelProperties: { - type: { - serializedName: "type", - required: true, - type: { - name: "String", - }, - }, - name: { - constraints: { - MaxLength: 2048, - }, - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ChaosTargetSelector: coreClient.CompositeMapper = { - serializedName: "ChaosTargetSelector", - type: { - name: "Composite", - className: "ChaosTargetSelector", - uberParent: "ChaosTargetSelector", - additionalProperties: { type: { name: "Object" } }, - polymorphicDiscriminator: { - serializedName: "type", - clientName: "type", - }, - modelProperties: { - type: { - serializedName: "type", - required: true, - type: { - name: "String", - }, - }, - id: { - constraints: { - MinLength: 1, - }, - serializedName: "id", - required: true, - type: { - name: "String", - }, - }, - filter: { - serializedName: "filter", - type: { - name: "Composite", - className: "ChaosTargetFilter", - }, - }, - }, - }, -}; - -export const ChaosTargetFilter: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ChaosTargetFilter", - uberParent: "ChaosTargetFilter", - polymorphicDiscriminator: { - serializedName: "type", - clientName: "type", - }, - modelProperties: { - type: { - serializedName: "type", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ExperimentUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExperimentUpdate", - modelProperties: { - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "ResourceIdentity", - }, - }, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - }, - }, -}; - -export const ExperimentExecutionListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExperimentExecutionListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExperimentExecution", - }, - }, - }, - }, - nextLink: { - constraints: { - MaxLength: 2048, - }, - serializedName: "nextLink", - readOnly: true, - nullable: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ExperimentExecution: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExperimentExecution", - modelProperties: { - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - status: { - serializedName: "properties.status", - readOnly: true, - type: { - name: "String", - }, - }, - startedAt: { - serializedName: "properties.startedAt", - readOnly: true, - type: { - name: "DateTime", - }, - }, - stoppedAt: { - serializedName: "properties.stoppedAt", - readOnly: true, - type: { - name: "DateTime", - }, - }, - }, - }, -}; - -export const ExperimentExecutionProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExperimentExecutionProperties", - modelProperties: { - status: { - serializedName: "status", - readOnly: true, - type: { - name: "String", - }, - }, - startedAt: { - serializedName: "startedAt", - readOnly: true, - type: { - name: "DateTime", - }, - }, - stoppedAt: { - serializedName: "stoppedAt", - readOnly: true, - type: { - name: "DateTime", - }, - }, - }, - }, -}; - -export const ExperimentExecutionDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExperimentExecutionDetails", - modelProperties: { - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - status: { - serializedName: "properties.status", - readOnly: true, - type: { - name: "String", - }, - }, - startedAt: { - serializedName: "properties.startedAt", - readOnly: true, - type: { - name: "DateTime", - }, - }, - stoppedAt: { - serializedName: "properties.stoppedAt", - readOnly: true, - type: { - name: "DateTime", - }, - }, - failureReason: { - serializedName: "properties.failureReason", - readOnly: true, - type: { - name: "String", - }, - }, - lastActionAt: { - serializedName: "properties.lastActionAt", - readOnly: true, - type: { - name: "DateTime", - }, - }, - runInformation: { - serializedName: "properties.runInformation", - type: { - name: "Composite", - className: "ExperimentExecutionDetailsPropertiesRunInformation", - }, - }, - }, - }, -}; - -export const ExperimentExecutionDetailsPropertiesRunInformation: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "ExperimentExecutionDetailsPropertiesRunInformation", - modelProperties: { - steps: { - serializedName: "steps", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "StepStatus", - }, - }, - }, - }, - }, - }, - }; - -export const StepStatus: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "StepStatus", - modelProperties: { - stepName: { - serializedName: "stepName", - readOnly: true, - type: { - name: "String", - }, - }, - stepId: { - serializedName: "stepId", - readOnly: true, - type: { - name: "String", - }, - }, - status: { - serializedName: "status", - readOnly: true, - type: { - name: "String", - }, - }, - branches: { - serializedName: "branches", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "BranchStatus", - }, - }, - }, - }, - }, - }, -}; - -export const BranchStatus: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BranchStatus", - modelProperties: { - branchName: { - serializedName: "branchName", - readOnly: true, - type: { - name: "String", - }, - }, - branchId: { - serializedName: "branchId", - readOnly: true, - type: { - name: "String", - }, - }, - status: { - serializedName: "status", - readOnly: true, - type: { - name: "String", - }, - }, - actions: { - serializedName: "actions", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ActionStatus", - }, - }, - }, - }, - }, - }, -}; - -export const ActionStatus: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ActionStatus", - modelProperties: { - actionName: { - serializedName: "actionName", - readOnly: true, - type: { - name: "String", - }, - }, - actionId: { - serializedName: "actionId", - readOnly: true, - type: { - name: "String", - }, - }, - status: { - serializedName: "status", - readOnly: true, - type: { - name: "String", - }, - }, - startTime: { - serializedName: "startTime", - readOnly: true, - type: { - name: "DateTime", - }, - }, - endTime: { - serializedName: "endTime", - readOnly: true, - type: { - name: "DateTime", - }, - }, - targets: { - serializedName: "targets", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExperimentExecutionActionTargetDetailsProperties", - }, - }, - }, - }, - }, - }, -}; - -export const ExperimentExecutionActionTargetDetailsProperties: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "ExperimentExecutionActionTargetDetailsProperties", - modelProperties: { - status: { - serializedName: "status", - readOnly: true, - type: { - name: "String", - }, - }, - target: { - serializedName: "target", - readOnly: true, - type: { - name: "String", - }, - }, - targetFailedTime: { - serializedName: "targetFailedTime", - readOnly: true, - nullable: true, - type: { - name: "DateTime", - }, - }, - targetCompletedTime: { - serializedName: "targetCompletedTime", - readOnly: true, - nullable: true, - type: { - name: "DateTime", - }, - }, - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ExperimentExecutionActionTargetDetailsError", - }, - }, - }, - }, - }; - -export const ExperimentExecutionActionTargetDetailsError: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "ExperimentExecutionActionTargetDetailsError", - modelProperties: { - code: { - serializedName: "code", - readOnly: true, - type: { - name: "String", - }, - }, - message: { - serializedName: "message", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, - }; - -export const OperationListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Operation", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Operation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Operation", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - isDataAction: { - serializedName: "isDataAction", - readOnly: true, - type: { - name: "Boolean", - }, - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay", - }, - }, - origin: { - serializedName: "origin", - readOnly: true, - type: { - name: "String", - }, - }, - actionType: { - serializedName: "actionType", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const OperationDisplay: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationDisplay", - modelProperties: { - provider: { - serializedName: "provider", - readOnly: true, - type: { - name: "String", - }, - }, - resource: { - serializedName: "resource", - readOnly: true, - type: { - name: "String", - }, - }, - operation: { - serializedName: "operation", - readOnly: true, - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const TargetTypeListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TargetTypeListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "TargetType", - }, - }, - }, - }, - nextLink: { - constraints: { - MaxLength: 2048, - }, - serializedName: "nextLink", - readOnly: true, - nullable: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const TargetListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TargetListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Target", - }, - }, - }, - }, - nextLink: { - constraints: { - MaxLength: 2048, - }, - serializedName: "nextLink", - readOnly: true, - nullable: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const KeyValuePair: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "KeyValuePair", - modelProperties: { - key: { - constraints: { - MinLength: 1, - }, - serializedName: "key", - required: true, - type: { - name: "String", - }, - }, - value: { - constraints: { - MinLength: 1, - }, - serializedName: "value", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const TargetReference: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TargetReference", - modelProperties: { - type: { - serializedName: "type", - required: true, - type: { - name: "String", - }, - }, - id: { - constraints: { - Pattern: new RegExp( - "^\\/[Ss][Uu][Bb][Ss][Cc][Rr][Ii][Pp][Tt][Ii][Oo][Nn][Ss]\\/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\\/[Rr][Ee][Ss][Oo][Uu][Rr][Cc][Ee][Gg][Rr][Oo][Uu][Pp][Ss]\\/[a-zA-Z0-9_\\-\\.\\(\\)]*[a-zA-Z0-9_\\-\\(\\)]\\/[Pp][Rr][Oo][Vv][Ii][Dd][Ee][Rr][Ss]\\/[a-zA-Z0-9]+\\.[a-zA-Z0-9]+\\/[a-zA-Z0-9_\\-\\.]+\\/[a-zA-Z0-9_\\-\\.]+\\/[Pp][Rr][Oo][Vv][Ii][Dd][Ee][Rr][Ss]\\/[Mm][Ii][Cc][Rr][Oo][Ss][Oo][Ff][Tt]\\.[Cc][Hh][Aa][Oo][Ss]\\/[Tt][Aa][Rr][Gg][Ee][Tt][Ss]\\/[a-zA-Z0-9_\\-\\.]+$", - ), - }, - serializedName: "id", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ChaosTargetSimpleFilterParameters: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ChaosTargetSimpleFilterParameters", - modelProperties: { - zones: { - serializedName: "zones", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const Capability: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Capability", - modelProperties: { - ...Resource.type.modelProperties, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData", - }, - }, - publisher: { - serializedName: "properties.publisher", - readOnly: true, - type: { - name: "String", - }, - }, - targetType: { - serializedName: "properties.targetType", - readOnly: true, - type: { - name: "String", - }, - }, - description: { - serializedName: "properties.description", - readOnly: true, - type: { - name: "String", - }, - }, - parametersSchema: { - constraints: { - MaxLength: 2048, - }, - serializedName: "properties.parametersSchema", - readOnly: true, - type: { - name: "String", - }, - }, - urn: { - constraints: { - MaxLength: 2048, - }, - serializedName: "properties.urn", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CapabilityType: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CapabilityType", - modelProperties: { - ...Resource.type.modelProperties, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - publisher: { - serializedName: "properties.publisher", - readOnly: true, - type: { - name: "String", - }, - }, - targetType: { - serializedName: "properties.targetType", - readOnly: true, - type: { - name: "String", - }, - }, - displayName: { - serializedName: "properties.displayName", - readOnly: true, - type: { - name: "String", - }, - }, - description: { - serializedName: "properties.description", - readOnly: true, - type: { - name: "String", - }, - }, - parametersSchema: { - constraints: { - MaxLength: 2048, - }, - serializedName: "properties.parametersSchema", - readOnly: true, - type: { - name: "String", - }, - }, - urn: { - constraints: { - MaxLength: 2048, - }, - serializedName: "properties.urn", - readOnly: true, - type: { - name: "String", - }, - }, - kind: { - serializedName: "properties.kind", - readOnly: true, - type: { - name: "String", - }, - }, - azureRbacActions: { - serializedName: "properties.azureRbacActions", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - azureRbacDataActions: { - serializedName: "properties.azureRbacDataActions", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - runtimeProperties: { - serializedName: "properties.runtimeProperties", - type: { - name: "Composite", - className: "CapabilityTypePropertiesRuntimeProperties", - }, - }, - }, - }, -}; - -export const TrackedResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TrackedResource", - modelProperties: { - ...Resource.type.modelProperties, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - location: { - serializedName: "location", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const TargetType: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TargetType", - modelProperties: { - ...Resource.type.modelProperties, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - displayName: { - serializedName: "properties.displayName", - readOnly: true, - type: { - name: "String", - }, - }, - description: { - serializedName: "properties.description", - readOnly: true, - type: { - name: "String", - }, - }, - propertiesSchema: { - constraints: { - MaxLength: 2048, - }, - serializedName: "properties.propertiesSchema", - readOnly: true, - type: { - name: "String", - }, - }, - resourceTypes: { - serializedName: "properties.resourceTypes", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const Target: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Target", - modelProperties: { - ...Resource.type.modelProperties, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - properties: { - serializedName: "properties", - required: true, - type: { - name: "Dictionary", - value: { type: { name: "any" } }, - }, - }, - }, - }, -}; - -export const OperationStatus: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationStatus", - modelProperties: { - ...ErrorResponse.type.modelProperties, - id: { - serializedName: "id", - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - type: { - name: "String", - }, - }, - startTime: { - serializedName: "startTime", - type: { - name: "String", - }, - }, - endTime: { - serializedName: "endTime", - type: { - name: "String", - }, - }, - status: { - serializedName: "status", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DelayAction: coreClient.CompositeMapper = { - serializedName: "delay", - type: { - name: "Composite", - className: "DelayAction", - uberParent: "ChaosExperimentAction", - polymorphicDiscriminator: - ChaosExperimentAction.type.polymorphicDiscriminator, - modelProperties: { - ...ChaosExperimentAction.type.modelProperties, - duration: { - serializedName: "duration", - required: true, - type: { - name: "TimeSpan", - }, - }, - }, - }, -}; - -export const DiscreteAction: coreClient.CompositeMapper = { - serializedName: "discrete", - type: { - name: "Composite", - className: "DiscreteAction", - uberParent: "ChaosExperimentAction", - polymorphicDiscriminator: - ChaosExperimentAction.type.polymorphicDiscriminator, - modelProperties: { - ...ChaosExperimentAction.type.modelProperties, - parameters: { - serializedName: "parameters", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "KeyValuePair", - }, - }, - }, - }, - selectorId: { - constraints: { - MinLength: 1, - }, - serializedName: "selectorId", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ContinuousAction: coreClient.CompositeMapper = { - serializedName: "continuous", - type: { - name: "Composite", - className: "ContinuousAction", - uberParent: "ChaosExperimentAction", - polymorphicDiscriminator: - ChaosExperimentAction.type.polymorphicDiscriminator, - modelProperties: { - ...ChaosExperimentAction.type.modelProperties, - duration: { - serializedName: "duration", - required: true, - type: { - name: "TimeSpan", - }, - }, - parameters: { - serializedName: "parameters", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "KeyValuePair", - }, - }, - }, - }, - selectorId: { - constraints: { - MinLength: 1, - }, - serializedName: "selectorId", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ChaosTargetListSelector: coreClient.CompositeMapper = { - serializedName: "List", - type: { - name: "Composite", - className: "ChaosTargetListSelector", - uberParent: "ChaosTargetSelector", - additionalProperties: { type: { name: "Object" } }, - polymorphicDiscriminator: ChaosTargetSelector.type.polymorphicDiscriminator, - modelProperties: { - ...ChaosTargetSelector.type.modelProperties, - targets: { - constraints: { - MinItems: 1, - MaxItems: 50, - }, - serializedName: "targets", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "TargetReference", - }, - }, - }, - }, - }, - }, -}; - -export const ChaosTargetQuerySelector: coreClient.CompositeMapper = { - serializedName: "Query", - type: { - name: "Composite", - className: "ChaosTargetQuerySelector", - uberParent: "ChaosTargetSelector", - additionalProperties: { type: { name: "Object" } }, - polymorphicDiscriminator: ChaosTargetSelector.type.polymorphicDiscriminator, - modelProperties: { - ...ChaosTargetSelector.type.modelProperties, - queryString: { - serializedName: "queryString", - required: true, - type: { - name: "String", - }, - }, - subscriptionIds: { - constraints: { - MinItems: 1, - }, - serializedName: "subscriptionIds", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const ChaosTargetSimpleFilter: coreClient.CompositeMapper = { - serializedName: "Simple", - type: { - name: "Composite", - className: "ChaosTargetSimpleFilter", - uberParent: "ChaosTargetFilter", - polymorphicDiscriminator: ChaosTargetFilter.type.polymorphicDiscriminator, - modelProperties: { - ...ChaosTargetFilter.type.modelProperties, - parameters: { - serializedName: "parameters", - type: { - name: "Composite", - className: "ChaosTargetSimpleFilterParameters", - }, - }, - }, - }, -}; - -export const ExperimentExecutionDetailsProperties: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "ExperimentExecutionDetailsProperties", - modelProperties: { - ...ExperimentExecutionProperties.type.modelProperties, - failureReason: { - serializedName: "failureReason", - readOnly: true, - type: { - name: "String", - }, - }, - lastActionAt: { - serializedName: "lastActionAt", - readOnly: true, - type: { - name: "DateTime", - }, - }, - runInformation: { - serializedName: "runInformation", - type: { - name: "Composite", - className: "ExperimentExecutionDetailsPropertiesRunInformation", - }, - }, - }, - }, - }; - -export const Experiment: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Experiment", - modelProperties: { - ...TrackedResource.type.modelProperties, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "ResourceIdentity", - }, - }, - provisioningState: { - serializedName: "properties.provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - steps: { - constraints: { - MinItems: 1, - MaxItems: 4, - }, - serializedName: "properties.steps", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ChaosExperimentStep", - }, - }, - }, - }, - selectors: { - constraints: { - MinItems: 1, - }, - serializedName: "properties.selectors", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ChaosTargetSelector", - }, - }, - }, - }, - }, - }, -}; - -export let discriminators = { - ChaosExperimentAction: ChaosExperimentAction, - ChaosTargetSelector: ChaosTargetSelector, - ChaosTargetFilter: ChaosTargetFilter, - "ChaosExperimentAction.delay": DelayAction, - "ChaosExperimentAction.discrete": DiscreteAction, - "ChaosExperimentAction.continuous": ContinuousAction, - "ChaosTargetSelector.List": ChaosTargetListSelector, - "ChaosTargetSelector.Query": ChaosTargetQuerySelector, - "ChaosTargetFilter.Simple": ChaosTargetSimpleFilter, -}; diff --git a/sdk/chaos/arm-chaos/src/models/models.ts b/sdk/chaos/arm-chaos/src/models/models.ts new file mode 100644 index 000000000000..2211b8404ce6 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/models/models.ts @@ -0,0 +1,2075 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** The current status of an async operation. */ +export interface OperationStatusResult { + /** Fully qualified ID for the async operation. */ + id?: string; + /** Name of the async operation. */ + name?: string; + /** Operation status. */ + status: string; + /** Percent of the operation that is complete. */ + percentComplete?: number; + /** The start time of the operation. */ + startTime?: Date; + /** The end time of the operation. */ + endTime?: Date; + /** The operations list. */ + operations?: OperationStatusResult[]; + /** If present, details of the operation error. */ + error?: ErrorDetail; + /** Fully qualified ID of the resource against which the original async operation was started. */ + readonly resourceId?: string; +} + +export function operationStatusResultDeserializer(item: any): OperationStatusResult { + return { + id: item["id"], + name: item["name"], + status: item["status"], + percentComplete: item["percentComplete"], + startTime: !item["startTime"] ? item["startTime"] : new Date(item["startTime"]), + endTime: !item["endTime"] ? item["endTime"] : new Date(item["endTime"]), + operations: !item["operations"] + ? item["operations"] + : operationStatusResultArrayDeserializer(item["operations"]), + error: !item["error"] ? item["error"] : errorDetailDeserializer(item["error"]), + resourceId: item["resourceId"], + }; +} + +export function operationStatusResultArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return operationStatusResultDeserializer(item); + }); +} + +/** The error detail. */ +export interface ErrorDetail { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: ErrorDetail[]; + /** The error additional info. */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +export function errorDetailDeserializer(item: any): ErrorDetail { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] ? item["details"] : errorDetailArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), + }; +} + +export function errorDetailArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorDetailDeserializer(item); + }); +} + +export function errorAdditionalInfoArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorAdditionalInfoDeserializer(item); + }); +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: Record; +} + +export function errorAdditionalInfoDeserializer(item: any): ErrorAdditionalInfo { + return { + type: item["type"], + info: !item["info"] ? item["info"] : _errorAdditionalInfoInfoDeserializer(item["info"]), + }; +} + +/** model interface _ErrorAdditionalInfoInfo */ +export interface _ErrorAdditionalInfoInfo {} + +export function _errorAdditionalInfoInfoDeserializer(item: any): _ErrorAdditionalInfoInfo { + return item; +} + +/** Model that represents a Target Type resource. */ +export interface TargetType extends ProxyResource { + /** Azure resource location. */ + location?: string; + /** The properties of the target type resource. */ + properties: TargetTypeProperties; +} + +export function targetTypeDeserializer(item: any): TargetType { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + location: item["location"], + properties: targetTypePropertiesDeserializer(item["properties"]), + }; +} + +/** Model that represents the base Target Type properties model. */ +export interface TargetTypeProperties { + /** Localized string of the display name. */ + readonly displayName?: string; + /** Localized string of the description. */ + readonly description?: string; + /** URL to retrieve JSON schema of the Target Type properties. */ + readonly propertiesSchema?: string; + /** List of resource types this Target Type can extend. */ + readonly resourceTypes?: string[]; +} + +export function targetTypePropertiesDeserializer(item: any): TargetTypeProperties { + return { + displayName: item["displayName"], + description: item["description"], + propertiesSchema: item["propertiesSchema"], + resourceTypes: !item["resourceTypes"] + ? item["resourceTypes"] + : item["resourceTypes"].map((p: any) => { + return p; + }), + }; +} + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +export function proxyResourceSerializer(item: ProxyResource): any { + return item; +} + +export function proxyResourceDeserializer(item: any): ProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(item: Resource): any { + return item; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnowncreatedByType} can be used interchangeably with createdByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** Model that represents a list of Target Type resources and a link for pagination. */ +export interface _TargetTypeListResult { + /** The TargetType items on this page */ + value: TargetType[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _targetTypeListResultDeserializer(item: any): _TargetTypeListResult { + return { + value: targetTypeArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function targetTypeArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return targetTypeDeserializer(item); + }); +} + +/** The private endpoint connection resource. */ +export interface PrivateEndpointConnection extends ProxyResource { + /** Resource properties. */ + properties?: PrivateEndpointConnectionProperties; +} + +export function privateEndpointConnectionDeserializer(item: any): PrivateEndpointConnection { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : privateEndpointConnectionPropertiesDeserializer(item["properties"]), + }; +} + +/** Properties of the private endpoint connection. */ +export interface PrivateEndpointConnectionProperties { + /** The group ids for the private endpoint resource. */ + readonly groupIds?: string[]; + /** The private endpoint resource. */ + privateEndpoint?: PrivateEndpoint; + /** A collection of information about the state of the connection between service consumer and provider. */ + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + /** The provisioning state of the private endpoint connection resource. */ + readonly provisioningState?: ProvisioningState; +} + +export function privateEndpointConnectionPropertiesDeserializer( + item: any, +): PrivateEndpointConnectionProperties { + return { + groupIds: !item["groupIds"] + ? item["groupIds"] + : item["groupIds"].map((p: any) => { + return p; + }), + privateEndpoint: !item["privateEndpoint"] + ? item["privateEndpoint"] + : privateEndpointDeserializer(item["privateEndpoint"]), + privateLinkServiceConnectionState: privateLinkServiceConnectionStateDeserializer( + item["privateLinkServiceConnectionState"], + ), + provisioningState: item["provisioningState"], + }; +} + +/** The private endpoint resource. */ +export interface PrivateEndpoint { + /** The ARM identifier for private endpoint. */ + readonly id?: string; +} + +export function privateEndpointDeserializer(item: any): PrivateEndpoint { + return { + id: item["id"], + }; +} + +/** A collection of information about the state of the connection between service consumer and provider. */ +export interface PrivateLinkServiceConnectionState { + /** Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. */ + status?: PrivateEndpointServiceConnectionStatus; + /** The reason for approval/rejection of the connection. */ + description?: string; + /** A message indicating if changes on the service provider require any updates on the consumer. */ + actionsRequired?: string; +} + +export function privateLinkServiceConnectionStateDeserializer( + item: any, +): PrivateLinkServiceConnectionState { + return { + status: item["status"], + description: item["description"], + actionsRequired: item["actionsRequired"], + }; +} + +/** The private endpoint connection status. */ +export enum KnownPrivateEndpointServiceConnectionStatus { + /** Pending status. */ + Pending = "Pending", + /** Approved status. */ + Approved = "Approved", + /** Rejected status. */ + Rejected = "Rejected", +} + +/** + * The private endpoint connection status. \ + * {@link KnownPrivateEndpointServiceConnectionStatus} can be used interchangeably with PrivateEndpointServiceConnectionStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Pending**: Pending status. \ + * **Approved**: Approved status. \ + * **Rejected**: Rejected status. + */ +export type PrivateEndpointServiceConnectionStatus = string; + +/** Current provisioning state for a given Azure Chaos resource. */ +export enum KnownProvisioningState { + /** Resource has been created. */ + Succeeded = "Succeeded", + /** Resource creation failed. */ + Failed = "Failed", + /** Resource creation was canceled. */ + Canceled = "Canceled", + /** Initial creation in progress. */ + Creating = "Creating", + /** Update in progress. */ + Updating = "Updating", + /** Deletion in progress. */ + Deleting = "Deleting", +} + +/** + * Current provisioning state for a given Azure Chaos resource. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: Resource has been created. \ + * **Failed**: Resource creation failed. \ + * **Canceled**: Resource creation was canceled. \ + * **Creating**: Initial creation in progress. \ + * **Updating**: Update in progress. \ + * **Deleting**: Deletion in progress. + */ +export type ProvisioningState = string; + +/** A list of private link resources */ +export interface _PrivateEndpointConnectionListResult { + /** The PrivateEndpointConnection items on this page */ + value: PrivateEndpointConnection[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _privateEndpointConnectionListResultDeserializer( + item: any, +): _PrivateEndpointConnectionListResult { + return { + value: privateEndpointConnectionArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function privateEndpointConnectionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return privateEndpointConnectionDeserializer(item); + }); +} + +/** PrivateAccesses tracked resource. */ +export interface PrivateAccess extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties: PrivateAccessProperties; +} + +export function privateAccessSerializer(item: PrivateAccess): any { + return { + tags: item["tags"], + location: item["location"], + properties: privateAccessPropertiesSerializer(item["properties"]), + }; +} + +export function privateAccessDeserializer(item: any): PrivateAccess { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: privateAccessPropertiesDeserializer(item["properties"]), + }; +} + +/** The properties of a private access resource */ +export interface PrivateAccessProperties { + /** Most recent provisioning state for the given privateAccess resource. */ + readonly provisioningState?: ProvisioningState; + /** A readonly collection of private endpoint connection. Currently only one endpoint connection is supported. */ + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + /** Public Network Access Control for PrivateAccess resource. */ + publicNetworkAccess?: PublicNetworkAccessOption; +} + +export function privateAccessPropertiesSerializer(item: PrivateAccessProperties): any { + return { publicNetworkAccess: item["publicNetworkAccess"] }; +} + +export function privateAccessPropertiesDeserializer(item: any): PrivateAccessProperties { + return { + provisioningState: item["provisioningState"], + privateEndpointConnections: !item["privateEndpointConnections"] + ? item["privateEndpointConnections"] + : privateEndpointConnectionArrayDeserializer(item["privateEndpointConnections"]), + publicNetworkAccess: item["publicNetworkAccess"], + }; +} + +/** Public Network Access Control for PrivateAccess resource. */ +export enum KnownPublicNetworkAccessOption { + /** Enabled access. */ + Enabled = "Enabled", + /** Disabled access. */ + Disabled = "Disabled", +} + +/** + * Public Network Access Control for PrivateAccess resource. \ + * {@link KnownPublicNetworkAccessOption} can be used interchangeably with PublicNetworkAccessOption, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled**: Enabled access. \ + * **Disabled**: Disabled access. + */ +export type PublicNetworkAccessOption = string; + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: item["tags"], + location: item["location"], + }; +} + +/** Describes a private access update. */ +export interface PrivateAccessPatch { + /** Resource tags. */ + tags?: Record; +} + +export function privateAccessPatchSerializer(item: PrivateAccessPatch): any { + return { tags: item["tags"] }; +} + +/** Model that represents a list of private access resources and a link for pagination. */ +export interface _PrivateAccessListResult { + /** The PrivateAccess items on this page */ + value: PrivateAccess[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _privateAccessListResultDeserializer(item: any): _PrivateAccessListResult { + return { + value: privateAccessArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function privateAccessArraySerializer(result: Array): any[] { + return result.map((item) => { + return privateAccessSerializer(item); + }); +} + +export function privateAccessArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return privateAccessDeserializer(item); + }); +} + +/** A list of private link resources */ +export interface _PrivateLinkResourceListResult { + /** The PrivateLinkResource items on this page */ + value: PrivateLinkResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _privateLinkResourceListResultDeserializer( + item: any, +): _PrivateLinkResourceListResult { + return { + value: privateLinkResourceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function privateLinkResourceArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return privateLinkResourceDeserializer(item); + }); +} + +/** A private link resource. */ +export interface PrivateLinkResource extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties: PrivateLinkResourceProperties; +} + +export function privateLinkResourceDeserializer(item: any): PrivateLinkResource { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: privateLinkResourcePropertiesDeserializer(item["properties"]), + }; +} + +/** Properties of a private link resource. */ +export interface PrivateLinkResourceProperties { + /** The private link resource group id. */ + readonly groupId?: string; + /** The private link resource required member names. */ + readonly requiredMembers?: string[]; + /** The private link resource private link DNS zone name. */ + requiredZoneNames?: string[]; + /** Resource provisioning state. Not currently in use. */ + readonly provisioningState?: ProvisioningState; +} + +export function privateLinkResourcePropertiesDeserializer( + item: any, +): PrivateLinkResourceProperties { + return { + groupId: item["groupId"], + requiredMembers: !item["requiredMembers"] + ? item["requiredMembers"] + : item["requiredMembers"].map((p: any) => { + return p; + }), + requiredZoneNames: !item["requiredZoneNames"] + ? item["requiredZoneNames"] + : item["requiredZoneNames"].map((p: any) => { + return p; + }), + provisioningState: item["provisioningState"], + }; +} + +/** Model that represents the execution of a Experiment. */ +export interface ExperimentExecution extends ProxyResource { + /** The properties of experiment execution status. */ + properties?: ExperimentExecutionProperties; +} + +export function experimentExecutionDeserializer(item: any): ExperimentExecution { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : experimentExecutionPropertiesDeserializer(item["properties"]), + }; +} + +/** Model that represents the execution properties of an Experiment. */ +export interface ExperimentExecutionProperties { + /** The status of the execution. */ + readonly status?: string; + /** String that represents the start date time. */ + readonly startedAt?: Date; + /** String that represents the stop date time. */ + readonly stoppedAt?: Date; +} + +export function experimentExecutionPropertiesDeserializer( + item: any, +): ExperimentExecutionProperties { + return { + status: item["status"], + startedAt: !item["startedAt"] ? item["startedAt"] : new Date(item["startedAt"]), + stoppedAt: !item["stoppedAt"] ? item["stoppedAt"] : new Date(item["stoppedAt"]), + }; +} + +/** Model that represents a list of Experiment executions and a link for pagination. */ +export interface _ExperimentExecutionListResult { + /** The ExperimentExecution items on this page */ + value: ExperimentExecution[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _experimentExecutionListResultDeserializer( + item: any, +): _ExperimentExecutionListResult { + return { + value: experimentExecutionArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function experimentExecutionArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return experimentExecutionDeserializer(item); + }); +} + +/** Model that represents the execution details of an Experiment. */ +export interface ExperimentExecutionDetails { + /** String of the resource type. */ + readonly type?: string; + /** String of the fully qualified resource ID. */ + readonly id?: string; + /** String of the resource name. */ + readonly name?: string; + /** The properties of the experiment execution details. */ + readonly properties?: ExperimentExecutionDetailsProperties; +} + +export function experimentExecutionDetailsDeserializer(item: any): ExperimentExecutionDetails { + return { + type: item["type"], + id: item["id"], + name: item["name"], + properties: !item["properties"] + ? item["properties"] + : experimentExecutionDetailsPropertiesDeserializer(item["properties"]), + }; +} + +/** Model that represents the extended properties of an experiment execution. */ +export interface ExperimentExecutionDetailsProperties { + /** The status of the execution. */ + readonly status?: string; + /** String that represents the start date time. */ + readonly startedAt?: Date; + /** String that represents the stop date time. */ + readonly stoppedAt?: Date; + /** The reason why the execution failed. */ + readonly failureReason?: string; + /** String that represents the last action date time. */ + readonly lastActionAt?: Date; + /** The information of the experiment run. */ + readonly runInformation?: ExperimentExecutionDetailsPropertiesRunInformation; +} + +export function experimentExecutionDetailsPropertiesDeserializer( + item: any, +): ExperimentExecutionDetailsProperties { + return { + status: item["status"], + startedAt: !item["startedAt"] ? item["startedAt"] : new Date(item["startedAt"]), + stoppedAt: !item["stoppedAt"] ? item["stoppedAt"] : new Date(item["stoppedAt"]), + failureReason: item["failureReason"], + lastActionAt: !item["lastActionAt"] ? item["lastActionAt"] : new Date(item["lastActionAt"]), + runInformation: !item["runInformation"] + ? item["runInformation"] + : experimentExecutionDetailsPropertiesRunInformationDeserializer(item["runInformation"]), + }; +} + +/** The information of the experiment run. */ +export interface ExperimentExecutionDetailsPropertiesRunInformation { + /** The steps of the experiment run. */ + readonly steps?: StepStatus[]; +} + +export function experimentExecutionDetailsPropertiesRunInformationDeserializer( + item: any, +): ExperimentExecutionDetailsPropertiesRunInformation { + return { + steps: !item["steps"] ? item["steps"] : stepStatusArrayDeserializer(item["steps"]), + }; +} + +export function stepStatusArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return stepStatusDeserializer(item); + }); +} + +/** Model that represents the a list of branches and branch statuses. */ +export interface StepStatus { + /** The name of the step. */ + readonly stepName?: string; + /** The id of the step. */ + readonly stepId?: string; + /** The value of the status of the step. */ + readonly status?: string; + /** The array of branches. */ + readonly branches?: BranchStatus[]; +} + +export function stepStatusDeserializer(item: any): StepStatus { + return { + stepName: item["stepName"], + stepId: item["stepId"], + status: item["status"], + branches: !item["branches"] + ? item["branches"] + : branchStatusArrayDeserializer(item["branches"]), + }; +} + +export function branchStatusArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return branchStatusDeserializer(item); + }); +} + +/** Model that represents the a list of actions and action statuses. */ +export interface BranchStatus { + /** The name of the branch status. */ + readonly branchName?: string; + /** The id of the branch status. */ + readonly branchId?: string; + /** The status of the branch. */ + readonly status?: string; + /** The array of actions. */ + readonly actions?: ActionStatus[]; +} + +export function branchStatusDeserializer(item: any): BranchStatus { + return { + branchName: item["branchName"], + branchId: item["branchId"], + status: item["status"], + actions: !item["actions"] ? item["actions"] : actionStatusArrayDeserializer(item["actions"]), + }; +} + +export function actionStatusArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return actionStatusDeserializer(item); + }); +} + +/** Model that represents the an action and its status. */ +export interface ActionStatus { + /** The name of the action status. */ + readonly actionName?: string; + /** The id of the action status. */ + readonly actionId?: string; + /** The status of the action. */ + readonly status?: string; + /** String that represents the start time of the action. */ + readonly startTime?: Date; + /** String that represents the end time of the action. */ + readonly endTime?: Date; + /** The array of targets. */ + readonly targets?: ExperimentExecutionActionTargetDetailsProperties[]; +} + +export function actionStatusDeserializer(item: any): ActionStatus { + return { + actionName: item["actionName"], + actionId: item["actionId"], + status: item["status"], + startTime: !item["startTime"] ? item["startTime"] : new Date(item["startTime"]), + endTime: !item["endTime"] ? item["endTime"] : new Date(item["endTime"]), + targets: !item["targets"] + ? item["targets"] + : experimentExecutionActionTargetDetailsPropertiesArrayDeserializer(item["targets"]), + }; +} + +export function experimentExecutionActionTargetDetailsPropertiesArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return experimentExecutionActionTargetDetailsPropertiesDeserializer(item); + }); +} + +/** Model that represents the Experiment action target details properties model. */ +export interface ExperimentExecutionActionTargetDetailsProperties { + /** The status of the execution. */ + readonly status?: string; + /** The target for the action. */ + readonly target?: string; + /** String that represents the failed date time. */ + readonly targetFailedTime?: Date; + /** String that represents the completed date time. */ + readonly targetCompletedTime?: Date; + /** The error of the action. */ + readonly error?: ExperimentExecutionActionTargetDetailsError; +} + +export function experimentExecutionActionTargetDetailsPropertiesDeserializer( + item: any, +): ExperimentExecutionActionTargetDetailsProperties { + return { + status: item["status"], + target: item["target"], + targetFailedTime: !item["targetFailedTime"] + ? item["targetFailedTime"] + : new Date(item["targetFailedTime"]), + targetCompletedTime: !item["targetCompletedTime"] + ? item["targetCompletedTime"] + : new Date(item["targetCompletedTime"]), + error: !item["error"] + ? item["error"] + : experimentExecutionActionTargetDetailsErrorDeserializer(item["error"]), + }; +} + +/** Model that represents the Experiment action target details error model. */ +export interface ExperimentExecutionActionTargetDetailsError { + /** The error code. */ + readonly code?: string; + /** The error message */ + readonly message?: string; +} + +export function experimentExecutionActionTargetDetailsErrorDeserializer( + item: any, +): ExperimentExecutionActionTargetDetailsError { + return { + code: item["code"], + message: item["message"], + }; +} + +/** Model that represents a Experiment resource. */ +export interface Experiment extends TrackedResource { + /** The managed service identities assigned to this resource. */ + identity?: ManagedServiceIdentity; + /** The properties of the experiment resource. */ + properties: ExperimentProperties; +} + +export function experimentSerializer(item: Experiment): any { + return { + tags: item["tags"], + location: item["location"], + identity: !item["identity"] + ? item["identity"] + : managedServiceIdentitySerializer(item["identity"]), + properties: experimentPropertiesSerializer(item["properties"]), + }; +} + +export function experimentDeserializer(item: any): Experiment { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + identity: !item["identity"] + ? item["identity"] + : managedServiceIdentityDeserializer(item["identity"]), + properties: experimentPropertiesDeserializer(item["properties"]), + }; +} + +/** Managed service identity (system assigned and/or user assigned identities) */ +export interface ManagedServiceIdentity { + /** The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. */ + readonly principalId?: string; + /** The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. */ + readonly tenantId?: string; + /** The type of managed identity assigned to this resource. */ + type: ManagedServiceIdentityType; + /** The identities assigned to this resource by the user. */ + userAssignedIdentities?: Record; +} + +export function managedServiceIdentitySerializer(item: ManagedServiceIdentity): any { + return { + type: item["type"], + userAssignedIdentities: item["userAssignedIdentities"], + }; +} + +export function managedServiceIdentityDeserializer(item: any): ManagedServiceIdentity { + return { + principalId: item["principalId"], + tenantId: item["tenantId"], + type: item["type"], + userAssignedIdentities: item["userAssignedIdentities"], + }; +} + +/** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ +export enum KnownManagedServiceIdentityType { + /** No managed identity. */ + None = "None", + /** System assigned managed identity. */ + SystemAssigned = "SystemAssigned", + /** User assigned managed identity. */ + UserAssigned = "UserAssigned", + /** System and user assigned managed identity. */ + "SystemAssigned,UserAssigned" = "SystemAssigned,UserAssigned", +} + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). \ + * {@link KnownManagedServiceIdentityType} can be used interchangeably with ManagedServiceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None**: No managed identity. \ + * **SystemAssigned**: System assigned managed identity. \ + * **UserAssigned**: User assigned managed identity. \ + * **SystemAssigned,UserAssigned**: System and user assigned managed identity. + */ +export type ManagedServiceIdentityType = string; + +/** User assigned identity properties */ +export interface UserAssignedIdentity { + /** The principal ID of the assigned identity. */ + readonly principalId?: string; + /** The client ID of the assigned identity. */ + readonly clientId?: string; +} + +export function userAssignedIdentitySerializer(item: UserAssignedIdentity): any { + return item; +} + +export function userAssignedIdentityDeserializer(item: any): UserAssignedIdentity { + return { + principalId: item["principalId"], + clientId: item["clientId"], + }; +} + +/** Model that represents the Experiment properties model. */ +export interface ExperimentProperties { + /** Most recent provisioning state for the given experiment resource. */ + readonly provisioningState?: ProvisioningState; + /** List of steps. */ + steps: ChaosExperimentStep[]; + /** List of selectors. */ + selectors: ChaosTargetSelectorUnion[]; + /** Optional customer-managed Storage account where Experiment schema will be stored. */ + customerDataStorage?: CustomerDataStorageProperties; +} + +export function experimentPropertiesSerializer(item: ExperimentProperties): any { + return { + steps: chaosExperimentStepArraySerializer(item["steps"]), + selectors: chaosTargetSelectorUnionArraySerializer(item["selectors"]), + customerDataStorage: !item["customerDataStorage"] + ? item["customerDataStorage"] + : customerDataStoragePropertiesSerializer(item["customerDataStorage"]), + }; +} + +export function experimentPropertiesDeserializer(item: any): ExperimentProperties { + return { + provisioningState: item["provisioningState"], + steps: chaosExperimentStepArrayDeserializer(item["steps"]), + selectors: chaosTargetSelectorUnionArrayDeserializer(item["selectors"]), + customerDataStorage: !item["customerDataStorage"] + ? item["customerDataStorage"] + : customerDataStoragePropertiesDeserializer(item["customerDataStorage"]), + }; +} + +export function chaosExperimentStepArraySerializer(result: Array): any[] { + return result.map((item) => { + return chaosExperimentStepSerializer(item); + }); +} + +export function chaosExperimentStepArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return chaosExperimentStepDeserializer(item); + }); +} + +/** Model that represents a step in the Experiment resource. */ +export interface ChaosExperimentStep { + /** String of the step name. */ + name: string; + /** List of branches. */ + branches: ChaosExperimentBranch[]; +} + +export function chaosExperimentStepSerializer(item: ChaosExperimentStep): any { + return { + name: item["name"], + branches: chaosExperimentBranchArraySerializer(item["branches"]), + }; +} + +export function chaosExperimentStepDeserializer(item: any): ChaosExperimentStep { + return { + name: item["name"], + branches: chaosExperimentBranchArrayDeserializer(item["branches"]), + }; +} + +export function chaosExperimentBranchArraySerializer(result: Array): any[] { + return result.map((item) => { + return chaosExperimentBranchSerializer(item); + }); +} + +export function chaosExperimentBranchArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return chaosExperimentBranchDeserializer(item); + }); +} + +/** Model that represents a branch in the step. 9 total per experiment. */ +export interface ChaosExperimentBranch { + /** String of the branch name. */ + name: string; + /** List of actions. */ + actions: ChaosExperimentActionUnion[]; +} + +export function chaosExperimentBranchSerializer(item: ChaosExperimentBranch): any { + return { + name: item["name"], + actions: chaosExperimentActionUnionArraySerializer(item["actions"]), + }; +} + +export function chaosExperimentBranchDeserializer(item: any): ChaosExperimentBranch { + return { + name: item["name"], + actions: chaosExperimentActionUnionArrayDeserializer(item["actions"]), + }; +} + +export function chaosExperimentActionUnionArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return chaosExperimentActionUnionSerializer(item); + }); +} + +export function chaosExperimentActionUnionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return chaosExperimentActionUnionDeserializer(item); + }); +} + +/** Model that represents the base action model. 9 total per experiment. */ +export interface ChaosExperimentAction { + /** String that represents a Capability URN. */ + name: string; + /** Chaos experiment action discriminator type */ + /** The discriminator possible values: continuous, delay, discrete */ + type: ExperimentActionType; +} + +export function chaosExperimentActionSerializer(item: ChaosExperimentAction): any { + return { name: item["name"], type: item["type"] }; +} + +export function chaosExperimentActionDeserializer(item: any): ChaosExperimentAction { + return { + name: item["name"], + type: item["type"], + }; +} + +/** Alias for ChaosExperimentActionUnion */ +export type ChaosExperimentActionUnion = + | ContinuousAction + | DelayAction + | DiscreteAction + | ChaosExperimentAction; + +export function chaosExperimentActionUnionSerializer(item: ChaosExperimentActionUnion): any { + switch (item.type) { + case "continuous": + return continuousActionSerializer(item as ContinuousAction); + + case "delay": + return delayActionSerializer(item as DelayAction); + + case "discrete": + return discreteActionSerializer(item as DiscreteAction); + + default: + return chaosExperimentActionSerializer(item); + } +} + +export function chaosExperimentActionUnionDeserializer(item: any): ChaosExperimentActionUnion { + switch (item.type) { + case "continuous": + return continuousActionDeserializer(item as ContinuousAction); + + case "delay": + return delayActionDeserializer(item as DelayAction); + + case "discrete": + return discreteActionDeserializer(item as DiscreteAction); + + default: + return chaosExperimentActionDeserializer(item); + } +} + +/** Enum union of Chaos experiment action types. */ +export enum KnownExperimentActionType { + delay = "delay", + discrete = "discrete", + continuous = "continuous", +} + +/** + * Enum union of Chaos experiment action types. \ + * {@link KnownExperimentActionType} can be used interchangeably with ExperimentActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **delay** \ + * **discrete** \ + * **continuous** + */ +export type ExperimentActionType = string; + +/** Model that represents a continuous action. */ +export interface ContinuousAction extends ChaosExperimentAction { + /** ISO8601 formatted string that represents a duration. */ + duration: string; + /** List of key value pairs. */ + parameters: KeyValuePair[]; + /** String that represents a selector. */ + selectorId: string; + /** Enum that discriminates between action models. */ + type: "continuous"; +} + +export function continuousActionSerializer(item: ContinuousAction): any { + return { + name: item["name"], + type: item["type"], + duration: item["duration"], + parameters: keyValuePairArraySerializer(item["parameters"]), + selectorId: item["selectorId"], + }; +} + +export function continuousActionDeserializer(item: any): ContinuousAction { + return { + name: item["name"], + type: item["type"], + duration: item["duration"], + parameters: keyValuePairArrayDeserializer(item["parameters"]), + selectorId: item["selectorId"], + }; +} + +export function keyValuePairArraySerializer(result: Array): any[] { + return result.map((item) => { + return keyValuePairSerializer(item); + }); +} + +export function keyValuePairArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return keyValuePairDeserializer(item); + }); +} + +/** A map to describe the settings of an action. */ +export interface KeyValuePair { + /** The name of the setting for the action. */ + key: string; + /** The value of the setting for the action. */ + value: string; +} + +export function keyValuePairSerializer(item: KeyValuePair): any { + return { key: item["key"], value: item["value"] }; +} + +export function keyValuePairDeserializer(item: any): KeyValuePair { + return { + key: item["key"], + value: item["value"], + }; +} + +/** Model that represents a delay action. */ +export interface DelayAction extends ChaosExperimentAction { + /** ISO8601 formatted string that represents a duration. */ + duration: string; + /** Enum that discriminates between action models. */ + type: "delay"; +} + +export function delayActionSerializer(item: DelayAction): any { + return { name: item["name"], type: item["type"], duration: item["duration"] }; +} + +export function delayActionDeserializer(item: any): DelayAction { + return { + name: item["name"], + type: item["type"], + duration: item["duration"], + }; +} + +/** Model that represents a discrete action. */ +export interface DiscreteAction extends ChaosExperimentAction { + /** List of key value pairs. */ + parameters: KeyValuePair[]; + /** String that represents a selector. */ + selectorId: string; + /** Enum that discriminates between action models. */ + type: "discrete"; +} + +export function discreteActionSerializer(item: DiscreteAction): any { + return { + name: item["name"], + type: item["type"], + parameters: keyValuePairArraySerializer(item["parameters"]), + selectorId: item["selectorId"], + }; +} + +export function discreteActionDeserializer(item: any): DiscreteAction { + return { + name: item["name"], + type: item["type"], + parameters: keyValuePairArrayDeserializer(item["parameters"]), + selectorId: item["selectorId"], + }; +} + +export function chaosTargetSelectorUnionArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return chaosTargetSelectorUnionSerializer(item); + }); +} + +export function chaosTargetSelectorUnionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return chaosTargetSelectorUnionDeserializer(item); + }); +} + +/** Model that represents a selector in the Experiment resource. */ +export interface ChaosTargetSelector { + /** String of the selector ID. */ + id: string; + /** Chaos target selector discriminator type */ + /** The discriminator possible values: List, Query */ + type: SelectorType; + /** Model that represents available filter types that can be applied to a targets list. */ + filter?: ChaosTargetFilterUnion; +} + +export function chaosTargetSelectorSerializer(item: ChaosTargetSelector): any { + return { + id: item["id"], + type: item["type"], + filter: !item["filter"] ? item["filter"] : chaosTargetFilterUnionSerializer(item["filter"]), + }; +} + +export function chaosTargetSelectorDeserializer(item: any): ChaosTargetSelector { + return { + id: item["id"], + type: item["type"], + filter: !item["filter"] ? item["filter"] : chaosTargetFilterUnionDeserializer(item["filter"]), + }; +} + +/** Alias for ChaosTargetSelectorUnion */ +export type ChaosTargetSelectorUnion = + | ChaosTargetListSelector + | ChaosTargetQuerySelector + | ChaosTargetSelector; + +export function chaosTargetSelectorUnionSerializer(item: ChaosTargetSelectorUnion): any { + switch (item.type) { + case "List": + return chaosTargetListSelectorSerializer(item as ChaosTargetListSelector); + + case "Query": + return chaosTargetQuerySelectorSerializer(item as ChaosTargetQuerySelector); + + default: + return chaosTargetSelectorSerializer(item); + } +} + +export function chaosTargetSelectorUnionDeserializer(item: any): ChaosTargetSelectorUnion { + switch (item.type) { + case "List": + return chaosTargetListSelectorDeserializer(item as ChaosTargetListSelector); + + case "Query": + return chaosTargetQuerySelectorDeserializer(item as ChaosTargetQuerySelector); + + default: + return chaosTargetSelectorDeserializer(item); + } +} + +/** Enum of the selector type. */ +export enum KnownSelectorType { + /** List selector type. */ + List = "List", + /** Query selector type. */ + Query = "Query", +} + +/** + * Enum of the selector type. \ + * {@link KnownSelectorType} can be used interchangeably with SelectorType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **List**: List selector type. \ + * **Query**: Query selector type. + */ +export type SelectorType = string; + +/** Model that represents available filter types that can be applied to a targets list. */ +export interface ChaosTargetFilter { + /** Chaos target filter discriminator type */ + /** The discriminator possible values: Simple */ + type: FilterType; +} + +export function chaosTargetFilterSerializer(item: ChaosTargetFilter): any { + return { type: item["type"] }; +} + +export function chaosTargetFilterDeserializer(item: any): ChaosTargetFilter { + return { + type: item["type"], + }; +} + +/** Alias for ChaosTargetFilterUnion */ +export type ChaosTargetFilterUnion = ChaosTargetSimpleFilter | ChaosTargetFilter; + +export function chaosTargetFilterUnionSerializer(item: ChaosTargetFilterUnion): any { + switch (item.type) { + case "Simple": + return chaosTargetSimpleFilterSerializer(item as ChaosTargetSimpleFilter); + + default: + return chaosTargetFilterSerializer(item); + } +} + +export function chaosTargetFilterUnionDeserializer(item: any): ChaosTargetFilterUnion { + switch (item.type) { + case "Simple": + return chaosTargetSimpleFilterDeserializer(item as ChaosTargetSimpleFilter); + + default: + return chaosTargetFilterDeserializer(item); + } +} + +/** Enum that discriminates between filter types. Currently only `Simple` type is supported. */ +export enum KnownFilterType { + /** Simple filter type. */ + Simple = "Simple", +} + +/** + * Enum that discriminates between filter types. Currently only `Simple` type is supported. \ + * {@link KnownFilterType} can be used interchangeably with FilterType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Simple**: Simple filter type. + */ +export type FilterType = string; + +/** Model that represents a simple target filter. */ +export interface ChaosTargetSimpleFilter extends ChaosTargetFilter { + /** Model that represents the Simple filter parameters. */ + parameters?: ChaosTargetSimpleFilterParameters; + /** Enum that discriminates between filter types. Currently only `Simple` type is supported. */ + type: "Simple"; +} + +export function chaosTargetSimpleFilterSerializer(item: ChaosTargetSimpleFilter): any { + return { + type: item["type"], + parameters: !item["parameters"] + ? item["parameters"] + : chaosTargetSimpleFilterParametersSerializer(item["parameters"]), + }; +} + +export function chaosTargetSimpleFilterDeserializer(item: any): ChaosTargetSimpleFilter { + return { + type: item["type"], + parameters: !item["parameters"] + ? item["parameters"] + : chaosTargetSimpleFilterParametersDeserializer(item["parameters"]), + }; +} + +/** Model that represents the Simple filter parameters. */ +export interface ChaosTargetSimpleFilterParameters { + /** List of Azure availability zones to filter targets by. */ + zones?: string[]; +} + +export function chaosTargetSimpleFilterParametersSerializer( + item: ChaosTargetSimpleFilterParameters, +): any { + return { + zones: !item["zones"] + ? item["zones"] + : item["zones"].map((p: any) => { + return p; + }), + }; +} + +export function chaosTargetSimpleFilterParametersDeserializer( + item: any, +): ChaosTargetSimpleFilterParameters { + return { + zones: !item["zones"] + ? item["zones"] + : item["zones"].map((p: any) => { + return p; + }), + }; +} + +/** Model that represents a list selector. */ +export interface ChaosTargetListSelector extends ChaosTargetSelector { + /** List of Target references. */ + targets: TargetReference[]; + /** Enum of the selector type. */ + type: "List"; +} + +export function chaosTargetListSelectorSerializer(item: ChaosTargetListSelector): any { + return { + id: item["id"], + type: item["type"], + filter: !item["filter"] ? item["filter"] : chaosTargetFilterUnionSerializer(item["filter"]), + targets: targetReferenceArraySerializer(item["targets"]), + }; +} + +export function chaosTargetListSelectorDeserializer(item: any): ChaosTargetListSelector { + return { + id: item["id"], + type: item["type"], + filter: !item["filter"] ? item["filter"] : chaosTargetFilterUnionDeserializer(item["filter"]), + targets: targetReferenceArrayDeserializer(item["targets"]), + }; +} + +export function targetReferenceArraySerializer(result: Array): any[] { + return result.map((item) => { + return targetReferenceSerializer(item); + }); +} + +export function targetReferenceArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return targetReferenceDeserializer(item); + }); +} + +/** Model that represents a reference to a Target in the selector. */ +export interface TargetReference { + /** Enum of the Target reference type. */ + type: TargetReferenceType; + /** String of the resource ID of a Target resource. */ + id: string; +} + +export function targetReferenceSerializer(item: TargetReference): any { + return { type: item["type"], id: item["id"] }; +} + +export function targetReferenceDeserializer(item: any): TargetReference { + return { + type: item["type"], + id: item["id"], + }; +} + +/** Enum of the Target reference type. */ +export enum KnownTargetReferenceType { + /** Chaos target reference type. */ + ChaosTarget = "ChaosTarget", +} + +/** + * Enum of the Target reference type. \ + * {@link KnownTargetReferenceType} can be used interchangeably with TargetReferenceType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ChaosTarget**: Chaos target reference type. + */ +export type TargetReferenceType = string; + +/** Model that represents a query selector. */ +export interface ChaosTargetQuerySelector extends ChaosTargetSelector { + /** Azure Resource Graph (ARG) Query Language query for target resources. */ + queryString: string; + /** Subscription id list to scope resource query. */ + subscriptionIds: string[]; + /** Enum of the selector type. */ + type: "Query"; +} + +export function chaosTargetQuerySelectorSerializer(item: ChaosTargetQuerySelector): any { + return { + id: item["id"], + type: item["type"], + filter: !item["filter"] ? item["filter"] : chaosTargetFilterUnionSerializer(item["filter"]), + queryString: item["queryString"], + subscriptionIds: item["subscriptionIds"].map((p: any) => { + return p; + }), + }; +} + +export function chaosTargetQuerySelectorDeserializer(item: any): ChaosTargetQuerySelector { + return { + id: item["id"], + type: item["type"], + filter: !item["filter"] ? item["filter"] : chaosTargetFilterUnionDeserializer(item["filter"]), + queryString: item["queryString"], + subscriptionIds: item["subscriptionIds"].map((p: any) => { + return p; + }), + }; +} + +/** Model that represents the Customer Managed Storage for an Experiment. */ +export interface CustomerDataStorageProperties { + /** ARM Resource ID of the Storage account to use for Customer Data storage. */ + storageAccountResourceId?: string; + /** Name of the Azure Blob Storage container to use or create. */ + blobContainerName?: string; +} + +export function customerDataStoragePropertiesSerializer(item: CustomerDataStorageProperties): any { + return { + storageAccountResourceId: item["storageAccountResourceId"], + blobContainerName: item["blobContainerName"], + }; +} + +export function customerDataStoragePropertiesDeserializer( + item: any, +): CustomerDataStorageProperties { + return { + storageAccountResourceId: item["storageAccountResourceId"], + blobContainerName: item["blobContainerName"], + }; +} + +/** Describes an experiment update. */ +export interface ExperimentUpdate { + /** The managed service identities assigned to this resource. */ + identity?: ManagedServiceIdentity; + /** Resource tags. */ + tags?: Record; +} + +export function experimentUpdateSerializer(item: ExperimentUpdate): any { + return { + identity: !item["identity"] + ? item["identity"] + : managedServiceIdentitySerializer(item["identity"]), + tags: item["tags"], + }; +} + +/** Model that represents a list of Experiment resources and a link for pagination. */ +export interface _ExperimentListResult { + /** The Experiment items on this page */ + value: Experiment[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _experimentListResultDeserializer(item: any): _ExperimentListResult { + return { + value: experimentArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function experimentArraySerializer(result: Array): any[] { + return result.map((item) => { + return experimentSerializer(item); + }); +} + +export function experimentArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return experimentDeserializer(item); + }); +} + +/** Model that represents a Capability Type resource. */ +export interface CapabilityType extends ProxyResource { + /** Azure resource location. */ + location?: string; + /** The properties of the capability type resource. */ + properties?: CapabilityTypeProperties; +} + +export function capabilityTypeDeserializer(item: any): CapabilityType { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : capabilityTypePropertiesDeserializer(item["properties"]), + }; +} + +/** Model that represents the Capability Type properties model. */ +export interface CapabilityTypeProperties { + /** String of the Publisher that this Capability Type extends. */ + readonly publisher?: string; + /** String of the Target Type that this Capability Type extends. */ + readonly targetType?: string; + /** Localized string of the display name. */ + readonly displayName?: string; + /** Localized string of the description. */ + readonly description?: string; + /** URL to retrieve JSON schema of the Capability Type parameters. */ + readonly parametersSchema?: string; + /** String of the URN for this Capability Type. */ + readonly urn?: string; + /** String of the kind of this Capability Type. */ + readonly kind?: string; + /** Control plane actions necessary to execute capability type. */ + readonly azureRbacActions?: string[]; + /** Data plane actions necessary to execute capability type. */ + readonly azureRbacDataActions?: string[]; + /** Runtime properties of this Capability Type. */ + readonly runtimeProperties?: CapabilityTypePropertiesRuntimeProperties; +} + +export function capabilityTypePropertiesDeserializer(item: any): CapabilityTypeProperties { + return { + publisher: item["publisher"], + targetType: item["targetType"], + displayName: item["displayName"], + description: item["description"], + parametersSchema: item["parametersSchema"], + urn: item["urn"], + kind: item["kind"], + azureRbacActions: !item["azureRbacActions"] + ? item["azureRbacActions"] + : item["azureRbacActions"].map((p: any) => { + return p; + }), + azureRbacDataActions: !item["azureRbacDataActions"] + ? item["azureRbacDataActions"] + : item["azureRbacDataActions"].map((p: any) => { + return p; + }), + runtimeProperties: !item["runtimeProperties"] + ? item["runtimeProperties"] + : capabilityTypePropertiesRuntimePropertiesDeserializer(item["runtimeProperties"]), + }; +} + +/** Runtime properties of this Capability Type. */ +export interface CapabilityTypePropertiesRuntimeProperties { + /** String of the kind of the resource's action type (continuous or discrete). */ + readonly kind?: string; +} + +export function capabilityTypePropertiesRuntimePropertiesDeserializer( + item: any, +): CapabilityTypePropertiesRuntimeProperties { + return { + kind: item["kind"], + }; +} + +/** Model that represents a list of Capability Type resources and a link for pagination. */ +export interface _CapabilityTypeListResult { + /** The CapabilityType items on this page */ + value: CapabilityType[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _capabilityTypeListResultDeserializer(item: any): _CapabilityTypeListResult { + return { + value: capabilityTypeArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function capabilityTypeArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return capabilityTypeDeserializer(item); + }); +} + +/** Model that represents a Target resource. */ +export interface Target extends ProxyResource { + /** Azure resource location. */ + location?: string; + /** The properties of the target resource. */ + properties: TargetProperties; +} + +export function targetSerializer(item: Target): any { + return { + location: item["location"], + properties: targetPropertiesSerializer(item["properties"]), + }; +} + +export function targetDeserializer(item: any): Target { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + location: item["location"], + properties: targetPropertiesDeserializer(item["properties"]), + }; +} + +/** Target properties. */ +export interface TargetProperties extends Record {} + +export function targetPropertiesSerializer(item: TargetProperties): any { + return { ...item }; +} + +export function targetPropertiesDeserializer(item: any): TargetProperties { + return { + ...item, + }; +} + +/** Model that represents a list of Target resources and a link for pagination. */ +export interface _TargetListResult { + /** The Target items on this page */ + value: Target[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _targetListResultDeserializer(item: any): _TargetListResult { + return { + value: targetArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function targetArraySerializer(result: Array): any[] { + return result.map((item) => { + return targetSerializer(item); + }); +} + +export function targetArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return targetDeserializer(item); + }); +} + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface _OperationListResult { + /** The Operation items on this page */ + value: Operation[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _operationListResultDeserializer(item: any): _OperationListResult { + return { + value: operationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationDeserializer(item); + }); +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ + readonly name?: string; + /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ + readonly origin?: Origin; + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ + readonly actionType?: ActionType; +} + +export function operationDeserializer(item: any): Operation { + return { + name: item["name"], + isDataAction: item["isDataAction"], + display: !item["display"] ? item["display"] : operationDisplayDeserializer(item["display"]), + origin: item["origin"], + actionType: item["actionType"], + }; +} + +/** Localized display information for and operation. */ +export interface OperationDisplay { + /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ + readonly provider?: string; + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ + readonly resource?: string; + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ + readonly operation?: string; + /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ + readonly description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ +export enum KnownOrigin { + /** Indicates the operation is initiated by a user. */ + user = "user", + /** Indicates the operation is initiated by a system. */ + system = "system", + /** Indicates the operation is initiated by a user or system. */ + "user,system" = "user,system", +} + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user**: Indicates the operation is initiated by a user. \ + * **system**: Indicates the operation is initiated by a system. \ + * **user,system**: Indicates the operation is initiated by a user or system. + */ +export type Origin = string; + +/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +export enum KnownActionType { + /** Actions are for internal-only APIs. */ + Internal = "Internal", +} + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal**: Actions are for internal-only APIs. + */ +export type ActionType = string; + +/** Model that represents a Capability resource. */ +export interface Capability extends ProxyResource { + /** The properties of a capability resource. */ + properties?: CapabilityProperties; +} + +export function capabilitySerializer(item: Capability): any { + return { + properties: !item["properties"] + ? item["properties"] + : capabilityPropertiesSerializer(item["properties"]), + }; +} + +export function capabilityDeserializer(item: any): Capability { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : capabilityPropertiesDeserializer(item["properties"]), + }; +} + +/** Model that represents the Capability properties model. */ +export interface CapabilityProperties { + /** String of the Publisher that this Capability extends. */ + readonly publisher?: string; + /** String of the Target Type that this Capability extends. */ + readonly targetType?: string; + /** Localized string of the description. */ + readonly description?: string; + /** URL to retrieve JSON schema of the Capability parameters. */ + readonly parametersSchema?: string; + /** String of the URN for this Capability Type. */ + readonly urn?: string; +} + +export function capabilityPropertiesSerializer(item: CapabilityProperties): any { + return item; +} + +export function capabilityPropertiesDeserializer(item: any): CapabilityProperties { + return { + publisher: item["publisher"], + targetType: item["targetType"], + description: item["description"], + parametersSchema: item["parametersSchema"], + urn: item["urn"], + }; +} + +/** Model that represents a list of Capability resources and a link for pagination. */ +export interface _CapabilityListResult { + /** The Capability items on this page */ + value: Capability[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _capabilityListResultDeserializer(item: any): _CapabilityListResult { + return { + value: capabilityArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function capabilityArraySerializer(result: Array): any[] { + return result.map((item) => { + return capabilitySerializer(item); + }); +} + +export function capabilityArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return capabilityDeserializer(item); + }); +} + +/** The available API versions. */ +export enum KnownVersions { + /** The 2024-11-01-preview API version. */ + v2024_11_01_preview = "2024-11-01-preview", +} diff --git a/sdk/chaos/arm-chaos/src/models/parameters.ts b/sdk/chaos/arm-chaos/src/models/parameters.ts deleted file mode 100644 index 4cf170278934..000000000000 --- a/sdk/chaos/arm-chaos/src/models/parameters.ts +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - OperationParameter, - OperationURLParameter, - OperationQueryParameter, -} from "@azure/core-client"; -import { - Capability as CapabilityMapper, - Experiment as ExperimentMapper, - ExperimentUpdate as ExperimentUpdateMapper, - Target as TargetMapper, -} from "../models/mappers"; - -export const accept: OperationParameter = { - parameterPath: "accept", - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Accept", - type: { - name: "String", - }, - }, -}; - -export const $host: OperationURLParameter = { - parameterPath: "$host", - mapper: { - serializedName: "$host", - required: true, - type: { - name: "String", - }, - }, - skipEncoding: true, -}; - -export const apiVersion: OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - defaultValue: "2024-01-01", - isConstant: true, - serializedName: "api-version", - type: { - name: "String", - }, - }, -}; - -export const subscriptionId: OperationURLParameter = { - parameterPath: "subscriptionId", - mapper: { - constraints: { - Pattern: new RegExp( - "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$", - ), - }, - serializedName: "subscriptionId", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resourceGroupName: OperationURLParameter = { - parameterPath: "resourceGroupName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9_\\-\\.\\(\\)]*[a-zA-Z0-9_\\-\\(\\)]$"), - }, - serializedName: "resourceGroupName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const parentProviderNamespace: OperationURLParameter = { - parameterPath: "parentProviderNamespace", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9]+\\.[a-zA-Z0-9]+$"), - }, - serializedName: "parentProviderNamespace", - required: true, - type: { - name: "String", - }, - }, -}; - -export const parentResourceType: OperationURLParameter = { - parameterPath: "parentResourceType", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9_\\-\\.]+$"), - }, - serializedName: "parentResourceType", - required: true, - type: { - name: "String", - }, - }, -}; - -export const parentResourceName: OperationURLParameter = { - parameterPath: "parentResourceName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9_\\-\\.]+$"), - }, - serializedName: "parentResourceName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const targetName: OperationURLParameter = { - parameterPath: "targetName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9_\\-\\.]+$"), - }, - serializedName: "targetName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const continuationToken: OperationQueryParameter = { - parameterPath: ["options", "continuationToken"], - mapper: { - serializedName: "continuationToken", - type: { - name: "String", - }, - }, -}; - -export const capabilityName: OperationURLParameter = { - parameterPath: "capabilityName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9\\-\\.]+-\\d\\.\\d$"), - }, - serializedName: "capabilityName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Content-Type", - type: { - name: "String", - }, - }, -}; - -export const capability: OperationParameter = { - parameterPath: "capability", - mapper: CapabilityMapper, -}; - -export const nextLink: OperationURLParameter = { - parameterPath: "nextLink", - mapper: { - serializedName: "nextLink", - required: true, - type: { - name: "String", - }, - }, - skipEncoding: true, -}; - -export const locationName: OperationURLParameter = { - parameterPath: "locationName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9_\\-\\.]+$"), - }, - serializedName: "locationName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const targetTypeName: OperationURLParameter = { - parameterPath: "targetTypeName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9_\\-\\.]+$"), - }, - serializedName: "targetTypeName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const capabilityTypeName: OperationURLParameter = { - parameterPath: "capabilityTypeName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9\\-\\.]+-\\d\\.\\d$"), - }, - serializedName: "capabilityTypeName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const running: OperationQueryParameter = { - parameterPath: ["options", "running"], - mapper: { - serializedName: "running", - type: { - name: "Boolean", - }, - }, -}; - -export const experimentName: OperationURLParameter = { - parameterPath: "experimentName", - mapper: { - constraints: { - Pattern: new RegExp("^[^<>%&:?#/\\\\]+$"), - MinLength: 1, - }, - serializedName: "experimentName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const experiment: OperationParameter = { - parameterPath: "experiment", - mapper: ExperimentMapper, -}; - -export const experiment1: OperationParameter = { - parameterPath: "experiment", - mapper: ExperimentUpdateMapper, -}; - -export const executionId: OperationURLParameter = { - parameterPath: "executionId", - mapper: { - constraints: { - Pattern: new RegExp( - "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$", - ), - }, - serializedName: "executionId", - required: true, - type: { - name: "String", - }, - }, -}; - -export const location: OperationURLParameter = { - parameterPath: "location", - mapper: { - constraints: { - MinLength: 1, - }, - serializedName: "location", - required: true, - type: { - name: "String", - }, - }, -}; - -export const asyncOperationId: OperationURLParameter = { - parameterPath: "asyncOperationId", - mapper: { - serializedName: "asyncOperationId", - required: true, - type: { - name: "String", - }, - }, -}; - -export const target: OperationParameter = { - parameterPath: "target", - mapper: TargetMapper, -}; diff --git a/sdk/chaos/arm-chaos/src/operations/capabilities.ts b/sdk/chaos/arm-chaos/src/operations/capabilities.ts deleted file mode 100644 index ae8f4d4affd3..000000000000 --- a/sdk/chaos/arm-chaos/src/operations/capabilities.ts +++ /dev/null @@ -1,444 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { Capabilities } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { ChaosManagementClient } from "../chaosManagementClient"; -import { - Capability, - CapabilitiesListNextOptionalParams, - CapabilitiesListOptionalParams, - CapabilitiesListResponse, - CapabilitiesGetOptionalParams, - CapabilitiesGetResponse, - CapabilitiesDeleteOptionalParams, - CapabilitiesCreateOrUpdateOptionalParams, - CapabilitiesCreateOrUpdateResponse, - CapabilitiesListNextResponse, -} from "../models"; - -/// -/** Class containing Capabilities operations. */ -export class CapabilitiesImpl implements Capabilities { - private readonly client: ChaosManagementClient; - - /** - * Initialize a new instance of the class Capabilities class. - * @param client Reference to the service client - */ - constructor(client: ChaosManagementClient) { - this.client = client; - } - - /** - * Get a list of Capability resources that extend a Target resource.. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param options The options parameters. - */ - public list( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - options?: CapabilitiesListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll( - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - targetName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage( - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - targetName, - options, - settings, - ); - }, - }; - } - - private async *listPagingPage( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - options?: CapabilitiesListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: CapabilitiesListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list( - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - targetName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext( - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - targetName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - options?: CapabilitiesListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - targetName, - options, - )) { - yield* page; - } - } - - /** - * Get a list of Capability resources that extend a Target resource.. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param options The options parameters. - */ - private _list( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - options?: CapabilitiesListOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - targetName, - options, - }, - listOperationSpec, - ); - } - - /** - * Get a Capability resource that extends a Target resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param capabilityName String that represents a Capability resource name. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - capabilityName: string, - options?: CapabilitiesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - targetName, - capabilityName, - options, - }, - getOperationSpec, - ); - } - - /** - * Delete a Capability that extends a Target resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param capabilityName String that represents a Capability resource name. - * @param options The options parameters. - */ - delete( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - capabilityName: string, - options?: CapabilitiesDeleteOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - targetName, - capabilityName, - options, - }, - deleteOperationSpec, - ); - } - - /** - * Create or update a Capability resource that extends a Target resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param capabilityName String that represents a Capability resource name. - * @param capability Capability resource to be created or updated. - * @param options The options parameters. - */ - createOrUpdate( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - capabilityName: string, - capability: Capability, - options?: CapabilitiesCreateOrUpdateOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - targetName, - capabilityName, - capability, - options, - }, - createOrUpdateOperationSpec, - ); - } - - /** - * ListNext - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - nextLink: string, - options?: CapabilitiesListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - targetName, - nextLink, - options, - }, - listNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CapabilityListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion, Parameters.continuationToken], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.parentProviderNamespace, - Parameters.parentResourceType, - Parameters.parentResourceName, - Parameters.targetName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Capability, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.parentProviderNamespace, - Parameters.parentResourceType, - Parameters.parentResourceName, - Parameters.targetName, - Parameters.capabilityName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.parentProviderNamespace, - Parameters.parentResourceType, - Parameters.parentResourceName, - Parameters.targetName, - Parameters.capabilityName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Capability, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.capability, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.parentProviderNamespace, - Parameters.parentResourceType, - Parameters.parentResourceName, - Parameters.targetName, - Parameters.capabilityName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CapabilityListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.parentProviderNamespace, - Parameters.parentResourceType, - Parameters.parentResourceName, - Parameters.targetName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/chaos/arm-chaos/src/operations/capabilityTypes.ts b/sdk/chaos/arm-chaos/src/operations/capabilityTypes.ts deleted file mode 100644 index ca6f6b979cd5..000000000000 --- a/sdk/chaos/arm-chaos/src/operations/capabilityTypes.ts +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { CapabilityTypes } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { ChaosManagementClient } from "../chaosManagementClient"; -import { - CapabilityType, - CapabilityTypesListNextOptionalParams, - CapabilityTypesListOptionalParams, - CapabilityTypesListResponse, - CapabilityTypesGetOptionalParams, - CapabilityTypesGetResponse, - CapabilityTypesListNextResponse, -} from "../models"; - -/// -/** Class containing CapabilityTypes operations. */ -export class CapabilityTypesImpl implements CapabilityTypes { - private readonly client: ChaosManagementClient; - - /** - * Initialize a new instance of the class CapabilityTypes class. - * @param client Reference to the service client - */ - constructor(client: ChaosManagementClient) { - this.client = client; - } - - /** - * Get a list of Capability Type resources for given Target Type and location. - * @param locationName String that represents a Location resource name. - * @param targetTypeName String that represents a Target Type resource name. - * @param options The options parameters. - */ - public list( - locationName: string, - targetTypeName: string, - options?: CapabilityTypesListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(locationName, targetTypeName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage( - locationName, - targetTypeName, - options, - settings, - ); - }, - }; - } - - private async *listPagingPage( - locationName: string, - targetTypeName: string, - options?: CapabilityTypesListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: CapabilityTypesListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(locationName, targetTypeName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext( - locationName, - targetTypeName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - locationName: string, - targetTypeName: string, - options?: CapabilityTypesListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - locationName, - targetTypeName, - options, - )) { - yield* page; - } - } - - /** - * Get a list of Capability Type resources for given Target Type and location. - * @param locationName String that represents a Location resource name. - * @param targetTypeName String that represents a Target Type resource name. - * @param options The options parameters. - */ - private _list( - locationName: string, - targetTypeName: string, - options?: CapabilityTypesListOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { locationName, targetTypeName, options }, - listOperationSpec, - ); - } - - /** - * Get a Capability Type resource for given Target Type and location. - * @param locationName String that represents a Location resource name. - * @param targetTypeName String that represents a Target Type resource name. - * @param capabilityTypeName String that represents a Capability Type resource name. - * @param options The options parameters. - */ - get( - locationName: string, - targetTypeName: string, - capabilityTypeName: string, - options?: CapabilityTypesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { locationName, targetTypeName, capabilityTypeName, options }, - getOperationSpec, - ); - } - - /** - * ListNext - * @param locationName String that represents a Location resource name. - * @param targetTypeName String that represents a Target Type resource name. - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - locationName: string, - targetTypeName: string, - nextLink: string, - options?: CapabilityTypesListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { locationName, targetTypeName, nextLink, options }, - listNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CapabilityTypeListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion, Parameters.continuationToken], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.locationName, - Parameters.targetTypeName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CapabilityType, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.locationName, - Parameters.targetTypeName, - Parameters.capabilityTypeName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CapabilityTypeListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink, - Parameters.locationName, - Parameters.targetTypeName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/chaos/arm-chaos/src/operations/experiments.ts b/sdk/chaos/arm-chaos/src/operations/experiments.ts deleted file mode 100644 index 06909a5c6de5..000000000000 --- a/sdk/chaos/arm-chaos/src/operations/experiments.ts +++ /dev/null @@ -1,1172 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { Experiments } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { ChaosManagementClient } from "../chaosManagementClient"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl"; -import { - Experiment, - ExperimentsListAllNextOptionalParams, - ExperimentsListAllOptionalParams, - ExperimentsListAllResponse, - ExperimentsListNextOptionalParams, - ExperimentsListOptionalParams, - ExperimentsListResponse, - ExperimentExecution, - ExperimentsListAllExecutionsNextOptionalParams, - ExperimentsListAllExecutionsOptionalParams, - ExperimentsListAllExecutionsResponse, - ExperimentsDeleteOptionalParams, - ExperimentsGetOptionalParams, - ExperimentsGetResponse, - ExperimentsCreateOrUpdateOptionalParams, - ExperimentsCreateOrUpdateResponse, - ExperimentUpdate, - ExperimentsUpdateOptionalParams, - ExperimentsUpdateResponse, - ExperimentsCancelOptionalParams, - ExperimentsStartOptionalParams, - ExperimentsGetExecutionOptionalParams, - ExperimentsGetExecutionResponse, - ExperimentsExecutionDetailsOptionalParams, - ExperimentsExecutionDetailsResponse, - ExperimentsListAllNextResponse, - ExperimentsListNextResponse, - ExperimentsListAllExecutionsNextResponse, -} from "../models"; - -/// -/** Class containing Experiments operations. */ -export class ExperimentsImpl implements Experiments { - private readonly client: ChaosManagementClient; - - /** - * Initialize a new instance of the class Experiments class. - * @param client Reference to the service client - */ - constructor(client: ChaosManagementClient) { - this.client = client; - } - - /** - * Get a list of Experiment resources in a subscription. - * @param options The options parameters. - */ - public listAll( - options?: ExperimentsListAllOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listAllPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listAllPagingPage(options, settings); - }, - }; - } - - private async *listAllPagingPage( - options?: ExperimentsListAllOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: ExperimentsListAllResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listAll(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listAllNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listAllPagingAll( - options?: ExperimentsListAllOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listAllPagingPage(options)) { - yield* page; - } - } - - /** - * Get a list of Experiment resources in a resource group. - * @param resourceGroupName String that represents an Azure resource group. - * @param options The options parameters. - */ - public list( - resourceGroupName: string, - options?: ExperimentsListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(resourceGroupName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(resourceGroupName, options, settings); - }, - }; - } - - private async *listPagingPage( - resourceGroupName: string, - options?: ExperimentsListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: ExperimentsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(resourceGroupName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext( - resourceGroupName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - resourceGroupName: string, - options?: ExperimentsListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(resourceGroupName, options)) { - yield* page; - } - } - - /** - * Get a list of executions of an Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - public listAllExecutions( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsListAllExecutionsOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listAllExecutionsPagingAll( - resourceGroupName, - experimentName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listAllExecutionsPagingPage( - resourceGroupName, - experimentName, - options, - settings, - ); - }, - }; - } - - private async *listAllExecutionsPagingPage( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsListAllExecutionsOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: ExperimentsListAllExecutionsResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listAllExecutions( - resourceGroupName, - experimentName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listAllExecutionsNext( - resourceGroupName, - experimentName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listAllExecutionsPagingAll( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsListAllExecutionsOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listAllExecutionsPagingPage( - resourceGroupName, - experimentName, - options, - )) { - yield* page; - } - } - - /** - * Get a list of Experiment resources in a subscription. - * @param options The options parameters. - */ - private _listAll( - options?: ExperimentsListAllOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ options }, listAllOperationSpec); - } - - /** - * Get a list of Experiment resources in a resource group. - * @param resourceGroupName String that represents an Azure resource group. - * @param options The options parameters. - */ - private _list( - resourceGroupName: string, - options?: ExperimentsListOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, options }, - listOperationSpec, - ); - } - - /** - * Delete a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsDeleteOptionalParams, - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, experimentName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Delete a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - experimentName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Get a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, options }, - getOperationSpec, - ); - } - - /** - * Create or update a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - experimentName: string, - experiment: Experiment, - options?: ExperimentsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ExperimentsCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, experimentName, experiment, options }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - ExperimentsCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create or update a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - experimentName: string, - experiment: Experiment, - options?: ExperimentsCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - experimentName, - experiment, - options, - ); - return poller.pollUntilDone(); - } - - /** - * The operation to update an experiment. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - experimentName: string, - experiment: ExperimentUpdate, - options?: ExperimentsUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ExperimentsUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, experimentName, experiment, options }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - ExperimentsUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * The operation to update an experiment. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - experimentName: string, - experiment: ExperimentUpdate, - options?: ExperimentsUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - experimentName, - experiment, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Cancel a running Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - async beginCancel( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsCancelOptionalParams, - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, experimentName, options }, - spec: cancelOperationSpec, - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Cancel a running Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - async beginCancelAndWait( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsCancelOptionalParams, - ): Promise { - const poller = await this.beginCancel( - resourceGroupName, - experimentName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Start a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - async beginStart( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsStartOptionalParams, - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, experimentName, options }, - spec: startOperationSpec, - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Start a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - async beginStartAndWait( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsStartOptionalParams, - ): Promise { - const poller = await this.beginStart( - resourceGroupName, - experimentName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Get a list of executions of an Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - private _listAllExecutions( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsListAllExecutionsOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, options }, - listAllExecutionsOperationSpec, - ); - } - - /** - * Get an execution of an Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. - * @param options The options parameters. - */ - getExecution( - resourceGroupName: string, - experimentName: string, - executionId: string, - options?: ExperimentsGetExecutionOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, executionId, options }, - getExecutionOperationSpec, - ); - } - - /** - * Execution details of an experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. - * @param options The options parameters. - */ - executionDetails( - resourceGroupName: string, - experimentName: string, - executionId: string, - options?: ExperimentsExecutionDetailsOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, executionId, options }, - executionDetailsOperationSpec, - ); - } - - /** - * ListAllNext - * @param nextLink The nextLink from the previous successful call to the ListAll method. - * @param options The options parameters. - */ - private _listAllNext( - nextLink: string, - options?: ExperimentsListAllNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listAllNextOperationSpec, - ); - } - - /** - * ListNext - * @param resourceGroupName String that represents an Azure resource group. - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - resourceGroupName: string, - nextLink: string, - options?: ExperimentsListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, nextLink, options }, - listNextOperationSpec, - ); - } - - /** - * ListAllExecutionsNext - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param nextLink The nextLink from the previous successful call to the ListAllExecutions method. - * @param options The options parameters. - */ - private _listAllExecutionsNext( - resourceGroupName: string, - experimentName: string, - nextLink: string, - options?: ExperimentsListAllExecutionsNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, nextLink, options }, - listAllExecutionsNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listAllOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/experiments", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ExperimentListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.continuationToken, - Parameters.running, - ], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer, -}; -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ExperimentListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.continuationToken, - Parameters.running, - ], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.experimentName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Experiment, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.experimentName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Experiment, - }, - 201: { - bodyMapper: Mappers.Experiment, - }, - 202: { - bodyMapper: Mappers.Experiment, - }, - 204: { - bodyMapper: Mappers.Experiment, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.experiment, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.experimentName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.Experiment, - }, - 201: { - bodyMapper: Mappers.Experiment, - }, - 202: { - bodyMapper: Mappers.Experiment, - }, - 204: { - bodyMapper: Mappers.Experiment, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.experiment1, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.experimentName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const cancelOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel", - httpMethod: "POST", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.experimentName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const startOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start", - httpMethod: "POST", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.experimentName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listAllExecutionsOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ExperimentExecutionListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.experimentName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getExecutionOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ExperimentExecution, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.experimentName, - Parameters.executionId, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const executionDetailsOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}/getExecutionDetails", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.ExperimentExecutionDetails, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.experimentName, - Parameters.executionId, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listAllNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ExperimentListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ExperimentListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listAllExecutionsNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ExperimentExecutionListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.nextLink, - Parameters.experimentName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/chaos/arm-chaos/src/operations/index.ts b/sdk/chaos/arm-chaos/src/operations/index.ts deleted file mode 100644 index a8dac204e1bb..000000000000 --- a/sdk/chaos/arm-chaos/src/operations/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./capabilities"; -export * from "./capabilityTypes"; -export * from "./experiments"; -export * from "./operationStatuses"; -export * from "./operations"; -export * from "./targetTypes"; -export * from "./targets"; diff --git a/sdk/chaos/arm-chaos/src/operations/operationStatuses.ts b/sdk/chaos/arm-chaos/src/operations/operationStatuses.ts deleted file mode 100644 index 1c562cee2da1..000000000000 --- a/sdk/chaos/arm-chaos/src/operations/operationStatuses.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the 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 { OperationStatuses } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { ChaosManagementClient } from "../chaosManagementClient"; -import { - OperationStatusesGetOptionalParams, - OperationStatusesGetResponse, -} from "../models"; - -/** Class containing OperationStatuses operations. */ -export class OperationStatusesImpl implements OperationStatuses { - private readonly client: ChaosManagementClient; - - /** - * Initialize a new instance of the class OperationStatuses class. - * @param client Reference to the service client - */ - constructor(client: ChaosManagementClient) { - this.client = client; - } - - /** - * Get the status of a long running azure asynchronous operation. - * @param location The name of the Azure region. - * @param asyncOperationId The operation Id. - * @param options The options parameters. - */ - get( - location: string, - asyncOperationId: string, - options?: OperationStatusesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { location, asyncOperationId, options }, - getOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/operationStatuses/{asyncOperationId}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationStatus, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.location, - Parameters.asyncOperationId, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/chaos/arm-chaos/src/operations/operations.ts b/sdk/chaos/arm-chaos/src/operations/operations.ts deleted file mode 100644 index 091356fee0e5..000000000000 --- a/sdk/chaos/arm-chaos/src/operations/operations.ts +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { Operations } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { ChaosManagementClient } from "../chaosManagementClient"; -import { - Operation, - OperationsListAllNextOptionalParams, - OperationsListAllOptionalParams, - OperationsListAllResponse, - OperationsListAllNextResponse, -} from "../models"; - -/// -/** Class containing Operations operations. */ -export class OperationsImpl implements Operations { - private readonly client: ChaosManagementClient; - - /** - * Initialize a new instance of the class Operations class. - * @param client Reference to the service client - */ - constructor(client: ChaosManagementClient) { - this.client = client; - } - - /** - * Get a list all available Operations. - * @param options The options parameters. - */ - public listAll( - options?: OperationsListAllOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listAllPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listAllPagingPage(options, settings); - }, - }; - } - - private async *listAllPagingPage( - options?: OperationsListAllOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: OperationsListAllResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listAll(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listAllNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listAllPagingAll( - options?: OperationsListAllOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listAllPagingPage(options)) { - yield* page; - } - } - - /** - * Get a list all available Operations. - * @param options The options parameters. - */ - private _listAll( - options?: OperationsListAllOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ options }, listAllOperationSpec); - } - - /** - * ListAllNext - * @param nextLink The nextLink from the previous successful call to the ListAll method. - * @param options The options parameters. - */ - private _listAllNext( - nextLink: string, - options?: OperationsListAllNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listAllNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listAllOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.Chaos/operations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer, -}; -const listAllNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [Parameters.$host, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/chaos/arm-chaos/src/operations/targetTypes.ts b/sdk/chaos/arm-chaos/src/operations/targetTypes.ts deleted file mode 100644 index 9f241e48a2eb..000000000000 --- a/sdk/chaos/arm-chaos/src/operations/targetTypes.ts +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { TargetTypes } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { ChaosManagementClient } from "../chaosManagementClient"; -import { - TargetType, - TargetTypesListNextOptionalParams, - TargetTypesListOptionalParams, - TargetTypesListResponse, - TargetTypesGetOptionalParams, - TargetTypesGetResponse, - TargetTypesListNextResponse, -} from "../models"; - -/// -/** Class containing TargetTypes operations. */ -export class TargetTypesImpl implements TargetTypes { - private readonly client: ChaosManagementClient; - - /** - * Initialize a new instance of the class TargetTypes class. - * @param client Reference to the service client - */ - constructor(client: ChaosManagementClient) { - this.client = client; - } - - /** - * Get a list of Target Type resources for given location. - * @param locationName String that represents a Location resource name. - * @param options The options parameters. - */ - public list( - locationName: string, - options?: TargetTypesListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(locationName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(locationName, options, settings); - }, - }; - } - - private async *listPagingPage( - locationName: string, - options?: TargetTypesListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: TargetTypesListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(locationName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(locationName, continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - locationName: string, - options?: TargetTypesListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(locationName, options)) { - yield* page; - } - } - - /** - * Get a list of Target Type resources for given location. - * @param locationName String that represents a Location resource name. - * @param options The options parameters. - */ - private _list( - locationName: string, - options?: TargetTypesListOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { locationName, options }, - listOperationSpec, - ); - } - - /** - * Get a Target Type resources for given location. - * @param locationName String that represents a Location resource name. - * @param targetTypeName String that represents a Target Type resource name. - * @param options The options parameters. - */ - get( - locationName: string, - targetTypeName: string, - options?: TargetTypesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { locationName, targetTypeName, options }, - getOperationSpec, - ); - } - - /** - * ListNext - * @param locationName String that represents a Location resource name. - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - locationName: string, - nextLink: string, - options?: TargetTypesListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { locationName, nextLink, options }, - listNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.TargetTypeListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion, Parameters.continuationToken], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.locationName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.TargetType, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.locationName, - Parameters.targetTypeName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.TargetTypeListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink, - Parameters.locationName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/chaos/arm-chaos/src/operations/targets.ts b/sdk/chaos/arm-chaos/src/operations/targets.ts deleted file mode 100644 index 1d84dc1cf961..000000000000 --- a/sdk/chaos/arm-chaos/src/operations/targets.ts +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { Targets } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { ChaosManagementClient } from "../chaosManagementClient"; -import { - Target, - TargetsListNextOptionalParams, - TargetsListOptionalParams, - TargetsListResponse, - TargetsGetOptionalParams, - TargetsGetResponse, - TargetsDeleteOptionalParams, - TargetsCreateOrUpdateOptionalParams, - TargetsCreateOrUpdateResponse, - TargetsListNextResponse, -} from "../models"; - -/// -/** Class containing Targets operations. */ -export class TargetsImpl implements Targets { - private readonly client: ChaosManagementClient; - - /** - * Initialize a new instance of the class Targets class. - * @param client Reference to the service client - */ - constructor(client: ChaosManagementClient) { - this.client = client; - } - - /** - * Get a list of Target resources that extend a tracked regional resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param options The options parameters. - */ - public list( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - options?: TargetsListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll( - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage( - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - options, - settings, - ); - }, - }; - } - - private async *listPagingPage( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - options?: TargetsListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: TargetsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list( - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext( - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - options?: TargetsListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - options, - )) { - yield* page; - } - } - - /** - * Get a list of Target resources that extend a tracked regional resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param options The options parameters. - */ - private _list( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - options?: TargetsListOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - options, - }, - listOperationSpec, - ); - } - - /** - * Get a Target resource that extends a tracked regional resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - options?: TargetsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - targetName, - options, - }, - getOperationSpec, - ); - } - - /** - * Delete a Target resource that extends a tracked regional resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param options The options parameters. - */ - delete( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - options?: TargetsDeleteOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - targetName, - options, - }, - deleteOperationSpec, - ); - } - - /** - * Create or update a Target resource that extends a tracked regional resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param target Target resource to be created or updated. - * @param options The options parameters. - */ - createOrUpdate( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - target: Target, - options?: TargetsCreateOrUpdateOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - targetName, - target, - options, - }, - createOrUpdateOperationSpec, - ); - } - - /** - * ListNext - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - nextLink: string, - options?: TargetsListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - parentProviderNamespace, - parentResourceType, - parentResourceName, - nextLink, - options, - }, - listNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.TargetListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion, Parameters.continuationToken], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.parentProviderNamespace, - Parameters.parentResourceType, - Parameters.parentResourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Target, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.parentProviderNamespace, - Parameters.parentResourceType, - Parameters.parentResourceName, - Parameters.targetName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.parentProviderNamespace, - Parameters.parentResourceType, - Parameters.parentResourceName, - Parameters.targetName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Target, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.target, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.parentProviderNamespace, - Parameters.parentResourceType, - Parameters.parentResourceName, - Parameters.targetName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.TargetListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.parentProviderNamespace, - Parameters.parentResourceType, - Parameters.parentResourceName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/chaos/arm-chaos/src/operationsInterfaces/capabilities.ts b/sdk/chaos/arm-chaos/src/operationsInterfaces/capabilities.ts deleted file mode 100644 index fc9dc09207d8..000000000000 --- a/sdk/chaos/arm-chaos/src/operationsInterfaces/capabilities.ts +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - Capability, - CapabilitiesListOptionalParams, - CapabilitiesGetOptionalParams, - CapabilitiesGetResponse, - CapabilitiesDeleteOptionalParams, - CapabilitiesCreateOrUpdateOptionalParams, - CapabilitiesCreateOrUpdateResponse, -} from "../models"; - -/// -/** Interface representing a Capabilities. */ -export interface Capabilities { - /** - * Get a list of Capability resources that extend a Target resource.. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param options The options parameters. - */ - list( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - options?: CapabilitiesListOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a Capability resource that extends a Target resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param capabilityName String that represents a Capability resource name. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - capabilityName: string, - options?: CapabilitiesGetOptionalParams, - ): Promise; - /** - * Delete a Capability that extends a Target resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param capabilityName String that represents a Capability resource name. - * @param options The options parameters. - */ - delete( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - capabilityName: string, - options?: CapabilitiesDeleteOptionalParams, - ): Promise; - /** - * Create or update a Capability resource that extends a Target resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param capabilityName String that represents a Capability resource name. - * @param capability Capability resource to be created or updated. - * @param options The options parameters. - */ - createOrUpdate( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - capabilityName: string, - capability: Capability, - options?: CapabilitiesCreateOrUpdateOptionalParams, - ): Promise; -} diff --git a/sdk/chaos/arm-chaos/src/operationsInterfaces/capabilityTypes.ts b/sdk/chaos/arm-chaos/src/operationsInterfaces/capabilityTypes.ts deleted file mode 100644 index 330f070da1d4..000000000000 --- a/sdk/chaos/arm-chaos/src/operationsInterfaces/capabilityTypes.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - CapabilityType, - CapabilityTypesListOptionalParams, - CapabilityTypesGetOptionalParams, - CapabilityTypesGetResponse, -} from "../models"; - -/// -/** Interface representing a CapabilityTypes. */ -export interface CapabilityTypes { - /** - * Get a list of Capability Type resources for given Target Type and location. - * @param locationName String that represents a Location resource name. - * @param targetTypeName String that represents a Target Type resource name. - * @param options The options parameters. - */ - list( - locationName: string, - targetTypeName: string, - options?: CapabilityTypesListOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a Capability Type resource for given Target Type and location. - * @param locationName String that represents a Location resource name. - * @param targetTypeName String that represents a Target Type resource name. - * @param capabilityTypeName String that represents a Capability Type resource name. - * @param options The options parameters. - */ - get( - locationName: string, - targetTypeName: string, - capabilityTypeName: string, - options?: CapabilityTypesGetOptionalParams, - ): Promise; -} diff --git a/sdk/chaos/arm-chaos/src/operationsInterfaces/experiments.ts b/sdk/chaos/arm-chaos/src/operationsInterfaces/experiments.ts deleted file mode 100644 index 3b717738b43b..000000000000 --- a/sdk/chaos/arm-chaos/src/operationsInterfaces/experiments.ts +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - Experiment, - ExperimentsListAllOptionalParams, - ExperimentsListOptionalParams, - ExperimentExecution, - ExperimentsListAllExecutionsOptionalParams, - ExperimentsDeleteOptionalParams, - ExperimentsGetOptionalParams, - ExperimentsGetResponse, - ExperimentsCreateOrUpdateOptionalParams, - ExperimentsCreateOrUpdateResponse, - ExperimentUpdate, - ExperimentsUpdateOptionalParams, - ExperimentsUpdateResponse, - ExperimentsCancelOptionalParams, - ExperimentsStartOptionalParams, - ExperimentsGetExecutionOptionalParams, - ExperimentsGetExecutionResponse, - ExperimentsExecutionDetailsOptionalParams, - ExperimentsExecutionDetailsResponse, -} from "../models"; - -/// -/** Interface representing a Experiments. */ -export interface Experiments { - /** - * Get a list of Experiment resources in a subscription. - * @param options The options parameters. - */ - listAll( - options?: ExperimentsListAllOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a list of Experiment resources in a resource group. - * @param resourceGroupName String that represents an Azure resource group. - * @param options The options parameters. - */ - list( - resourceGroupName: string, - options?: ExperimentsListOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a list of executions of an Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - listAllExecutions( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsListAllExecutionsOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Delete a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsDeleteOptionalParams, - ): Promise, void>>; - /** - * Delete a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsDeleteOptionalParams, - ): Promise; - /** - * Get a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsGetOptionalParams, - ): Promise; - /** - * Create or update a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - experimentName: string, - experiment: Experiment, - options?: ExperimentsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ExperimentsCreateOrUpdateResponse - > - >; - /** - * Create or update a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - experimentName: string, - experiment: Experiment, - options?: ExperimentsCreateOrUpdateOptionalParams, - ): Promise; - /** - * The operation to update an experiment. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - experimentName: string, - experiment: ExperimentUpdate, - options?: ExperimentsUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ExperimentsUpdateResponse - > - >; - /** - * The operation to update an experiment. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - experimentName: string, - experiment: ExperimentUpdate, - options?: ExperimentsUpdateOptionalParams, - ): Promise; - /** - * Cancel a running Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - beginCancel( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsCancelOptionalParams, - ): Promise, void>>; - /** - * Cancel a running Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - beginCancelAndWait( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsCancelOptionalParams, - ): Promise; - /** - * Start a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - beginStart( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsStartOptionalParams, - ): Promise, void>>; - /** - * Start a Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param options The options parameters. - */ - beginStartAndWait( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsStartOptionalParams, - ): Promise; - /** - * Get an execution of an Experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. - * @param options The options parameters. - */ - getExecution( - resourceGroupName: string, - experimentName: string, - executionId: string, - options?: ExperimentsGetExecutionOptionalParams, - ): Promise; - /** - * Execution details of an experiment resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. - * @param options The options parameters. - */ - executionDetails( - resourceGroupName: string, - experimentName: string, - executionId: string, - options?: ExperimentsExecutionDetailsOptionalParams, - ): Promise; -} diff --git a/sdk/chaos/arm-chaos/src/operationsInterfaces/index.ts b/sdk/chaos/arm-chaos/src/operationsInterfaces/index.ts deleted file mode 100644 index a8dac204e1bb..000000000000 --- a/sdk/chaos/arm-chaos/src/operationsInterfaces/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./capabilities"; -export * from "./capabilityTypes"; -export * from "./experiments"; -export * from "./operationStatuses"; -export * from "./operations"; -export * from "./targetTypes"; -export * from "./targets"; diff --git a/sdk/chaos/arm-chaos/src/operationsInterfaces/operationStatuses.ts b/sdk/chaos/arm-chaos/src/operationsInterfaces/operationStatuses.ts deleted file mode 100644 index 307733f15b49..000000000000 --- a/sdk/chaos/arm-chaos/src/operationsInterfaces/operationStatuses.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the 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 { - OperationStatusesGetOptionalParams, - OperationStatusesGetResponse, -} from "../models"; - -/** Interface representing a OperationStatuses. */ -export interface OperationStatuses { - /** - * Get the status of a long running azure asynchronous operation. - * @param location The name of the Azure region. - * @param asyncOperationId The operation Id. - * @param options The options parameters. - */ - get( - location: string, - asyncOperationId: string, - options?: OperationStatusesGetOptionalParams, - ): Promise; -} diff --git a/sdk/chaos/arm-chaos/src/operationsInterfaces/operations.ts b/sdk/chaos/arm-chaos/src/operationsInterfaces/operations.ts deleted file mode 100644 index 6894aae3c495..000000000000 --- a/sdk/chaos/arm-chaos/src/operationsInterfaces/operations.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { Operation, OperationsListAllOptionalParams } from "../models"; - -/// -/** Interface representing a Operations. */ -export interface Operations { - /** - * Get a list all available Operations. - * @param options The options parameters. - */ - listAll( - options?: OperationsListAllOptionalParams, - ): PagedAsyncIterableIterator; -} diff --git a/sdk/chaos/arm-chaos/src/operationsInterfaces/targetTypes.ts b/sdk/chaos/arm-chaos/src/operationsInterfaces/targetTypes.ts deleted file mode 100644 index 652bdeb9f03c..000000000000 --- a/sdk/chaos/arm-chaos/src/operationsInterfaces/targetTypes.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - TargetType, - TargetTypesListOptionalParams, - TargetTypesGetOptionalParams, - TargetTypesGetResponse, -} from "../models"; - -/// -/** Interface representing a TargetTypes. */ -export interface TargetTypes { - /** - * Get a list of Target Type resources for given location. - * @param locationName String that represents a Location resource name. - * @param options The options parameters. - */ - list( - locationName: string, - options?: TargetTypesListOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a Target Type resources for given location. - * @param locationName String that represents a Location resource name. - * @param targetTypeName String that represents a Target Type resource name. - * @param options The options parameters. - */ - get( - locationName: string, - targetTypeName: string, - options?: TargetTypesGetOptionalParams, - ): Promise; -} diff --git a/sdk/chaos/arm-chaos/src/operationsInterfaces/targets.ts b/sdk/chaos/arm-chaos/src/operationsInterfaces/targets.ts deleted file mode 100644 index d58ad7628e0a..000000000000 --- a/sdk/chaos/arm-chaos/src/operationsInterfaces/targets.ts +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - Target, - TargetsListOptionalParams, - TargetsGetOptionalParams, - TargetsGetResponse, - TargetsDeleteOptionalParams, - TargetsCreateOrUpdateOptionalParams, - TargetsCreateOrUpdateResponse, -} from "../models"; - -/// -/** Interface representing a Targets. */ -export interface Targets { - /** - * Get a list of Target resources that extend a tracked regional resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param options The options parameters. - */ - list( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - options?: TargetsListOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a Target resource that extends a tracked regional resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - options?: TargetsGetOptionalParams, - ): Promise; - /** - * Delete a Target resource that extends a tracked regional resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param options The options parameters. - */ - delete( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - options?: TargetsDeleteOptionalParams, - ): Promise; - /** - * Create or update a Target resource that extends a tracked regional resource. - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param target Target resource to be created or updated. - * @param options The options parameters. - */ - createOrUpdate( - resourceGroupName: string, - parentProviderNamespace: string, - parentResourceType: string, - parentResourceName: string, - targetName: string, - target: Target, - options?: TargetsCreateOrUpdateOptionalParams, - ): Promise; -} diff --git a/sdk/chaos/arm-chaos/src/pagingHelper.ts b/sdk/chaos/arm-chaos/src/pagingHelper.ts deleted file mode 100644 index 205cccc26592..000000000000 --- a/sdk/chaos/arm-chaos/src/pagingHelper.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export interface PageInfo { - continuationToken?: string; -} - -const pageMap = new WeakMap(); - -/** - * Given the last `.value` produced by the `byPage` iterator, - * returns a continuation token that can be used to begin paging from - * that point later. - * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. - * @returns The continuation token that can be passed into byPage() during future calls. - */ -export function getContinuationToken(page: unknown): string | undefined { - if (typeof page !== "object" || page === null) { - return undefined; - } - return pageMap.get(page)?.continuationToken; -} - -export function setContinuationToken( - page: unknown, - continuationToken: string | undefined, -): void { - if (typeof page !== "object" || page === null || !continuationToken) { - return; - } - const pageInfo = pageMap.get(page) ?? {}; - pageInfo.continuationToken = continuationToken; - pageMap.set(page, pageInfo); -} diff --git a/sdk/chaos/arm-chaos/src/restorePollerHelpers.ts b/sdk/chaos/arm-chaos/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..ff44b358a44f --- /dev/null +++ b/sdk/chaos/arm-chaos/src/restorePollerHelpers.ts @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ChaosManagementClient } from "./chaosManagementClient.js"; +import { + _experimentsCreateOrUpdateDeserialize, + _experimentsUpdateDeserialize, + _experimentsDeleteDeserialize, + _experimentsCancelDeserialize, + _experimentsStartDeserialize, +} from "./api/experiments/index.js"; +import { + _privateAccessesCreateOrUpdateDeserialize, + _privateAccessesUpdateDeserialize, + _privateAccessesDeleteDeserialize, +} from "./api/privateAccesses/index.js"; +import { _privateEndpointConnectionsDeleteAPrivateEndpointConnectionDeserialize } from "./api/privateEndpointConnections/index.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; +import { + PollerLike, + OperationState, + deserializeState, + ResourceLocationConfig, +} from "@azure/core-lro"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: ChaosManagementClient, + serializedState: string, + sourceOperation: (...args: any[]) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + }, + ); +} + +interface DeserializationHelper { + deserializer: Function; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}": + { + deserializer: _experimentsCreateOrUpdateDeserialize, + expectedStatuses: ["200", "201"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}": + { + deserializer: _experimentsUpdateDeserialize, + expectedStatuses: ["200", "202"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}": + { + deserializer: _experimentsDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel": + { + deserializer: _experimentsCancelDeserialize, + expectedStatuses: ["202", "200"], + }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start": + { + deserializer: _experimentsStartDeserialize, + expectedStatuses: ["202", "200"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/privateAccesses/{privateAccessName}": + { + deserializer: _privateAccessesCreateOrUpdateDeserialize, + expectedStatuses: ["200", "201"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/privateAccesses/{privateAccessName}": + { + deserializer: _privateAccessesUpdateDeserialize, + expectedStatuses: ["200", "202"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/privateAccesses/{privateAccessName}": + { + deserializer: _privateAccessesDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/privateAccesses/{privateAccessName}/privateEndpointConnections/{privateEndpointConnectionName}": + { + deserializer: _privateEndpointConnectionsDeleteAPrivateEndpointConnectionDeserialize, + expectedStatuses: ["202", "204", "200"], + }, +}; + +function getDeserializationHelper( + urlStr: string, + method: string, +): DeserializationHelper | undefined { + const path = new URL(urlStr).pathname; + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: DeserializationHelper | undefined; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(deserializeMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/sdk/chaos/arm-chaos/src/static-helpers/pagingHelpers.ts b/sdk/chaos/arm-chaos/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..ce33af5f4178 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + const result = + pageLink === undefined + ? await getInitialResponse() + : await client.pathUnchecked(pageLink).get(); + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} diff --git a/sdk/chaos/arm-chaos/src/static-helpers/pollingHelpers.ts b/sdk/chaos/arm-chaos/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..f01c41bab69d --- /dev/null +++ b/sdk/chaos/arm-chaos/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + createHttpPoller, + OperationResponse, +} from "@azure/core-lro"; + +import { Client, PathUncheckedResponse, createRestError } from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; +} +export function getLongRunningPoller( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse } = options; + if (!restoreFrom && !getInitialResponse) { + throw new Error("Either restoreFrom or getInitialResponse must be specified"); + } + let initialResponse: TResponse | undefined = undefined; + const pollAbortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + if (!getInitialResponse) { + throw new Error("getInitialResponse is required when initializing a new poller"); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse, expectedStatuses); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + response = await client.pathUnchecked(path).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + + return getLroResponse(response as TResponse, expectedStatuses); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, + expectedStatuses: string[], +): OperationResponse { + if (!expectedStatuses.includes(response.status)) { + throw createRestError(response); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} diff --git a/sdk/chaos/arm-chaos/test/chaos_examples.spec.ts b/sdk/chaos/arm-chaos/test/chaos_examples.spec.ts deleted file mode 100644 index 8f7688163aaf..000000000000 --- a/sdk/chaos/arm-chaos/test/chaos_examples.spec.ts +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - env, - Recorder, - RecorderStartOptions, - delay, - isPlaybackMode, -} from "@azure-tools/test-recorder"; -import { createTestCredential } from "@azure-tools/test-credential"; -import { assert } from "chai"; -import { Context } from "mocha"; -import { ChaosManagementClient } from "../src/chaosManagementClient"; -import { CosmosDBManagementClient } from "@azure/arm-cosmosdb" - -const replaceableVariables: Record = { - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - SUBSCRIPTION_ID: "88888888-8888-8888-8888-888888888888" -}; - -const recorderOptions: RecorderStartOptions = { - envSetupForPlayback: replaceableVariables, - removeCentralSanitizers: [ - "AZSDK3493", // .name in the body is not a secret and is listed below in the beforeEach section - "AZSDK3430", // .id in the body is not a secret and is listed below in the beforeEach section - ], -}; - -export const testPollingOptions = { - updateIntervalInMs: isPlaybackMode() ? 0 : undefined, -}; - -describe("Chaos test", () => { - let recorder: Recorder; - let subscriptionId: string; - let client: ChaosManagementClient; - let location: string; - let resourceGroup: string; - let experimentName: string; - let cos_client: CosmosDBManagementClient; - let cosmosdbName: string; - let targetid: string; - let parentProviderNamespace: string; - let parentResourceType: string; - let targetName: string; - - beforeEach(async function (this: Context) { - recorder = new Recorder(this.currentTest); - await recorder.start(recorderOptions); - subscriptionId = env.SUBSCRIPTION_ID || ''; - // This is an example of how the environment variables are used - const credential = createTestCredential(); - client = new ChaosManagementClient(credential, subscriptionId, recorder.configureClientOptions({})); - cos_client = new CosmosDBManagementClient(credential, subscriptionId, recorder.configureClientOptions({})); - location = "eastus"; - resourceGroup = "myjstest"; - experimentName = "exampleExperiment11"; - cosmosdbName = "test-123aaa" - parentProviderNamespace = "Microsoft.DocumentDB"; - parentResourceType = "databaseAccounts"; - targetName = "Microsoft-CosmosDB"; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("chaos dependence create", async function () { - const cosmosdb_res = await cos_client.databaseAccounts.beginCreateOrUpdateAndWait(resourceGroup, cosmosdbName, { - databaseAccountOfferType: "Standard", - locations: [ - // { - // failoverPriority: 2, - // locationName: "southcentralus", - // isZoneRedundant: false - // }, - { - locationName: "eastus", - failoverPriority: 1 - }, - { - locationName: "westus", - failoverPriority: 0 - } - ], - location: location, - createMode: "Default" - }, testPollingOptions); - assert.equal(cosmosdb_res.name, cosmosdbName); - targetid = String(cosmosdb_res.id); - }); - - it("target create test", async function () { - const res = await client.targets.createOrUpdate( - resourceGroup, - parentProviderNamespace, - parentResourceType, - cosmosdbName, - targetName, - { - location, - properties: { - identities: [ - { type: "CertificateSubjectIssuer", subject: "CN=example.subject" } - ] - } - } - ); - }); - - it("experiment create test", async function () { - const res = await client.experiments.beginCreateOrUpdateAndWait(resourceGroup, experimentName, { - identity: { type: "SystemAssigned" }, - location: "eastus", - selectors: [ - { - type: "List", - id: "f15dd483-3281-4e95-bcbe-cbf535d0de98", - targets: [ - { - type: "ChaosTarget", - id: targetid - } - ] - } - ], - 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" - } - ] - } - ] - } - ] - }, - testPollingOptions); - assert.equal(res.name, experimentName); - }); - - it("experiment get test", async function () { - const res = await client.experiments.get(resourceGroup, experimentName); - assert.equal(res.name, experimentName); - }); - - it("targets get test", async function () { - const res = await client.targets.get(resourceGroup, - parentProviderNamespace, - parentResourceType, - cosmosdbName, - targetName - ); - assert.equal(res.name, targetName); - }); - - it("experiment list test", async function () { - const resArray = new Array(); - for await (let item of client.experiments.list(resourceGroup)) { - resArray.push(item); - } - assert.equal(resArray.length, 1); - }); - - it("targets list test", async function () { - const resArray = new Array(); - for await (let item of client.targets.list(resourceGroup, - parentProviderNamespace, - parentResourceType, - cosmosdbName)) { - resArray.push(item); - } - assert.equal(resArray.length, 1); - }); - - it("experiment delete test", async function () { - const resArray = new Array(); - const res = await client.experiments.beginDeleteAndWait(resourceGroup, experimentName, testPollingOptions) - for await (let item of client.experiments.list(resourceGroup)) { - resArray.push(item); - } - assert.equal(resArray.length, 0); - }); - - it("target delete test", async function () { - const resArray = new Array(); - const res = await client.targets.delete(resourceGroup, - parentProviderNamespace, - parentResourceType, - cosmosdbName, - targetName) - for await (let item of client.targets.list(resourceGroup, - parentProviderNamespace, - parentResourceType, - cosmosdbName)) { - resArray.push(item); - } - assert.equal(resArray.length, 0); - }); - - it("chaos dependence delete test", async function () { - const resArray = new Array(); - const res = await cos_client.databaseAccounts.beginDeleteAndWait(resourceGroup, cosmosdbName, testPollingOptions) - for await (let item of cos_client.databaseAccounts.listByResourceGroup(resourceGroup)) { - resArray.push(item); - } - assert.equal(resArray.length, 0); - }).timeout(3600000); -}); diff --git a/sdk/chaos/arm-chaos/test/public/sampleTest.spec.ts b/sdk/chaos/arm-chaos/test/public/sampleTest.spec.ts new file mode 100644 index 000000000000..6cf37d4513a0 --- /dev/null +++ b/sdk/chaos/arm-chaos/test/public/sampleTest.spec.ts @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { assert, beforeEach, afterEach, it, describe } from "vitest"; + +describe("My test", () => { + // let recorder: Recorder; + + beforeEach(async function () { + // recorder = await createRecorder(this); + }); + + afterEach(async function () { + // await recorder.stop(); + }); + + it("sample test", async function () { + assert.equal(1, 1); + }); +}); diff --git a/sdk/chaos/arm-chaos/test/public/utils/recordedClient.ts b/sdk/chaos/arm-chaos/test/public/utils/recordedClient.ts new file mode 100644 index 000000000000..14dcd9fa397c --- /dev/null +++ b/sdk/chaos/arm-chaos/test/public/utils/recordedClient.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Recorder, RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder"; + +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "azure_subscription_id", +}; + +const recorderEnvSetup: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables, +}; + +/** + * creates the recorder and reads the environment variables from the `.env` file. + * Should be called first in the test suite to make sure environment variables are + * read before they are being used. + */ +export async function createRecorder(context: VitestTestContext): Promise { + const recorder = new Recorder(context); + await recorder.start(recorderEnvSetup); + return recorder; +} diff --git a/sdk/chaos/arm-chaos/tsconfig.browser.config.json b/sdk/chaos/arm-chaos/tsconfig.browser.config.json new file mode 100644 index 000000000000..f772e6eb3b76 --- /dev/null +++ b/sdk/chaos/arm-chaos/tsconfig.browser.config.json @@ -0,0 +1,10 @@ +{ + "extends": "./.tshy/build.json", + "include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.spec.ts", "./test/**/*.mts"], + "exclude": ["./test/**/node/**/*.ts"], + "compilerOptions": { + "outDir": "./dist-test/browser", + "rootDir": ".", + "skipLibCheck": true + } +} diff --git a/sdk/chaos/arm-chaos/tsconfig.json b/sdk/chaos/arm-chaos/tsconfig.json index cb248642ee7c..19ceb382b521 100644 --- a/sdk/chaos/arm-chaos/tsconfig.json +++ b/sdk/chaos/arm-chaos/tsconfig.json @@ -1,33 +1,13 @@ { - "compilerOptions": { - "module": "es6", - "moduleResolution": "node", - "strict": true, - "target": "es6", - "sourceMap": true, - "declarationMap": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "lib": [ - "es6", - "dom" - ], - "declaration": true, - "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-chaos": [ - "./src/index" - ] + "references": [ + { + "path": "./tsconfig.src.json" + }, + { + "path": "./tsconfig.samples.json" + }, + { + "path": "./tsconfig.test.json" } - }, - "include": [ - "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" - ], - "exclude": [ - "node_modules" ] -} \ No newline at end of file +} diff --git a/sdk/chaos/arm-chaos/tsconfig.samples.json b/sdk/chaos/arm-chaos/tsconfig.samples.json new file mode 100644 index 000000000000..a5602930e363 --- /dev/null +++ b/sdk/chaos/arm-chaos/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure/arm-chaos": ["./dist/esm"] + } + } +} diff --git a/sdk/chaos/arm-chaos/tsconfig.src.json b/sdk/chaos/arm-chaos/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/chaos/arm-chaos/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/chaos/arm-chaos/tsconfig.test.json b/sdk/chaos/arm-chaos/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/chaos/arm-chaos/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/chaos/arm-chaos/tsp-location.yaml b/sdk/chaos/arm-chaos/tsp-location.yaml new file mode 100644 index 000000000000..988f1c06023f --- /dev/null +++ b/sdk/chaos/arm-chaos/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/chaos/Chaos.Management +commit: 38ec2b5336f3d2e8fa1087f6bc3362b43164312f +repo: ../azure-rest-api-specs +additionalDirectories: diff --git a/sdk/chaos/arm-chaos/vitest.browser.config.ts b/sdk/chaos/arm-chaos/vitest.browser.config.ts new file mode 100644 index 000000000000..b48c61b2ef46 --- /dev/null +++ b/sdk/chaos/arm-chaos/vitest.browser.config.ts @@ -0,0 +1,17 @@ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { defineConfig, mergeConfig } from "vitest/config"; +import viteConfig from "../../../vitest.browser.shared.config.ts"; + +export default mergeConfig( + viteConfig, + defineConfig({ + test: { + include: [ + "dist-test/browser/test/**/*.spec.js", + ], + }, + }), +); diff --git a/sdk/chaos/arm-chaos/vitest.config.ts b/sdk/chaos/arm-chaos/vitest.config.ts new file mode 100644 index 000000000000..cc5cd85d4131 --- /dev/null +++ b/sdk/chaos/arm-chaos/vitest.config.ts @@ -0,0 +1,7 @@ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import viteConfig from "../../../vitest.shared.config.ts"; + +export default viteConfig; diff --git a/sdk/chaos/arm-chaos/vitest.esm.config.ts b/sdk/chaos/arm-chaos/vitest.esm.config.ts new file mode 100644 index 000000000000..a70127279fc9 --- /dev/null +++ b/sdk/chaos/arm-chaos/vitest.esm.config.ts @@ -0,0 +1,12 @@ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { mergeConfig } from "vitest/config"; +import vitestConfig from "./vitest.config.ts"; +import vitestEsmConfig from "../../../vitest.esm.shared.config.ts"; + +export default mergeConfig( + vitestConfig, + vitestEsmConfig +); diff --git a/sdk/chaos/ci.mgmt.yml b/sdk/chaos/ci.mgmt.yml index 637c96398f9a..8d5832c75325 100644 --- a/sdk/chaos/ci.mgmt.yml +++ b/sdk/chaos/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -13,7 +13,6 @@ trigger: include: - sdk/chaos/arm-chaos - sdk/chaos/ci.mgmt.yml - pr: branches: include: @@ -27,7 +26,6 @@ pr: include: - sdk/chaos/arm-chaos - sdk/chaos/ci.mgmt.yml - extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: @@ -35,4 +33,3 @@ extends: Artifacts: - name: azure-arm-chaos safeName: azurearmchaos - \ No newline at end of file