diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 3d649a2e213e..460c8e39786a 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -10736,12 +10736,12 @@ packages: dev: false file:projects/arm-chaos.tgz: - resolution: {integrity: sha512-5tVHYfsa4c80DA7PNdZB6A2NR2mZmpXkT6MxSvtvq2gjDJwIyblu07/dHCx/qJ1kaa6NaLkV9ecBKIcPpIu0xw==, tarball: file:projects/arm-chaos.tgz} + resolution: {integrity: sha512-udwB10lGlqvWVnJbzAAvJ7KolcYPYfzQ0hsT1mKvH6txm8kqG5gP5+QX2yQJk1H7B4/4cIKn3lDfgFUTzhgZhg==, 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.31.2 + '@microsoft/api-extractor': 7.18.11 '@rollup/plugin-commonjs': 21.1.0_rollup@2.79.1 '@rollup/plugin-json': 4.1.0_rollup@2.79.1 '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 @@ -10755,7 +10755,7 @@ packages: rollup: 2.79.1 rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.1 tslib: 2.4.0 - typescript: 4.6.4 + typescript: 4.2.4 uglify-js: 3.17.2 transitivePeerDependencies: - '@types/node' diff --git a/sdk/chaos/arm-chaos/CHANGELOG.md b/sdk/chaos/arm-chaos/CHANGELOG.md index 345bf37e03a1..1c24d8efe27e 100644 --- a/sdk/chaos/arm-chaos/CHANGELOG.md +++ b/sdk/chaos/arm-chaos/CHANGELOG.md @@ -1,15 +1,18 @@ # Release History + +## 1.0.0-beta.2 (2022-09-30) + +**Features** -## 1.0.0-beta.2 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - 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) 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..9f97a938f778 100644 --- a/sdk/chaos/arm-chaos/README.md +++ b/sdk/chaos/arm-chaos/README.md @@ -13,7 +13,7 @@ Chaos Management Client ### Currently supported environments -- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- [LTS versions of Node.js](https://nodejs.org/about/releases/) - Latest versions of Safari, Chrome, Edge and Firefox. See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. diff --git a/sdk/chaos/arm-chaos/_meta.json b/sdk/chaos/arm-chaos/_meta.json index 7fc7de57e6bd..6f3569fe3c07 100644 --- a/sdk/chaos/arm-chaos/_meta.json +++ b/sdk/chaos/arm-chaos/_meta.json @@ -1,8 +1,8 @@ { - "commit": "2acf276d94cf6a8767aaa21b3b6038685eadf20b", + "commit": "001f57e8c17b508a5de551697ccc18e81bb0d93e", "readme": "specification/chaos/resource-manager/readme.md", - "autorest_command": "autorest --version=3.8.4 --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.0-rc.1.20220727.1 --generate-sample=true", + "autorest_command": "autorest --version=3.8.4 --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.0-rc.1", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.4.2", - "use": "@autorest/typescript@6.0.0-rc.1.20220727.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.4.3", + "use": "@autorest/typescript@6.0.0-rc.1" } \ No newline at end of file diff --git a/sdk/chaos/arm-chaos/package.json b/sdk/chaos/arm-chaos/package.json index f9a276f90be2..fe8c79b93815 100644 --- a/sdk/chaos/arm-chaos/package.json +++ b/sdk/chaos/arm-chaos/package.json @@ -26,7 +26,7 @@ "module": "./dist-esm/src/index.js", "types": "./types/arm-chaos.d.ts", "devDependencies": { - "@microsoft/api-extractor": "^7.31.1", + "@microsoft/api-extractor": "7.18.11", "@rollup/plugin-commonjs": "^21.0.1", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-multi-entry": "^4.1.0", @@ -34,7 +34,7 @@ "mkdirp": "^1.0.4", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", - "typescript": "~4.6.0", + "typescript": "~4.2.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", "@azure/identity": "^2.0.1", @@ -44,8 +44,7 @@ "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", - "@azure/dev-tool": "^1.0.0", - "@azure/arm-cosmosdb": "^15.2.0" + "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/chaos/arm-chaos", "repository": { @@ -108,13 +107,5 @@ } ] }, - "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-chaos?view=azure-node-preview" - } -} + "autoPublish": true +} \ 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 ffebe6cadb5e..c72650423f89 100644 --- a/sdk/chaos/arm-chaos/review/arm-chaos.api.md +++ b/sdk/chaos/arm-chaos/review/arm-chaos.api.md @@ -439,6 +439,17 @@ export interface ExperimentStatusListResult { readonly value?: ExperimentStatus[]; } +// @public +export interface Filter { + type: "Simple"; +} + +// @public +export type FilterType = string; + +// @public (undocumented) +export type FilterUnion = Filter | SimpleFilter; + // @public export interface KeyValuePair { key: string; @@ -458,6 +469,11 @@ export enum KnownCreatedByType { User = "User" } +// @public +export enum KnownFilterType { + Simple = "Simple" +} + // @public export enum KnownOrigin { System = "system", @@ -529,6 +545,7 @@ export type ResourceIdentityType = "None" | "SystemAssigned"; // @public export interface Selector { + filter?: FilterUnion; id: string; targets: TargetReference[]; type: SelectorType; @@ -537,6 +554,17 @@ export interface Selector { // @public export type SelectorType = "Percent" | "Random" | "Tag" | "List"; +// @public +export interface SimpleFilter extends Filter { + parameters?: SimpleFilterParameters; + type: "Simple"; +} + +// @public +export interface SimpleFilterParameters { + zones?: string[]; +} + // @public export interface Step { branches: Branch[]; diff --git a/sdk/chaos/arm-chaos/src/chaosManagementClient.ts b/sdk/chaos/arm-chaos/src/chaosManagementClient.ts index 7c6846f4b1f7..2aaba5d7b0c7 100644 --- a/sdk/chaos/arm-chaos/src/chaosManagementClient.ts +++ b/sdk/chaos/arm-chaos/src/chaosManagementClient.ts @@ -16,19 +16,19 @@ import { import * as coreAuth from "@azure/core-auth"; import { CapabilitiesImpl, + CapabilityTypesImpl, ExperimentsImpl, OperationsImpl, - TargetsImpl, TargetTypesImpl, - CapabilityTypesImpl + TargetsImpl } from "./operations"; import { Capabilities, + CapabilityTypes, Experiments, Operations, - Targets, TargetTypes, - CapabilityTypes + Targets } from "./operationsInterfaces"; import { ChaosManagementClientOptionalParams } from "./models"; @@ -84,47 +84,40 @@ export class ChaosManagementClient extends coreClient.ServiceClient { }; super(optionsWithDefaults); - let bearerTokenAuthenticationPolicyFound: boolean = false; if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); - bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( (pipelinePolicy) => pipelinePolicy.name === coreRestPipeline.bearerTokenAuthenticationPolicyName ); - } - if ( - !options || - !options.pipeline || - options.pipeline.getOrderedPolicies().length == 0 || - !bearerTokenAuthenticationPolicyFound - ) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - credential: credentials, - scopes: `${optionsWithDefaults.credentialScopes}`, - challengeCallbacks: { - authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge - } - }) - ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } } // Parameter assignments this.subscriptionId = subscriptionId; // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2022-07-01-preview"; + this.apiVersion = options.apiVersion || "2022-10-01-preview"; this.capabilities = new CapabilitiesImpl(this); + this.capabilityTypes = new CapabilityTypesImpl(this); this.experiments = new ExperimentsImpl(this); this.operations = new OperationsImpl(this); - this.targets = new TargetsImpl(this); this.targetTypes = new TargetTypesImpl(this); - this.capabilityTypes = new CapabilityTypesImpl(this); + this.targets = new TargetsImpl(this); this.addCustomApiVersionPolicy(options.apiVersion); } @@ -157,9 +150,9 @@ export class ChaosManagementClient extends coreClient.ServiceClient { } capabilities: Capabilities; + capabilityTypes: CapabilityTypes; experiments: Experiments; operations: Operations; - targets: Targets; targetTypes: TargetTypes; - capabilityTypes: CapabilityTypes; + targets: Targets; } diff --git a/sdk/chaos/arm-chaos/src/models/index.ts b/sdk/chaos/arm-chaos/src/models/index.ts index 3e4639483dce..af03ad3c94b4 100644 --- a/sdk/chaos/arm-chaos/src/models/index.ts +++ b/sdk/chaos/arm-chaos/src/models/index.ts @@ -13,6 +13,7 @@ export type ActionUnion = | DelayAction | DiscreteAction | ContinuousAction; +export type FilterUnion = Filter | SimpleFilter; /** Model that represents a list of Capability resources and a link for pagination. */ export interface CapabilityListResult { @@ -112,6 +113,29 @@ export interface ErrorAdditionalInfo { readonly info?: Record; } +/** Model that represents a list of Capability Type resources and a link for pagination. */ +export interface CapabilityTypeListResult { + /** + * List of Capability Type resources. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: CapabilityType[]; + /** + * URL to retrieve the next page of Capability Type resources. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Runtime properties of this Capability Type. */ +export interface CapabilityTypePropertiesRuntimeProperties { + /** + * String of the kind of the resource's action type (continuous or discrete). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly kind?: string; +} + /** Model that represents a list of Experiment resources and a link for pagination. */ export interface ExperimentListResult { /** @@ -174,6 +198,8 @@ export interface Selector { id: string; /** List of Target references. */ targets: TargetReference[]; + /** Model that represents available filter types that can be applied to a targets list. */ + filter?: FilterUnion; } /** Model that represents a reference to a Target in the selector. */ @@ -184,6 +210,12 @@ export interface TargetReference { id: string; } +/** Model that represents available filter types that can be applied to a targets list. */ +export interface Filter { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "Simple"; +} + /** Model that represents the result of a cancel Experiment operation. */ export interface ExperimentCancelOperationResult { /** @@ -531,20 +563,6 @@ export interface OperationDisplay { readonly description?: string; } -/** Model that represents a list of Target resources and a link for pagination. */ -export interface TargetListResult { - /** - * List of Target resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Target[]; - /** - * URL to retrieve the next page of Target resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - /** Model that represents a list of Target Type resources and a link for pagination. */ export interface TargetTypeListResult { /** @@ -559,29 +577,20 @@ export interface TargetTypeListResult { readonly nextLink?: string; } -/** Model that represents a list of Capability Type resources and a link for pagination. */ -export interface CapabilityTypeListResult { +/** Model that represents a list of Target resources and a link for pagination. */ +export interface TargetListResult { /** - * List of Capability Type resources. + * List of Target resources. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly value?: CapabilityType[]; + readonly value?: Target[]; /** - * URL to retrieve the next page of Capability Type resources. + * URL to retrieve the next page of Target resources. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly nextLink?: string; } -/** Runtime properties of this Capability Type. */ -export interface CapabilityTypePropertiesRuntimeProperties { - /** - * String of the kind of the resource's action type (continuous or discrete). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly kind?: string; -} - /** A map to describe the settings of an action. */ export interface KeyValuePair { /** The name of the setting for the action. */ @@ -590,6 +599,12 @@ export interface KeyValuePair { value: string; } +/** Model that represents the Simple filter parameters. */ +export interface SimpleFilterParameters { + /** List of Azure availability zones to filter targets by. */ + zones?: string[]; +} + /** Model that represents a Capability resource. */ export interface Capability extends Resource { /** @@ -624,36 +639,25 @@ export interface Capability extends Resource { readonly urn?: string; } -/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ -export interface TrackedResource extends Resource { - /** Resource tags. */ - tags?: { [propertyName: string]: string }; - /** The geo-location where the resource lives */ - location: string; -} - -/** Model that represents a Target resource. */ -export interface Target extends Resource { +/** Model that represents a Capability Type resource. */ +export interface CapabilityType extends Resource { /** - * The system metadata of the target resource. + * The system metadata properties of the capability type resource. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly systemData?: SystemData; - /** Location of the target resource. */ + /** Location of the Capability Type resource. */ location?: string; - /** The properties of the target resource. */ - properties: { [propertyName: string]: any }; -} - -/** Model that represents a Target Type resource. */ -export interface TargetType extends Resource { /** - * The system metadata properties of the target type resource. + * String of the Publisher that this Capability Type extends. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly systemData?: SystemData; - /** Location of the Target Type resource. */ - location?: string; + readonly publisher?: string; + /** + * String of the Target Type that this Capability Type extends. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly targetType?: string; /** * Localized string of the display name. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -665,36 +669,41 @@ export interface TargetType extends Resource { */ readonly description?: string; /** - * URL to retrieve JSON schema of the Target Type properties. + * URL to retrieve JSON schema of the Capability Type parameters. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly propertiesSchema?: string; + readonly parametersSchema?: string; /** - * List of resource types this Target Type can extend. + * String of the URN for this Capability Type. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly resourceTypes?: string[]; + readonly urn?: string; + /** + * String of the kind of this Capability Type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly kind?: string; + /** Runtime properties of this Capability Type. */ + runtimeProperties?: CapabilityTypePropertiesRuntimeProperties; } -/** Model that represents a Capability Type resource. */ -export interface CapabilityType extends Resource { +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +} + +/** Model that represents a Target Type resource. */ +export interface TargetType extends Resource { /** - * The system metadata properties of the capability type resource. + * The system metadata properties of the target type resource. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly systemData?: SystemData; - /** Location of the Capability Type resource. */ + /** Location of the Target Type resource. */ location?: string; - /** - * String of the Publisher that this Capability Type extends. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly publisher?: string; - /** - * String of the Target Type that this Capability Type extends. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly targetType?: string; /** * Localized string of the display name. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -706,22 +715,28 @@ export interface CapabilityType extends Resource { */ readonly description?: string; /** - * URL to retrieve JSON schema of the Capability Type parameters. + * URL to retrieve JSON schema of the Target Type properties. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly parametersSchema?: string; + readonly propertiesSchema?: string; /** - * String of the URN for this Capability Type. + * List of resource types this Target Type can extend. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly urn?: string; + readonly resourceTypes?: string[]; +} + +/** Model that represents a Target resource. */ +export interface Target extends Resource { /** - * String of the kind of this Capability Type. + * The system metadata of the target resource. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly kind?: string; - /** Runtime properties of this Capability Type. */ - runtimeProperties?: CapabilityTypePropertiesRuntimeProperties; + readonly systemData?: SystemData; + /** Location of the target resource. */ + location?: string; + /** The properties of the target resource. */ + properties: { [propertyName: string]: any }; } /** Model that represents a delay action. */ @@ -754,6 +769,14 @@ export interface ContinuousAction extends Action { selectorId: string; } +/** Model that represents a simple target filter. */ +export interface SimpleFilter extends Filter { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "Simple"; + /** Model that represents the Simple filter parameters. */ + parameters?: SimpleFilterParameters; +} + /** Model that represents a Experiment resource. */ export interface Experiment extends TrackedResource { /** @@ -795,6 +818,21 @@ export enum KnownCreatedByType { */ export type CreatedByType = string; +/** Known values of {@link FilterType} that the service accepts. */ +export enum KnownFilterType { + /** Simple */ + Simple = "Simple" +} + +/** + * Defines values for FilterType. \ + * {@link KnownFilterType} can be used interchangeably with FilterType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Simple** + */ +export type FilterType = string; + /** Known values of {@link Origin} that the service accepts. */ export enum KnownOrigin { /** User */ @@ -873,6 +911,33 @@ export interface CapabilitiesListNextOptionalParams /** Contains response data for the listNext operation. */ export type CapabilitiesListNextResponse = CapabilityListResult; +/** Optional parameters. */ +export interface CapabilityTypesListOptionalParams + extends coreClient.OperationOptions { + /** String that sets the continuation token. */ + continuationToken?: string; +} + +/** Contains response data for the list operation. */ +export type CapabilityTypesListResponse = CapabilityTypeListResult; + +/** Optional parameters. */ +export interface CapabilityTypesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type CapabilityTypesGetResponse = CapabilityType; + +/** Optional parameters. */ +export interface CapabilityTypesListNextOptionalParams + extends coreClient.OperationOptions { + /** String that sets the continuation token. */ + continuationToken?: string; +} + +/** Contains response data for the listNext operation. */ +export type CapabilityTypesListNextResponse = CapabilityTypeListResult; + /** Optional parameters. */ export interface ExperimentsListAllOptionalParams extends coreClient.OperationOptions { @@ -1009,42 +1074,6 @@ export interface OperationsListAllNextOptionalParams /** Contains response data for the listAllNext operation. */ export type OperationsListAllNextResponse = OperationListResult; -/** Optional parameters. */ -export interface TargetsListOptionalParams extends coreClient.OperationOptions { - /** String that sets the continuation token. */ - continuationToken?: string; -} - -/** Contains response data for the list operation. */ -export type TargetsListResponse = TargetListResult; - -/** Optional parameters. */ -export interface TargetsGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type TargetsGetResponse = Target; - -/** Optional parameters. */ -export interface TargetsDeleteOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface TargetsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the createOrUpdate operation. */ -export type TargetsCreateOrUpdateResponse = Target; - -/** Optional parameters. */ -export interface TargetsListNextOptionalParams - extends coreClient.OperationOptions { - /** String that sets the continuation token. */ - continuationToken?: string; -} - -/** Contains response data for the listNext operation. */ -export type TargetsListNextResponse = TargetListResult; - /** Optional parameters. */ export interface TargetTypesListOptionalParams extends coreClient.OperationOptions { @@ -1073,31 +1102,40 @@ export interface TargetTypesListNextOptionalParams export type TargetTypesListNextResponse = TargetTypeListResult; /** Optional parameters. */ -export interface CapabilityTypesListOptionalParams - extends coreClient.OperationOptions { +export interface TargetsListOptionalParams extends coreClient.OperationOptions { /** String that sets the continuation token. */ continuationToken?: string; } /** Contains response data for the list operation. */ -export type CapabilityTypesListResponse = CapabilityTypeListResult; +export type TargetsListResponse = TargetListResult; /** Optional parameters. */ -export interface CapabilityTypesGetOptionalParams - extends coreClient.OperationOptions {} +export interface TargetsGetOptionalParams extends coreClient.OperationOptions {} /** Contains response data for the get operation. */ -export type CapabilityTypesGetResponse = CapabilityType; +export type TargetsGetResponse = Target; /** Optional parameters. */ -export interface CapabilityTypesListNextOptionalParams +export interface TargetsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface TargetsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type TargetsCreateOrUpdateResponse = Target; + +/** Optional parameters. */ +export interface TargetsListNextOptionalParams extends coreClient.OperationOptions { /** String that sets the continuation token. */ continuationToken?: string; } /** Contains response data for the listNext operation. */ -export type CapabilityTypesListNextResponse = CapabilityTypeListResult; +export type TargetsListNextResponse = TargetListResult; /** Optional parameters. */ export interface ChaosManagementClientOptionalParams diff --git a/sdk/chaos/arm-chaos/src/models/mappers.ts b/sdk/chaos/arm-chaos/src/models/mappers.ts index 1fd8f79a105d..cdca450912b1 100644 --- a/sdk/chaos/arm-chaos/src/models/mappers.ts +++ b/sdk/chaos/arm-chaos/src/models/mappers.ts @@ -212,6 +212,55 @@ export const ErrorAdditionalInfo: coreClient.CompositeMapper = { } }; +export const CapabilityTypeListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CapabilityTypeListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CapabilityType" + } + } + } + }, + nextLink: { + constraints: { + MaxLength: 2048 + }, + serializedName: "nextLink", + readOnly: true, + nullable: true, + type: { + name: "String" + } + } + } + } +}; + +export const CapabilityTypePropertiesRuntimeProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CapabilityTypePropertiesRuntimeProperties", + modelProperties: { + kind: { + serializedName: "kind", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + export const ExperimentListResult: coreClient.CompositeMapper = { type: { name: "Composite", @@ -425,6 +474,13 @@ export const Selector: coreClient.CompositeMapper = { } } } + }, + filter: { + serializedName: "filter", + type: { + name: "Composite", + className: "Filter" + } } } } @@ -459,6 +515,27 @@ export const TargetReference: coreClient.CompositeMapper = { } }; +export const Filter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Filter", + uberParent: "Filter", + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, + modelProperties: { + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + } + } + } +}; + export const ExperimentCancelOperationResult: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1059,10 +1136,10 @@ export const OperationDisplay: coreClient.CompositeMapper = { } }; -export const TargetListResult: coreClient.CompositeMapper = { +export const TargetTypeListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "TargetListResult", + className: "TargetTypeListResult", modelProperties: { value: { serializedName: "value", @@ -1072,7 +1149,7 @@ export const TargetListResult: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "Target" + className: "TargetType" } } } @@ -1092,10 +1169,10 @@ export const TargetListResult: coreClient.CompositeMapper = { } }; -export const TargetTypeListResult: coreClient.CompositeMapper = { +export const TargetListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "TargetTypeListResult", + className: "TargetListResult", modelProperties: { value: { serializedName: "value", @@ -1105,7 +1182,7 @@ export const TargetTypeListResult: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "TargetType" + className: "Target" } } } @@ -1125,31 +1202,27 @@ export const TargetTypeListResult: coreClient.CompositeMapper = { } }; -export const CapabilityTypeListResult: coreClient.CompositeMapper = { +export const KeyValuePair: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CapabilityTypeListResult", + className: "KeyValuePair", modelProperties: { - value: { - serializedName: "value", - readOnly: true, + key: { + constraints: { + MinLength: 1 + }, + serializedName: "key", + required: true, type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "CapabilityType" - } - } + name: "String" } }, - nextLink: { + value: { constraints: { - MaxLength: 2048 + MinLength: 1 }, - serializedName: "nextLink", - readOnly: true, - nullable: true, + serializedName: "value", + required: true, type: { name: "String" } @@ -1158,43 +1231,76 @@ export const CapabilityTypeListResult: coreClient.CompositeMapper = { } }; -export const CapabilityTypePropertiesRuntimeProperties: coreClient.CompositeMapper = { +export const SimpleFilterParameters: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CapabilityTypePropertiesRuntimeProperties", + className: "SimpleFilterParameters", modelProperties: { - kind: { - serializedName: "kind", - readOnly: true, + zones: { + serializedName: "zones", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "String" + } + } } } } } }; -export const KeyValuePair: coreClient.CompositeMapper = { +export const Capability: coreClient.CompositeMapper = { type: { name: "Composite", - className: "KeyValuePair", + className: "Capability", modelProperties: { - key: { + ...Resource.type.modelProperties, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + publisher: { + serializedName: "properties.publisher", + readOnly: true, + type: { + name: "String" + } + }, + targetType: { + serializedName: "properties.targetType", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "properties.description", + readOnly: true, + type: { + name: "String" + } + }, + parametersSchema: { constraints: { - MinLength: 1 + MaxLength: 2048 }, - serializedName: "key", - required: true, + serializedName: "properties.parametersSchema", + readOnly: true, type: { name: "String" } }, - value: { + urn: { constraints: { - MinLength: 1 + MaxLength: 2048 }, - serializedName: "value", - required: true, + serializedName: "properties.urn", + readOnly: true, type: { name: "String" } @@ -1203,10 +1309,10 @@ export const KeyValuePair: coreClient.CompositeMapper = { } }; -export const Capability: coreClient.CompositeMapper = { +export const CapabilityType: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Capability", + className: "CapabilityType", modelProperties: { ...Resource.type.modelProperties, systemData: { @@ -1216,6 +1322,12 @@ export const Capability: coreClient.CompositeMapper = { className: "SystemData" } }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, publisher: { serializedName: "properties.publisher", readOnly: true, @@ -1230,6 +1342,13 @@ export const Capability: coreClient.CompositeMapper = { name: "String" } }, + displayName: { + serializedName: "properties.displayName", + readOnly: true, + type: { + name: "String" + } + }, description: { serializedName: "properties.description", readOnly: true, @@ -1256,6 +1375,20 @@ export const Capability: coreClient.CompositeMapper = { type: { name: "String" } + }, + kind: { + serializedName: "properties.kind", + readOnly: true, + type: { + name: "String" + } + }, + runtimeProperties: { + serializedName: "properties.runtimeProperties", + type: { + name: "Composite", + className: "CapabilityTypePropertiesRuntimeProperties" + } } } } @@ -1285,37 +1418,6 @@ export const TrackedResource: coreClient.CompositeMapper = { } }; -export const Target: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Target", - modelProperties: { - ...Resource.type.modelProperties, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - }, - location: { - serializedName: "location", - type: { - name: "String" - } - }, - properties: { - serializedName: "properties", - required: true, - type: { - name: "Dictionary", - value: { type: { name: "any" } } - } - } - } - } -}; - export const TargetType: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1375,10 +1477,10 @@ export const TargetType: coreClient.CompositeMapper = { } }; -export const CapabilityType: coreClient.CompositeMapper = { +export const Target: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CapabilityType", + className: "Target", modelProperties: { ...Resource.type.modelProperties, systemData: { @@ -1394,66 +1496,12 @@ export const CapabilityType: coreClient.CompositeMapper = { name: "String" } }, - publisher: { - serializedName: "properties.publisher", - readOnly: true, - type: { - name: "String" - } - }, - targetType: { - serializedName: "properties.targetType", - readOnly: true, - type: { - name: "String" - } - }, - displayName: { - serializedName: "properties.displayName", - readOnly: true, - type: { - name: "String" - } - }, - description: { - serializedName: "properties.description", - readOnly: true, - type: { - name: "String" - } - }, - parametersSchema: { - constraints: { - MaxLength: 2048 - }, - serializedName: "properties.parametersSchema", - readOnly: true, - type: { - name: "String" - } - }, - urn: { - constraints: { - MaxLength: 2048 - }, - serializedName: "properties.urn", - readOnly: true, - type: { - name: "String" - } - }, - kind: { - serializedName: "properties.kind", - readOnly: true, - type: { - name: "String" - } - }, - runtimeProperties: { - serializedName: "properties.runtimeProperties", + properties: { + serializedName: "properties", + required: true, type: { - name: "Composite", - className: "CapabilityTypePropertiesRuntimeProperties" + name: "Dictionary", + value: { type: { name: "any" } } } } } @@ -1569,6 +1617,26 @@ export const ContinuousAction: coreClient.CompositeMapper = { } }; +export const SimpleFilter: coreClient.CompositeMapper = { + serializedName: "Simple", + type: { + name: "Composite", + className: "SimpleFilter", + uberParent: "Filter", + polymorphicDiscriminator: Filter.type.polymorphicDiscriminator, + modelProperties: { + ...Filter.type.modelProperties, + parameters: { + serializedName: "parameters", + type: { + name: "Composite", + className: "SimpleFilterParameters" + } + } + } + } +}; + export const Experiment: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1634,7 +1702,9 @@ export const Experiment: coreClient.CompositeMapper = { export let discriminators = { Action: Action, + Filter: Filter, "Action.delay": DelayAction, "Action.discrete": DiscreteAction, - "Action.continuous": ContinuousAction + "Action.continuous": ContinuousAction, + "Filter.Simple": SimpleFilter }; diff --git a/sdk/chaos/arm-chaos/src/models/parameters.ts b/sdk/chaos/arm-chaos/src/models/parameters.ts index edf25686c438..1e44c53dd26f 100644 --- a/sdk/chaos/arm-chaos/src/models/parameters.ts +++ b/sdk/chaos/arm-chaos/src/models/parameters.ts @@ -44,7 +44,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2022-07-01-preview", + defaultValue: "2022-10-01-preview", isConstant: true, serializedName: "api-version", type: { @@ -192,6 +192,48 @@ export const nextLink: OperationURLParameter = { skipEncoding: true }; +export const locationName: OperationURLParameter = { + parameterPath: "locationName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9_\\-\\.]+$") + }, + serializedName: "locationName", + required: true, + type: { + name: "String" + } + } +}; + +export const targetTypeName: OperationURLParameter = { + parameterPath: "targetTypeName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9_\\-\\.]+$") + }, + serializedName: "targetTypeName", + required: true, + type: { + name: "String" + } + } +}; + +export const capabilityTypeName: OperationURLParameter = { + parameterPath: "capabilityTypeName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9\\-\\.]+-\\d\\.\\d$") + }, + serializedName: "capabilityTypeName", + required: true, + type: { + name: "String" + } + } +}; + export const running: OperationQueryParameter = { parameterPath: ["options", "running"], mapper: { @@ -258,45 +300,3 @@ export const target: OperationParameter = { parameterPath: "target", mapper: TargetMapper }; - -export const locationName: OperationURLParameter = { - parameterPath: "locationName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9_\\-\\.]+$") - }, - serializedName: "locationName", - required: true, - type: { - name: "String" - } - } -}; - -export const targetTypeName: OperationURLParameter = { - parameterPath: "targetTypeName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9_\\-\\.]+$") - }, - serializedName: "targetTypeName", - required: true, - type: { - name: "String" - } - } -}; - -export const capabilityTypeName: OperationURLParameter = { - parameterPath: "capabilityTypeName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9\\-\\.]+-\\d\\.\\d$") - }, - serializedName: "capabilityTypeName", - required: true, - type: { - name: "String" - } - } -}; diff --git a/sdk/chaos/arm-chaos/src/operations/index.ts b/sdk/chaos/arm-chaos/src/operations/index.ts index 540e90a46783..200980df3f09 100644 --- a/sdk/chaos/arm-chaos/src/operations/index.ts +++ b/sdk/chaos/arm-chaos/src/operations/index.ts @@ -7,8 +7,8 @@ */ export * from "./capabilities"; +export * from "./capabilityTypes"; export * from "./experiments"; export * from "./operations"; -export * from "./targets"; export * from "./targetTypes"; -export * from "./capabilityTypes"; +export * from "./targets"; diff --git a/sdk/chaos/arm-chaos/src/operationsInterfaces/index.ts b/sdk/chaos/arm-chaos/src/operationsInterfaces/index.ts index 540e90a46783..200980df3f09 100644 --- a/sdk/chaos/arm-chaos/src/operationsInterfaces/index.ts +++ b/sdk/chaos/arm-chaos/src/operationsInterfaces/index.ts @@ -7,8 +7,8 @@ */ export * from "./capabilities"; +export * from "./capabilityTypes"; export * from "./experiments"; export * from "./operations"; -export * from "./targets"; export * from "./targetTypes"; -export * from "./capabilityTypes"; +export * from "./targets"; 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"