diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 6767c3038392..12a0f788af09 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1807,6 +1807,16 @@ packages: lodash: 4.17.21 dev: false + /@microsoft/api-extractor-model@7.28.2(@types/node@14.18.63): + resolution: {integrity: sha512-vkojrM2fo3q4n4oPh4uUZdjJ2DxQ2+RnDQL/xhTWSRUNPF6P4QyrvY357HBxbnltKcYu+nNNolVqc6TIGQ73Ig==} + dependencies: + '@microsoft/tsdoc': 0.14.2 + '@microsoft/tsdoc-config': 0.16.2 + '@rushstack/node-core-library': 3.61.0(@types/node@14.18.63) + transitivePeerDependencies: + - '@types/node' + dev: false + /@microsoft/api-extractor-model@7.28.2(@types/node@16.18.55): resolution: {integrity: sha512-vkojrM2fo3q4n4oPh4uUZdjJ2DxQ2+RnDQL/xhTWSRUNPF6P4QyrvY357HBxbnltKcYu+nNNolVqc6TIGQ73Ig==} dependencies: @@ -1817,6 +1827,26 @@ packages: - '@types/node' dev: false + /@microsoft/api-extractor@7.38.0(@types/node@14.18.63): + resolution: {integrity: sha512-e1LhZYnfw+JEebuY2bzhw0imDCl1nwjSThTrQqBXl40hrVo6xm3j/1EpUr89QyzgjqmAwek2ZkIVZbrhaR+cqg==} + hasBin: true + dependencies: + '@microsoft/api-extractor-model': 7.28.2(@types/node@14.18.63) + '@microsoft/tsdoc': 0.14.2 + '@microsoft/tsdoc-config': 0.16.2 + '@rushstack/node-core-library': 3.61.0(@types/node@14.18.63) + '@rushstack/rig-package': 0.5.1 + '@rushstack/ts-command-line': 4.16.1 + colors: 1.2.5 + lodash: 4.17.21 + resolve: 1.22.6 + semver: 7.5.4 + source-map: 0.6.1 + typescript: 5.0.4 + transitivePeerDependencies: + - '@types/node' + dev: false + /@microsoft/api-extractor@7.38.0(@types/node@16.18.55): resolution: {integrity: sha512-e1LhZYnfw+JEebuY2bzhw0imDCl1nwjSThTrQqBXl40hrVo6xm3j/1EpUr89QyzgjqmAwek2ZkIVZbrhaR+cqg==} hasBin: true @@ -2465,6 +2495,24 @@ packages: rollup: 3.29.4 dev: false + /@rushstack/node-core-library@3.61.0(@types/node@14.18.63): + resolution: {integrity: sha512-tdOjdErme+/YOu4gPed3sFS72GhtWCgNV9oDsHDnoLY5oDfwjKUc9Z+JOZZ37uAxcm/OCahDHfuu2ugqrfWAVQ==} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true + dependencies: + '@types/node': 14.18.63 + colors: 1.2.5 + fs-extra: 7.0.1 + import-lazy: 4.0.0 + jju: 1.4.0 + resolve: 1.22.6 + semver: 7.5.4 + z-schema: 5.0.5 + dev: false + /@rushstack/node-core-library@3.61.0(@types/node@16.18.55): resolution: {integrity: sha512-tdOjdErme+/YOu4gPed3sFS72GhtWCgNV9oDsHDnoLY5oDfwjKUc9Z+JOZZ37uAxcm/OCahDHfuu2ugqrfWAVQ==} peerDependencies: @@ -3997,7 +4045,7 @@ packages: resolution: {integrity: sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==} deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) dependencies: - ms: 2.1.1 + ms: 2.1.3 dev: false /debug@3.2.7: @@ -4249,7 +4297,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.3.0-dev.20231011 + typescript: 5.3.0-dev.20231012 dev: false /eastasianwidth@0.2.0: @@ -8820,6 +8868,37 @@ packages: code-block-writer: 12.0.0 dev: false + /ts-node@10.9.1(@types/node@14.18.63)(typescript@5.0.4): + resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} + hasBin: true + peerDependencies: + '@swc/core': '>=1.2.50' + '@swc/wasm': '>=1.2.50' + '@types/node': '*' + typescript: '>=2.7' + peerDependenciesMeta: + '@swc/core': + optional: true + '@swc/wasm': + optional: true + dependencies: + '@cspotcode/source-map-support': 0.8.1 + '@tsconfig/node10': 1.0.9 + '@tsconfig/node12': 1.0.11 + '@tsconfig/node14': 1.0.3 + '@tsconfig/node16': 1.0.4 + '@types/node': 14.18.63 + acorn: 8.10.0 + acorn-walk: 8.2.0 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.2 + make-error: 1.3.6 + typescript: 5.0.4 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + dev: false + /ts-node@10.9.1(@types/node@16.18.55)(typescript@5.0.4): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true @@ -8993,8 +9072,8 @@ packages: hasBin: true dev: false - /typescript@5.3.0-dev.20231011: - resolution: {integrity: sha512-qpyUI7J37X3Xj7/bPWSNPUvmJ8yDGVnkQ8665xD4+LVWKUX7vwO7n2E1CUuQzeQIF4y369iPaz1d396rTW5LfA==} + /typescript@5.3.0-dev.20231012: + resolution: {integrity: sha512-k/m+QK/2eVsPMAao4I28Cv2Y9WzUKFVhRqvFGZ3CIXc0lrMkw/1pSA+8tp7IMw1ecxoa1myFql1tmCUrMKCbzA==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -11129,32 +11208,34 @@ packages: dev: false file:projects/arm-chaos.tgz: - resolution: {integrity: sha512-n4aV6Bmzk6OTrt78wmhkZGEdNXOW/umqZ0XiYWgg4r7USXaJXmHmZMR31XjduPW/8WFI8WsgZFyMpAM4Y/CHNg==, tarball: file:projects/arm-chaos.tgz} + resolution: {integrity: sha512-a+o/NRfCWQBtbg0BRBl3tm+eppeOTcTfP7fv2NvwnwlDQpjEsUEztSA1GMpj5jPOxKS/GZPbOHCsZ/MlS25tVQ==, tarball: file:projects/arm-chaos.tgz} name: '@rush-temp/arm-chaos' version: 0.0.0 dependencies: - '@microsoft/api-extractor': 7.38.0(@types/node@16.18.55) + '@azure/identity': 2.1.0 + '@microsoft/api-extractor': 7.38.0(@types/node@14.18.63) '@rollup/plugin-commonjs': 24.1.0(rollup@2.79.1) '@rollup/plugin-json': 6.0.0(rollup@2.79.1) '@rollup/plugin-multi-entry': 6.0.0(rollup@2.79.1) '@rollup/plugin-node-resolve': 13.3.0(rollup@2.79.1) '@types/chai': 4.3.6 - '@types/node': 16.18.55 + '@types/node': 14.18.63 chai: 4.3.10 cross-env: 7.0.3 dotenv: 16.3.1 mkdirp: 2.1.6 - mocha: 10.2.0 - rimraf: 3.0.2 + mocha: 7.2.0 + rimraf: 5.0.5 rollup: 2.79.1 - rollup-plugin-sourcemaps: 0.6.3(@types/node@16.18.55)(rollup@2.79.1) - ts-node: 10.9.1(@types/node@16.18.55)(typescript@5.0.4) + rollup-plugin-sourcemaps: 0.6.3(@types/node@14.18.63)(rollup@2.79.1) + ts-node: 10.9.1(@types/node@14.18.63)(typescript@5.0.4) tslib: 2.6.2 typescript: 5.0.4 uglify-js: 3.17.4 transitivePeerDependencies: - '@swc/core' - '@swc/wasm' + - supports-color dev: false file:projects/arm-cognitiveservices.tgz: @@ -17269,7 +17350,7 @@ packages: dev: false file:projects/communication-sms.tgz: - resolution: {integrity: sha512-Zy9WPrxVxDAuq5iLYpiy+HF8IQkHW5qHW8lvszMJ0eKWAWOgTgtr60bcu7A83DWz2vWBXRsGUWKaNqS3yUqOmA==, tarball: file:projects/communication-sms.tgz} + resolution: {integrity: sha512-HPqBjVlUjJug38F2I1GghNK4OH69dfIymbHuB2zKRL+PPuX3EaSSDLRPoJm9FLQke6nSh15tekNMhtT0Mzbr1g==, tarball: file:projects/communication-sms.tgz} name: '@rush-temp/communication-sms' version: 0.0.0 dependencies: diff --git a/sdk/chaos/arm-chaos/CHANGELOG.md b/sdk/chaos/arm-chaos/CHANGELOG.md index 206a97c69f89..7aeb9b30f70a 100644 --- a/sdk/chaos/arm-chaos/CHANGELOG.md +++ b/sdk/chaos/arm-chaos/CHANGELOG.md @@ -1,70 +1,5 @@ # Release History - -## 1.0.0-beta.5 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 1.0.0-beta.4 (2023-08-04) - -**Features** - - - Added operation Experiments.update - - Added Interface ExperimentsUpdateOptionalParams - - Added Interface ExperimentUpdate - - Added Interface ListSelector - - Added Interface QuerySelector - - Added Interface UserAssignedIdentity - - Added Type Alias ExperimentsUpdateResponse - - Added Type Alias SelectorUnion - - Added Type Alias TargetReferenceType - - Interface CapabilityType has a new optional parameter azureRbacActions - - Interface CapabilityType has a new optional parameter azureRbacDataActions - - Interface ResourceIdentity has a new optional parameter userAssignedIdentities - - Added Enum KnownSelectorType - - Added Enum KnownTargetReferenceType - - Class ChaosManagementClient has a new signature - -**Breaking Changes** - - - Interface Selector no longer has parameter targets - - Type of parameter selectors of interface Experiment is changed from Selector[] to SelectorUnion[] - - Type of parameter type of interface Selector is changed from SelectorType to "List" | "Query" - - Type of parameter type of interface TargetReference is changed from "ChaosTarget" to TargetReferenceType - - -## 1.0.0-beta.3 (2023-01-12) - -**Features** - - - Interface CapabilitiesListNextOptionalParams no longer has parameter continuationToken - - Interface CapabilityTypesListNextOptionalParams no longer has parameter continuationToken - - Interface ExperimentsListAllNextOptionalParams no longer has parameter continuationToken - - Interface ExperimentsListAllNextOptionalParams no longer has parameter running - - Interface ExperimentsListNextOptionalParams no longer has parameter continuationToken - - Interface ExperimentsListNextOptionalParams no longer has parameter running - - Interface TargetsListNextOptionalParams no longer has parameter continuationToken - - Interface TargetTypesListNextOptionalParams no longer has parameter continuationToken - - -## 1.0.0-beta.2 (2022-10-19) - -**Features** - - - Added Interface Filter - - Added Interface SimpleFilter - - Added Interface SimpleFilterParameters - - Added Type Alias FilterType - - Added Type Alias FilterUnion - - Interface Selector has a new optional parameter filter - - Added Enum KnownFilterType - -## 1.0.0-beta.1 (2022-09-13) +## 1.0.0 (2023-10-12) -The package of @azure/arm-chaos is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ). +The package of @azure/arm-chaos is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/chaos/arm-chaos/README.md b/sdk/chaos/arm-chaos/README.md index 688b96ebe2eb..22575e490997 100644 --- a/sdk/chaos/arm-chaos/README.md +++ b/sdk/chaos/arm-chaos/README.md @@ -6,7 +6,7 @@ Chaos Management Client [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/chaos/arm-chaos) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-chaos) | -[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-chaos?view=azure-node-preview) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-chaos) | [Samples](https://github.com/Azure-Samples/azure-samples-js-management) ## Getting started diff --git a/sdk/chaos/arm-chaos/_meta.json b/sdk/chaos/arm-chaos/_meta.json index 7977e5f4ef8d..7fa3f45e405a 100644 --- a/sdk/chaos/arm-chaos/_meta.json +++ b/sdk/chaos/arm-chaos/_meta.json @@ -1,8 +1,8 @@ { - "commit": "8a56aa33078dad6012aa59653cbfa643fa985f15", + "commit": "372d21d5ee90c66ac8a90f0072d15f5963bb2ad9", "readme": "specification/chaos/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\chaos\\resource-manager\\readme.md --use=@autorest/typescript@6.0.5 --generate-sample=true", + "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=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/chaos/resource-manager/readme.md --use=@autorest/typescript@^6.0.4", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.0", - "use": "@autorest/typescript@6.0.5" + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.2", + "use": "@autorest/typescript@^6.0.4" } \ No newline at end of file diff --git a/sdk/chaos/arm-chaos/package.json b/sdk/chaos/arm-chaos/package.json index 2bdb18a212ce..69d043858482 100644 --- a/sdk/chaos/arm-chaos/package.json +++ b/sdk/chaos/arm-chaos/package.json @@ -3,15 +3,17 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ChaosManagementClient.", - "version": "1.0.0-beta.5", + "version": "1.0.0", "engines": { - "node": ">=16.0.0" + "node": ">=14.0.0" }, "dependencies": { + "@azure/core-lro": "^2.5.4", + "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.8.0", + "@azure/core-rest-pipeline": "^1.12.0", "tslib": "^2.2.0" }, "keywords": [ @@ -36,19 +38,18 @@ "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~5.0.0", "uglify-js": "^3.4.9", - "rimraf": "^3.0.0", + "rimraf": "^5.0.0", "dotenv": "^16.0.0", - "@azure/identity": "^3.3.0", + "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", - "mocha": "^10.0.0", + "mocha": "^7.1.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", - "@types/node": "^16.0.0", - "@azure/dev-tool": "^1.0.0", - "@azure/arm-cosmosdb": "16.0.0-beta.7", - "ts-node": "^10.0.0" + "@types/node": "^14.0.0", + "ts-node": "^10.0.0", + "@azure/dev-tool": "^1.0.0" }, "repository": { "type": "git", @@ -83,7 +84,7 @@ "extract-api": "api-extractor run --local", "lint": "echo skipped", "audit": "echo skipped", - "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", "build:browser": "echo skipped", "build:test": "echo skipped", @@ -111,13 +112,5 @@ ] }, "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://docs.microsoft.com/javascript/api/@azure/arm-chaos?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/chaos/arm-chaos" +} \ No newline at end of file diff --git a/sdk/chaos/arm-chaos/review/arm-chaos.api.md b/sdk/chaos/arm-chaos/review/arm-chaos.api.md index 63f95f3d1726..1dd9e7c72688 100644 --- a/sdk/chaos/arm-chaos/review/arm-chaos.api.md +++ b/sdk/chaos/arm-chaos/review/arm-chaos.api.md @@ -6,7 +6,9 @@ import * as coreAuth from '@azure/core-auth'; import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { SimplePollerLike } from '@azure/core-lro'; // @public export interface Action { @@ -14,16 +16,6 @@ export interface Action { type: "delay" | "discrete" | "continuous"; } -// @public -export interface ActionStatus { - readonly actionId?: string; - readonly actionName?: string; - readonly endTime?: Date; - readonly startTime?: Date; - readonly status?: string; - readonly targets?: ExperimentExecutionActionTargetDetailsProperties[]; -} - // @public export type ActionType = string; @@ -36,14 +28,6 @@ export interface Branch { name: string; } -// @public -export interface BranchStatus { - readonly actions?: ActionStatus[]; - readonly branchId?: string; - readonly branchName?: string; - readonly status?: string; -} - // @public export interface Capabilities { createOrUpdate(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, capabilityName: string, capability: Capability, options?: CapabilitiesCreateOrUpdateOptionalParams): Promise; @@ -169,10 +153,14 @@ export class ChaosManagementClient extends coreClient.ServiceClient { // (undocumented) capabilityTypes: CapabilityTypes; // (undocumented) + expand?: string; + // (undocumented) experiments: Experiments; // (undocumented) operations: Operations; // (undocumented) + operationStatuses: OperationStatuses; + // (undocumented) subscriptionId?: string; // (undocumented) targets: Targets; @@ -185,6 +173,7 @@ export interface ChaosManagementClientOptionalParams extends coreClient.ServiceC $host?: string; apiVersion?: string; endpoint?: string; + expand?: string; } // @public @@ -234,57 +223,27 @@ export interface ErrorResponse { // @public export interface Experiment extends TrackedResource { identity?: ResourceIdentity; + readonly provisioningState?: ProvisioningState; selectors: SelectorUnion[]; - startOnCreation?: boolean; steps: Step[]; readonly systemData?: SystemData; } // @public -export interface ExperimentCancelOperationResult { - readonly name?: string; - readonly statusUrl?: string; -} - -// @public -export interface ExperimentExecutionActionTargetDetailsError { - readonly code?: string; - readonly message?: string; -} - -// @public -export interface ExperimentExecutionActionTargetDetailsProperties { - readonly error?: ExperimentExecutionActionTargetDetailsError; - readonly status?: string; - readonly target?: string; - readonly targetCompletedTime?: Date; - readonly targetFailedTime?: Date; -} - -// @public -export interface ExperimentExecutionDetails { - readonly createdDateTime?: Date; +export interface ExperimentExecution { readonly experimentId?: string; - readonly failureReason?: string; readonly id?: string; - readonly lastActionDateTime?: Date; readonly name?: string; - readonly runInformation?: ExperimentExecutionDetailsPropertiesRunInformation; - readonly startDateTime?: Date; + readonly startedAt?: Date; readonly status?: string; - readonly stopDateTime?: Date; + readonly stoppedAt?: Date; readonly type?: string; } // @public -export interface ExperimentExecutionDetailsListResult { +export interface ExperimentExecutionListResult { readonly nextLink?: string; - readonly value?: ExperimentExecutionDetails[]; -} - -// @public -export interface ExperimentExecutionDetailsPropertiesRunInformation { - readonly steps?: StepStatus[]; + readonly value?: ExperimentExecution[]; } // @public @@ -295,29 +254,33 @@ export interface ExperimentListResult { // @public export interface Experiments { - cancel(resourceGroupName: string, experimentName: string, options?: ExperimentsCancelOptionalParams): Promise; - createOrUpdate(resourceGroupName: string, experimentName: string, experiment: Experiment, options?: ExperimentsCreateOrUpdateOptionalParams): Promise; - delete(resourceGroupName: string, experimentName: string, options?: ExperimentsDeleteOptionalParams): Promise; + 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; get(resourceGroupName: string, experimentName: string, options?: ExperimentsGetOptionalParams): Promise; - getExecutionDetails(resourceGroupName: string, experimentName: string, executionDetailsId: string, options?: ExperimentsGetExecutionDetailsOptionalParams): Promise; - getStatus(resourceGroupName: string, experimentName: string, statusId: string, options?: ExperimentsGetStatusOptionalParams): Promise; + getExecution(resourceGroupName: string, experimentName: string, executionId: string, options?: ExperimentsGetExecutionOptionalParams): Promise; list(resourceGroupName: string, options?: ExperimentsListOptionalParams): PagedAsyncIterableIterator; listAll(options?: ExperimentsListAllOptionalParams): PagedAsyncIterableIterator; - listAllStatuses(resourceGroupName: string, experimentName: string, options?: ExperimentsListAllStatusesOptionalParams): PagedAsyncIterableIterator; - listExecutionDetails(resourceGroupName: string, experimentName: string, options?: ExperimentsListExecutionDetailsOptionalParams): PagedAsyncIterableIterator; - start(resourceGroupName: string, experimentName: string, options?: ExperimentsStartOptionalParams): Promise; - update(resourceGroupName: string, experimentName: string, experiment: ExperimentUpdate, options?: ExperimentsUpdateOptionalParams): Promise; + listAllExecutions(resourceGroupName: string, experimentName: string, options?: ExperimentsListAllExecutionsOptionalParams): PagedAsyncIterableIterator; } // @public export interface ExperimentsCancelOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; } -// @public -export type ExperimentsCancelResponse = ExperimentCancelOperationResult; - // @public export interface ExperimentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; } // @public @@ -325,14 +288,16 @@ export type ExperimentsCreateOrUpdateResponse = Experiment; // @public export interface ExperimentsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; } // @public -export interface ExperimentsGetExecutionDetailsOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsGetExecutionOptionalParams extends coreClient.OperationOptions { } // @public -export type ExperimentsGetExecutionDetailsResponse = ExperimentExecutionDetails; +export type ExperimentsGetExecutionResponse = ExperimentExecution; // @public export interface ExperimentsGetOptionalParams extends coreClient.OperationOptions { @@ -342,11 +307,18 @@ export interface ExperimentsGetOptionalParams extends coreClient.OperationOption export type ExperimentsGetResponse = Experiment; // @public -export interface ExperimentsGetStatusOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsListAllExecutionsNextOptionalParams extends coreClient.OperationOptions { } // @public -export type ExperimentsGetStatusResponse = ExperimentStatus; +export type ExperimentsListAllExecutionsNextResponse = ExperimentExecutionListResult; + +// @public +export interface ExperimentsListAllExecutionsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ExperimentsListAllExecutionsResponse = ExperimentExecutionListResult; // @public export interface ExperimentsListAllNextOptionalParams extends coreClient.OperationOptions { @@ -364,34 +336,6 @@ export interface ExperimentsListAllOptionalParams extends coreClient.OperationOp // @public export type ExperimentsListAllResponse = ExperimentListResult; -// @public -export interface ExperimentsListAllStatusesNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ExperimentsListAllStatusesNextResponse = ExperimentStatusListResult; - -// @public -export interface ExperimentsListAllStatusesOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ExperimentsListAllStatusesResponse = ExperimentStatusListResult; - -// @public -export interface ExperimentsListExecutionDetailsNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ExperimentsListExecutionDetailsNextResponse = ExperimentExecutionDetailsListResult; - -// @public -export interface ExperimentsListExecutionDetailsOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ExperimentsListExecutionDetailsResponse = ExperimentExecutionDetailsListResult; - // @public export interface ExperimentsListNextOptionalParams extends coreClient.OperationOptions { } @@ -410,35 +354,14 @@ export type ExperimentsListResponse = ExperimentListResult; // @public export interface ExperimentsStartOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ExperimentsStartResponse = ExperimentStartOperationResult; - -// @public -export interface ExperimentStartOperationResult { - readonly name?: string; - readonly statusUrl?: string; -} - -// @public -export interface ExperimentStatus { - readonly createdDateUtc?: Date; - readonly endDateUtc?: Date; - readonly id?: string; - readonly name?: string; - readonly status?: string; - readonly type?: string; -} - -// @public -export interface ExperimentStatusListResult { - readonly nextLink?: string; - readonly value?: ExperimentStatus[]; + resumeFrom?: string; + updateIntervalInMs?: number; } // @public export interface ExperimentsUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; } // @public @@ -494,6 +417,16 @@ export enum KnownOrigin { UserSystem = "user,system" } +// @public +export enum KnownProvisioningState { + Canceled = "Canceled", + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded", + Updating = "Updating" +} + // @public export enum KnownSelectorType { List = "List", @@ -553,9 +486,34 @@ export interface OperationsListAllOptionalParams extends coreClient.OperationOpt // @public export type OperationsListAllResponse = OperationListResult; +// @public +export interface OperationStatus { + endTime?: string; + error?: ErrorResponse; + id?: string; + name?: string; + startTime?: string; + status?: string; +} + +// @public +export interface OperationStatuses { + get(location: string, asyncOperationId: string, options?: OperationStatusesGetOptionalParams): Promise; +} + +// @public +export interface OperationStatusesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationStatusesGetResponse = OperationStatus; + // @public export type Origin = string; +// @public +export type ProvisioningState = string; + // @public export interface QuerySelector extends Selector { queryString: string; @@ -614,14 +572,6 @@ export interface Step { name: string; } -// @public -export interface StepStatus { - readonly branches?: BranchStatus[]; - readonly status?: string; - readonly stepId?: string; - readonly stepName?: string; -} - // @public export interface SystemData { createdAt?: Date; diff --git a/sdk/chaos/arm-chaos/src/chaosManagementClient.ts b/sdk/chaos/arm-chaos/src/chaosManagementClient.ts index 5e3161917640..f4d99d502146 100644 --- a/sdk/chaos/arm-chaos/src/chaosManagementClient.ts +++ b/sdk/chaos/arm-chaos/src/chaosManagementClient.ts @@ -18,6 +18,7 @@ import { CapabilitiesImpl, CapabilityTypesImpl, ExperimentsImpl, + OperationStatusesImpl, OperationsImpl, TargetTypesImpl, TargetsImpl @@ -26,6 +27,7 @@ import { Capabilities, CapabilityTypes, Experiments, + OperationStatuses, Operations, TargetTypes, Targets @@ -36,6 +38,7 @@ export class ChaosManagementClient extends coreClient.ServiceClient { $host: string; apiVersion: string; subscriptionId?: string; + expand?: string; /** * Initializes a new instance of the ChaosManagementClient class. @@ -78,7 +81,7 @@ export class ChaosManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-chaos/1.0.0-beta.5`; + const packageDetails = `azsdk-js-arm-chaos/1.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -131,10 +134,11 @@ export class ChaosManagementClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2023-04-15-preview"; + this.apiVersion = options.apiVersion || "2023-11-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); @@ -172,6 +176,7 @@ export class ChaosManagementClient extends coreClient.ServiceClient { capabilities: Capabilities; capabilityTypes: CapabilityTypes; experiments: Experiments; + operationStatuses: OperationStatuses; operations: Operations; targetTypes: TargetTypes; targets: Targets; diff --git a/sdk/chaos/arm-chaos/src/lroImpl.ts b/sdk/chaos/arm-chaos/src/lroImpl.ts new file mode 100644 index 000000000000..dd803cd5e28c --- /dev/null +++ b/sdk/chaos/arm-chaos/src/lroImpl.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AbortSignalLike } from "@azure/abort-controller"; +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike } + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal + }); + } + }; +} diff --git a/sdk/chaos/arm-chaos/src/models/index.ts b/sdk/chaos/arm-chaos/src/models/index.ts index 3709a0232221..d1b96c25376f 100644 --- a/sdk/chaos/arm-chaos/src/models/index.ts +++ b/sdk/chaos/arm-chaos/src/models/index.ts @@ -231,98 +231,22 @@ export interface ExperimentUpdate { identity?: ResourceIdentity; } -/** Model that represents the result of a cancel Experiment operation. */ -export interface ExperimentCancelOperationResult { +/** Model that represents a list of Experiment executions and a link for pagination. */ +export interface ExperimentExecutionListResult { /** - * String of the Experiment name. + * List of Experiment executions. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly name?: string; - /** - * URL to retrieve the Experiment status. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly statusUrl?: string; -} - -/** Model that represents the result of a start Experiment operation. */ -export interface ExperimentStartOperationResult { - /** - * String of the Experiment name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * URL to retrieve the Experiment status. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly statusUrl?: string; -} - -/** Model that represents a list of Experiment statuses and a link for pagination. */ -export interface ExperimentStatusListResult { - /** - * List of Experiment statuses. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: ExperimentStatus[]; - /** - * URL to retrieve the next page of Experiment statuses. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Model that represents the status of a Experiment. */ -export interface ExperimentStatus { - /** - * 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; - /** - * String that represents the status of a Experiment. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: string; - /** - * String that represents the created date time of a Experiment. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly createdDateUtc?: Date; - /** - * String that represents the end date time of a Experiment. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly endDateUtc?: Date; -} - -/** Model that represents a list of Experiment execution details and a link for pagination. */ -export interface ExperimentExecutionDetailsListResult { - /** - * List of Experiment execution details. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: ExperimentExecutionDetails[]; + readonly value?: ExperimentExecution[]; /** - * URL to retrieve the next page of Experiment execution details. + * 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 details of a Experiment. */ -export interface ExperimentExecutionDetails { +/** 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. @@ -344,174 +268,36 @@ export interface ExperimentExecutionDetails { */ readonly experimentId?: string; /** - * The value of the status of the experiment execution. + * The status of the execution. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly status?: string; - /** - * 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 created date time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly createdDateTime?: Date; - /** - * String that represents the last action date time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly lastActionDateTime?: Date; /** * String that represents the start date time. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly startDateTime?: Date; + 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 stopDateTime?: 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; + readonly stoppedAt?: Date; } -/** 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; +/** The status of operation. */ +export interface OperationStatus { + /** 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; + /** The error detail of the operation if any. */ + error?: ErrorResponse; } /** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ @@ -831,12 +617,15 @@ export interface Experiment extends TrackedResource { 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: Step[]; /** List of selectors. */ selectors: SelectorUnion[]; - /** A boolean value that indicates if experiment should be started on creation or not. */ - startOnCreation?: boolean; } /** Known values of {@link CreatedByType} that the service accepts. */ @@ -863,6 +652,36 @@ export enum KnownCreatedByType { */ 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 */ @@ -1034,7 +853,12 @@ export type ExperimentsListResponse = ExperimentListResult; /** Optional parameters. */ export interface ExperimentsDeleteOptionalParams - extends coreClient.OperationOptions {} + 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 @@ -1045,59 +869,59 @@ export type ExperimentsGetResponse = Experiment; /** Optional parameters. */ export interface ExperimentsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions {} + 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 {} + 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 {} - -/** Contains response data for the cancel operation. */ -export type ExperimentsCancelResponse = ExperimentCancelOperationResult; + 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 {} - -/** Contains response data for the start operation. */ -export type ExperimentsStartResponse = ExperimentStartOperationResult; - -/** Optional parameters. */ -export interface ExperimentsListAllStatusesOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listAllStatuses operation. */ -export type ExperimentsListAllStatusesResponse = ExperimentStatusListResult; - -/** Optional parameters. */ -export interface ExperimentsGetStatusOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the getStatus operation. */ -export type ExperimentsGetStatusResponse = ExperimentStatus; + 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 ExperimentsListExecutionDetailsOptionalParams +export interface ExperimentsListAllExecutionsOptionalParams extends coreClient.OperationOptions {} -/** Contains response data for the listExecutionDetails operation. */ -export type ExperimentsListExecutionDetailsResponse = ExperimentExecutionDetailsListResult; +/** Contains response data for the listAllExecutions operation. */ +export type ExperimentsListAllExecutionsResponse = ExperimentExecutionListResult; /** Optional parameters. */ -export interface ExperimentsGetExecutionDetailsOptionalParams +export interface ExperimentsGetExecutionOptionalParams extends coreClient.OperationOptions {} -/** Contains response data for the getExecutionDetails operation. */ -export type ExperimentsGetExecutionDetailsResponse = ExperimentExecutionDetails; +/** Contains response data for the getExecution operation. */ +export type ExperimentsGetExecutionResponse = ExperimentExecution; /** Optional parameters. */ export interface ExperimentsListAllNextOptionalParams @@ -1114,18 +938,18 @@ export interface ExperimentsListNextOptionalParams export type ExperimentsListNextResponse = ExperimentListResult; /** Optional parameters. */ -export interface ExperimentsListAllStatusesNextOptionalParams +export interface ExperimentsListAllExecutionsNextOptionalParams extends coreClient.OperationOptions {} -/** Contains response data for the listAllStatusesNext operation. */ -export type ExperimentsListAllStatusesNextResponse = ExperimentStatusListResult; +/** Contains response data for the listAllExecutionsNext operation. */ +export type ExperimentsListAllExecutionsNextResponse = ExperimentExecutionListResult; /** Optional parameters. */ -export interface ExperimentsListExecutionDetailsNextOptionalParams +export interface OperationStatusesGetOptionalParams extends coreClient.OperationOptions {} -/** Contains response data for the listExecutionDetailsNext operation. */ -export type ExperimentsListExecutionDetailsNextResponse = ExperimentExecutionDetailsListResult; +/** Contains response data for the get operation. */ +export type OperationStatusesGetResponse = OperationStatus; /** Optional parameters. */ export interface OperationsListAllOptionalParams @@ -1205,6 +1029,8 @@ export interface ChaosManagementClientOptionalParams $host?: string; /** Api Version */ apiVersion?: string; + /** The expand expression to apply on the operation. */ + expand?: string; /** Overrides client endpoint. */ endpoint?: string; } diff --git a/sdk/chaos/arm-chaos/src/models/mappers.ts b/sdk/chaos/arm-chaos/src/models/mappers.ts index 6f5aca130306..0a8bd57f5322 100644 --- a/sdk/chaos/arm-chaos/src/models/mappers.ts +++ b/sdk/chaos/arm-chaos/src/models/mappers.ts @@ -545,62 +545,10 @@ export const ExperimentUpdate: coreClient.CompositeMapper = { } }; -export const ExperimentCancelOperationResult: coreClient.CompositeMapper = { +export const ExperimentExecutionListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ExperimentCancelOperationResult", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - statusUrl: { - constraints: { - MaxLength: 2048 - }, - serializedName: "statusUrl", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const ExperimentStartOperationResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExperimentStartOperationResult", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - statusUrl: { - constraints: { - MaxLength: 2048 - }, - serializedName: "statusUrl", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const ExperimentStatusListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExperimentStatusListResult", + className: "ExperimentExecutionListResult", modelProperties: { value: { serializedName: "value", @@ -610,7 +558,7 @@ export const ExperimentStatusListResult: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "ExperimentStatus" + className: "ExperimentExecution" } } } @@ -630,95 +578,10 @@ export const ExperimentStatusListResult: coreClient.CompositeMapper = { } }; -export const ExperimentStatus: coreClient.CompositeMapper = { +export const ExperimentExecution: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ExperimentStatus", - 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" - } - }, - createdDateUtc: { - serializedName: "properties.createdDateUtc", - readOnly: true, - type: { - name: "DateTime" - } - }, - endDateUtc: { - serializedName: "properties.endDateUtc", - readOnly: true, - nullable: true, - type: { - name: "DateTime" - } - } - } - } -}; - -export const ExperimentExecutionDetailsListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExperimentExecutionDetailsListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExperimentExecutionDetails" - } - } - } - }, - nextLink: { - constraints: { - MaxLength: 2048 - }, - serializedName: "nextLink", - readOnly: true, - nullable: true, - type: { - name: "String" - } - } - } - } -}; - -export const ExperimentExecutionDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExperimentExecutionDetails", + className: "ExperimentExecution", modelProperties: { type: { serializedName: "type", @@ -755,280 +618,64 @@ export const ExperimentExecutionDetails: coreClient.CompositeMapper = { name: "String" } }, - failureReason: { - serializedName: "properties.failureReason", - readOnly: true, - type: { - name: "String" - } - }, - createdDateTime: { - serializedName: "properties.createdDateTime", - readOnly: true, - type: { - name: "DateTime" - } - }, - lastActionDateTime: { - serializedName: "properties.lastActionDateTime", + startedAt: { + serializedName: "properties.startedAt", readOnly: true, type: { name: "DateTime" } }, - startDateTime: { - serializedName: "properties.startDateTime", + stoppedAt: { + serializedName: "properties.stoppedAt", readOnly: true, type: { name: "DateTime" } - }, - stopDateTime: { - serializedName: "properties.stopDateTime", - 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 = { +export const OperationStatus: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ActionStatus", + className: "OperationStatus", modelProperties: { - actionName: { - serializedName: "actionName", - readOnly: true, - type: { - name: "String" - } - }, - actionId: { - serializedName: "actionId", - readOnly: true, + id: { + serializedName: "id", type: { name: "String" } }, - status: { - serializedName: "status", - readOnly: true, + name: { + serializedName: "name", type: { name: "String" } }, startTime: { serializedName: "startTime", - readOnly: true, type: { - name: "DateTime" + name: "String" } }, endTime: { serializedName: "endTime", - readOnly: true, type: { - name: "DateTime" + name: "String" } }, - 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" + className: "ErrorResponse" } } } @@ -1772,6 +1419,13 @@ export const Experiment: coreClient.CompositeMapper = { className: "ResourceIdentity" } }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, steps: { constraints: { MinItems: 1 @@ -1803,13 +1457,6 @@ export const Experiment: coreClient.CompositeMapper = { } } } - }, - startOnCreation: { - serializedName: "properties.startOnCreation", - nullable: true, - type: { - name: "Boolean" - } } } } diff --git a/sdk/chaos/arm-chaos/src/models/parameters.ts b/sdk/chaos/arm-chaos/src/models/parameters.ts index 6075ecf078f5..a8aad9537767 100644 --- a/sdk/chaos/arm-chaos/src/models/parameters.ts +++ b/sdk/chaos/arm-chaos/src/models/parameters.ts @@ -45,7 +45,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2023-04-15-preview", + defaultValue: "2023-11-01", isConstant: true, serializedName: "api-version", type: { @@ -270,15 +270,15 @@ export const experiment1: OperationParameter = { mapper: ExperimentUpdateMapper }; -export const statusId: OperationURLParameter = { - parameterPath: "statusId", +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: "statusId", + serializedName: "executionId", required: true, type: { name: "String" @@ -286,15 +286,31 @@ export const statusId: OperationURLParameter = { } }; -export const executionDetailsId: OperationURLParameter = { - parameterPath: "executionDetailsId", +export const expand: OperationQueryParameter = { + parameterPath: "expand", 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: "executionDetailsId", + serializedName: "$expand", + type: { + name: "String" + } + } +}; + +export const location: OperationURLParameter = { + parameterPath: "location", + mapper: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } +}; + +export const asyncOperationId: OperationURLParameter = { + parameterPath: "asyncOperationId", + mapper: { + serializedName: "asyncOperationId", required: true, type: { name: "String" diff --git a/sdk/chaos/arm-chaos/src/operations/experiments.ts b/sdk/chaos/arm-chaos/src/operations/experiments.ts index c7de32e6aca2..a0315f9f520e 100644 --- a/sdk/chaos/arm-chaos/src/operations/experiments.ts +++ b/sdk/chaos/arm-chaos/src/operations/experiments.ts @@ -13,6 +13,12 @@ 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, @@ -21,14 +27,10 @@ import { ExperimentsListNextOptionalParams, ExperimentsListOptionalParams, ExperimentsListResponse, - ExperimentStatus, - ExperimentsListAllStatusesNextOptionalParams, - ExperimentsListAllStatusesOptionalParams, - ExperimentsListAllStatusesResponse, - ExperimentExecutionDetails, - ExperimentsListExecutionDetailsNextOptionalParams, - ExperimentsListExecutionDetailsOptionalParams, - ExperimentsListExecutionDetailsResponse, + ExperimentExecution, + ExperimentsListAllExecutionsNextOptionalParams, + ExperimentsListAllExecutionsOptionalParams, + ExperimentsListAllExecutionsResponse, ExperimentsDeleteOptionalParams, ExperimentsGetOptionalParams, ExperimentsGetResponse, @@ -38,17 +40,12 @@ import { ExperimentsUpdateOptionalParams, ExperimentsUpdateResponse, ExperimentsCancelOptionalParams, - ExperimentsCancelResponse, ExperimentsStartOptionalParams, - ExperimentsStartResponse, - ExperimentsGetStatusOptionalParams, - ExperimentsGetStatusResponse, - ExperimentsGetExecutionDetailsOptionalParams, - ExperimentsGetExecutionDetailsResponse, + ExperimentsGetExecutionOptionalParams, + ExperimentsGetExecutionResponse, ExperimentsListAllNextResponse, ExperimentsListNextResponse, - ExperimentsListAllStatusesNextResponse, - ExperimentsListExecutionDetailsNextResponse + ExperimentsListAllExecutionsNextResponse } from "../models"; /// @@ -181,17 +178,17 @@ export class ExperimentsImpl implements Experiments { } /** - * Get a list of statuses of a Experiment resource. + * 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 listAllStatuses( + public listAllExecutions( resourceGroupName: string, experimentName: string, - options?: ExperimentsListAllStatusesOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listAllStatusesPagingAll( + options?: ExperimentsListAllExecutionsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listAllExecutionsPagingAll( resourceGroupName, experimentName, options @@ -207,7 +204,7 @@ export class ExperimentsImpl implements Experiments { if (settings?.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } - return this.listAllStatusesPagingPage( + return this.listAllExecutionsPagingPage( resourceGroupName, experimentName, options, @@ -217,16 +214,16 @@ export class ExperimentsImpl implements Experiments { }; } - private async *listAllStatusesPagingPage( + private async *listAllExecutionsPagingPage( resourceGroupName: string, experimentName: string, - options?: ExperimentsListAllStatusesOptionalParams, + options?: ExperimentsListAllExecutionsOptionalParams, settings?: PageSettings - ): AsyncIterableIterator { - let result: ExperimentsListAllStatusesResponse; + ): AsyncIterableIterator { + let result: ExperimentsListAllExecutionsResponse; let continuationToken = settings?.continuationToken; if (!continuationToken) { - result = await this._listAllStatuses( + result = await this._listAllExecutions( resourceGroupName, experimentName, options @@ -237,7 +234,7 @@ export class ExperimentsImpl implements Experiments { yield page; } while (continuationToken) { - result = await this._listAllStatusesNext( + result = await this._listAllExecutionsNext( resourceGroupName, experimentName, continuationToken, @@ -250,96 +247,12 @@ export class ExperimentsImpl implements Experiments { } } - private async *listAllStatusesPagingAll( + private async *listAllExecutionsPagingAll( resourceGroupName: string, experimentName: string, - options?: ExperimentsListAllStatusesOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listAllStatusesPagingPage( - resourceGroupName, - experimentName, - options - )) { - yield* page; - } - } - - /** - * Get a list of execution details of 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. - */ - public listExecutionDetails( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsListExecutionDetailsOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listExecutionDetailsPagingAll( - 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.listExecutionDetailsPagingPage( - resourceGroupName, - experimentName, - options, - settings - ); - } - }; - } - - private async *listExecutionDetailsPagingPage( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsListExecutionDetailsOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: ExperimentsListExecutionDetailsResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listExecutionDetails( - resourceGroupName, - experimentName, - options - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listExecutionDetailsNext( - resourceGroupName, - experimentName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listExecutionDetailsPagingAll( - resourceGroupName: string, - experimentName: string, - options?: ExperimentsListExecutionDetailsOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listExecutionDetailsPagingPage( + options?: ExperimentsListAllExecutionsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listAllExecutionsPagingPage( resourceGroupName, experimentName, options @@ -379,15 +292,81 @@ export class ExperimentsImpl implements Experiments { * @param experimentName String that represents a Experiment resource name. * @param options The options parameters. */ - delete( + 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 { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, options }, - deleteOperationSpec + const poller = await this.beginDelete( + resourceGroupName, + experimentName, + options ); + return poller.pollUntilDone(); } /** @@ -414,16 +393,167 @@ export class ExperimentsImpl implements Experiments { * @param experiment Experiment resource to be created or updated. * @param options The options parameters. */ - createOrUpdate( + 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: "location" + }); + 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 { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, experiment, options }, - createOrUpdateOperationSpec + 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; } /** @@ -433,16 +563,19 @@ export class ExperimentsImpl implements Experiments { * @param experiment Parameters supplied to the Update experiment operation. * @param options The options parameters. */ - update( + async beginUpdateAndWait( resourceGroupName: string, experimentName: string, experiment: ExperimentUpdate, options?: ExperimentsUpdateOptionalParams ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, experiment, options }, - updateOperationSpec + const poller = await this.beginUpdate( + resourceGroupName, + experimentName, + experiment, + options ); + return poller.pollUntilDone(); } /** @@ -451,103 +584,199 @@ export class ExperimentsImpl implements Experiments { * @param experimentName String that represents a Experiment resource name. * @param options The options parameters. */ - cancel( + async beginCancel( resourceGroupName: string, experimentName: string, options?: ExperimentsCancelOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, options }, - cancelOperationSpec - ); + ): 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; } /** - * Start a Experiment resource. + * 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. */ - start( + async beginCancelAndWait( resourceGroupName: string, experimentName: string, - options?: ExperimentsStartOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, options }, - startOperationSpec + options?: ExperimentsCancelOptionalParams + ): Promise { + const poller = await this.beginCancel( + resourceGroupName, + experimentName, + options ); + return poller.pollUntilDone(); } /** - * Get a list of statuses of a Experiment resource. + * 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. */ - private _listAllStatuses( + async beginStart( resourceGroupName: string, experimentName: string, - options?: ExperimentsListAllStatusesOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, options }, - listAllStatusesOperationSpec - ); + 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; } /** - * Get a status of a Experiment resource. + * Start a Experiment resource. * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param statusId GUID that represents a Experiment status. * @param options The options parameters. */ - getStatus( + async beginStartAndWait( resourceGroupName: string, experimentName: string, - statusId: string, - options?: ExperimentsGetStatusOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, statusId, options }, - getStatusOperationSpec + options?: ExperimentsStartOptionalParams + ): Promise { + const poller = await this.beginStart( + resourceGroupName, + experimentName, + options ); + return poller.pollUntilDone(); } /** - * Get a list of execution details of a Experiment resource. + * 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 _listExecutionDetails( + private _listAllExecutions( resourceGroupName: string, experimentName: string, - options?: ExperimentsListExecutionDetailsOptionalParams - ): Promise { + options?: ExperimentsListAllExecutionsOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, experimentName, options }, - listExecutionDetailsOperationSpec + listAllExecutionsOperationSpec ); } /** - * Get an execution detail of a Experiment resource. + * 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 executionDetailsId GUID that represents a Experiment execution detail. + * @param executionId GUID that represents a Experiment execution detail. * @param options The options parameters. */ - getExecutionDetails( + getExecution( resourceGroupName: string, experimentName: string, - executionDetailsId: string, - options?: ExperimentsGetExecutionDetailsOptionalParams - ): Promise { + executionId: string, + options?: ExperimentsGetExecutionOptionalParams + ): Promise { return this.client.sendOperationRequest( - { resourceGroupName, experimentName, executionDetailsId, options }, - getExecutionDetailsOperationSpec + { resourceGroupName, experimentName, executionId, options }, + getExecutionOperationSpec ); } @@ -584,40 +813,21 @@ export class ExperimentsImpl implements Experiments { } /** - * ListAllStatusesNext + * 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 ListAllStatuses method. + * @param nextLink The nextLink from the previous successful call to the ListAllExecutions method. * @param options The options parameters. */ - private _listAllStatusesNext( + private _listAllExecutionsNext( resourceGroupName: string, experimentName: string, nextLink: string, - options?: ExperimentsListAllStatusesNextOptionalParams - ): Promise { + options?: ExperimentsListAllExecutionsNextOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, experimentName, nextLink, options }, - listAllStatusesNextOperationSpec - ); - } - - /** - * ListExecutionDetailsNext - * @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 ListExecutionDetails method. - * @param options The options parameters. - */ - private _listExecutionDetailsNext( - resourceGroupName: string, - experimentName: string, - nextLink: string, - options?: ExperimentsListExecutionDetailsNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, nextLink, options }, - listExecutionDetailsNextOperationSpec + listAllExecutionsNextOperationSpec ); } } @@ -675,6 +885,8 @@ const deleteOperationSpec: coreClient.OperationSpec = { httpMethod: "DELETE", responses: { 200: {}, + 201: {}, + 202: {}, 204: {}, default: { bodyMapper: Mappers.ErrorResponse @@ -720,6 +932,15 @@ const createOrUpdateOperationSpec: coreClient.OperationSpec = { 200: { bodyMapper: Mappers.Experiment }, + 201: { + bodyMapper: Mappers.Experiment + }, + 202: { + bodyMapper: Mappers.Experiment + }, + 204: { + bodyMapper: Mappers.Experiment + }, default: { bodyMapper: Mappers.ErrorResponse } @@ -744,6 +965,15 @@ const updateOperationSpec: coreClient.OperationSpec = { 200: { bodyMapper: Mappers.Experiment }, + 201: { + bodyMapper: Mappers.Experiment + }, + 202: { + bodyMapper: Mappers.Experiment + }, + 204: { + bodyMapper: Mappers.Experiment + }, default: { bodyMapper: Mappers.ErrorResponse } @@ -765,9 +995,10 @@ const cancelOperationSpec: coreClient.OperationSpec = { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel", httpMethod: "POST", responses: { - 202: { - bodyMapper: Mappers.ExperimentCancelOperationResult - }, + 200: {}, + 201: {}, + 202: {}, + 204: {}, default: { bodyMapper: Mappers.ErrorResponse } @@ -787,9 +1018,10 @@ const startOperationSpec: coreClient.OperationSpec = { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start", httpMethod: "POST", responses: { - 202: { - bodyMapper: Mappers.ExperimentStartOperationResult - }, + 200: {}, + 201: {}, + 202: {}, + 204: {}, default: { bodyMapper: Mappers.ErrorResponse } @@ -804,13 +1036,13 @@ const startOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; -const listAllStatusesOperationSpec: coreClient.OperationSpec = { +const listAllExecutionsOperationSpec: coreClient.OperationSpec = { path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.ExperimentStatusListResult + bodyMapper: Mappers.ExperimentExecutionListResult }, default: { bodyMapper: Mappers.ErrorResponse @@ -826,70 +1058,25 @@ const listAllStatusesOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; -const getStatusOperationSpec: coreClient.OperationSpec = { +const getExecutionOperationSpec: coreClient.OperationSpec = { path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses/{statusId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.ExperimentStatus + bodyMapper: Mappers.ExperimentExecution }, default: { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion], + queryParameters: [Parameters.apiVersion, Parameters.expand], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.experimentName, - Parameters.statusId - ], - headerParameters: [Parameters.accept], - serializer -}; -const listExecutionDetailsOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ExperimentExecutionDetailsListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.experimentName - ], - headerParameters: [Parameters.accept], - serializer -}; -const getExecutionDetailsOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails/{executionDetailsId}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ExperimentExecutionDetails - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.experimentName, - Parameters.executionDetailsId + Parameters.executionId ], headerParameters: [Parameters.accept], serializer @@ -933,33 +1120,12 @@ const listNextOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; -const listAllStatusesNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ExperimentStatusListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.nextLink, - Parameters.experimentName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listExecutionDetailsNextOperationSpec: coreClient.OperationSpec = { +const listAllExecutionsNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.ExperimentExecutionDetailsListResult + bodyMapper: Mappers.ExperimentExecutionListResult }, default: { bodyMapper: Mappers.ErrorResponse diff --git a/sdk/chaos/arm-chaos/src/operations/index.ts b/sdk/chaos/arm-chaos/src/operations/index.ts index 200980df3f09..a8dac204e1bb 100644 --- a/sdk/chaos/arm-chaos/src/operations/index.ts +++ b/sdk/chaos/arm-chaos/src/operations/index.ts @@ -9,6 +9,7 @@ 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 new file mode 100644 index 000000000000..7398bcdd3cf1 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/operations/operationStatuses.ts @@ -0,0 +1,72 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { 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 region name of operation. + * @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}/operationsStatuses/{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/operationsInterfaces/experiments.ts b/sdk/chaos/arm-chaos/src/operationsInterfaces/experiments.ts index 8ef06c0de026..9f474467d96a 100644 --- a/sdk/chaos/arm-chaos/src/operationsInterfaces/experiments.ts +++ b/sdk/chaos/arm-chaos/src/operationsInterfaces/experiments.ts @@ -7,14 +7,13 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { Experiment, ExperimentsListAllOptionalParams, ExperimentsListOptionalParams, - ExperimentStatus, - ExperimentsListAllStatusesOptionalParams, - ExperimentExecutionDetails, - ExperimentsListExecutionDetailsOptionalParams, + ExperimentExecution, + ExperimentsListAllExecutionsOptionalParams, ExperimentsDeleteOptionalParams, ExperimentsGetOptionalParams, ExperimentsGetResponse, @@ -24,13 +23,9 @@ import { ExperimentsUpdateOptionalParams, ExperimentsUpdateResponse, ExperimentsCancelOptionalParams, - ExperimentsCancelResponse, ExperimentsStartOptionalParams, - ExperimentsStartResponse, - ExperimentsGetStatusOptionalParams, - ExperimentsGetStatusResponse, - ExperimentsGetExecutionDetailsOptionalParams, - ExperimentsGetExecutionDetailsResponse + ExperimentsGetExecutionOptionalParams, + ExperimentsGetExecutionResponse } from "../models"; /// @@ -53,34 +48,34 @@ export interface Experiments { options?: ExperimentsListOptionalParams ): PagedAsyncIterableIterator; /** - * Get a list of statuses of a Experiment resource. + * 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. */ - listAllStatuses( + listAllExecutions( resourceGroupName: string, experimentName: string, - options?: ExperimentsListAllStatusesOptionalParams - ): PagedAsyncIterableIterator; + options?: ExperimentsListAllExecutionsOptionalParams + ): PagedAsyncIterableIterator; /** - * Get a list of execution details of a Experiment resource. + * 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. */ - listExecutionDetails( + beginDelete( resourceGroupName: string, experimentName: string, - options?: ExperimentsListExecutionDetailsOptionalParams - ): PagedAsyncIterableIterator; + 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. */ - delete( + beginDeleteAndWait( resourceGroupName: string, experimentName: string, options?: ExperimentsDeleteOptionalParams @@ -103,7 +98,25 @@ export interface Experiments { * @param experiment Experiment resource to be created or updated. * @param options The options parameters. */ - createOrUpdate( + 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, @@ -116,7 +129,25 @@ export interface Experiments { * @param experiment Parameters supplied to the Update experiment operation. * @param options The options parameters. */ - update( + 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, @@ -128,46 +159,55 @@ export interface Experiments { * @param experimentName String that represents a Experiment resource name. * @param options The options parameters. */ - cancel( + 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; + ): 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. */ - start( + beginStart( resourceGroupName: string, experimentName: string, options?: ExperimentsStartOptionalParams - ): Promise; + ): Promise, void>>; /** - * Get a status of a Experiment resource. + * Start a Experiment resource. * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param statusId GUID that represents a Experiment status. * @param options The options parameters. */ - getStatus( + beginStartAndWait( resourceGroupName: string, experimentName: string, - statusId: string, - options?: ExperimentsGetStatusOptionalParams - ): Promise; + options?: ExperimentsStartOptionalParams + ): Promise; /** - * Get an execution detail of a Experiment resource. + * 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 executionDetailsId GUID that represents a Experiment execution detail. + * @param executionId GUID that represents a Experiment execution detail. * @param options The options parameters. */ - getExecutionDetails( + getExecution( resourceGroupName: string, experimentName: string, - executionDetailsId: string, - options?: ExperimentsGetExecutionDetailsOptionalParams - ): Promise; + executionId: string, + options?: ExperimentsGetExecutionOptionalParams + ): Promise; } diff --git a/sdk/chaos/arm-chaos/src/operationsInterfaces/index.ts b/sdk/chaos/arm-chaos/src/operationsInterfaces/index.ts index 200980df3f09..a8dac204e1bb 100644 --- a/sdk/chaos/arm-chaos/src/operationsInterfaces/index.ts +++ b/sdk/chaos/arm-chaos/src/operationsInterfaces/index.ts @@ -9,6 +9,7 @@ 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 new file mode 100644 index 000000000000..10c482497419 --- /dev/null +++ b/sdk/chaos/arm-chaos/src/operationsInterfaces/operationStatuses.ts @@ -0,0 +1,27 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + OperationStatusesGetOptionalParams, + OperationStatusesGetResponse +} from "../models"; + +/** Interface representing a OperationStatuses. */ +export interface OperationStatuses { + /** + * Get the status of a long running azure asynchronous operation. + * @param location The region name of operation. + * @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/test/sampleTest.ts b/sdk/chaos/arm-chaos/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/chaos/arm-chaos/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/chaos/arm-chaos/tsconfig.json b/sdk/chaos/arm-chaos/tsconfig.json index cb248642ee7c..3e6ae96443f3 100644 --- a/sdk/chaos/arm-chaos/tsconfig.json +++ b/sdk/chaos/arm-chaos/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-chaos": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"