diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 175fdf525d4f..0148a42fc655 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -3840,7 +3840,7 @@ packages: dependencies: semver: 7.5.1 shelljs: 0.8.5 - typescript: 5.2.0-dev.20230524 + typescript: 5.2.0-dev.20230526 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8383,14 +8383,20 @@ packages: hasBin: true dev: false + /typescript/4.8.4: + resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==} + engines: {node: '>=4.2.0'} + hasBin: true + dev: false + /typescript/5.0.4: resolution: {integrity: sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==} engines: {node: '>=12.20'} hasBin: true dev: false - /typescript/5.2.0-dev.20230524: - resolution: {integrity: sha512-1XzSUJCt31jm7jIZ3vBKzK46ZxnmqX2VdVg/dur9AIaz9WmidrABs7F8H8d4onpIV8RYD/L6xW6MXR5EHjl+LA==} + /typescript/5.2.0-dev.20230526: + resolution: {integrity: sha512-FG5f+kPZixLksvcKtzIgprYSc4vfyeGEAJL046/mU6Ws3BVYmg+SolJO/8/6PDdOXKUHcA1jnXVk1K5soY3ASw==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -10363,7 +10369,7 @@ packages: dev: false file:projects/arm-chaos.tgz: - resolution: {integrity: sha512-Op4XH6fvPLU1mch3iN6qkSorU58ZcEkhf/bL0sqtEOyga4kRpdg80iOhXUdxfh2B95PT0O/GF9ySCFi71UTrWw==, tarball: file:projects/arm-chaos.tgz} + resolution: {integrity: sha512-6fpyOBFzsMdtjtoaQElNykREKb0XJRL7hU2YdU4Prcx12CIVqO50b3M0MX59qWQqYNxjoakzq5t/tHi94zOBNA==, tarball: file:projects/arm-chaos.tgz} name: '@rush-temp/arm-chaos' version: 0.0.0 dependencies: @@ -10377,14 +10383,14 @@ packages: '@types/node': 14.18.47 chai: 4.3.7 cross-env: 7.0.3 - dotenv: 8.6.0 - mkdirp: 1.0.4 + dotenv: 16.0.3 + mkdirp: 2.1.6 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 rollup-plugin-sourcemaps: 0.6.3_ehqevut6loiv2j3zjuhqc62mru tslib: 2.5.2 - typescript: 5.0.4 + typescript: 4.8.4 uglify-js: 3.17.4 transitivePeerDependencies: - supports-color diff --git a/sdk/chaos/arm-chaos/CHANGELOG.md b/sdk/chaos/arm-chaos/CHANGELOG.md index 017f0e2e09db..7db39f15cbca 100644 --- a/sdk/chaos/arm-chaos/CHANGELOG.md +++ b/sdk/chaos/arm-chaos/CHANGELOG.md @@ -1,15 +1,32 @@ # Release History + +## 1.0.0-beta.4 (2023-05-26) + +**Features** -## 1.0.0-beta.4 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Added operation Experiments.update + - Added Interface ExperimentsUpdateOptionalParams + - Added Interface ExperimentUpdate + - Added Interface ListSelector + - Added Interface QuerySelector + - Added Interface UserAssignedIdentity + - Added Type Alias ExperimentsUpdateResponse + - Added Type Alias SelectorUnion + - Added Type Alias TargetReferenceType + - Interface CapabilityType has a new optional parameter azureRbacActions + - Interface CapabilityType has a new optional parameter azureRbacDataActions + - Interface ResourceIdentity has a new optional parameter userAssignedIdentities + - Added Enum KnownSelectorType + - Added Enum KnownTargetReferenceType + +**Breaking Changes** + + - Interface Selector no longer has parameter targets + - Type of parameter selectors of interface Experiment is changed from Selector[] to SelectorUnion[] + - Type of parameter type of interface Selector is changed from SelectorType to "List" | "Query" + - Type of parameter type of interface TargetReference is changed from "ChaosTarget" to TargetReferenceType + + ## 1.0.0-beta.3 (2023-01-12) **Features** diff --git a/sdk/chaos/arm-chaos/_meta.json b/sdk/chaos/arm-chaos/_meta.json index 033ae6473764..6863c3a7a79b 100644 --- a/sdk/chaos/arm-chaos/_meta.json +++ b/sdk/chaos/arm-chaos/_meta.json @@ -1,8 +1,8 @@ { - "commit": "5263f0b2ead74031fa567da2700411743da26e7f", - "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=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\chaos\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.5.20221215.1 --generate-sample=true", + "commit": "718e66de9d41a725286a24b877bd1ad62c005e87", + "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=/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.10", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.5.4", - "use": "@autorest/typescript@6.0.0-rc.5.20221215.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.0", + "use": "@autorest/typescript@6.0.0-rc.10" } \ No newline at end of file diff --git a/sdk/chaos/arm-chaos/package.json b/sdk/chaos/arm-chaos/package.json index c2f7e9e6a623..558a7aa01bfd 100644 --- a/sdk/chaos/arm-chaos/package.json +++ b/sdk/chaos/arm-chaos/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.6.1", + "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -31,13 +31,13 @@ "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", "@rollup/plugin-node-resolve": "^13.1.3", - "mkdirp": "^1.0.4", + "mkdirp": "^2.1.2", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", - "typescript": "~5.0.0", + "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", - "dotenv": "^8.2.0", + "dotenv": "^16.0.0", "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", @@ -46,8 +46,7 @@ "chai": "^4.2.0", "cross-env": "^7.0.2", "@types/node": "^14.0.0", - "@azure/dev-tool": "^1.0.0", - "@azure/arm-cosmosdb": "^15.2.0" + "@azure/dev-tool": "^1.0.0" }, "repository": { "type": "git", @@ -110,13 +109,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 7af47c26ef3e..9f70c9febe3e 100644 --- a/sdk/chaos/arm-chaos/review/arm-chaos.api.md +++ b/sdk/chaos/arm-chaos/review/arm-chaos.api.md @@ -103,6 +103,8 @@ export interface CapabilityListResult { // @public export interface CapabilityType extends Resource { + azureRbacActions?: string[]; + azureRbacDataActions?: string[]; readonly description?: string; readonly displayName?: string; readonly kind?: string; @@ -231,7 +233,7 @@ export interface ErrorResponse { // @public export interface Experiment extends TrackedResource { identity?: ResourceIdentity; - selectors: Selector[]; + selectors: SelectorUnion[]; startOnCreation?: boolean; steps: Step[]; readonly systemData?: SystemData; @@ -303,6 +305,7 @@ export interface Experiments { 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 @@ -433,6 +436,18 @@ export interface ExperimentStatusListResult { readonly value?: ExperimentStatus[]; } +// @public +export interface ExperimentsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ExperimentsUpdateResponse = Experiment; + +// @public +export interface ExperimentUpdate { + identity?: ResourceIdentity; +} + // @public export interface Filter { type: "Simple"; @@ -478,6 +493,23 @@ export enum KnownOrigin { UserSystem = "user,system" } +// @public +export enum KnownSelectorType { + List = "List", + Query = "Query" +} + +// @public +export enum KnownTargetReferenceType { + ChaosTarget = "ChaosTarget" +} + +// @public +export interface ListSelector extends Selector { + targets: TargetReference[]; + type: "List"; +} + // @public export interface Operation { readonly actionType?: ActionType; @@ -523,6 +555,13 @@ export type OperationsListAllResponse = OperationListResult; // @public export type Origin = string; +// @public +export interface QuerySelector extends Selector { + queryString: string; + subscriptionIds: string[]; + type: "Query"; +} + // @public export interface Resource { readonly id?: string; @@ -535,21 +574,27 @@ export interface ResourceIdentity { readonly principalId?: string; readonly tenantId?: string; type: ResourceIdentityType; + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentity; + }; } // @public -export type ResourceIdentityType = "None" | "SystemAssigned"; +export type ResourceIdentityType = "None" | "SystemAssigned" | "UserAssigned"; // @public export interface Selector { + [property: string]: any; filter?: FilterUnion; id: string; - targets: TargetReference[]; - type: SelectorType; + type: "List" | "Query"; } // @public -export type SelectorType = "Percent" | "Random" | "Tag" | "List"; +export type SelectorType = string; + +// @public (undocumented) +export type SelectorUnion = Selector | ListSelector | QuerySelector; // @public export interface SimpleFilter extends Filter { @@ -604,9 +649,12 @@ export interface TargetListResult { // @public export interface TargetReference { id: string; - type: "ChaosTarget"; + type: TargetReferenceType; } +// @public +export type TargetReferenceType = string; + // @public export interface Targets { createOrUpdate(resourceGroupName: string, parentProviderNamespace: string, parentResourceType: string, parentResourceName: string, targetName: string, target: Target, options?: TargetsCreateOrUpdateOptionalParams): Promise; @@ -700,6 +748,12 @@ export interface TrackedResource extends Resource { }; } +// @public +export interface UserAssignedIdentity { + readonly clientId?: string; + readonly principalId?: string; +} + // (No @packageDocumentation comment for this package) ``` diff --git a/sdk/chaos/arm-chaos/src/chaosManagementClient.ts b/sdk/chaos/arm-chaos/src/chaosManagementClient.ts index 494d4e711d49..26ef2ff88d28 100644 --- a/sdk/chaos/arm-chaos/src/chaosManagementClient.ts +++ b/sdk/chaos/arm-chaos/src/chaosManagementClient.ts @@ -117,7 +117,7 @@ export class ChaosManagementClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2022-10-01-preview"; + this.apiVersion = options.apiVersion || "2023-04-15-preview"; this.capabilities = new CapabilitiesImpl(this); this.capabilityTypes = new CapabilityTypesImpl(this); this.experiments = new ExperimentsImpl(this); diff --git a/sdk/chaos/arm-chaos/src/models/index.ts b/sdk/chaos/arm-chaos/src/models/index.ts index 0b2b9a855c9f..3709a0232221 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 SelectorUnion = Selector | ListSelector | QuerySelector; export type FilterUnion = Filter | SimpleFilter; /** Model that represents a list of Capability resources and a link for pagination. */ @@ -150,10 +151,12 @@ export interface ExperimentListResult { readonly nextLink?: string; } -/** The managed identity of a resource. */ +/** The identity of a resource. */ export interface ResourceIdentity { /** String of the resource identity type. */ type: ResourceIdentityType; + /** The list of user identities associated with the Experiment. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ + userAssignedIdentities?: { [propertyName: string]: UserAssignedIdentity }; /** * GUID that represents the principal ID of this resource identity. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -166,6 +169,20 @@ export interface ResourceIdentity { readonly tenantId?: string; } +/** User assigned identity properties */ +export interface UserAssignedIdentity { + /** + * The principal ID of the assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The client ID of the assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly clientId?: string; +} + /** Model that represents a step in the Experiment resource. */ export interface Step { /** String of the step name. */ @@ -192,30 +209,28 @@ export interface Action { /** Model that represents a selector in the Experiment resource. */ export interface Selector { - /** Enum of the selector type. */ - type: SelectorType; + /** 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. */ + [property: string]: any; /** String of the selector ID. */ 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. */ -export interface TargetReference { - /** Enum of the Target reference type. */ - type: "ChaosTarget"; - /** String of the resource ID of a Target resource. */ - 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"; } +/** 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 { /** @@ -599,6 +614,14 @@ export interface KeyValuePair { value: string; } +/** Model that represents a reference to a Target in the selector. */ +export interface TargetReference { + /** Enum of the Target reference type. */ + type: TargetReferenceType; + /** String of the resource ID of a Target resource. */ + id: string; +} + /** Model that represents the Simple filter parameters. */ export interface SimpleFilterParameters { /** List of Azure availability zones to filter targets by. */ @@ -683,6 +706,10 @@ export interface CapabilityType extends Resource { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly kind?: string; + /** Control plane actions necessary to execute capability type. */ + azureRbacActions?: string[]; + /** Data plane actions necessary to execute capability type. */ + azureRbacDataActions?: string[]; /** Runtime properties of this Capability Type. */ runtimeProperties?: CapabilityTypePropertiesRuntimeProperties; } @@ -769,6 +796,24 @@ export interface ContinuousAction extends Action { selectorId: string; } +/** Model that represents a list selector. */ +export interface ListSelector extends Selector { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "List"; + /** List of Target references. */ + targets: TargetReference[]; +} + +/** Model that represents a query selector. */ +export interface QuerySelector extends Selector { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "Query"; + /** Azure Resource Graph (ARG) Query Language query for target resources. */ + queryString: string; + /** Subscription id list to scope resource query. */ + subscriptionIds: string[]; +} + /** Model that represents a simple target filter. */ export interface SimpleFilter extends Filter { /** Polymorphic discriminator, which specifies the different types this object can be */ @@ -789,7 +834,7 @@ export interface Experiment extends TrackedResource { /** List of steps. */ steps: Step[]; /** List of selectors. */ - selectors: Selector[]; + selectors: SelectorUnion[]; /** A boolean value that indicates if experiment should be started on creation or not. */ startOnCreation?: boolean; } @@ -818,6 +863,24 @@ export enum KnownCreatedByType { */ export type CreatedByType = string; +/** Known values of {@link SelectorType} that the service accepts. */ +export enum KnownSelectorType { + /** List */ + List = "List", + /** Query */ + Query = "Query" +} + +/** + * Defines values for SelectorType. \ + * {@link KnownSelectorType} can be used interchangeably with SelectorType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **List** \ + * **Query** + */ +export type SelectorType = string; + /** Known values of {@link FilterType} that the service accepts. */ export enum KnownFilterType { /** Simple */ @@ -868,10 +931,23 @@ export enum KnownActionType { * **Internal** */ export type ActionType = string; + +/** Known values of {@link TargetReferenceType} that the service accepts. */ +export enum KnownTargetReferenceType { + /** ChaosTarget */ + ChaosTarget = "ChaosTarget" +} + +/** + * Defines values for TargetReferenceType. \ + * {@link KnownTargetReferenceType} can be used interchangeably with TargetReferenceType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ChaosTarget** + */ +export type TargetReferenceType = string; /** Defines values for ResourceIdentityType. */ -export type ResourceIdentityType = "None" | "SystemAssigned"; -/** Defines values for SelectorType. */ -export type SelectorType = "Percent" | "Random" | "Tag" | "List"; +export type ResourceIdentityType = "None" | "SystemAssigned" | "UserAssigned"; /** Optional parameters. */ export interface CapabilitiesListOptionalParams @@ -974,6 +1050,13 @@ export interface ExperimentsCreateOrUpdateOptionalParams /** Contains response data for the createOrUpdate operation. */ export type ExperimentsCreateOrUpdateResponse = Experiment; +/** Optional parameters. */ +export interface ExperimentsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type ExperimentsUpdateResponse = Experiment; + /** Optional parameters. */ export interface ExperimentsCancelOptionalParams extends coreClient.OperationOptions {} diff --git a/sdk/chaos/arm-chaos/src/models/mappers.ts b/sdk/chaos/arm-chaos/src/models/mappers.ts index cdca450912b1..6f5aca130306 100644 --- a/sdk/chaos/arm-chaos/src/models/mappers.ts +++ b/sdk/chaos/arm-chaos/src/models/mappers.ts @@ -304,7 +304,16 @@ export const ResourceIdentity: coreClient.CompositeMapper = { required: true, type: { name: "Enum", - allowedValues: ["None", "SystemAssigned"] + allowedValues: ["None", "SystemAssigned", "UserAssigned"] + } + }, + userAssignedIdentities: { + serializedName: "userAssignedIdentities", + type: { + name: "Dictionary", + value: { + type: { name: "Composite", className: "UserAssignedIdentity" } + } } }, principalId: { @@ -335,6 +344,29 @@ export const ResourceIdentity: coreClient.CompositeMapper = { } }; +export const UserAssignedIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserAssignedIdentity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "Uuid" + } + }, + clientId: { + serializedName: "clientId", + readOnly: true, + type: { + name: "Uuid" + } + } + } + } +}; + export const Step: coreClient.CompositeMapper = { type: { name: "Composite", @@ -437,16 +469,22 @@ export const Action: coreClient.CompositeMapper = { }; export const Selector: coreClient.CompositeMapper = { + serializedName: "Selector", type: { name: "Composite", className: "Selector", + uberParent: "Selector", + additionalProperties: { type: { name: "Object" } }, + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, modelProperties: { type: { serializedName: "type", required: true, type: { - name: "Enum", - allowedValues: ["Percent", "Random", "Tag", "List"] + name: "String" } }, id: { @@ -459,22 +497,6 @@ export const Selector: coreClient.CompositeMapper = { name: "String" } }, - targets: { - constraints: { - MinItems: 1 - }, - serializedName: "targets", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "TargetReference" - } - } - } - }, filter: { serializedName: "filter", type: { @@ -486,26 +508,18 @@ export const Selector: coreClient.CompositeMapper = { } }; -export const TargetReference: coreClient.CompositeMapper = { +export const Filter: coreClient.CompositeMapper = { type: { name: "Composite", - className: "TargetReference", + className: "Filter", + uberParent: "Filter", + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, modelProperties: { type: { - defaultValue: "ChaosTarget", - isConstant: true, serializedName: "type", - type: { - name: "String" - } - }, - id: { - constraints: { - Pattern: new RegExp( - "^\\/[Ss][Uu][Bb][Ss][Cc][Rr][Ii][Pp][Tt][Ii][Oo][Nn][Ss]\\/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\\/[Rr][Ee][Ss][Oo][Uu][Rr][Cc][Ee][Gg][Rr][Oo][Uu][Pp][Ss]\\/[a-zA-Z0-9_\\-\\.\\(\\)]*[a-zA-Z0-9_\\-\\(\\)]\\/[Pp][Rr][Oo][Vv][Ii][Dd][Ee][Rr][Ss]\\/[a-zA-Z0-9]+\\.[a-zA-Z0-9]+\\/[a-zA-Z0-9_\\-\\.]+\\/[a-zA-Z0-9_\\-\\.]+\\/[Pp][Rr][Oo][Vv][Ii][Dd][Ee][Rr][Ss]\\/[Mm][Ii][Cc][Rr][Oo][Ss][Oo][Ff][Tt]\\.[Cc][Hh][Aa][Oo][Ss]\\/[Tt][Aa][Rr][Gg][Ee][Tt][Ss]\\/[a-zA-Z0-9_\\-\\.]+$" - ) - }, - serializedName: "id", required: true, type: { name: "String" @@ -515,21 +529,16 @@ export const TargetReference: coreClient.CompositeMapper = { } }; -export const Filter: coreClient.CompositeMapper = { +export const ExperimentUpdate: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Filter", - uberParent: "Filter", - polymorphicDiscriminator: { - serializedName: "type", - clientName: "type" - }, + className: "ExperimentUpdate", modelProperties: { - type: { - serializedName: "type", - required: true, + identity: { + serializedName: "identity", type: { - name: "String" + name: "Composite", + className: "ResourceIdentity" } } } @@ -1231,6 +1240,34 @@ export const KeyValuePair: coreClient.CompositeMapper = { } }; +export const TargetReference: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TargetReference", + modelProperties: { + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + }, + id: { + constraints: { + Pattern: new RegExp( + "^\\/[Ss][Uu][Bb][Ss][Cc][Rr][Ii][Pp][Tt][Ii][Oo][Nn][Ss]\\/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\\/[Rr][Ee][Ss][Oo][Uu][Rr][Cc][Ee][Gg][Rr][Oo][Uu][Pp][Ss]\\/[a-zA-Z0-9_\\-\\.\\(\\)]*[a-zA-Z0-9_\\-\\(\\)]\\/[Pp][Rr][Oo][Vv][Ii][Dd][Ee][Rr][Ss]\\/[a-zA-Z0-9]+\\.[a-zA-Z0-9]+\\/[a-zA-Z0-9_\\-\\.]+\\/[a-zA-Z0-9_\\-\\.]+\\/[Pp][Rr][Oo][Vv][Ii][Dd][Ee][Rr][Ss]\\/[Mm][Ii][Cc][Rr][Oo][Ss][Oo][Ff][Tt]\\.[Cc][Hh][Aa][Oo][Ss]\\/[Tt][Aa][Rr][Gg][Ee][Tt][Ss]\\/[a-zA-Z0-9_\\-\\.]+$" + ) + }, + serializedName: "id", + required: true, + type: { + name: "String" + } + } + } + } +}; + export const SimpleFilterParameters: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1383,6 +1420,28 @@ export const CapabilityType: coreClient.CompositeMapper = { name: "String" } }, + azureRbacActions: { + serializedName: "properties.azureRbacActions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + azureRbacDataActions: { + serializedName: "properties.azureRbacDataActions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, runtimeProperties: { serializedName: "properties.runtimeProperties", type: { @@ -1518,15 +1577,10 @@ export const DelayAction: coreClient.CompositeMapper = { modelProperties: { ...Action.type.modelProperties, duration: { - constraints: { - Pattern: new RegExp( - "^P(\\d+Y)?(\\d+M)?(\\d+D)?(T(\\d+H)?(\\d+M)?(\\d+(\\.\\d+)?S)?)?$" - ) - }, serializedName: "duration", required: true, type: { - name: "String" + name: "TimeSpan" } } } @@ -1579,15 +1633,10 @@ export const ContinuousAction: coreClient.CompositeMapper = { modelProperties: { ...Action.type.modelProperties, duration: { - constraints: { - Pattern: new RegExp( - "^P(\\d+Y)?(\\d+M)?(\\d+D)?(T(\\d+H)?(\\d+M)?(\\d+(\\.\\d+)?S)?)?$" - ) - }, serializedName: "duration", required: true, type: { - name: "String" + name: "TimeSpan" } }, parameters: { @@ -1617,6 +1666,72 @@ export const ContinuousAction: coreClient.CompositeMapper = { } }; +export const ListSelector: coreClient.CompositeMapper = { + serializedName: "List", + type: { + name: "Composite", + className: "ListSelector", + uberParent: "Selector", + additionalProperties: { type: { name: "Object" } }, + polymorphicDiscriminator: Selector.type.polymorphicDiscriminator, + modelProperties: { + ...Selector.type.modelProperties, + targets: { + constraints: { + MinItems: 1 + }, + serializedName: "targets", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TargetReference" + } + } + } + } + } + } +}; + +export const QuerySelector: coreClient.CompositeMapper = { + serializedName: "Query", + type: { + name: "Composite", + className: "QuerySelector", + uberParent: "Selector", + additionalProperties: { type: { name: "Object" } }, + polymorphicDiscriminator: Selector.type.polymorphicDiscriminator, + modelProperties: { + ...Selector.type.modelProperties, + queryString: { + serializedName: "queryString", + required: true, + type: { + name: "String" + } + }, + subscriptionIds: { + constraints: { + MinItems: 1 + }, + serializedName: "subscriptionIds", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + export const SimpleFilter: coreClient.CompositeMapper = { serializedName: "Simple", type: { @@ -1702,9 +1817,12 @@ 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 }; diff --git a/sdk/chaos/arm-chaos/src/models/parameters.ts b/sdk/chaos/arm-chaos/src/models/parameters.ts index 1e44c53dd26f..6075ecf078f5 100644 --- a/sdk/chaos/arm-chaos/src/models/parameters.ts +++ b/sdk/chaos/arm-chaos/src/models/parameters.ts @@ -14,6 +14,7 @@ import { import { Capability as CapabilityMapper, Experiment as ExperimentMapper, + ExperimentUpdate as ExperimentUpdateMapper, Target as TargetMapper } from "../models/mappers"; @@ -44,7 +45,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2022-10-01-preview", + defaultValue: "2023-04-15-preview", isConstant: true, serializedName: "api-version", type: { @@ -264,6 +265,11 @@ export const experiment: OperationParameter = { mapper: ExperimentMapper }; +export const experiment1: OperationParameter = { + parameterPath: "experiment", + mapper: ExperimentUpdateMapper +}; + export const statusId: OperationURLParameter = { parameterPath: "statusId", mapper: { diff --git a/sdk/chaos/arm-chaos/src/operations/experiments.ts b/sdk/chaos/arm-chaos/src/operations/experiments.ts index 7b92c7f5163d..c7de32e6aca2 100644 --- a/sdk/chaos/arm-chaos/src/operations/experiments.ts +++ b/sdk/chaos/arm-chaos/src/operations/experiments.ts @@ -34,6 +34,9 @@ import { ExperimentsGetResponse, ExperimentsCreateOrUpdateOptionalParams, ExperimentsCreateOrUpdateResponse, + ExperimentUpdate, + ExperimentsUpdateOptionalParams, + ExperimentsUpdateResponse, ExperimentsCancelOptionalParams, ExperimentsCancelResponse, ExperimentsStartOptionalParams, @@ -423,6 +426,25 @@ export class ExperimentsImpl implements Experiments { ); } + /** + * 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. + */ + update( + resourceGroupName: string, + experimentName: string, + experiment: ExperimentUpdate, + options?: ExperimentsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, experimentName, experiment, options }, + updateOperationSpec + ); + } + /** * Cancel a running Experiment resource. * @param resourceGroupName String that represents an Azure resource group. @@ -714,6 +736,30 @@ const createOrUpdateOperationSpec: coreClient.OperationSpec = { mediaType: "json", serializer }; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Experiment + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.experiment1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.experimentName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; const cancelOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel", diff --git a/sdk/chaos/arm-chaos/src/operationsInterfaces/experiments.ts b/sdk/chaos/arm-chaos/src/operationsInterfaces/experiments.ts index 160869539685..8ef06c0de026 100644 --- a/sdk/chaos/arm-chaos/src/operationsInterfaces/experiments.ts +++ b/sdk/chaos/arm-chaos/src/operationsInterfaces/experiments.ts @@ -20,6 +20,9 @@ import { ExperimentsGetResponse, ExperimentsCreateOrUpdateOptionalParams, ExperimentsCreateOrUpdateResponse, + ExperimentUpdate, + ExperimentsUpdateOptionalParams, + ExperimentsUpdateResponse, ExperimentsCancelOptionalParams, ExperimentsCancelResponse, ExperimentsStartOptionalParams, @@ -106,6 +109,19 @@ export interface Experiments { experiment: Experiment, options?: ExperimentsCreateOrUpdateOptionalParams ): Promise; + /** + * 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. + */ + update( + resourceGroupName: string, + experimentName: string, + experiment: ExperimentUpdate, + options?: ExperimentsUpdateOptionalParams + ): Promise; /** * Cancel a running Experiment resource. * @param resourceGroupName String that represents an Azure resource group. 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"