diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index e29ea4a82c83..e9b7eafe127f 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -3955,7 +3955,7 @@ packages: resolution: {integrity: sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==} deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) dependencies: - ms: 2.1.1 + ms: 2.1.3 dev: false /debug@3.2.7: @@ -4207,7 +4207,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.3.0-dev.20231002 + typescript: 5.3.0-dev.20231005 dev: false /eastasianwidth@0.2.0: @@ -5215,7 +5215,7 @@ packages: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.0.4 + minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 dev: false @@ -8937,8 +8937,8 @@ packages: hasBin: true dev: false - /typescript@5.3.0-dev.20231002: - resolution: {integrity: sha512-TQXM13rrDgID8W4Ok4KDQAqwLUjLcAXL+NKv0zJiIEQfa0bOM0yoRiSgvcjaCJ4lZT4bScrq3vHspVM2x8rkOQ==} + /typescript@5.3.0-dev.20231005: + resolution: {integrity: sha512-Twm3wBauTO94CSWbjXFMpsHsbaOUVssreq6pUo4wr8YsaIp0jim8EeCa9LfawFetQ+P4PODMmiM+uBhhWRVX0Q==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -11072,10 +11072,11 @@ packages: dev: false file:projects/arm-chaos.tgz: - resolution: {integrity: sha512-Tg5sGn871wb2lzLom6crSCHNIvjzyuzg0wGS/WNXfNPgf71bYg1C5XxZRsM34RKPldiEGWA8ypr+DFr99EQPow==, tarball: file:projects/arm-chaos.tgz} + resolution: {integrity: sha512-a+o/NRfCWQBtbg0BRBl3tm+eppeOTcTfP7fv2NvwnwlDQpjEsUEztSA1GMpj5jPOxKS/GZPbOHCsZ/MlS25tVQ==, tarball: file:projects/arm-chaos.tgz} name: '@rush-temp/arm-chaos' version: 0.0.0 dependencies: + '@azure/identity': 2.1.0 '@microsoft/api-extractor': 7.38.0(@types/node@14.18.63) '@rollup/plugin-commonjs': 24.1.0(rollup@2.79.1) '@rollup/plugin-json': 6.0.0(rollup@2.79.1) @@ -11087,8 +11088,8 @@ packages: cross-env: 7.0.3 dotenv: 16.3.1 mkdirp: 2.1.6 - mocha: 10.2.0 - rimraf: 3.0.2 + mocha: 7.2.0 + rimraf: 5.0.5 rollup: 2.79.1 rollup-plugin-sourcemaps: 0.6.3(@types/node@14.18.63)(rollup@2.79.1) ts-node: 10.9.1(@types/node@14.18.63)(typescript@5.0.4) @@ -11098,6 +11099,7 @@ packages: transitivePeerDependencies: - '@swc/core' - '@swc/wasm' + - supports-color dev: false file:projects/arm-cognitiveservices.tgz: diff --git a/sdk/chaos/arm-chaos/CHANGELOG.md b/sdk/chaos/arm-chaos/CHANGELOG.md index 206a97c69f89..5fcab3ca0793 100644 --- a/sdk/chaos/arm-chaos/CHANGELOG.md +++ b/sdk/chaos/arm-chaos/CHANGELOG.md @@ -1,15 +1,63 @@ # Release History + +## 1.0.0-beta.5 (2023-10-05) + +**Features** -## 1.0.0-beta.5 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed + - Added operation group OperationStatuses + - Added operation Experiments.beginCancel + - Added operation Experiments.beginCancelAndWait + - Added operation Experiments.beginCreateOrUpdate + - Added operation Experiments.beginCreateOrUpdateAndWait + - Added operation Experiments.beginDelete + - Added operation Experiments.beginDeleteAndWait + - Added operation Experiments.beginStart + - Added operation Experiments.beginStartAndWait + - Added operation Experiments.beginUpdate + - Added operation Experiments.beginUpdateAndWait + - Added Interface ChaosExperimentAction + - Added Interface ChaosExperimentBranch + - Added Interface ChaosExperimentStep + - Added Interface ChaosTargetFilter + - Added Interface ChaosTargetListSelector + - Added Interface ChaosTargetQuerySelector + - Added Interface ChaosTargetSelector + - Added Interface ChaosTargetSimpleFilter + - Added Interface ChaosTargetSimpleFilterParameters + - Added Interface CustomerDataStorageProperties + - Added Interface OperationStatus + - Added Interface OperationStatusesGetOptionalParams + - Added Type Alias ChaosExperimentActionUnion + - Added Type Alias ChaosTargetFilterUnion + - Added Type Alias ChaosTargetSelectorUnion + - Added Type Alias OperationStatusesGetResponse + - Added Type Alias ProvisioningState + - Interface Experiment has a new optional parameter customerDataStorage + - Interface Experiment has a new optional parameter provisioningState + - Interface ExperimentsCancelOptionalParams has a new optional parameter resumeFrom + - Interface ExperimentsCancelOptionalParams has a new optional parameter updateIntervalInMs + - Interface ExperimentsCreateOrUpdateOptionalParams has a new optional parameter resumeFrom + - Interface ExperimentsCreateOrUpdateOptionalParams has a new optional parameter updateIntervalInMs + - Interface ExperimentsDeleteOptionalParams has a new optional parameter resumeFrom + - Interface ExperimentsDeleteOptionalParams has a new optional parameter updateIntervalInMs + - Interface ExperimentsStartOptionalParams has a new optional parameter resumeFrom + - Interface ExperimentsStartOptionalParams has a new optional parameter updateIntervalInMs + - Interface ExperimentsUpdateOptionalParams has a new optional parameter resumeFrom + - Interface ExperimentsUpdateOptionalParams has a new optional parameter updateIntervalInMs + - Added Enum KnownProvisioningState -### Other Changes +**Breaking Changes** + - Removed operation Experiments.cancel + - Removed operation Experiments.createOrUpdate + - Removed operation Experiments.delete + - Removed operation Experiments.start + - Removed operation Experiments.update + - Interface Experiment no longer has parameter startOnCreation + - Type of parameter selectors of interface Experiment is changed from SelectorUnion[] to ChaosTargetSelectorUnion[] + - Type of parameter steps of interface Experiment is changed from Step[] to ChaosExperimentStep[] + + ## 1.0.0-beta.4 (2023-08-04) **Features** @@ -67,4 +115,4 @@ ## 1.0.0-beta.1 (2022-09-13) -The package of @azure/arm-chaos is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/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/_meta.json b/sdk/chaos/arm-chaos/_meta.json index 7977e5f4ef8d..9c3ee1e981e3 100644 --- a/sdk/chaos/arm-chaos/_meta.json +++ b/sdk/chaos/arm-chaos/_meta.json @@ -1,8 +1,8 @@ { - "commit": "8a56aa33078dad6012aa59653cbfa643fa985f15", + "commit": "838b56a04f1b546d5df8e6cec42f40e2b8d15e25", "readme": "specification/chaos/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\chaos\\resource-manager\\readme.md --use=@autorest/typescript@6.0.5 --generate-sample=true", + "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/chaos/resource-manager/readme.md --use=@autorest/typescript@^6.0.4", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.0", - "use": "@autorest/typescript@6.0.5" + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.2", + "use": "@autorest/typescript@^6.0.4" } \ No newline at end of file diff --git a/sdk/chaos/arm-chaos/package.json b/sdk/chaos/arm-chaos/package.json index 5a30b1748b11..7dd01f8e3fc6 100644 --- a/sdk/chaos/arm-chaos/package.json +++ b/sdk/chaos/arm-chaos/package.json @@ -8,10 +8,12 @@ "node": ">=14.0.0" }, "dependencies": { + "@azure/core-lro": "^2.5.4", + "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.8.0", + "@azure/core-rest-pipeline": "^1.12.0", "tslib": "^2.2.0" }, "keywords": [ @@ -36,19 +38,18 @@ "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~5.0.0", "uglify-js": "^3.4.9", - "rimraf": "^3.0.0", + "rimraf": "^5.0.0", "dotenv": "^16.0.0", - "@azure/identity": "^3.3.0", + "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", - "mocha": "^10.0.0", + "mocha": "^7.1.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", "@types/node": "^14.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", @@ -83,7 +84,7 @@ "extract-api": "api-extractor run --local", "lint": "echo skipped", "audit": "echo skipped", - "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", "build:browser": "echo skipped", "build:test": "echo skipped", @@ -111,13 +112,5 @@ ] }, "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/chaos/arm-chaos", - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-chaos?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/chaos/arm-chaos" +} \ No newline at end of file diff --git a/sdk/chaos/arm-chaos/review/arm-chaos.api.md b/sdk/chaos/arm-chaos/review/arm-chaos.api.md index 63f95f3d1726..6d8239179c87 100644 --- a/sdk/chaos/arm-chaos/review/arm-chaos.api.md +++ b/sdk/chaos/arm-chaos/review/arm-chaos.api.md @@ -6,13 +6,9 @@ import * as coreAuth from '@azure/core-auth'; import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; - -// @public -export interface Action { - name: string; - type: "delay" | "discrete" | "continuous"; -} +import { SimplePollerLike } from '@azure/core-lro'; // @public export interface ActionStatus { @@ -27,15 +23,6 @@ export interface ActionStatus { // @public export type ActionType = string; -// @public (undocumented) -export type ActionUnion = Action | DelayAction | DiscreteAction | ContinuousAction; - -// @public -export interface Branch { - actions: ActionUnion[]; - name: string; -} - // @public export interface BranchStatus { readonly actions?: ActionStatus[]; @@ -156,6 +143,27 @@ export interface CapabilityTypesListOptionalParams extends coreClient.OperationO // @public export type CapabilityTypesListResponse = CapabilityTypeListResult; +// @public +export interface ChaosExperimentAction { + name: string; + type: "delay" | "discrete" | "continuous"; +} + +// @public (undocumented) +export type ChaosExperimentActionUnion = ChaosExperimentAction | DelayAction | DiscreteAction | ContinuousAction; + +// @public +export interface ChaosExperimentBranch { + actions: ChaosExperimentActionUnion[]; + name: string; +} + +// @public +export interface ChaosExperimentStep { + branches: ChaosExperimentBranch[]; + name: string; +} + // @public (undocumented) export class ChaosManagementClient extends coreClient.ServiceClient { // (undocumented) @@ -173,6 +181,8 @@ export class ChaosManagementClient extends coreClient.ServiceClient { // (undocumented) operations: Operations; // (undocumented) + operationStatuses: OperationStatuses; + // (undocumented) subscriptionId?: string; // (undocumented) targets: Targets; @@ -188,7 +198,50 @@ export interface ChaosManagementClientOptionalParams extends coreClient.ServiceC } // @public -export interface ContinuousAction extends Action { +export interface ChaosTargetFilter { + type: "Simple"; +} + +// @public (undocumented) +export type ChaosTargetFilterUnion = ChaosTargetFilter | ChaosTargetSimpleFilter; + +// @public +export interface ChaosTargetListSelector extends ChaosTargetSelector { + targets: TargetReference[]; + type: "List"; +} + +// @public +export interface ChaosTargetQuerySelector extends ChaosTargetSelector { + queryString: string; + subscriptionIds: string[]; + type: "Query"; +} + +// @public +export interface ChaosTargetSelector { + [property: string]: any; + filter?: ChaosTargetFilterUnion; + id: string; + type: "List" | "Query"; +} + +// @public (undocumented) +export type ChaosTargetSelectorUnion = ChaosTargetSelector | ChaosTargetListSelector | ChaosTargetQuerySelector; + +// @public +export interface ChaosTargetSimpleFilter extends ChaosTargetFilter { + parameters?: ChaosTargetSimpleFilterParameters; + type: "Simple"; +} + +// @public +export interface ChaosTargetSimpleFilterParameters { + zones?: string[]; +} + +// @public +export interface ContinuousAction extends ChaosExperimentAction { duration: string; parameters: KeyValuePair[]; selectorId: string; @@ -199,13 +252,19 @@ export interface ContinuousAction extends Action { export type CreatedByType = string; // @public -export interface DelayAction extends Action { +export interface CustomerDataStorageProperties { + blobContainerName?: string; + storageAccountResourceId?: string; +} + +// @public +export interface DelayAction extends ChaosExperimentAction { duration: string; type: "delay"; } // @public -export interface DiscreteAction extends Action { +export interface DiscreteAction extends ChaosExperimentAction { parameters: KeyValuePair[]; selectorId: string; type: "discrete"; @@ -233,19 +292,14 @@ export interface ErrorResponse { // @public export interface Experiment extends TrackedResource { + customerDataStorage?: CustomerDataStorageProperties; identity?: ResourceIdentity; - selectors: SelectorUnion[]; - startOnCreation?: boolean; - steps: Step[]; + readonly provisioningState?: ProvisioningState; + selectors: ChaosTargetSelectorUnion[]; + steps: ChaosExperimentStep[]; readonly systemData?: SystemData; } -// @public -export interface ExperimentCancelOperationResult { - readonly name?: string; - readonly statusUrl?: string; -} - // @public export interface ExperimentExecutionActionTargetDetailsError { readonly code?: string; @@ -295,9 +349,16 @@ export interface ExperimentListResult { // @public export interface Experiments { - cancel(resourceGroupName: string, experimentName: string, options?: ExperimentsCancelOptionalParams): Promise; - createOrUpdate(resourceGroupName: string, experimentName: string, experiment: Experiment, options?: ExperimentsCreateOrUpdateOptionalParams): Promise; - delete(resourceGroupName: string, experimentName: string, options?: ExperimentsDeleteOptionalParams): Promise; + beginCancel(resourceGroupName: string, experimentName: string, options?: ExperimentsCancelOptionalParams): Promise, void>>; + beginCancelAndWait(resourceGroupName: string, experimentName: string, options?: ExperimentsCancelOptionalParams): Promise; + beginCreateOrUpdate(resourceGroupName: string, experimentName: string, experiment: Experiment, options?: ExperimentsCreateOrUpdateOptionalParams): Promise, ExperimentsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, experimentName: string, experiment: Experiment, options?: ExperimentsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, experimentName: string, options?: ExperimentsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, experimentName: string, options?: ExperimentsDeleteOptionalParams): Promise; + beginStart(resourceGroupName: string, experimentName: string, options?: ExperimentsStartOptionalParams): Promise, void>>; + beginStartAndWait(resourceGroupName: string, experimentName: string, options?: ExperimentsStartOptionalParams): Promise; + beginUpdate(resourceGroupName: string, experimentName: string, experiment: ExperimentUpdate, options?: ExperimentsUpdateOptionalParams): Promise, ExperimentsUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, experimentName: string, experiment: ExperimentUpdate, options?: ExperimentsUpdateOptionalParams): Promise; get(resourceGroupName: string, experimentName: string, options?: ExperimentsGetOptionalParams): Promise; getExecutionDetails(resourceGroupName: string, experimentName: string, executionDetailsId: string, options?: ExperimentsGetExecutionDetailsOptionalParams): Promise; getStatus(resourceGroupName: string, experimentName: string, statusId: string, options?: ExperimentsGetStatusOptionalParams): Promise; @@ -305,19 +366,18 @@ export interface Experiments { 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; } // @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,6 +385,8 @@ export type ExperimentsCreateOrUpdateResponse = Experiment; // @public export interface ExperimentsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; } // @public @@ -410,15 +472,8 @@ 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; + resumeFrom?: string; + updateIntervalInMs?: number; } // @public @@ -439,6 +494,8 @@ export interface ExperimentStatusListResult { // @public export interface ExperimentsUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; } // @public @@ -449,17 +506,9 @@ export interface ExperimentUpdate { identity?: ResourceIdentity; } -// @public -export interface Filter { - type: "Simple"; -} - // @public export type FilterType = string; -// @public (undocumented) -export type FilterUnion = Filter | SimpleFilter; - // @public export function getContinuationToken(page: unknown): string | undefined; @@ -494,6 +543,16 @@ export enum KnownOrigin { UserSystem = "user,system" } +// @public +export enum KnownProvisioningState { + Canceled = "Canceled", + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded", + Updating = "Updating" +} + // @public export enum KnownSelectorType { List = "List", @@ -505,12 +564,6 @@ export enum KnownTargetReferenceType { ChaosTarget = "ChaosTarget" } -// @public -export interface ListSelector extends Selector { - targets: TargetReference[]; - type: "List"; -} - // @public export interface Operation { readonly actionType?: ActionType; @@ -554,15 +607,33 @@ export interface OperationsListAllOptionalParams extends coreClient.OperationOpt export type OperationsListAllResponse = OperationListResult; // @public -export type Origin = string; +export interface OperationStatus { + endTime?: string; + error?: ErrorResponse; + id?: string; + name?: string; + startTime?: string; + status?: string; +} // @public -export interface QuerySelector extends Selector { - queryString: string; - subscriptionIds: string[]; - type: "Query"; +export interface OperationStatuses { + get(location: string, asyncOperationId: string, options?: OperationStatusesGetOptionalParams): Promise; +} + +// @public +export interface OperationStatusesGetOptionalParams extends coreClient.OperationOptions { } +// @public +export type OperationStatusesGetResponse = OperationStatus; + +// @public +export type Origin = string; + +// @public +export type ProvisioningState = string; + // @public export interface Resource { readonly id?: string; @@ -583,37 +654,9 @@ export interface ResourceIdentity { // @public export type ResourceIdentityType = "None" | "SystemAssigned" | "UserAssigned"; -// @public -export interface Selector { - [property: string]: any; - filter?: FilterUnion; - id: string; - type: "List" | "Query"; -} - // @public export type SelectorType = string; -// @public (undocumented) -export type SelectorUnion = Selector | ListSelector | QuerySelector; - -// @public -export interface SimpleFilter extends Filter { - parameters?: SimpleFilterParameters; - type: "Simple"; -} - -// @public -export interface SimpleFilterParameters { - zones?: string[]; -} - -// @public -export interface Step { - branches: Branch[]; - name: string; -} - // @public export interface StepStatus { readonly branches?: BranchStatus[]; diff --git a/sdk/chaos/arm-chaos/src/chaosManagementClient.ts b/sdk/chaos/arm-chaos/src/chaosManagementClient.ts index 5e3161917640..4be4300887c2 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 @@ -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-10-27-preview"; 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..985f8b41a33f 100644 --- a/sdk/chaos/arm-chaos/src/models/index.ts +++ b/sdk/chaos/arm-chaos/src/models/index.ts @@ -8,13 +8,18 @@ import * as coreClient from "@azure/core-client"; -export type ActionUnion = - | Action +export type ChaosExperimentActionUnion = + | ChaosExperimentAction | DelayAction | DiscreteAction | ContinuousAction; -export type SelectorUnion = Selector | ListSelector | QuerySelector; -export type FilterUnion = Filter | SimpleFilter; +export type ChaosTargetSelectorUnion = + | ChaosTargetSelector + | ChaosTargetListSelector + | ChaosTargetQuerySelector; +export type ChaosTargetFilterUnion = + | ChaosTargetFilter + | ChaosTargetSimpleFilter; /** Model that represents a list of Capability resources and a link for pagination. */ export interface CapabilityListResult { @@ -184,23 +189,23 @@ export interface UserAssignedIdentity { } /** Model that represents a step in the Experiment resource. */ -export interface Step { +export interface ChaosExperimentStep { /** String of the step name. */ name: string; /** List of branches. */ - branches: Branch[]; + branches: ChaosExperimentBranch[]; } /** Model that represents a branch in the step. */ -export interface Branch { +export interface ChaosExperimentBranch { /** String of the branch name. */ name: string; /** List of actions. */ - actions: ActionUnion[]; + actions: ChaosExperimentActionUnion[]; } /** Model that represents the base action model. */ -export interface Action { +export interface ChaosExperimentAction { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "delay" | "discrete" | "continuous"; /** String that represents a Capability URN. */ @@ -208,7 +213,7 @@ export interface Action { } /** Model that represents a selector in the Experiment resource. */ -export interface Selector { +export interface ChaosTargetSelector { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "List" | "Query"; /** Describes unknown properties. The value of an unknown property can be of "any" type. */ @@ -216,49 +221,29 @@ export interface Selector { /** String of the selector ID. */ id: string; /** Model that represents available filter types that can be applied to a targets list. */ - filter?: FilterUnion; + filter?: ChaosTargetFilterUnion; } /** Model that represents available filter types that can be applied to a targets list. */ -export interface Filter { +export interface ChaosTargetFilter { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "Simple"; } +/** Model that represents the Customer Managed Storage for an Experiment. */ +export interface CustomerDataStorageProperties { + /** ARM Resource ID of the Storage account to use for Customer Data storage. */ + storageAccountResourceId?: string; + /** Name of the Azure Blob Storage container to use or create. */ + blobContainerName?: string; +} + /** Describes an experiment update. */ export interface ExperimentUpdate { /** The identity of the experiment resource. */ identity?: ResourceIdentity; } -/** Model that represents the result of a cancel Experiment operation. */ -export interface ExperimentCancelOperationResult { - /** - * 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 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 { /** @@ -514,6 +499,22 @@ export interface ExperimentExecutionActionTargetDetailsError { readonly message?: string; } +/** The status of operation. */ +export interface OperationStatus { + /** The operation Id. */ + id?: string; + /** The operation name. */ + name?: string; + /** The start time of the operation. */ + startTime?: string; + /** The end time of the operation. */ + endTime?: string; + /** The status of the operation. */ + status?: string; + /** The error detail of the operation if any. */ + error?: ErrorResponse; +} + /** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ export interface OperationListResult { /** @@ -623,7 +624,7 @@ export interface TargetReference { } /** Model that represents the Simple filter parameters. */ -export interface SimpleFilterParameters { +export interface ChaosTargetSimpleFilterParameters { /** List of Azure availability zones to filter targets by. */ zones?: string[]; } @@ -767,7 +768,7 @@ export interface Target extends Resource { } /** Model that represents a delay action. */ -export interface DelayAction extends Action { +export interface DelayAction extends ChaosExperimentAction { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "delay"; /** ISO8601 formatted string that represents a duration. */ @@ -775,7 +776,7 @@ export interface DelayAction extends Action { } /** Model that represents a discrete action. */ -export interface DiscreteAction extends Action { +export interface DiscreteAction extends ChaosExperimentAction { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "discrete"; /** List of key value pairs. */ @@ -785,7 +786,7 @@ export interface DiscreteAction extends Action { } /** Model that represents a continuous action. */ -export interface ContinuousAction extends Action { +export interface ContinuousAction extends ChaosExperimentAction { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "continuous"; /** ISO8601 formatted string that represents a duration. */ @@ -797,7 +798,7 @@ export interface ContinuousAction extends Action { } /** Model that represents a list selector. */ -export interface ListSelector extends Selector { +export interface ChaosTargetListSelector extends ChaosTargetSelector { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "List"; /** List of Target references. */ @@ -805,7 +806,7 @@ export interface ListSelector extends Selector { } /** Model that represents a query selector. */ -export interface QuerySelector extends Selector { +export interface ChaosTargetQuerySelector extends ChaosTargetSelector { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "Query"; /** Azure Resource Graph (ARG) Query Language query for target resources. */ @@ -815,11 +816,11 @@ export interface QuerySelector extends Selector { } /** Model that represents a simple target filter. */ -export interface SimpleFilter extends Filter { +export interface ChaosTargetSimpleFilter extends ChaosTargetFilter { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "Simple"; /** Model that represents the Simple filter parameters. */ - parameters?: SimpleFilterParameters; + parameters?: ChaosTargetSimpleFilterParameters; } /** Model that represents a Experiment resource. */ @@ -831,12 +832,17 @@ export interface Experiment extends TrackedResource { readonly systemData?: SystemData; /** The identity of the experiment resource. */ identity?: ResourceIdentity; + /** + * Most recent provisioning state for the given experiment resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; /** List of steps. */ - steps: Step[]; + steps: ChaosExperimentStep[]; /** List of selectors. */ - selectors: SelectorUnion[]; - /** A boolean value that indicates if experiment should be started on creation or not. */ - startOnCreation?: boolean; + selectors: ChaosTargetSelectorUnion[]; + /** Optional customer-managed Storage account where Experiment schema will be stored. */ + customerDataStorage?: CustomerDataStorageProperties; } /** 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,31 +1086,45 @@ 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; + 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 ExperimentsListAllStatusesOptionalParams @@ -1127,6 +1182,13 @@ export interface ExperimentsListExecutionDetailsNextOptionalParams /** Contains response data for the listExecutionDetailsNext operation. */ export type ExperimentsListExecutionDetailsNextResponse = ExperimentExecutionDetailsListResult; +/** Optional parameters. */ +export interface OperationStatusesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type OperationStatusesGetResponse = OperationStatus; + /** Optional parameters. */ export interface OperationsListAllOptionalParams extends coreClient.OperationOptions {} diff --git a/sdk/chaos/arm-chaos/src/models/mappers.ts b/sdk/chaos/arm-chaos/src/models/mappers.ts index 6f5aca130306..0b484786c896 100644 --- a/sdk/chaos/arm-chaos/src/models/mappers.ts +++ b/sdk/chaos/arm-chaos/src/models/mappers.ts @@ -367,10 +367,10 @@ export const UserAssignedIdentity: coreClient.CompositeMapper = { } }; -export const Step: coreClient.CompositeMapper = { +export const ChaosExperimentStep: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Step", + className: "ChaosExperimentStep", modelProperties: { name: { constraints: { @@ -393,7 +393,7 @@ export const Step: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "Branch" + className: "ChaosExperimentBranch" } } } @@ -402,10 +402,10 @@ export const Step: coreClient.CompositeMapper = { } }; -export const Branch: coreClient.CompositeMapper = { +export const ChaosExperimentBranch: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Branch", + className: "ChaosExperimentBranch", modelProperties: { name: { constraints: { @@ -428,7 +428,7 @@ export const Branch: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "Action" + className: "ChaosExperimentAction" } } } @@ -437,11 +437,11 @@ export const Branch: coreClient.CompositeMapper = { } }; -export const Action: coreClient.CompositeMapper = { +export const ChaosExperimentAction: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Action", - uberParent: "Action", + className: "ChaosExperimentAction", + uberParent: "ChaosExperimentAction", polymorphicDiscriminator: { serializedName: "type", clientName: "type" @@ -468,12 +468,12 @@ export const Action: coreClient.CompositeMapper = { } }; -export const Selector: coreClient.CompositeMapper = { - serializedName: "Selector", +export const ChaosTargetSelector: coreClient.CompositeMapper = { + serializedName: "ChaosTargetSelector", type: { name: "Composite", - className: "Selector", - uberParent: "Selector", + className: "ChaosTargetSelector", + uberParent: "ChaosTargetSelector", additionalProperties: { type: { name: "Object" } }, polymorphicDiscriminator: { serializedName: "type", @@ -501,18 +501,18 @@ export const Selector: coreClient.CompositeMapper = { serializedName: "filter", type: { name: "Composite", - className: "Filter" + className: "ChaosTargetFilter" } } } } }; -export const Filter: coreClient.CompositeMapper = { +export const ChaosTargetFilter: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Filter", - uberParent: "Filter", + className: "ChaosTargetFilter", + uberParent: "ChaosTargetFilter", polymorphicDiscriminator: { serializedName: "type", clientName: "type" @@ -529,40 +529,25 @@ export const Filter: coreClient.CompositeMapper = { } }; -export const ExperimentUpdate: coreClient.CompositeMapper = { +export const CustomerDataStorageProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ExperimentUpdate", + className: "CustomerDataStorageProperties", modelProperties: { - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "ResourceIdentity" - } - } - } - } -}; - -export const ExperimentCancelOperationResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExperimentCancelOperationResult", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, + storageAccountResourceId: { + serializedName: "storageAccountResourceId", type: { name: "String" } }, - statusUrl: { + blobContainerName: { constraints: { - MaxLength: 2048 + Pattern: new RegExp("^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$"), + MaxLength: 63, + MinLength: 3 }, - serializedName: "statusUrl", - readOnly: true, + serializedName: "blobContainerName", + nullable: true, type: { name: "String" } @@ -571,26 +556,16 @@ export const ExperimentCancelOperationResult: coreClient.CompositeMapper = { } }; -export const ExperimentStartOperationResult: coreClient.CompositeMapper = { +export const ExperimentUpdate: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ExperimentStartOperationResult", + className: "ExperimentUpdate", modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - statusUrl: { - constraints: { - MaxLength: 2048 - }, - serializedName: "statusUrl", - readOnly: true, + identity: { + serializedName: "identity", type: { - name: "String" + name: "Composite", + className: "ResourceIdentity" } } } @@ -1035,6 +1010,52 @@ export const ExperimentExecutionActionTargetDetailsError: coreClient.CompositeMa } }; +export const OperationStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationStatus", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + startTime: { + serializedName: "startTime", + type: { + name: "String" + } + }, + endTime: { + serializedName: "endTime", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorResponse" + } + } + } + } +}; + export const OperationListResult: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1268,10 +1289,10 @@ export const TargetReference: coreClient.CompositeMapper = { } }; -export const SimpleFilterParameters: coreClient.CompositeMapper = { +export const ChaosTargetSimpleFilterParameters: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SimpleFilterParameters", + className: "ChaosTargetSimpleFilterParameters", modelProperties: { zones: { serializedName: "zones", @@ -1572,10 +1593,11 @@ export const DelayAction: coreClient.CompositeMapper = { type: { name: "Composite", className: "DelayAction", - uberParent: "Action", - polymorphicDiscriminator: Action.type.polymorphicDiscriminator, + uberParent: "ChaosExperimentAction", + polymorphicDiscriminator: + ChaosExperimentAction.type.polymorphicDiscriminator, modelProperties: { - ...Action.type.modelProperties, + ...ChaosExperimentAction.type.modelProperties, duration: { serializedName: "duration", required: true, @@ -1592,10 +1614,11 @@ export const DiscreteAction: coreClient.CompositeMapper = { type: { name: "Composite", className: "DiscreteAction", - uberParent: "Action", - polymorphicDiscriminator: Action.type.polymorphicDiscriminator, + uberParent: "ChaosExperimentAction", + polymorphicDiscriminator: + ChaosExperimentAction.type.polymorphicDiscriminator, modelProperties: { - ...Action.type.modelProperties, + ...ChaosExperimentAction.type.modelProperties, parameters: { serializedName: "parameters", required: true, @@ -1628,10 +1651,11 @@ export const ContinuousAction: coreClient.CompositeMapper = { type: { name: "Composite", className: "ContinuousAction", - uberParent: "Action", - polymorphicDiscriminator: Action.type.polymorphicDiscriminator, + uberParent: "ChaosExperimentAction", + polymorphicDiscriminator: + ChaosExperimentAction.type.polymorphicDiscriminator, modelProperties: { - ...Action.type.modelProperties, + ...ChaosExperimentAction.type.modelProperties, duration: { serializedName: "duration", required: true, @@ -1666,16 +1690,16 @@ export const ContinuousAction: coreClient.CompositeMapper = { } }; -export const ListSelector: coreClient.CompositeMapper = { +export const ChaosTargetListSelector: coreClient.CompositeMapper = { serializedName: "List", type: { name: "Composite", - className: "ListSelector", - uberParent: "Selector", + className: "ChaosTargetListSelector", + uberParent: "ChaosTargetSelector", additionalProperties: { type: { name: "Object" } }, - polymorphicDiscriminator: Selector.type.polymorphicDiscriminator, + polymorphicDiscriminator: ChaosTargetSelector.type.polymorphicDiscriminator, modelProperties: { - ...Selector.type.modelProperties, + ...ChaosTargetSelector.type.modelProperties, targets: { constraints: { MinItems: 1 @@ -1696,16 +1720,16 @@ export const ListSelector: coreClient.CompositeMapper = { } }; -export const QuerySelector: coreClient.CompositeMapper = { +export const ChaosTargetQuerySelector: coreClient.CompositeMapper = { serializedName: "Query", type: { name: "Composite", - className: "QuerySelector", - uberParent: "Selector", + className: "ChaosTargetQuerySelector", + uberParent: "ChaosTargetSelector", additionalProperties: { type: { name: "Object" } }, - polymorphicDiscriminator: Selector.type.polymorphicDiscriminator, + polymorphicDiscriminator: ChaosTargetSelector.type.polymorphicDiscriminator, modelProperties: { - ...Selector.type.modelProperties, + ...ChaosTargetSelector.type.modelProperties, queryString: { serializedName: "queryString", required: true, @@ -1732,20 +1756,20 @@ export const QuerySelector: coreClient.CompositeMapper = { } }; -export const SimpleFilter: coreClient.CompositeMapper = { +export const ChaosTargetSimpleFilter: coreClient.CompositeMapper = { serializedName: "Simple", type: { name: "Composite", - className: "SimpleFilter", - uberParent: "Filter", - polymorphicDiscriminator: Filter.type.polymorphicDiscriminator, + className: "ChaosTargetSimpleFilter", + uberParent: "ChaosTargetFilter", + polymorphicDiscriminator: ChaosTargetFilter.type.polymorphicDiscriminator, modelProperties: { - ...Filter.type.modelProperties, + ...ChaosTargetFilter.type.modelProperties, parameters: { serializedName: "parameters", type: { name: "Composite", - className: "SimpleFilterParameters" + className: "ChaosTargetSimpleFilterParameters" } } } @@ -1772,6 +1796,13 @@ export const Experiment: coreClient.CompositeMapper = { className: "ResourceIdentity" } }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, steps: { constraints: { MinItems: 1 @@ -1783,7 +1814,7 @@ export const Experiment: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "Step" + className: "ChaosExperimentStep" } } } @@ -1799,16 +1830,16 @@ export const Experiment: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "Selector" + className: "ChaosTargetSelector" } } } }, - startOnCreation: { - serializedName: "properties.startOnCreation", - nullable: true, + customerDataStorage: { + serializedName: "properties.customerDataStorage", type: { - name: "Boolean" + name: "Composite", + className: "CustomerDataStorageProperties" } } } @@ -1816,13 +1847,13 @@ export const Experiment: coreClient.CompositeMapper = { }; export let discriminators = { - Action: Action, - Selector: Selector, - Filter: Filter, - "Action.delay": DelayAction, - "Action.discrete": DiscreteAction, - "Action.continuous": ContinuousAction, - "Selector.List": ListSelector, - "Selector.Query": QuerySelector, - "Filter.Simple": SimpleFilter + ChaosExperimentAction: ChaosExperimentAction, + ChaosTargetSelector: ChaosTargetSelector, + ChaosTargetFilter: ChaosTargetFilter, + "ChaosExperimentAction.delay": DelayAction, + "ChaosExperimentAction.discrete": DiscreteAction, + "ChaosExperimentAction.continuous": ContinuousAction, + "ChaosTargetSelector.List": ChaosTargetListSelector, + "ChaosTargetSelector.Query": ChaosTargetQuerySelector, + "ChaosTargetFilter.Simple": ChaosTargetSimpleFilter }; diff --git a/sdk/chaos/arm-chaos/src/models/parameters.ts b/sdk/chaos/arm-chaos/src/models/parameters.ts index 6075ecf078f5..62f22fe1f3eb 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-10-27-preview", isConstant: true, serializedName: "api-version", type: { @@ -302,6 +302,28 @@ export const executionDetailsId: OperationURLParameter = { } }; +export const location: OperationURLParameter = { + parameterPath: "location", + mapper: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } +}; + +export const asyncOperationId: OperationURLParameter = { + parameterPath: "asyncOperationId", + mapper: { + serializedName: "asyncOperationId", + required: true, + type: { + name: "String" + } + } +}; + export const target: OperationParameter = { parameterPath: "target", mapper: TargetMapper diff --git a/sdk/chaos/arm-chaos/src/operations/experiments.ts b/sdk/chaos/arm-chaos/src/operations/experiments.ts index c7de32e6aca2..7724ea5aa447 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, @@ -38,9 +44,7 @@ import { ExperimentsUpdateOptionalParams, ExperimentsUpdateResponse, ExperimentsCancelOptionalParams, - ExperimentsCancelResponse, ExperimentsStartOptionalParams, - ExperimentsStartResponse, ExperimentsGetStatusOptionalParams, ExperimentsGetStatusResponse, ExperimentsGetExecutionDetailsOptionalParams, @@ -379,15 +383,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 +484,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 +580,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 +675,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,15 +758,81 @@ 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; + } + + /** + * Start a Experiment resource. + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param options The options parameters. + */ + async beginStartAndWait( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsStartOptionalParams + ): Promise { + const poller = await this.beginStart( + resourceGroupName, + experimentName, + options ); + return poller.pollUntilDone(); } /** @@ -675,6 +1031,8 @@ const deleteOperationSpec: coreClient.OperationSpec = { httpMethod: "DELETE", responses: { 200: {}, + 201: {}, + 202: {}, 204: {}, default: { bodyMapper: Mappers.ErrorResponse @@ -720,6 +1078,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 +1111,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 +1141,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 +1164,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 } 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..a62a9cad8448 100644 --- a/sdk/chaos/arm-chaos/src/operationsInterfaces/experiments.ts +++ b/sdk/chaos/arm-chaos/src/operationsInterfaces/experiments.ts @@ -7,6 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { Experiment, ExperimentsListAllOptionalParams, @@ -24,9 +25,7 @@ import { ExperimentsUpdateOptionalParams, ExperimentsUpdateResponse, ExperimentsCancelOptionalParams, - ExperimentsCancelResponse, ExperimentsStartOptionalParams, - ExperimentsStartResponse, ExperimentsGetStatusOptionalParams, ExperimentsGetStatusResponse, ExperimentsGetExecutionDetailsOptionalParams, @@ -80,7 +79,18 @@ export interface Experiments { * @param experimentName String that represents a Experiment resource name. * @param options The options parameters. */ - delete( + beginDelete( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a Experiment resource. + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param options The options parameters. + */ + beginDeleteAndWait( resourceGroupName: string, experimentName: string, options?: ExperimentsDeleteOptionalParams @@ -103,7 +113,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 +144,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,22 +174,44 @@ 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; + ): Promise, void>>; + /** + * Cancel a running Experiment resource. + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param options The options parameters. + */ + beginCancelAndWait( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsCancelOptionalParams + ): Promise; + /** + * Start a Experiment resource. + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param options The options parameters. + */ + beginStart( + resourceGroupName: string, + experimentName: string, + options?: ExperimentsStartOptionalParams + ): Promise, void>>; /** * Start a Experiment resource. * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. * @param options The options parameters. */ - start( + beginStartAndWait( resourceGroupName: string, experimentName: string, options?: ExperimentsStartOptionalParams - ): Promise; + ): Promise; /** * Get a status of a Experiment resource. * @param resourceGroupName String that represents an Azure resource group. 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"