diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 35561e21b1cf..ac33ef9996d2 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -2916,7 +2916,7 @@ packages: /@types/is-buffer@2.0.0: resolution: {integrity: sha512-0f7N/e3BAz32qDYvgB4d2cqv1DqUwvGxHkXsrucICn8la1Vb6Yl6Eg8mPScGwUiqHJeE7diXlzaK+QMA9m4Gxw==} dependencies: - '@types/node': 16.18.58 + '@types/node': 18.18.6 dev: false /@types/json-schema@7.0.13: @@ -2930,13 +2930,13 @@ packages: /@types/jsonwebtoken@9.0.3: resolution: {integrity: sha512-b0jGiOgHtZ2jqdPgPnP6WLCXZk1T8p06A/vPGzUvxpFGgKMbjXJDjC5m52ErqBnIuWZFgGoIJyRdeG5AyreJjA==} dependencies: - '@types/node': 16.18.58 + '@types/node': 18.18.6 dev: false /@types/jws@3.2.6: resolution: {integrity: sha512-SVbs88FPvGVMj19JYVOV+NpWu3HO5LUjz0+z6ks/rdRbrWlxs6fBz6Qxb/PKalZaweJisPyfikeoPu8VlpljQQ==} dependencies: - '@types/node': 16.18.58 + '@types/node': 18.18.6 dev: false /@types/linkify-it@3.0.3: @@ -2987,13 +2987,13 @@ packages: /@types/mysql@2.15.22: resolution: {integrity: sha512-wK1pzsJVVAjYCSZWQoWHziQZbNggXFDUEIGf54g4ZM/ERuP86uGdWeKZWMYlqTPMZfHJJvLPyogXGvCOg87yLQ==} dependencies: - '@types/node': 16.18.58 + '@types/node': 18.18.6 dev: false /@types/node-fetch@2.6.6: resolution: {integrity: sha512-95X8guJYhfqiuVVhRFxVQcf4hW/2bCuoPwDasMf/531STFoNoWTT7YDnWdXHEZKqAGUigmpG31r2FE70LwnzJw==} dependencies: - '@types/node': 16.18.58 + '@types/node': 18.18.6 form-data: 4.0.0 dev: false @@ -3018,7 +3018,7 @@ packages: /@types/pg@8.6.1: resolution: {integrity: sha512-1Kc4oAGzAl7uqUStZCDvaLFqZrW9qWSjXOmBfdgyBP5La7Us6Mg4GBvRlSoaZMhQF/zSj1C8CtKMBkoiT8eL8w==} dependencies: - '@types/node': 16.18.58 + '@types/node': 18.18.6 pg-protocol: 1.6.0 pg-types: 2.2.0 dev: false @@ -3097,7 +3097,7 @@ packages: /@types/stoppable@1.1.1: resolution: {integrity: sha512-b8N+fCADRIYYrGZOcmOR8ZNBOqhktWTB/bMUl5LvGtT201QKJZOOH5UsFyI3qtteM6ZAJbJqZoBcLqqxKIwjhw==} dependencies: - '@types/node': 16.18.58 + '@types/node': 18.18.6 dev: false /@types/through@0.0.31: @@ -3117,7 +3117,7 @@ packages: /@types/tunnel@0.0.3: resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==} dependencies: - '@types/node': 16.18.58 + '@types/node': 18.18.6 dev: false /@types/underscore@1.11.11: @@ -3147,7 +3147,7 @@ packages: /@types/xml2js@0.4.12: resolution: {integrity: sha512-CZPpQKBZ8db66EP5hCjwvYrLThgZvnyZrPXK2W+UI1oOaWezGt34iOaUCX4Jah2X8+rQqjvl9VKEIT8TR1I0rA==} dependencies: - '@types/node': 16.18.58 + '@types/node': 18.18.6 dev: false /@types/yargs-parser@21.0.1: @@ -4432,7 +4432,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.3.0-dev.20231019 + typescript: 5.3.0-dev.20231020 dev: false /eastasianwidth@0.2.0: @@ -9090,8 +9090,8 @@ packages: hasBin: true dev: false - /typescript@5.3.0-dev.20231019: - resolution: {integrity: sha512-fdexB8vj46ZSMsAg6g5aSNjThPegwT73WYwNM1DLmEnt0+fKPmmyft3LzfUR1CMHtcQNic5hl+0FeNTv7l232Q==} + /typescript@5.3.0-dev.20231020: + resolution: {integrity: sha512-7C4VN/XIuL4MDSf06bSrCHUL4bZq8RMt58jZ5DdwoGZmBlnPE2YEm1gxygeUws72yvvlJJzU3BL89RMQjg7R9Q==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -11007,19 +11007,27 @@ packages: dev: false file:projects/arm-chaos.tgz: - resolution: {integrity: sha512-3at/4UQLX/AnDjAmmevuSGIEWW3S1DbLXZO2q9VwtlqBHsvbiOaOEcyDw5B3U8NX4J8tGHqICuvBuoy8bD5vmg==, tarball: file:projects/arm-chaos.tgz} + resolution: {integrity: sha512-nycN3wE3/fg/QiR70eJYxgyiOiGI7pXGwqryxCkSjtGYX6JU9eGBZaRbAc8pCLY7p3gtT5bOZgeKjPtycptSdw==, tarball: file:projects/arm-chaos.tgz} name: '@rush-temp/arm-chaos' version: 0.0.0 dependencies: '@microsoft/api-extractor': 7.38.0(@types/node@16.18.58) + '@rollup/plugin-commonjs': 24.1.0(rollup@2.79.1) + '@rollup/plugin-json': 6.0.1(rollup@2.79.1) + '@rollup/plugin-multi-entry': 6.0.1(rollup@2.79.1) + '@rollup/plugin-node-resolve': 13.3.0(rollup@2.79.1) '@types/chai': 4.3.9 + '@types/mocha': 10.0.2 '@types/node': 16.18.58 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.58)(rollup@2.79.1) ts-node: 10.9.1(@types/node@16.18.58)(typescript@5.0.4) tslib: 2.6.2 typescript: 5.0.4 diff --git a/sdk/chaos/arm-chaos/CHANGELOG.md b/sdk/chaos/arm-chaos/CHANGELOG.md index 206a97c69f89..4e771fd919bf 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-20) -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..42fa684e69c9 100644 --- a/sdk/chaos/arm-chaos/_meta.json +++ b/sdk/chaos/arm-chaos/_meta.json @@ -1,8 +1,8 @@ { - "commit": "8a56aa33078dad6012aa59653cbfa643fa985f15", + "commit": "e53b1473530ff466cf639d51191d98904f19d6df", "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.2", + "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 759e4a30588d..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", + "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..acecef6dcbea 100644 --- a/sdk/chaos/arm-chaos/review/arm-chaos.api.md +++ b/sdk/chaos/arm-chaos/review/arm-chaos.api.md @@ -6,7 +6,9 @@ import * as coreAuth from '@azure/core-auth'; import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { SimplePollerLike } from '@azure/core-lro'; // @public export interface Action { @@ -173,6 +175,8 @@ export class ChaosManagementClient extends coreClient.ServiceClient { // (undocumented) operations: Operations; // (undocumented) + operationStatuses: OperationStatuses; + // (undocumented) subscriptionId?: string; // (undocumented) targets: Targets; @@ -234,16 +238,20 @@ export interface ErrorResponse { // @public export interface Experiment extends TrackedResource { identity?: ResourceIdentity; + readonly provisioningState?: ProvisioningState; selectors: SelectorUnion[]; - startOnCreation?: boolean; steps: Step[]; readonly systemData?: SystemData; } // @public -export interface ExperimentCancelOperationResult { +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 +271,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 +294,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 +315,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 +350,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 { +export interface ExperimentsExecutionDetailsOptionalParams extends coreClient.OperationOptions { } // @public -export type ExperimentsGetResponse = Experiment; +export type ExperimentsExecutionDetailsResponse = ExperimentExecutionDetails; // @public -export interface ExperimentsGetStatusOptionalParams extends coreClient.OperationOptions { +export interface ExperimentsGetExecutionOptionalParams extends coreClient.OperationOptions { } // @public -export type ExperimentsGetStatusResponse = ExperimentStatus; +export type ExperimentsGetExecutionResponse = ExperimentExecution; // @public -export interface ExperimentsListAllNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ExperimentsListAllNextResponse = ExperimentListResult; - -// @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 +423,14 @@ export type ExperimentsListResponse = ExperimentListResult; // @public export interface ExperimentsStartOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ExperimentsStartResponse = ExperimentStartOperationResult; - -// @public -export interface ExperimentStartOperationResult { - readonly name?: string; - readonly statusUrl?: string; -} - -// @public -export interface ExperimentStatus { - readonly createdDateUtc?: Date; - readonly endDateUtc?: Date; - readonly id?: string; - readonly name?: string; - readonly status?: string; - readonly type?: string; -} - -// @public -export interface ExperimentStatusListResult { - readonly nextLink?: string; - readonly value?: ExperimentStatus[]; + resumeFrom?: string; + updateIntervalInMs?: number; } // @public export interface ExperimentsUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; } // @public @@ -494,6 +486,16 @@ export enum KnownOrigin { UserSystem = "user,system" } +// @public +export enum KnownProvisioningState { + Canceled = "Canceled", + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded", + Updating = "Updating" +} + // @public export enum KnownSelectorType { List = "List", @@ -553,9 +555,34 @@ export interface OperationsListAllOptionalParams extends coreClient.OperationOpt // @public export type OperationsListAllResponse = OperationListResult; +// @public +export interface OperationStatus { + endTime?: string; + error?: ErrorResponse; + id?: string; + name?: string; + startTime?: string; + status?: string; +} + +// @public +export interface OperationStatuses { + get(location: string, asyncOperationId: string, options?: OperationStatusesGetOptionalParams): Promise; +} + +// @public +export interface OperationStatusesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationStatusesGetResponse = OperationStatus; + // @public export type Origin = string; +// @public +export type ProvisioningState = string; + // @public export interface QuerySelector extends Selector { queryString: string; 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..8271bc48eefc 100644 --- a/sdk/chaos/arm-chaos/src/models/index.ts +++ b/sdk/chaos/arm-chaos/src/models/index.ts @@ -191,7 +191,7 @@ export interface Step { branches: Branch[]; } -/** Model that represents a branch in the step. */ +/** Model that represents a branch in the step. 9 total per experiment. */ export interface Branch { /** String of the branch name. */ name: string; @@ -199,7 +199,7 @@ export interface Branch { actions: ActionUnion[]; } -/** Model that represents the base action model. */ +/** Model that represents the base action model. 9 total per experiment. */ export interface Action { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "delay" | "discrete" | "continuous"; @@ -231,50 +231,22 @@ export interface ExperimentUpdate { identity?: ResourceIdentity; } -/** Model that represents the result of a cancel Experiment operation. */ -export interface ExperimentCancelOperationResult { +/** Model that represents a list of Experiment executions and a link for pagination. */ +export interface ExperimentExecutionListResult { /** - * String of the Experiment name. + * List of Experiment executions. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly name?: string; - /** - * URL to retrieve the Experiment status. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly statusUrl?: string; -} - -/** Model that represents the result of a start Experiment operation. */ -export interface ExperimentStartOperationResult { - /** - * String of the Experiment name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * URL to retrieve the Experiment status. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly statusUrl?: string; -} - -/** Model that represents a list of Experiment statuses and a link for pagination. */ -export interface ExperimentStatusListResult { - /** - * List of Experiment statuses. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: ExperimentStatus[]; + 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 +263,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 +316,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 +481,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 { /** @@ -822,6 +805,26 @@ export interface SimpleFilter extends Filter { parameters?: SimpleFilterParameters; } +/** Model that represents the extended properties of an experiment execution. */ +export interface ExperimentExecutionDetailsProperties + extends ExperimentExecutionProperties { + /** + * The reason why the execution failed. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly failureReason?: string; + /** + * String that represents the last action date time. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastActionAt?: Date; + /** + * The information of the experiment run. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly runInformation?: ExperimentExecutionDetailsPropertiesRunInformation; +} + /** Model that represents a Experiment resource. */ export interface Experiment extends TrackedResource { /** @@ -831,12 +834,15 @@ export interface Experiment extends TrackedResource { readonly systemData?: SystemData; /** The identity of the experiment resource. */ identity?: ResourceIdentity; + /** + * Most recent provisioning state for the given experiment resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; /** List of steps. */ steps: Step[]; /** List of selectors. */ selectors: SelectorUnion[]; - /** A boolean value that indicates if experiment should be started on creation or not. */ - startOnCreation?: boolean; } /** Known values of {@link CreatedByType} that the service accepts. */ @@ -863,6 +869,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 +1070,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 +1086,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 +1162,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..d5f2c70794ed 100644 --- a/sdk/chaos/arm-chaos/src/models/mappers.ts +++ b/sdk/chaos/arm-chaos/src/models/mappers.ts @@ -384,7 +384,8 @@ export const Step: coreClient.CompositeMapper = { }, branches: { constraints: { - MinItems: 1 + MinItems: 1, + MaxItems: 9 }, serializedName: "branches", required: true, @@ -419,7 +420,8 @@ export const Branch: coreClient.CompositeMapper = { }, actions: { constraints: { - MinItems: 1 + MinItems: 1, + MaxItems: 9 }, serializedName: "actions", required: true, @@ -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", @@ -1678,7 +1656,8 @@ export const ListSelector: coreClient.CompositeMapper = { ...Selector.type.modelProperties, targets: { constraints: { - MinItems: 1 + MinItems: 1, + MaxItems: 50 }, serializedName: "targets", required: true, @@ -1752,6 +1731,37 @@ export const SimpleFilter: coreClient.CompositeMapper = { } }; +export const ExperimentExecutionDetailsProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExperimentExecutionDetailsProperties", + modelProperties: { + ...ExperimentExecutionProperties.type.modelProperties, + failureReason: { + serializedName: "failureReason", + readOnly: true, + type: { + name: "String" + } + }, + lastActionAt: { + serializedName: "lastActionAt", + readOnly: true, + type: { + name: "DateTime" + } + }, + runInformation: { + serializedName: "runInformation", + type: { + name: "Composite", + className: "ExperimentExecutionDetailsPropertiesRunInformation" + } + } + } + } +}; + export const Experiment: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1772,9 +1782,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, @@ -1803,13 +1821,6 @@ export const Experiment: coreClient.CompositeMapper = { } } } - }, - startOnCreation: { - serializedName: "properties.startOnCreation", - nullable: true, - type: { - name: "Boolean" - } } } } diff --git a/sdk/chaos/arm-chaos/src/models/parameters.ts b/sdk/chaos/arm-chaos/src/models/parameters.ts index 6075ecf078f5..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"