diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index be8f46d87a50..dcbf14209bb0 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -4822,7 +4822,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.3.0-dev.20231026 + typescript: 5.3.0-dev.20231027 dev: false /eastasianwidth@0.2.0: @@ -9573,6 +9573,37 @@ packages: code-block-writer: 12.0.0 dev: false + /ts-node@10.9.1(@types/node@16.18.55)(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': 16.18.55 + 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.2.2): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true @@ -9784,8 +9815,8 @@ packages: hasBin: true dev: false - /typescript@5.3.0-dev.20231026: - resolution: {integrity: sha512-TPCRnvIO1nKy3PLJwVyXwZJAQ3silk51ktcvvk1NzYoPtS9p3xX7LNodMA6DDDndhbeMkjMlxb/PmPur2Z+zUQ==} + /typescript@5.3.0-dev.20231027: + resolution: {integrity: sha512-YFAOvfXqPu/aZg27Xc6/Ftvbm5YmjgGEsVocBYbh3iZWRoYTcN3kF29ZZIdgRhoqSIN89+W29p4bBChsfVor2g==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -11978,7 +12009,7 @@ packages: dev: false file:projects/arm-chaos.tgz: - resolution: {integrity: sha512-HihBiLf29YvYyxjVJ2L8MVCo+8NcVkVyp0D5RPvkQ8g8L4we34e9WQaCtRrPL4Ab6knn8bJz4jgMN0lYSzl/aA==, tarball: file:projects/arm-chaos.tgz} + resolution: {integrity: sha512-nWLIVgazJLpIO8QeUXrfF0Hs+g4mucvtsz91IPQyK1jrypMGheZABkbu5rJTqhwCTivoT72esJMdcVRvySH+8g==, tarball: file:projects/arm-chaos.tgz} name: '@rush-temp/arm-chaos' version: 0.0.0 dependencies: @@ -11989,18 +12020,20 @@ packages: '@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/mocha': 10.0.2 '@types/node': 16.18.55 chai: 4.3.10 cross-env: 7.0.3 dotenv: 16.3.1 + esm: 3.2.25 mkdirp: 2.1.6 mocha: 10.2.0 - rimraf: 3.0.2 + 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.2.2) + ts-node: 10.9.1(@types/node@16.18.55)(typescript@5.0.4) tslib: 2.6.2 - typescript: 5.2.2 + typescript: 5.0.4 uglify-js: 3.17.4 transitivePeerDependencies: - '@swc/core' @@ -20048,7 +20081,7 @@ packages: dev: false file:projects/identity-broker.tgz: - resolution: {integrity: sha512-Td7ny0f5I13ifzov1ZRpLikjV1W1K+/dP3v0wLbPRNc+5PmO83YEggizdO557ZUAqgXig0lOgOjQNs8RU5Q2zw==, tarball: file:projects/identity-broker.tgz} + resolution: {integrity: sha512-bJeT5l52RzMz9AsOWdVh1c0a1FyZTR49uO1DqkoaMLfHDSxTnSotfk6PySH3xIlHCu6AziNVtLp6PTHB5nBdeA==, tarball: file:projects/identity-broker.tgz} name: '@rush-temp/identity-broker' version: 0.0.0 dependencies: @@ -22206,7 +22239,7 @@ packages: dev: false file:projects/search-documents.tgz: - resolution: {integrity: sha512-v58t6pSQO2V8yONwW5KEjBcPCGQKo0leyK1/Xu3r9/VodjwUkhCra7MN5g8bZXMqe3wl+l5d2KNcrqaMXOmnDg==, tarball: file:projects/search-documents.tgz} + resolution: {integrity: sha512-TYRJDw9i9Sl87uFVhvAvvk5N1Bq/7axieJRvMiK2YkRVDXO0iO4/B9B83ews5FIsNQkGVqEO8xS7cB1FEX+8Og==, tarball: file:projects/search-documents.tgz} name: '@rush-temp/search-documents' version: 0.0.0 dependencies: @@ -22254,7 +22287,7 @@ packages: dev: false file:projects/service-bus.tgz: - resolution: {integrity: sha512-CgQZNEj4Cd1d9SHnlFuFoYEeuVB4yufSziSCh6E+25sOH5CDqb0UmcagHrw+fLBeIY53n3PnF0seP9hzvp+hAg==, tarball: file:projects/service-bus.tgz} + resolution: {integrity: sha512-gyGZU0bo+BvUmhNcsvo0xxwlBz5N0jKg1WA7wND5RV2QdkNnCFSc2dr4D5A7XaE44nHDsyil7qFh5ZC7QOt6pA==, tarball: file:projects/service-bus.tgz} name: '@rush-temp/service-bus' version: 0.0.0 dependencies: diff --git a/sdk/chaos/arm-chaos/CHANGELOG.md b/sdk/chaos/arm-chaos/CHANGELOG.md index 206a97c69f89..4426051556aa 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-27) -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..799879549b77 100644 --- a/sdk/chaos/arm-chaos/_meta.json +++ b/sdk/chaos/arm-chaos/_meta.json @@ -1,8 +1,8 @@ { - "commit": "8a56aa33078dad6012aa59653cbfa643fa985f15", + "commit": "fa443ab78b3ad98066ea5a60bea7d50cc20ce426", "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.11", "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.3", + "use": "@autorest/typescript@^6.0.11" } \ No newline at end of file diff --git a/sdk/chaos/arm-chaos/package.json b/sdk/chaos/arm-chaos/package.json index 9e675227a079..dd726d3dd290 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" }, "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": [ @@ -27,22 +29,29 @@ "types": "./types/arm-chaos.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-multi-entry": "^6.0.0", + "@rollup/plugin-node-resolve": "^13.1.3", "mkdirp": "^2.1.2", - "typescript": "~5.2.0", + "rollup": "^2.66.1", + "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-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", + "@types/mocha": "^10.0.0", + "esm": "^3.2.18", "@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" + "ts-node": "^10.0.0", + "@azure/dev-tool": "^1.0.0" }, "repository": { "type": "git", @@ -63,20 +72,21 @@ "src/**/*.ts", "README.md", "LICENSE", + "rollup.config.js", "tsconfig.json", "review/*", "CHANGELOG.md", "types/*" ], "scripts": { - "build": "npm run clean && tsc && dev-tool run bundle && npm run minify && mkdirp ./review && npm run extract-api", + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", "extract-api": "api-extractor run --local", "lint": "echo skipped", "audit": "echo skipped", - "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "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", @@ -104,13 +114,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..84924a86a7a7 100644 --- a/sdk/chaos/arm-chaos/review/arm-chaos.api.md +++ b/sdk/chaos/arm-chaos/review/arm-chaos.api.md @@ -6,13 +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'; - -// @public -export interface Action { - name: string; - type: "delay" | "discrete" | "continuous"; -} +import { SimplePollerLike } from '@azure/core-lro'; // @public export interface ActionStatus { @@ -27,15 +23,6 @@ export interface ActionStatus { // @public export type ActionType = string; -// @public (undocumented) -export type ActionUnion = Action | DelayAction | DiscreteAction | ContinuousAction; - -// @public -export interface Branch { - actions: ActionUnion[]; - name: string; -} - // @public export interface BranchStatus { readonly actions?: ActionStatus[]; @@ -156,6 +143,27 @@ export interface CapabilityTypesListOptionalParams extends coreClient.OperationO // @public export type CapabilityTypesListResponse = CapabilityTypeListResult; +// @public +export interface ChaosExperimentAction { + name: string; + type: "delay" | "discrete" | "continuous"; +} + +// @public (undocumented) +export type ChaosExperimentActionUnion = ChaosExperimentAction | DelayAction | DiscreteAction | ContinuousAction; + +// @public +export interface ChaosExperimentBranch { + actions: ChaosExperimentActionUnion[]; + name: string; +} + +// @public +export interface ChaosExperimentStep { + branches: ChaosExperimentBranch[]; + name: string; +} + // @public (undocumented) export class ChaosManagementClient extends coreClient.ServiceClient { // (undocumented) @@ -173,6 +181,8 @@ export class ChaosManagementClient extends coreClient.ServiceClient { // (undocumented) operations: Operations; // (undocumented) + operationStatuses: OperationStatuses; + // (undocumented) subscriptionId?: string; // (undocumented) targets: Targets; @@ -188,7 +198,50 @@ export interface ChaosManagementClientOptionalParams extends coreClient.ServiceC } // @public -export interface ContinuousAction extends Action { +export interface ChaosTargetFilter { + type: "Simple"; +} + +// @public (undocumented) +export type ChaosTargetFilterUnion = ChaosTargetFilter | ChaosTargetSimpleFilter; + +// @public +export interface ChaosTargetListSelector extends ChaosTargetSelector { + targets: TargetReference[]; + type: "List"; +} + +// @public +export interface ChaosTargetQuerySelector extends ChaosTargetSelector { + queryString: string; + subscriptionIds: string[]; + type: "Query"; +} + +// @public +export interface ChaosTargetSelector { + [property: string]: any; + filter?: ChaosTargetFilterUnion; + id: string; + type: "List" | "Query"; +} + +// @public (undocumented) +export type ChaosTargetSelectorUnion = ChaosTargetSelector | ChaosTargetListSelector | ChaosTargetQuerySelector; + +// @public +export interface ChaosTargetSimpleFilter extends ChaosTargetFilter { + parameters?: ChaosTargetSimpleFilterParameters; + type: "Simple"; +} + +// @public +export interface ChaosTargetSimpleFilterParameters { + zones?: string[]; +} + +// @public +export interface ContinuousAction extends ChaosExperimentAction { duration: string; parameters: KeyValuePair[]; selectorId: string; @@ -199,13 +252,13 @@ export interface ContinuousAction extends Action { export type CreatedByType = string; // @public -export interface DelayAction extends Action { +export interface DelayAction extends ChaosExperimentAction { duration: string; type: "delay"; } // @public -export interface DiscreteAction extends Action { +export interface DiscreteAction extends ChaosExperimentAction { parameters: KeyValuePair[]; selectorId: string; type: "discrete"; @@ -234,16 +287,20 @@ export interface ErrorResponse { // @public export interface Experiment extends TrackedResource { identity?: ResourceIdentity; - selectors: SelectorUnion[]; - startOnCreation?: boolean; - steps: Step[]; + readonly provisioningState?: ProvisioningState; + selectors: ChaosTargetSelectorUnion[]; + steps: ChaosExperimentStep[]; readonly systemData?: SystemData; } // @public -export interface ExperimentCancelOperationResult { +export interface ExperimentExecution { + readonly id?: string; readonly name?: string; - readonly statusUrl?: string; + readonly startedAt?: Date; + readonly status?: string; + readonly stoppedAt?: Date; + readonly type?: string; } // @public @@ -263,23 +320,22 @@ export interface ExperimentExecutionActionTargetDetailsProperties { // @public export interface ExperimentExecutionDetails { - readonly createdDateTime?: Date; - readonly experimentId?: string; readonly failureReason?: string; readonly id?: string; - readonly lastActionDateTime?: Date; + readonly lastActionAt?: 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 { - readonly nextLink?: string; - readonly value?: ExperimentExecutionDetails[]; +export interface ExperimentExecutionDetailsProperties extends ExperimentExecutionProperties { + readonly failureReason?: string; + readonly lastActionAt?: Date; + readonly runInformation?: ExperimentExecutionDetailsPropertiesRunInformation; } // @public @@ -287,6 +343,19 @@ export interface ExperimentExecutionDetailsPropertiesRunInformation { readonly steps?: StepStatus[]; } +// @public +export interface ExperimentExecutionListResult { + readonly nextLink?: string; + readonly value?: ExperimentExecution[]; +} + +// @public +export interface ExperimentExecutionProperties { + readonly startedAt?: Date; + readonly status?: string; + readonly stoppedAt?: Date; +} + // @public export interface ExperimentListResult { readonly nextLink?: string; @@ -295,29 +364,34 @@ 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; + executionDetails(resourceGroupName: string, experimentName: string, executionId: string, options?: ExperimentsExecutionDetailsOptionalParams): 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,72 +399,60 @@ export type ExperimentsCreateOrUpdateResponse = Experiment; // @public export interface ExperimentsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; } // @public -export interface ExperimentsGetExecutionDetailsOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ExperimentsGetExecutionDetailsResponse = ExperimentExecutionDetails; - -// @public -export interface ExperimentsGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ExperimentsGetResponse = Experiment; - -// @public -export interface ExperimentsGetStatusOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsExecutionDetailsOptionalParams extends coreClient.OperationOptions { } // @public -export type ExperimentsGetStatusResponse = ExperimentStatus; +export type ExperimentsExecutionDetailsResponse = ExperimentExecutionDetails; // @public -export interface ExperimentsListAllNextOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsGetExecutionOptionalParams extends coreClient.OperationOptions { } // @public -export type ExperimentsListAllNextResponse = ExperimentListResult; +export type ExperimentsGetExecutionResponse = ExperimentExecution; // @public -export interface ExperimentsListAllOptionalParams extends coreClient.OperationOptions { - continuationToken?: string; - running?: boolean; +export interface ExperimentsGetOptionalParams extends coreClient.OperationOptions { } // @public -export type ExperimentsListAllResponse = ExperimentListResult; +export type ExperimentsGetResponse = Experiment; // @public -export interface ExperimentsListAllStatusesNextOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsListAllExecutionsNextOptionalParams extends coreClient.OperationOptions { } // @public -export type ExperimentsListAllStatusesNextResponse = ExperimentStatusListResult; +export type ExperimentsListAllExecutionsNextResponse = ExperimentExecutionListResult; // @public -export interface ExperimentsListAllStatusesOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsListAllExecutionsOptionalParams extends coreClient.OperationOptions { } // @public -export type ExperimentsListAllStatusesResponse = ExperimentStatusListResult; +export type ExperimentsListAllExecutionsResponse = ExperimentExecutionListResult; // @public -export interface ExperimentsListExecutionDetailsNextOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsListAllNextOptionalParams extends coreClient.OperationOptions { } // @public -export type ExperimentsListExecutionDetailsNextResponse = ExperimentExecutionDetailsListResult; +export type ExperimentsListAllNextResponse = ExperimentListResult; // @public -export interface ExperimentsListExecutionDetailsOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsListAllOptionalParams extends coreClient.OperationOptions { + continuationToken?: string; + running?: boolean; } // @public -export type ExperimentsListExecutionDetailsResponse = ExperimentExecutionDetailsListResult; +export type ExperimentsListAllResponse = ExperimentListResult; // @public export interface ExperimentsListNextOptionalParams extends coreClient.OperationOptions { @@ -410,35 +472,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 @@ -449,17 +490,9 @@ export interface ExperimentUpdate { identity?: ResourceIdentity; } -// @public -export interface Filter { - type: "Simple"; -} - // @public export type FilterType = string; -// @public (undocumented) -export type FilterUnion = Filter | SimpleFilter; - // @public export function getContinuationToken(page: unknown): string | undefined; @@ -494,6 +527,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", @@ -505,12 +548,6 @@ export enum KnownTargetReferenceType { ChaosTarget = "ChaosTarget" } -// @public -export interface ListSelector extends Selector { - targets: TargetReference[]; - type: "List"; -} - // @public export interface Operation { readonly actionType?: ActionType; @@ -554,15 +591,33 @@ export interface OperationsListAllOptionalParams extends coreClient.OperationOpt export type OperationsListAllResponse = OperationListResult; // @public -export type Origin = string; +export interface OperationStatus { + endTime?: string; + error?: ErrorResponse; + id?: string; + name?: string; + startTime?: string; + status?: string; +} // @public -export interface QuerySelector extends Selector { - queryString: string; - subscriptionIds: string[]; - type: "Query"; +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 Resource { readonly id?: string; @@ -583,37 +638,9 @@ export interface ResourceIdentity { // @public export type ResourceIdentityType = "None" | "SystemAssigned" | "UserAssigned"; -// @public -export interface Selector { - [property: string]: any; - filter?: FilterUnion; - id: string; - type: "List" | "Query"; -} - // @public export type SelectorType = string; -// @public (undocumented) -export type SelectorUnion = Selector | ListSelector | QuerySelector; - -// @public -export interface SimpleFilter extends Filter { - parameters?: SimpleFilterParameters; - type: "Simple"; -} - -// @public -export interface SimpleFilterParameters { - zones?: string[]; -} - -// @public -export interface Step { - branches: Branch[]; - name: string; -} - // @public export interface StepStatus { readonly branches?: BranchStatus[]; diff --git a/sdk/chaos/arm-chaos/rollup.config.js b/sdk/chaos/arm-chaos/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/chaos/arm-chaos/rollup.config.js @@ -0,0 +1,122 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs(), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/chaos/arm-chaos/src/chaosManagementClient.ts b/sdk/chaos/arm-chaos/src/chaosManagementClient.ts index 5e3161917640..eeb8fde3e426 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 @@ -78,7 +80,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 +133,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 +175,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..58786a60de8b 100644 --- a/sdk/chaos/arm-chaos/src/models/index.ts +++ b/sdk/chaos/arm-chaos/src/models/index.ts @@ -8,13 +8,18 @@ import * as coreClient from "@azure/core-client"; -export type ActionUnion = - | Action +export type ChaosExperimentActionUnion = + | ChaosExperimentAction | DelayAction | DiscreteAction | ContinuousAction; -export type SelectorUnion = Selector | ListSelector | QuerySelector; -export type FilterUnion = Filter | SimpleFilter; +export type ChaosTargetSelectorUnion = + | ChaosTargetSelector + | ChaosTargetListSelector + | ChaosTargetQuerySelector; +export type ChaosTargetFilterUnion = + | ChaosTargetFilter + | ChaosTargetSimpleFilter; /** Model that represents a list of Capability resources and a link for pagination. */ export interface CapabilityListResult { @@ -184,23 +189,23 @@ export interface UserAssignedIdentity { } /** Model that represents a step in the Experiment resource. */ -export interface Step { +export interface ChaosExperimentStep { /** String of the step name. */ name: string; /** List of branches. */ - branches: Branch[]; + branches: ChaosExperimentBranch[]; } -/** Model that represents a branch in the step. */ -export interface Branch { +/** Model that represents a branch in the step. 9 total per experiment. */ +export interface ChaosExperimentBranch { /** String of the branch name. */ name: string; /** List of actions. */ - actions: ActionUnion[]; + actions: ChaosExperimentActionUnion[]; } -/** Model that represents the base action model. */ -export interface Action { +/** Model that represents the base action model. 9 total per experiment. */ +export interface ChaosExperimentAction { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "delay" | "discrete" | "continuous"; /** String that represents a Capability URN. */ @@ -208,7 +213,7 @@ export interface Action { } /** Model that represents a selector in the Experiment resource. */ -export interface Selector { +export interface ChaosTargetSelector { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "List" | "Query"; /** Describes unknown properties. The value of an unknown property can be of "any" type. */ @@ -216,11 +221,11 @@ export interface Selector { /** String of the selector ID. */ id: string; /** Model that represents available filter types that can be applied to a targets list. */ - filter?: FilterUnion; + filter?: ChaosTargetFilterUnion; } /** Model that represents available filter types that can be applied to a targets list. */ -export interface Filter { +export interface ChaosTargetFilter { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "Simple"; } @@ -231,50 +236,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[]; + readonly value?: ExperimentExecution[]; /** - * URL to retrieve the next page of Experiment statuses. + * 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 status of a Experiment. */ -export interface ExperimentStatus { +/** 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. @@ -291,37 +268,42 @@ export interface ExperimentStatus { */ readonly name?: string; /** - * String that represents the status of a Experiment. + * The status of the execution. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly status?: string; /** - * String that represents the created date time of a Experiment. + * String that represents the start date time. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly createdDateUtc?: Date; + readonly startedAt?: Date; /** - * String that represents the end date time of a Experiment. + * String that represents the stop date time. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly endDateUtc?: Date; + readonly stoppedAt?: Date; } -/** Model that represents a list of Experiment execution details and a link for pagination. */ -export interface ExperimentExecutionDetailsListResult { +/** Model that represents the execution properties of an Experiment. */ +export interface ExperimentExecutionProperties { + /** + * The status of the execution. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly status?: string; /** - * List of Experiment execution details. + * String that represents the start date time. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly value?: ExperimentExecutionDetails[]; + readonly startedAt?: Date; /** - * URL to retrieve the next page of Experiment execution details. + * String that represents the stop date time. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly nextLink?: string; + readonly stoppedAt?: Date; } -/** Model that represents the execution details of a Experiment. */ +/** Model that represents the execution details of an Experiment. */ export interface ExperimentExecutionDetails { /** * String of the resource type. @@ -339,40 +321,30 @@ export interface ExperimentExecutionDetails { */ readonly name?: string; /** - * The id of the experiment. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - 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. + * String that represents the start date time. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly createdDateTime?: Date; + readonly startedAt?: Date; /** - * String that represents the last action date time. + * String that represents the stop date time. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly lastActionDateTime?: Date; + readonly stoppedAt?: Date; /** - * String that represents the start date time. + * The reason why the execution failed. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly startDateTime?: Date; + readonly failureReason?: string; /** - * String that represents the stop date time. + * String that represents the last action date time. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly stopDateTime?: Date; + readonly lastActionAt?: Date; /** * The information of the experiment run. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -514,6 +486,22 @@ export interface ExperimentExecutionActionTargetDetailsError { 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. */ export interface OperationListResult { /** @@ -623,7 +611,7 @@ export interface TargetReference { } /** Model that represents the Simple filter parameters. */ -export interface SimpleFilterParameters { +export interface ChaosTargetSimpleFilterParameters { /** List of Azure availability zones to filter targets by. */ zones?: string[]; } @@ -767,7 +755,7 @@ export interface Target extends Resource { } /** Model that represents a delay action. */ -export interface DelayAction extends Action { +export interface DelayAction extends ChaosExperimentAction { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "delay"; /** ISO8601 formatted string that represents a duration. */ @@ -775,7 +763,7 @@ export interface DelayAction extends Action { } /** Model that represents a discrete action. */ -export interface DiscreteAction extends Action { +export interface DiscreteAction extends ChaosExperimentAction { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "discrete"; /** List of key value pairs. */ @@ -785,7 +773,7 @@ export interface DiscreteAction extends Action { } /** Model that represents a continuous action. */ -export interface ContinuousAction extends Action { +export interface ContinuousAction extends ChaosExperimentAction { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "continuous"; /** ISO8601 formatted string that represents a duration. */ @@ -797,7 +785,7 @@ export interface ContinuousAction extends Action { } /** Model that represents a list selector. */ -export interface ListSelector extends Selector { +export interface ChaosTargetListSelector extends ChaosTargetSelector { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "List"; /** List of Target references. */ @@ -805,7 +793,7 @@ export interface ListSelector extends Selector { } /** Model that represents a query selector. */ -export interface QuerySelector extends Selector { +export interface ChaosTargetQuerySelector extends ChaosTargetSelector { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "Query"; /** Azure Resource Graph (ARG) Query Language query for target resources. */ @@ -815,11 +803,31 @@ export interface QuerySelector extends Selector { } /** Model that represents a simple target filter. */ -export interface SimpleFilter extends Filter { +export interface ChaosTargetSimpleFilter extends ChaosTargetFilter { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "Simple"; /** Model that represents the Simple filter parameters. */ - parameters?: SimpleFilterParameters; + parameters?: ChaosTargetSimpleFilterParameters; +} + +/** Model that represents the extended properties of an experiment execution. */ +export interface ExperimentExecutionDetailsProperties + extends ExperimentExecutionProperties { + /** + * The reason why the execution failed. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly failureReason?: string; + /** + * String that represents the last action date time. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastActionAt?: Date; + /** + * The information of the experiment run. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly runInformation?: ExperimentExecutionDetailsPropertiesRunInformation; } /** Model that represents a Experiment resource. */ @@ -831,12 +839,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[]; + steps: ChaosExperimentStep[]; /** List of selectors. */ - selectors: SelectorUnion[]; - /** A boolean value that indicates if experiment should be started on creation or not. */ - startOnCreation?: boolean; + selectors: ChaosTargetSelectorUnion[]; } /** Known values of {@link CreatedByType} that the service accepts. */ @@ -863,6 +874,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 +1075,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 +1091,66 @@ 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; + 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 ExperimentsGetStatusOptionalParams +export interface ExperimentsListAllExecutionsOptionalParams extends coreClient.OperationOptions {} -/** Contains response data for the getStatus operation. */ -export type ExperimentsGetStatusResponse = ExperimentStatus; +/** Contains response data for the listAllExecutions operation. */ +export type ExperimentsListAllExecutionsResponse = ExperimentExecutionListResult; /** Optional parameters. */ -export interface ExperimentsListExecutionDetailsOptionalParams +export interface ExperimentsGetExecutionOptionalParams extends coreClient.OperationOptions {} -/** Contains response data for the listExecutionDetails operation. */ -export type ExperimentsListExecutionDetailsResponse = ExperimentExecutionDetailsListResult; +/** Contains response data for the getExecution operation. */ +export type ExperimentsGetExecutionResponse = ExperimentExecution; /** Optional parameters. */ -export interface ExperimentsGetExecutionDetailsOptionalParams +export interface ExperimentsExecutionDetailsOptionalParams extends coreClient.OperationOptions {} -/** Contains response data for the getExecutionDetails operation. */ -export type ExperimentsGetExecutionDetailsResponse = ExperimentExecutionDetails; +/** Contains response data for the executionDetails operation. */ +export type ExperimentsExecutionDetailsResponse = ExperimentExecutionDetails; /** Optional parameters. */ export interface ExperimentsListAllNextOptionalParams @@ -1114,18 +1167,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 diff --git a/sdk/chaos/arm-chaos/src/models/mappers.ts b/sdk/chaos/arm-chaos/src/models/mappers.ts index 6f5aca130306..80f01dd60d88 100644 --- a/sdk/chaos/arm-chaos/src/models/mappers.ts +++ b/sdk/chaos/arm-chaos/src/models/mappers.ts @@ -367,10 +367,10 @@ export const UserAssignedIdentity: coreClient.CompositeMapper = { } }; -export const Step: coreClient.CompositeMapper = { +export const ChaosExperimentStep: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Step", + className: "ChaosExperimentStep", modelProperties: { name: { constraints: { @@ -384,7 +384,8 @@ export const Step: coreClient.CompositeMapper = { }, branches: { constraints: { - MinItems: 1 + MinItems: 1, + MaxItems: 9 }, serializedName: "branches", required: true, @@ -393,7 +394,7 @@ export const Step: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "Branch" + className: "ChaosExperimentBranch" } } } @@ -402,10 +403,10 @@ export const Step: coreClient.CompositeMapper = { } }; -export const Branch: coreClient.CompositeMapper = { +export const ChaosExperimentBranch: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Branch", + className: "ChaosExperimentBranch", modelProperties: { name: { constraints: { @@ -419,7 +420,8 @@ export const Branch: coreClient.CompositeMapper = { }, actions: { constraints: { - MinItems: 1 + MinItems: 1, + MaxItems: 9 }, serializedName: "actions", required: true, @@ -428,7 +430,7 @@ export const Branch: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "Action" + className: "ChaosExperimentAction" } } } @@ -437,11 +439,11 @@ export const Branch: coreClient.CompositeMapper = { } }; -export const Action: coreClient.CompositeMapper = { +export const ChaosExperimentAction: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Action", - uberParent: "Action", + className: "ChaosExperimentAction", + uberParent: "ChaosExperimentAction", polymorphicDiscriminator: { serializedName: "type", clientName: "type" @@ -468,12 +470,12 @@ export const Action: coreClient.CompositeMapper = { } }; -export const Selector: coreClient.CompositeMapper = { - serializedName: "Selector", +export const ChaosTargetSelector: coreClient.CompositeMapper = { + serializedName: "ChaosTargetSelector", type: { name: "Composite", - className: "Selector", - uberParent: "Selector", + className: "ChaosTargetSelector", + uberParent: "ChaosTargetSelector", additionalProperties: { type: { name: "Object" } }, polymorphicDiscriminator: { serializedName: "type", @@ -501,18 +503,18 @@ export const Selector: coreClient.CompositeMapper = { serializedName: "filter", type: { name: "Composite", - className: "Filter" + className: "ChaosTargetFilter" } } } } }; -export const Filter: coreClient.CompositeMapper = { +export const ChaosTargetFilter: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Filter", - uberParent: "Filter", + className: "ChaosTargetFilter", + uberParent: "ChaosTargetFilter", polymorphicDiscriminator: { serializedName: "type", clientName: "type" @@ -545,62 +547,10 @@ export const ExperimentUpdate: coreClient.CompositeMapper = { } }; -export const ExperimentCancelOperationResult: 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 = { +export const ExperimentExecutionListResult: 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 +560,7 @@ export const ExperimentStatusListResult: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "ExperimentStatus" + className: "ExperimentExecution" } } } @@ -630,10 +580,10 @@ export const ExperimentStatusListResult: coreClient.CompositeMapper = { } }; -export const ExperimentStatus: coreClient.CompositeMapper = { +export const ExperimentExecution: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ExperimentStatus", + className: "ExperimentExecution", modelProperties: { type: { serializedName: "type", @@ -663,17 +613,16 @@ export const ExperimentStatus: coreClient.CompositeMapper = { name: "String" } }, - createdDateUtc: { - serializedName: "properties.createdDateUtc", + startedAt: { + serializedName: "properties.startedAt", readOnly: true, type: { name: "DateTime" } }, - endDateUtc: { - serializedName: "properties.endDateUtc", + stoppedAt: { + serializedName: "properties.stoppedAt", readOnly: true, - nullable: true, type: { name: "DateTime" } @@ -682,33 +631,30 @@ export const ExperimentStatus: coreClient.CompositeMapper = { } }; -export const ExperimentExecutionDetailsListResult: coreClient.CompositeMapper = { +export const ExperimentExecutionProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ExperimentExecutionDetailsListResult", + className: "ExperimentExecutionProperties", modelProperties: { - value: { - serializedName: "value", + status: { + serializedName: "status", readOnly: true, type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExperimentExecutionDetails" - } - } + name: "String" } }, - nextLink: { - constraints: { - MaxLength: 2048 - }, - serializedName: "nextLink", + startedAt: { + serializedName: "startedAt", readOnly: true, - nullable: true, type: { - name: "String" + name: "DateTime" + } + }, + stoppedAt: { + serializedName: "stoppedAt", + readOnly: true, + type: { + name: "DateTime" } } } @@ -741,13 +687,6 @@ export const ExperimentExecutionDetails: coreClient.CompositeMapper = { name: "String" } }, - experimentId: { - serializedName: "properties.experimentId", - readOnly: true, - type: { - name: "String" - } - }, status: { serializedName: "properties.status", readOnly: true, @@ -755,36 +694,29 @@ export const ExperimentExecutionDetails: coreClient.CompositeMapper = { name: "String" } }, - failureReason: { - serializedName: "properties.failureReason", - readOnly: true, - type: { - name: "String" - } - }, - createdDateTime: { - serializedName: "properties.createdDateTime", + startedAt: { + serializedName: "properties.startedAt", readOnly: true, type: { name: "DateTime" } }, - lastActionDateTime: { - serializedName: "properties.lastActionDateTime", + stoppedAt: { + serializedName: "properties.stoppedAt", readOnly: true, type: { name: "DateTime" } }, - startDateTime: { - serializedName: "properties.startDateTime", + failureReason: { + serializedName: "properties.failureReason", readOnly: true, type: { - name: "DateTime" + name: "String" } }, - stopDateTime: { - serializedName: "properties.stopDateTime", + lastActionAt: { + serializedName: "properties.lastActionAt", readOnly: true, type: { name: "DateTime" @@ -1035,6 +967,52 @@ export const ExperimentExecutionActionTargetDetailsError: coreClient.CompositeMa } }; +export const OperationStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationStatus", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + startTime: { + serializedName: "startTime", + type: { + name: "String" + } + }, + endTime: { + serializedName: "endTime", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorResponse" + } + } + } + } +}; + export const OperationListResult: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1268,10 +1246,10 @@ export const TargetReference: coreClient.CompositeMapper = { } }; -export const SimpleFilterParameters: coreClient.CompositeMapper = { +export const ChaosTargetSimpleFilterParameters: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SimpleFilterParameters", + className: "ChaosTargetSimpleFilterParameters", modelProperties: { zones: { serializedName: "zones", @@ -1572,10 +1550,11 @@ export const DelayAction: coreClient.CompositeMapper = { type: { name: "Composite", className: "DelayAction", - uberParent: "Action", - polymorphicDiscriminator: Action.type.polymorphicDiscriminator, + uberParent: "ChaosExperimentAction", + polymorphicDiscriminator: + ChaosExperimentAction.type.polymorphicDiscriminator, modelProperties: { - ...Action.type.modelProperties, + ...ChaosExperimentAction.type.modelProperties, duration: { serializedName: "duration", required: true, @@ -1592,10 +1571,11 @@ export const DiscreteAction: coreClient.CompositeMapper = { type: { name: "Composite", className: "DiscreteAction", - uberParent: "Action", - polymorphicDiscriminator: Action.type.polymorphicDiscriminator, + uberParent: "ChaosExperimentAction", + polymorphicDiscriminator: + ChaosExperimentAction.type.polymorphicDiscriminator, modelProperties: { - ...Action.type.modelProperties, + ...ChaosExperimentAction.type.modelProperties, parameters: { serializedName: "parameters", required: true, @@ -1628,10 +1608,11 @@ export const ContinuousAction: coreClient.CompositeMapper = { type: { name: "Composite", className: "ContinuousAction", - uberParent: "Action", - polymorphicDiscriminator: Action.type.polymorphicDiscriminator, + uberParent: "ChaosExperimentAction", + polymorphicDiscriminator: + ChaosExperimentAction.type.polymorphicDiscriminator, modelProperties: { - ...Action.type.modelProperties, + ...ChaosExperimentAction.type.modelProperties, duration: { serializedName: "duration", required: true, @@ -1666,19 +1647,20 @@ export const ContinuousAction: coreClient.CompositeMapper = { } }; -export const ListSelector: coreClient.CompositeMapper = { +export const ChaosTargetListSelector: coreClient.CompositeMapper = { serializedName: "List", type: { name: "Composite", - className: "ListSelector", - uberParent: "Selector", + className: "ChaosTargetListSelector", + uberParent: "ChaosTargetSelector", additionalProperties: { type: { name: "Object" } }, - polymorphicDiscriminator: Selector.type.polymorphicDiscriminator, + polymorphicDiscriminator: ChaosTargetSelector.type.polymorphicDiscriminator, modelProperties: { - ...Selector.type.modelProperties, + ...ChaosTargetSelector.type.modelProperties, targets: { constraints: { - MinItems: 1 + MinItems: 1, + MaxItems: 50 }, serializedName: "targets", required: true, @@ -1696,16 +1678,16 @@ export const ListSelector: coreClient.CompositeMapper = { } }; -export const QuerySelector: coreClient.CompositeMapper = { +export const ChaosTargetQuerySelector: coreClient.CompositeMapper = { serializedName: "Query", type: { name: "Composite", - className: "QuerySelector", - uberParent: "Selector", + className: "ChaosTargetQuerySelector", + uberParent: "ChaosTargetSelector", additionalProperties: { type: { name: "Object" } }, - polymorphicDiscriminator: Selector.type.polymorphicDiscriminator, + polymorphicDiscriminator: ChaosTargetSelector.type.polymorphicDiscriminator, modelProperties: { - ...Selector.type.modelProperties, + ...ChaosTargetSelector.type.modelProperties, queryString: { serializedName: "queryString", required: true, @@ -1732,20 +1714,51 @@ export const QuerySelector: coreClient.CompositeMapper = { } }; -export const SimpleFilter: coreClient.CompositeMapper = { +export const ChaosTargetSimpleFilter: coreClient.CompositeMapper = { serializedName: "Simple", type: { name: "Composite", - className: "SimpleFilter", - uberParent: "Filter", - polymorphicDiscriminator: Filter.type.polymorphicDiscriminator, + className: "ChaosTargetSimpleFilter", + uberParent: "ChaosTargetFilter", + polymorphicDiscriminator: ChaosTargetFilter.type.polymorphicDiscriminator, modelProperties: { - ...Filter.type.modelProperties, + ...ChaosTargetFilter.type.modelProperties, parameters: { serializedName: "parameters", type: { name: "Composite", - className: "SimpleFilterParameters" + className: "ChaosTargetSimpleFilterParameters" + } + } + } + } +}; + +export const ExperimentExecutionDetailsProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExperimentExecutionDetailsProperties", + modelProperties: { + ...ExperimentExecutionProperties.type.modelProperties, + failureReason: { + serializedName: "failureReason", + readOnly: true, + type: { + name: "String" + } + }, + lastActionAt: { + serializedName: "lastActionAt", + readOnly: true, + type: { + name: "DateTime" + } + }, + runInformation: { + serializedName: "runInformation", + type: { + name: "Composite", + className: "ExperimentExecutionDetailsPropertiesRunInformation" } } } @@ -1772,9 +1785,17 @@ export const Experiment: coreClient.CompositeMapper = { className: "ResourceIdentity" } }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, steps: { constraints: { - MinItems: 1 + MinItems: 1, + MaxItems: 4 }, serializedName: "properties.steps", required: true, @@ -1783,7 +1804,7 @@ export const Experiment: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "Step" + className: "ChaosExperimentStep" } } } @@ -1799,30 +1820,23 @@ export const Experiment: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "Selector" + className: "ChaosTargetSelector" } } } - }, - startOnCreation: { - serializedName: "properties.startOnCreation", - nullable: true, - type: { - name: "Boolean" - } } } } }; export let discriminators = { - Action: Action, - Selector: Selector, - Filter: Filter, - "Action.delay": DelayAction, - "Action.discrete": DiscreteAction, - "Action.continuous": ContinuousAction, - "Selector.List": ListSelector, - "Selector.Query": QuerySelector, - "Filter.Simple": SimpleFilter + ChaosExperimentAction: ChaosExperimentAction, + ChaosTargetSelector: ChaosTargetSelector, + ChaosTargetFilter: ChaosTargetFilter, + "ChaosExperimentAction.delay": DelayAction, + "ChaosExperimentAction.discrete": DiscreteAction, + "ChaosExperimentAction.continuous": ContinuousAction, + "ChaosTargetSelector.List": ChaosTargetListSelector, + "ChaosTargetSelector.Query": ChaosTargetQuerySelector, + "ChaosTargetFilter.Simple": ChaosTargetSimpleFilter }; diff --git a/sdk/chaos/arm-chaos/src/models/parameters.ts b/sdk/chaos/arm-chaos/src/models/parameters.ts index 6075ecf078f5..23fd9fbcda84 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,21 @@ export const statusId: OperationURLParameter = { } }; -export const executionDetailsId: OperationURLParameter = { - parameterPath: "executionDetailsId", +export const location: OperationURLParameter = { + parameterPath: "location", 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: "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..79bc691392d5 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,14 @@ import { ExperimentsUpdateOptionalParams, ExperimentsUpdateResponse, ExperimentsCancelOptionalParams, - ExperimentsCancelResponse, ExperimentsStartOptionalParams, - ExperimentsStartResponse, - ExperimentsGetStatusOptionalParams, - ExperimentsGetStatusResponse, - ExperimentsGetExecutionDetailsOptionalParams, - ExperimentsGetExecutionDetailsResponse, + ExperimentsGetExecutionOptionalParams, + ExperimentsGetExecutionResponse, + ExperimentsExecutionDetailsOptionalParams, + ExperimentsExecutionDetailsResponse, ExperimentsListAllNextResponse, ExperimentsListNextResponse, - ExperimentsListAllStatusesNextResponse, - ExperimentsListExecutionDetailsNextResponse + ExperimentsListAllExecutionsNextResponse } from "../models"; /// @@ -181,17 +180,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 +206,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 +216,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 +236,7 @@ export class ExperimentsImpl implements Experiments { yield page; } while (continuationToken) { - result = await this._listAllStatusesNext( + result = await this._listAllExecutionsNext( resourceGroupName, experimentName, continuationToken, @@ -250,96 +249,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 +294,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 +395,93 @@ 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: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create or update a Experiment resource. + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or updated. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( resourceGroupName: string, experimentName: string, experiment: Experiment, options?: ExperimentsCreateOrUpdateOptionalParams ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, experiment, options }, - createOrUpdateOperationSpec + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + experimentName, + experiment, + options ); + return poller.pollUntilDone(); } /** @@ -433,16 +491,93 @@ export class ExperimentsImpl implements Experiments { * @param experiment Parameters supplied to the Update experiment operation. * @param options The options parameters. */ - update( + async beginUpdate( + resourceGroupName: string, + experimentName: string, + experiment: ExperimentUpdate, + options?: ExperimentsUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + ExperimentsUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, experimentName, experiment, options }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + ExperimentsUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * The operation to update an experiment. + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment operation. + * @param options The options parameters. + */ + async beginUpdateAndWait( resourceGroupName: string, experimentName: string, experiment: ExperimentUpdate, options?: ExperimentsUpdateOptionalParams ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, experiment, options }, - updateOperationSpec + const poller = await this.beginUpdate( + resourceGroupName, + experimentName, + experiment, + options ); + return poller.pollUntilDone(); } /** @@ -451,15 +586,81 @@ 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; + } + + /** + * Cancel a running Experiment resource. + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param options The options parameters. + */ + async beginCancelAndWait( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsCancelOptionalParams + ): Promise { + const poller = await this.beginCancel( + resourceGroupName, + experimentName, + options ); + return poller.pollUntilDone(); } /** @@ -468,86 +669,135 @@ export class ExperimentsImpl implements Experiments { * @param experimentName String that represents a Experiment resource name. * @param options The options parameters. */ - start( + async beginStart( resourceGroupName: string, experimentName: string, options?: ExperimentsStartOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, options }, - startOperationSpec - ); + ): 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 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 beginStartAndWait( resourceGroupName: string, experimentName: string, - options?: ExperimentsListAllStatusesOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, options }, - listAllStatusesOperationSpec + options?: ExperimentsStartOptionalParams + ): Promise { + const poller = await this.beginStart( + resourceGroupName, + experimentName, + options ); + return poller.pollUntilDone(); } /** - * Get a status 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 statusId GUID that represents a Experiment status. * @param options The options parameters. */ - getStatus( + private _listAllExecutions( resourceGroupName: string, experimentName: string, - statusId: string, - options?: ExperimentsGetStatusOptionalParams - ): Promise { + options?: ExperimentsListAllExecutionsOptionalParams + ): Promise { return this.client.sendOperationRequest( - { resourceGroupName, experimentName, statusId, options }, - getStatusOperationSpec + { resourceGroupName, experimentName, options }, + listAllExecutionsOperationSpec ); } /** - * Get a list of execution details 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 executionId GUID that represents a Experiment execution detail. * @param options The options parameters. */ - private _listExecutionDetails( + getExecution( resourceGroupName: string, experimentName: string, - options?: ExperimentsListExecutionDetailsOptionalParams - ): Promise { + executionId: string, + options?: ExperimentsGetExecutionOptionalParams + ): Promise { return this.client.sendOperationRequest( - { resourceGroupName, experimentName, options }, - listExecutionDetailsOperationSpec + { resourceGroupName, experimentName, executionId, options }, + getExecutionOperationSpec ); } /** - * Get an execution detail of a Experiment resource. + * Execution details of an experiment resource. * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param executionId GUID that represents a Experiment execution detail. * @param options The options parameters. */ - getExecutionDetails( + executionDetails( resourceGroupName: string, experimentName: string, - executionDetailsId: string, - options?: ExperimentsGetExecutionDetailsOptionalParams - ): Promise { + executionId: string, + options?: ExperimentsExecutionDetailsOptionalParams + ): Promise { return this.client.sendOperationRequest( - { resourceGroupName, experimentName, executionDetailsId, options }, - getExecutionDetailsOperationSpec + { resourceGroupName, experimentName, executionId, options }, + executionDetailsOperationSpec ); } @@ -584,40 +834,21 @@ export class ExperimentsImpl implements Experiments { } /** - * ListAllStatusesNext - * @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 options The options parameters. - */ - private _listAllStatusesNext( - resourceGroupName: string, - experimentName: string, - nextLink: string, - options?: ExperimentsListAllStatusesNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, experimentName, nextLink, options }, - listAllStatusesNextOperationSpec - ); - } - - /** - * ListExecutionDetailsNext + * 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 ListExecutionDetails method. + * @param nextLink The nextLink from the previous successful call to the ListAllExecutions method. * @param options The options parameters. */ - private _listExecutionDetailsNext( + private _listAllExecutionsNext( resourceGroupName: string, experimentName: string, nextLink: string, - options?: ExperimentsListExecutionDetailsNextOptionalParams - ): Promise { + options?: ExperimentsListAllExecutionsNextOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, experimentName, nextLink, options }, - listExecutionDetailsNextOperationSpec + listAllExecutionsNextOperationSpec ); } } @@ -675,6 +906,8 @@ const deleteOperationSpec: coreClient.OperationSpec = { httpMethod: "DELETE", responses: { 200: {}, + 201: {}, + 202: {}, 204: {}, default: { bodyMapper: Mappers.ErrorResponse @@ -720,6 +953,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 +986,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 +1016,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 +1039,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 +1057,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,13 +1079,13 @@ 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 @@ -844,37 +1097,15 @@ const getStatusOperationSpec: coreClient.OperationSpec = { 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 + Parameters.executionId ], headerParameters: [Parameters.accept], serializer }; -const getExecutionDetailsOperationSpec: coreClient.OperationSpec = { +const executionDetailsOperationSpec: coreClient.OperationSpec = { path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails/{executionDetailsId}", - httpMethod: "GET", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}/getExecutionDetails", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.ExperimentExecutionDetails @@ -889,7 +1120,7 @@ const getExecutionDetailsOperationSpec: coreClient.OperationSpec = { Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.experimentName, - Parameters.executionDetailsId + Parameters.executionId ], headerParameters: [Parameters.accept], serializer @@ -933,33 +1164,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..3005f041285b 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,11 @@ import { ExperimentsUpdateOptionalParams, ExperimentsUpdateResponse, ExperimentsCancelOptionalParams, - ExperimentsCancelResponse, ExperimentsStartOptionalParams, - ExperimentsStartResponse, - ExperimentsGetStatusOptionalParams, - ExperimentsGetStatusResponse, - ExperimentsGetExecutionDetailsOptionalParams, - ExperimentsGetExecutionDetailsResponse + ExperimentsGetExecutionOptionalParams, + ExperimentsGetExecutionResponse, + ExperimentsExecutionDetailsOptionalParams, + ExperimentsExecutionDetailsResponse } from "../models"; /// @@ -53,34 +50,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 +100,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 +131,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 +161,68 @@ 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>>; + /** + * Start a Experiment resource. + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param options The options parameters. + */ + beginStartAndWait( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsStartOptionalParams + ): Promise; /** - * Get a status 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 statusId GUID that represents a Experiment status. + * @param executionId GUID that represents a Experiment execution detail. * @param options The options parameters. */ - getStatus( + getExecution( resourceGroupName: string, experimentName: string, - statusId: string, - options?: ExperimentsGetStatusOptionalParams - ): Promise; + executionId: string, + options?: ExperimentsGetExecutionOptionalParams + ): Promise; /** - * Get an execution detail of a Experiment resource. + * Execution details of an experiment resource. * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param executionId GUID that represents a Experiment execution detail. * @param options The options parameters. */ - getExecutionDetails( + executionDetails( resourceGroupName: string, experimentName: string, - executionDetailsId: string, - options?: ExperimentsGetExecutionDetailsOptionalParams - ): Promise; + executionId: string, + options?: ExperimentsExecutionDetailsOptionalParams + ): Promise; } diff --git a/sdk/chaos/arm-chaos/src/operationsInterfaces/index.ts b/sdk/chaos/arm-chaos/src/operationsInterfaces/index.ts 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"