From 8a2ad714f867e8325a58a931ff947f5ebd0fc4f5 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 25 Aug 2022 07:55:29 +0000 Subject: [PATCH] CodeGen from PR 19870 in Azure/azure-rest-api-specs Merge 07ecbe547740e6ec7ecd7fd285e9cf4a93c33982 into 505bb06f3bf66661d0170e9dcd8c1c053d9cdbec --- common/config/rush/pnpm-lock.yaml | 11 +++-- .../arm-subscriptions/CHANGELOG.md | 20 ++++---- sdk/subscription/arm-subscriptions/_meta.json | 12 ++--- .../arm-subscriptions/package.json | 27 +++++------ .../review/arm-subscriptions.api.md | 29 +++++++----- .../arm-subscriptions/src/models/index.ts | 47 ++++++++++++++++++- .../arm-subscriptions/src/models/mappers.ts | 22 ++++++++- .../src/subscriptionClient.ts | 2 +- .../arm-subscriptions/test/sampleTest.ts | 39 +++++++-------- .../arm-subscriptions/tsconfig.json | 10 +--- 10 files changed, 136 insertions(+), 83 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index a8108e36afe0..e5af03f91b97 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -4080,7 +4080,7 @@ packages: dependencies: semver: 7.3.7 shelljs: 0.8.5 - typescript: 4.9.0-dev.20220823 + typescript: 4.9.0-dev.20220825 dev: false /downlevel-dts/0.4.0: @@ -8991,8 +8991,8 @@ packages: hasBin: true dev: false - /typescript/4.9.0-dev.20220823: - resolution: {integrity: sha512-8LTaS3Uev9r3Mj6CzXIpr1KQdFD+98bM1Y/tuXUpKGoPWnplMoralGsxflIMa5l6O8P0NPqioDJDsxWeHsxA5A==} + /typescript/4.9.0-dev.20220825: + resolution: {integrity: sha512-X6bFdJycFPfp4CC8RqOZkCQauNIayamosrtovm6UlCjez9AKMQ1TQJiwReDybks9TGHR3LegEIvLIMWj+uiHYg==} engines: {node: '>=4.2.0'} hasBin: true dev: false @@ -14912,7 +14912,7 @@ packages: dev: false file:projects/arm-subscriptions.tgz: - resolution: {integrity: sha512-VY1+MYOKFtHZX6Pi9GiDv+NA09OubHR8oYDeKz7OdPu4aP9xUAcI6FF7WprbAVyHGbB3qsnU2gtEma7bYzuWjA==, tarball: file:projects/arm-subscriptions.tgz} + resolution: {integrity: sha512-3twFVmZhKGDHQXIdQO1uXH7qNx2pbwVKpmTrk3X75FnO77lsbmDbvGVsO7J+nS+eCjaR64EQIPmR4HL60Eub/g==, tarball: file:projects/arm-subscriptions.tgz} name: '@rush-temp/arm-subscriptions' version: 0.0.0 dependencies: @@ -14924,6 +14924,8 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@2.77.2 '@rollup/plugin-multi-entry': 4.1.0_rollup@2.77.2 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.77.2 + '@types/chai': 4.3.1 + chai: 4.3.6 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 @@ -14935,7 +14937,6 @@ packages: uglify-js: 3.16.3 transitivePeerDependencies: - '@types/node' - - encoding - supports-color dev: false diff --git a/sdk/subscription/arm-subscriptions/CHANGELOG.md b/sdk/subscription/arm-subscriptions/CHANGELOG.md index 7f307bbaf612..0ff376a9e08a 100644 --- a/sdk/subscription/arm-subscriptions/CHANGELOG.md +++ b/sdk/subscription/arm-subscriptions/CHANGELOG.md @@ -1,15 +1,15 @@ # Release History + +## 5.1.0 (2022-08-25) + +**Features** -## 5.0.2 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Added Type Alias Provisioning + - Interface AcceptOwnershipStatusResponse has a new optional parameter provisioningState + - Interface Subscription has a new optional parameter tags + - Interface Subscription has a new optional parameter tenantId + - Added Enum KnownProvisioning + ## 5.0.1 (2022-05-05) **Features** diff --git a/sdk/subscription/arm-subscriptions/_meta.json b/sdk/subscription/arm-subscriptions/_meta.json index 248c3600c0d6..3f8e2144b5b8 100644 --- a/sdk/subscription/arm-subscriptions/_meta.json +++ b/sdk/subscription/arm-subscriptions/_meta.json @@ -1,8 +1,8 @@ { - "commit": "d600759c3516b61a7c353bc8682bccbab85a6f65", - "readme": "specification\\subscription\\resource-manager\\readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\subscription\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true", + "commit": "8c5a67d031b48e7e8f9c9c322e8c7ecf689dfbf7", + "readme": "specification/subscription/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=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/subscription/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.3.0", - "use": "@autorest/typescript@6.0.0-alpha.19.20220408.1" -} + "release_tool": "@azure-tools/js-sdk-release-tools@2.4.2", + "use": "@autorest/typescript@6.0.0-rc.1" +} \ No newline at end of file diff --git a/sdk/subscription/arm-subscriptions/package.json b/sdk/subscription/arm-subscriptions/package.json index 213d63b1b7b2..e21d11e0a796 100644 --- a/sdk/subscription/arm-subscriptions/package.json +++ b/sdk/subscription/arm-subscriptions/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for SubscriptionClient.", - "version": "5.0.2", + "version": "5.1.0", "engines": { "node": ">=12.0.0" }, @@ -40,9 +40,13 @@ "uglify-js": "^3.4.9", "rimraf": "^3.0.0", "@azure/identity": "^2.0.1", - "@azure-tools/test-recorder": "^1.0.0", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", "mocha": "^7.1.1", - "cross-env": "^7.0.2" + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/subscription/arm-subscriptions", "repository": { @@ -93,9 +97,8 @@ "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", "unit-test:browser": "echo skipped", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", - "integration-test:browser": "echo skipped", - "docs": "echo skipped" + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" }, "sideEffects": false, "//metadata": { @@ -106,13 +109,5 @@ } ] }, - "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-subscriptions?view=azure-node-preview" - } -} + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/subscription/arm-subscriptions/review/arm-subscriptions.api.md b/sdk/subscription/arm-subscriptions/review/arm-subscriptions.api.md index 37c2268b781e..9d76c8ca55ab 100644 --- a/sdk/subscription/arm-subscriptions/review/arm-subscriptions.api.md +++ b/sdk/subscription/arm-subscriptions/review/arm-subscriptions.api.md @@ -32,6 +32,7 @@ export interface AcceptOwnershipStatusResponse { readonly acceptOwnershipState?: AcceptOwnership; readonly billingOwner?: string; displayName?: string; + readonly provisioningState?: Provisioning; readonly subscriptionId?: string; subscriptionTenantId?: string; tags?: { @@ -145,41 +146,36 @@ export interface GetTenantPolicyResponse { // @public export enum KnownAcceptOwnership { - // (undocumented) Completed = "Completed", - // (undocumented) Expired = "Expired", - // (undocumented) Pending = "Pending" } // @public export enum KnownCreatedByType { - // (undocumented) Application = "Application", - // (undocumented) Key = "Key", - // (undocumented) ManagedIdentity = "ManagedIdentity", - // (undocumented) User = "User" } +// @public +export enum KnownProvisioning { + Accepted = "Accepted", + Pending = "Pending", + Succeeded = "Succeeded" +} + // @public export enum KnownProvisioningState { - // (undocumented) Accepted = "Accepted", - // (undocumented) Failed = "Failed", - // (undocumented) Succeeded = "Succeeded" } // @public export enum KnownWorkload { - // (undocumented) DevTest = "DevTest", - // (undocumented) Production = "Production" } @@ -239,6 +235,9 @@ export interface OperationsListOptionalParams extends coreClient.OperationOption // @public export type OperationsListResponse = OperationListResult; +// @public +export type Provisioning = string; + // @public export type ProvisioningState = string; @@ -296,6 +295,10 @@ export interface Subscription { readonly state?: SubscriptionState; readonly subscriptionId?: string; subscriptionPolicies?: SubscriptionPolicies; + tags?: { + [propertyName: string]: string; + }; + readonly tenantId?: string; } // @public @@ -396,7 +399,7 @@ export type SubscriptionEnableResponse = EnabledSubscriptionId; // @public export interface SubscriptionListResult { - nextLink: string; + nextLink?: string; value?: Subscription[]; } diff --git a/sdk/subscription/arm-subscriptions/src/models/index.ts b/sdk/subscription/arm-subscriptions/src/models/index.ts index a2d07f6ff54b..62c025cbcef8 100644 --- a/sdk/subscription/arm-subscriptions/src/models/index.ts +++ b/sdk/subscription/arm-subscriptions/src/models/index.ts @@ -70,6 +70,13 @@ export interface Subscription { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly state?: SubscriptionState; + /** + * The tenant ID. For example, 00000000-0000-0000-0000-000000000000. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** Tags for the subscription */ + tags?: { [propertyName: string]: string }; /** The subscription policies. */ subscriptionPolicies?: SubscriptionPolicies; /** The authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. */ @@ -100,7 +107,7 @@ export interface SubscriptionListResult { /** An array of subscriptions. */ value?: Subscription[]; /** The URL to get the next set of results. */ - nextLink: string; + nextLink?: string; } /** Tenant Ids information. */ @@ -371,6 +378,11 @@ export interface AcceptOwnershipStatusResponse { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly acceptOwnershipState?: AcceptOwnership; + /** + * The provisioning state of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: Provisioning; /** * UPN of the billing owner * NOTE: This property will not be serialized. It can only be populated by the server. @@ -501,7 +513,9 @@ export interface SubscriptionAcceptOwnershipHeaders { /** Known values of {@link Workload} that the service accepts. */ export enum KnownWorkload { + /** Production */ Production = "Production", + /** DevTest */ DevTest = "DevTest" } @@ -517,8 +531,11 @@ export type Workload = string; /** Known values of {@link ProvisioningState} that the service accepts. */ export enum KnownProvisioningState { + /** Accepted */ Accepted = "Accepted", + /** Succeeded */ Succeeded = "Succeeded", + /** Failed */ Failed = "Failed" } @@ -535,8 +552,11 @@ export type ProvisioningState = string; /** Known values of {@link AcceptOwnership} that the service accepts. */ export enum KnownAcceptOwnership { + /** Pending */ Pending = "Pending", + /** Completed */ Completed = "Completed", + /** Expired */ Expired = "Expired" } @@ -553,9 +573,13 @@ export type AcceptOwnership = string; /** Known values of {@link CreatedByType} that the service accepts. */ export enum KnownCreatedByType { + /** User */ User = "User", + /** Application */ Application = "Application", + /** ManagedIdentity */ ManagedIdentity = "ManagedIdentity", + /** Key */ Key = "Key" } @@ -570,6 +594,27 @@ export enum KnownCreatedByType { * **Key** */ export type CreatedByType = string; + +/** Known values of {@link Provisioning} that the service accepts. */ +export enum KnownProvisioning { + /** Pending */ + Pending = "Pending", + /** Accepted */ + Accepted = "Accepted", + /** Succeeded */ + Succeeded = "Succeeded" +} + +/** + * Defines values for Provisioning. \ + * {@link KnownProvisioning} can be used interchangeably with Provisioning, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Pending** \ + * **Accepted** \ + * **Succeeded** + */ +export type Provisioning = string; /** Defines values for SubscriptionState. */ export type SubscriptionState = | "Enabled" diff --git a/sdk/subscription/arm-subscriptions/src/models/mappers.ts b/sdk/subscription/arm-subscriptions/src/models/mappers.ts index 2cd311ec000a..088921b43f4a 100644 --- a/sdk/subscription/arm-subscriptions/src/models/mappers.ts +++ b/sdk/subscription/arm-subscriptions/src/models/mappers.ts @@ -114,6 +114,20 @@ export const Subscription: coreClient.CompositeMapper = { allowedValues: ["Enabled", "Warned", "PastDue", "Disabled", "Deleted"] } }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, subscriptionPolicies: { serializedName: "subscriptionPolicies", type: { @@ -181,7 +195,6 @@ export const SubscriptionListResult: coreClient.CompositeMapper = { }, nextLink: { serializedName: "nextLink", - required: true, type: { name: "String" } @@ -804,6 +817,13 @@ export const AcceptOwnershipStatusResponse: coreClient.CompositeMapper = { name: "String" } }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, billingOwner: { serializedName: "billingOwner", readOnly: true, diff --git a/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts b/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts index 6eb7dc8d7642..fb494e4b4e2b 100644 --- a/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts +++ b/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts @@ -54,7 +54,7 @@ export class SubscriptionClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-subscriptions/5.0.2`; + const packageDetails = `azsdk-js-arm-subscriptions/5.1.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` diff --git a/sdk/subscription/arm-subscriptions/test/sampleTest.ts b/sdk/subscription/arm-subscriptions/test/sampleTest.ts index 7ed89b043e1b..25aeb3ebcc36 100644 --- a/sdk/subscription/arm-subscriptions/test/sampleTest.ts +++ b/sdk/subscription/arm-subscriptions/test/sampleTest.ts @@ -7,35 +7,30 @@ */ import { - env, - record, - RecorderEnvironmentSetup, - Recorder + Recorder, + RecorderStartOptions, + env } from "@azure-tools/test-recorder"; -import * as assert from "assert"; +import { assert } from "chai"; +import { Context } from "mocha"; -const recorderEnvSetup: RecorderEnvironmentSetup = { - replaceableVariables: { - 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" - }, - customizationsOnRecordings: [ - (recording: any): any => - recording.replace( - /"access_token":"[^"]*"/g, - `"access_token":"access_token"` - ) - ], - queryParametersToSkip: [] +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() { - recorder = record(this, recorderEnvSetup); + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); }); afterEach(async function() { diff --git a/sdk/subscription/arm-subscriptions/tsconfig.json b/sdk/subscription/arm-subscriptions/tsconfig.json index 9889c4c576e3..3e6ae96443f3 100644 --- a/sdk/subscription/arm-subscriptions/tsconfig.json +++ b/sdk/subscription/arm-subscriptions/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-subscriptions": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"