From e87dedf6155ffbe880791168a94f6b1e8b78e3f0 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 17 May 2022 06:30:24 +0000 Subject: [PATCH] CodeGen from PR 19059 in Azure/azure-rest-api-specs Added Mising publicNetworkAccess property (#19059) --- sdk/servicebus/arm-servicebus/CHANGELOG.md | 33 ++- sdk/servicebus/arm-servicebus/README.md | 2 +- sdk/servicebus/arm-servicebus/_meta.json | 10 +- sdk/servicebus/arm-servicebus/package.json | 22 +- .../review/arm-servicebus.api.md | 151 ++++++++++- .../arm-servicebus/src/models/index.ts | 253 +++++++++++++++--- .../arm-servicebus/src/models/mappers.ts | 53 ++-- .../arm-servicebus/src/models/parameters.ts | 2 +- .../src/serviceBusManagementClient.ts | 38 ++- .../arm-servicebus/test/sampleTest.ts | 144 ++-------- sdk/servicebus/arm-servicebus/tsconfig.json | 10 +- 11 files changed, 479 insertions(+), 239 deletions(-) diff --git a/sdk/servicebus/arm-servicebus/CHANGELOG.md b/sdk/servicebus/arm-servicebus/CHANGELOG.md index 2ded2c86e810..938a7568009f 100644 --- a/sdk/servicebus/arm-servicebus/CHANGELOG.md +++ b/sdk/servicebus/arm-servicebus/CHANGELOG.md @@ -1,15 +1,28 @@ # Release History + +## 6.1.0-beta.1 (2022-05-17) + +**Features** -## 6.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Added Type Alias KeySource + - Added Type Alias PublicNetworkAccess + - Added Type Alias TlsVersion + - Type Alias SBNamespace has a new parameter minimumTlsVersion + - Type Alias SBNamespace has a new parameter publicNetworkAccess + - Added Enum KnownAccessRights + - Added Enum KnownFilterType + - Added Enum KnownKeySource + - Added Enum KnownKeyType + - Added Enum KnownManagedServiceIdentityType + - Added Enum KnownProvisioningStateDR + - Added Enum KnownPublicNetworkAccess + - Added Enum KnownRoleDisasterRecovery + - Added Enum KnownSkuName + - Added Enum KnownSkuTier + - Added Enum KnownTlsVersion + - Added Enum KnownUnavailableReason + + ## 6.0.0 (2022-05-01) **Features** diff --git a/sdk/servicebus/arm-servicebus/README.md b/sdk/servicebus/arm-servicebus/README.md index 2b35d6adae1d..e2c74a9d9fb0 100644 --- a/sdk/servicebus/arm-servicebus/README.md +++ b/sdk/servicebus/arm-servicebus/README.md @@ -6,7 +6,7 @@ Azure Service Bus client for managing Namespace [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicebus/arm-servicebus) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-servicebus) | -[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-servicebus) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-servicebus?view=azure-node-preview) | [Samples](https://github.com/Azure-Samples/azure-samples-js-management) ## Getting started diff --git a/sdk/servicebus/arm-servicebus/_meta.json b/sdk/servicebus/arm-servicebus/_meta.json index f240026fc0ba..65b2337687e1 100644 --- a/sdk/servicebus/arm-servicebus/_meta.json +++ b/sdk/servicebus/arm-servicebus/_meta.json @@ -1,8 +1,8 @@ { - "commit": "f9a6cb686bcc0f1b23761db19f2491c5c4df95cb", - "readme": "specification\\servicebus\\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\\servicebus\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true", + "commit": "634d6141b317d5342c7c3f993c0306b0a8ef6171", + "readme": "specification/servicebus/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=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/servicebus/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220425.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" -} + "use": "@autorest/typescript@6.0.0-alpha.19.20220425.1" +} \ No newline at end of file diff --git a/sdk/servicebus/arm-servicebus/package.json b/sdk/servicebus/arm-servicebus/package.json index 778312fc539a..53b99a09276d 100644 --- a/sdk/servicebus/arm-servicebus/package.json +++ b/sdk/servicebus/arm-servicebus/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ServiceBusManagementClient.", - "version": "6.0.1", + "version": "6.1.0-beta.1", "engines": { "node": ">=12.0.0" }, @@ -40,9 +40,11 @@ "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" + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicebus/arm-servicebus", "repository": { @@ -93,7 +95,7 @@ "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:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", "integration-test:browser": "echo skipped", "docs": "echo skipped" }, @@ -106,13 +108,5 @@ } ] }, - "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-servicebus?view=azure-node-preview" - } -} + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/servicebus/arm-servicebus/review/arm-servicebus.api.md b/sdk/servicebus/arm-servicebus/review/arm-servicebus.api.md index f2966d909123..6ab537a42c1e 100644 --- a/sdk/servicebus/arm-servicebus/review/arm-servicebus.api.md +++ b/sdk/servicebus/arm-servicebus/review/arm-servicebus.api.md @@ -22,7 +22,7 @@ export interface AccessKeys { } // @public -export type AccessRights = "Manage" | "Send" | "Listen"; +export type AccessRights = string; // @public export interface Action { @@ -179,7 +179,7 @@ export type DisasterRecoveryConfigsListResponse = ArmDisasterRecoveryListResult; // @public export interface Encryption { - keySource?: "Microsoft.KeyVault"; + keySource?: KeySource; keyVaultProperties?: KeyVaultProperties[]; requireInfrastructureEncryption?: boolean; } @@ -216,7 +216,7 @@ export interface FailoverProperties { } // @public -export type FilterType = "SqlFilter" | "CorrelationFilter"; +export type FilterType = string; // @public export interface Identity { @@ -229,7 +229,10 @@ export interface Identity { } // @public -type KeyType_2 = "PrimaryKey" | "SecondaryKey"; +export type KeySource = string; + +// @public +type KeyType_2 = string; export { KeyType_2 as KeyType } // @public @@ -241,6 +244,16 @@ export interface KeyVaultProperties { keyVersion?: string; } +// @public +export enum KnownAccessRights { + // (undocumented) + Listen = "Listen", + // (undocumented) + Manage = "Manage", + // (undocumented) + Send = "Send" +} + // @public export enum KnownCreatedByType { // (undocumented) @@ -277,6 +290,40 @@ export enum KnownEndPointProvisioningState { Updating = "Updating" } +// @public +export enum KnownFilterType { + // (undocumented) + CorrelationFilter = "CorrelationFilter", + // (undocumented) + SqlFilter = "SqlFilter" +} + +// @public +export enum KnownKeySource { + // (undocumented) + MicrosoftKeyVault = "Microsoft.KeyVault" +} + +// @public +export enum KnownKeyType { + // (undocumented) + PrimaryKey = "PrimaryKey", + // (undocumented) + SecondaryKey = "SecondaryKey" +} + +// @public +export enum KnownManagedServiceIdentityType { + // (undocumented) + None = "None", + // (undocumented) + SystemAssigned = "SystemAssigned", + // (undocumented) + SystemAssignedUserAssigned = "SystemAssigned, UserAssigned", + // (undocumented) + UserAssigned = "UserAssigned" +} + // @public export enum KnownMigrationConfigurationName { // (undocumented) @@ -301,6 +348,26 @@ export enum KnownPrivateLinkConnectionStatus { Rejected = "Rejected" } +// @public +export enum KnownProvisioningStateDR { + // (undocumented) + Accepted = "Accepted", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownPublicNetworkAccess { + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Enabled = "Enabled", + // (undocumented) + SecuredByPerimeter = "SecuredByPerimeter" +} + // @public export enum KnownPublicNetworkAccessFlag { // (undocumented) @@ -310,7 +377,63 @@ export enum KnownPublicNetworkAccessFlag { } // @public -export type ManagedServiceIdentityType = "SystemAssigned" | "UserAssigned" | "SystemAssigned, UserAssigned" | "None"; +export enum KnownRoleDisasterRecovery { + // (undocumented) + Primary = "Primary", + // (undocumented) + PrimaryNotReplicating = "PrimaryNotReplicating", + // (undocumented) + Secondary = "Secondary" +} + +// @public +export enum KnownSkuName { + // (undocumented) + Basic = "Basic", + // (undocumented) + Premium = "Premium", + // (undocumented) + Standard = "Standard" +} + +// @public +export enum KnownSkuTier { + // (undocumented) + Basic = "Basic", + // (undocumented) + Premium = "Premium", + // (undocumented) + Standard = "Standard" +} + +// @public +export enum KnownTlsVersion { + // (undocumented) + One0 = "1.0", + // (undocumented) + One1 = "1.1", + // (undocumented) + One2 = "1.2" +} + +// @public +export enum KnownUnavailableReason { + // (undocumented) + InvalidName = "InvalidName", + // (undocumented) + NameInLockdown = "NameInLockdown", + // (undocumented) + NameInUse = "NameInUse", + // (undocumented) + None = "None", + // (undocumented) + SubscriptionIsDisabled = "SubscriptionIsDisabled", + // (undocumented) + TooManyNamespaceInCurrentSubscription = "TooManyNamespaceInCurrentSubscription" +} + +// @public +export type ManagedServiceIdentityType = string; // @public export interface MessageCountDetails { @@ -721,7 +844,7 @@ export interface PrivateLinkResourcesListResult { } // @public -export type ProvisioningStateDR = "Accepted" | "Succeeded" | "Failed"; +export type ProvisioningStateDR = string; // @public export interface ProxyResource { @@ -731,6 +854,9 @@ export interface ProxyResource { readonly type?: string; } +// @public +export type PublicNetworkAccess = string; + // @public export type PublicNetworkAccessFlag = string; @@ -852,7 +978,7 @@ export type ResourceNamespacePatch = Resource & { }; // @public -export type RoleDisasterRecovery = "Primary" | "PrimaryNotReplicating" | "Secondary"; +export type RoleDisasterRecovery = string; // @public export type Rule = ProxyResource & { @@ -937,6 +1063,7 @@ export type SBNamespace = TrackedResource & { sku?: SBSku; identity?: Identity; readonly systemData?: SystemData; + minimumTlsVersion?: TlsVersion; readonly provisioningState?: string; readonly status?: string; readonly createdAt?: Date; @@ -948,6 +1075,7 @@ export type SBNamespace = TrackedResource & { privateEndpointConnections?: PrivateEndpointConnection[]; disableLocalAuth?: boolean; alternateName?: string; + publicNetworkAccess?: PublicNetworkAccess; }; // @public @@ -1109,10 +1237,10 @@ export interface ServiceBusManagementClientOptionalParams extends coreClient.Ser } // @public -export type SkuName = "Basic" | "Standard" | "Premium"; +export type SkuName = string; // @public -export type SkuTier = "Basic" | "Standard" | "Premium"; +export type SkuTier = string; // @public export interface SqlFilter { @@ -1183,6 +1311,9 @@ export interface SystemData { lastModifiedByType?: CreatedByType; } +// @public +export type TlsVersion = string; + // @public export interface Topics { createOrUpdate(resourceGroupName: string, namespaceName: string, topicName: string, parameters: SBTopic, options?: TopicsCreateOrUpdateOptionalParams): Promise; @@ -1288,7 +1419,7 @@ export type TrackedResource = Resource & { }; // @public -export type UnavailableReason = "None" | "InvalidName" | "SubscriptionIsDisabled" | "NameInUse" | "NameInLockdown" | "TooManyNamespaceInCurrentSubscription"; +export type UnavailableReason = string; // @public export interface UserAssignedIdentity { diff --git a/sdk/servicebus/arm-servicebus/src/models/index.ts b/sdk/servicebus/arm-servicebus/src/models/index.ts index acf9549edc51..8010a78df909 100644 --- a/sdk/servicebus/arm-servicebus/src/models/index.ts +++ b/sdk/servicebus/arm-servicebus/src/models/index.ts @@ -79,7 +79,7 @@ export interface Encryption { /** Properties of KeyVault */ keyVaultProperties?: KeyVaultProperties[]; /** Enumerates the possible value of keySource for Encryption */ - keySource?: "Microsoft.KeyVault"; + keySource?: KeySource; /** Enable Infrastructure Encryption (Double Encryption) */ requireInfrastructureEncryption?: boolean; } @@ -881,6 +881,8 @@ export type SBNamespace = TrackedResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly systemData?: SystemData; + /** The minimum TLS version for the cluster to support, e.g. '1.2' */ + minimumTlsVersion?: TlsVersion; /** * Provisioning state of the namespace. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -921,6 +923,8 @@ export type SBNamespace = TrackedResource & { disableLocalAuth?: boolean; /** Alternate name for namespace */ alternateName?: string; + /** This determines if traffic is allowed over public network. By default it is enabled. */ + publicNetworkAccess?: PublicNetworkAccess; }; /** Description of a namespace resource. */ @@ -969,6 +973,62 @@ export type SBNamespaceUpdateParameters = ResourceNamespacePatch & { alternateName?: string; }; +/** Known values of {@link SkuName} that the service accepts. */ +export enum KnownSkuName { + Basic = "Basic", + Standard = "Standard", + Premium = "Premium" +} + +/** + * Defines values for SkuName. \ + * {@link KnownSkuName} can be used interchangeably with SkuName, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Basic** \ + * **Standard** \ + * **Premium** + */ +export type SkuName = string; + +/** Known values of {@link SkuTier} that the service accepts. */ +export enum KnownSkuTier { + Basic = "Basic", + Standard = "Standard", + Premium = "Premium" +} + +/** + * Defines values for SkuTier. \ + * {@link KnownSkuTier} can be used interchangeably with SkuTier, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Basic** \ + * **Standard** \ + * **Premium** + */ +export type SkuTier = string; + +/** Known values of {@link ManagedServiceIdentityType} that the service accepts. */ +export enum KnownManagedServiceIdentityType { + SystemAssigned = "SystemAssigned", + UserAssigned = "UserAssigned", + SystemAssignedUserAssigned = "SystemAssigned, UserAssigned", + None = "None" +} + +/** + * Defines values for ManagedServiceIdentityType. \ + * {@link KnownManagedServiceIdentityType} can be used interchangeably with ManagedServiceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **SystemAssigned** \ + * **UserAssigned** \ + * **SystemAssigned, UserAssigned** \ + * **None** + */ +export type ManagedServiceIdentityType = string; + /** Known values of {@link CreatedByType} that the service accepts. */ export enum KnownCreatedByType { User = "User", @@ -989,6 +1049,38 @@ export enum KnownCreatedByType { */ export type CreatedByType = string; +/** Known values of {@link TlsVersion} that the service accepts. */ +export enum KnownTlsVersion { + One0 = "1.0", + One1 = "1.1", + One2 = "1.2" +} + +/** + * Defines values for TlsVersion. \ + * {@link KnownTlsVersion} can be used interchangeably with TlsVersion, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **1.0** \ + * **1.1** \ + * **1.2** + */ +export type TlsVersion = string; + +/** Known values of {@link KeySource} that the service accepts. */ +export enum KnownKeySource { + MicrosoftKeyVault = "Microsoft.KeyVault" +} + +/** + * Defines values for KeySource. \ + * {@link KnownKeySource} can be used interchangeably with KeySource, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Microsoft.KeyVault** + */ +export type KeySource = string; + /** Known values of {@link PrivateLinkConnectionStatus} that the service accepts. */ export enum KnownPrivateLinkConnectionStatus { Pending = "Pending", @@ -1033,6 +1125,60 @@ export enum KnownEndPointProvisioningState { */ export type EndPointProvisioningState = string; +/** Known values of {@link PublicNetworkAccess} that the service accepts. */ +export enum KnownPublicNetworkAccess { + Enabled = "Enabled", + Disabled = "Disabled", + SecuredByPerimeter = "SecuredByPerimeter" +} + +/** + * Defines values for PublicNetworkAccess. \ + * {@link KnownPublicNetworkAccess} can be used interchangeably with PublicNetworkAccess, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** \ + * **SecuredByPerimeter** + */ +export type PublicNetworkAccess = string; + +/** Known values of {@link ProvisioningStateDR} that the service accepts. */ +export enum KnownProvisioningStateDR { + Accepted = "Accepted", + Succeeded = "Succeeded", + Failed = "Failed" +} + +/** + * Defines values for ProvisioningStateDR. \ + * {@link KnownProvisioningStateDR} can be used interchangeably with ProvisioningStateDR, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Accepted** \ + * **Succeeded** \ + * **Failed** + */ +export type ProvisioningStateDR = string; + +/** Known values of {@link RoleDisasterRecovery} that the service accepts. */ +export enum KnownRoleDisasterRecovery { + Primary = "Primary", + PrimaryNotReplicating = "PrimaryNotReplicating", + Secondary = "Secondary" +} + +/** + * Defines values for RoleDisasterRecovery. \ + * {@link KnownRoleDisasterRecovery} can be used interchangeably with RoleDisasterRecovery, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Primary** \ + * **PrimaryNotReplicating** \ + * **Secondary** + */ +export type RoleDisasterRecovery = string; + /** Known values of {@link MigrationConfigurationName} that the service accepts. */ export enum KnownMigrationConfigurationName { Default = "$default" @@ -1092,27 +1238,80 @@ export enum KnownPublicNetworkAccessFlag { * **Disabled** */ export type PublicNetworkAccessFlag = string; -/** Defines values for SkuName. */ -export type SkuName = "Basic" | "Standard" | "Premium"; -/** Defines values for SkuTier. */ -export type SkuTier = "Basic" | "Standard" | "Premium"; -/** Defines values for ManagedServiceIdentityType. */ -export type ManagedServiceIdentityType = - | "SystemAssigned" - | "UserAssigned" - | "SystemAssigned, UserAssigned" - | "None"; -/** Defines values for ProvisioningStateDR. */ -export type ProvisioningStateDR = "Accepted" | "Succeeded" | "Failed"; -/** Defines values for RoleDisasterRecovery. */ -export type RoleDisasterRecovery = - | "Primary" - | "PrimaryNotReplicating" - | "Secondary"; -/** Defines values for AccessRights. */ -export type AccessRights = "Manage" | "Send" | "Listen"; -/** Defines values for KeyType. */ -export type KeyType = "PrimaryKey" | "SecondaryKey"; + +/** Known values of {@link AccessRights} that the service accepts. */ +export enum KnownAccessRights { + Manage = "Manage", + Send = "Send", + Listen = "Listen" +} + +/** + * Defines values for AccessRights. \ + * {@link KnownAccessRights} can be used interchangeably with AccessRights, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Manage** \ + * **Send** \ + * **Listen** + */ +export type AccessRights = string; + +/** Known values of {@link KeyType} that the service accepts. */ +export enum KnownKeyType { + PrimaryKey = "PrimaryKey", + SecondaryKey = "SecondaryKey" +} + +/** + * Defines values for KeyType. \ + * {@link KnownKeyType} can be used interchangeably with KeyType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **PrimaryKey** \ + * **SecondaryKey** + */ +export type KeyType = string; + +/** Known values of {@link FilterType} that the service accepts. */ +export enum KnownFilterType { + SqlFilter = "SqlFilter", + CorrelationFilter = "CorrelationFilter" +} + +/** + * 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 + * **SqlFilter** \ + * **CorrelationFilter** + */ +export type FilterType = string; + +/** Known values of {@link UnavailableReason} that the service accepts. */ +export enum KnownUnavailableReason { + None = "None", + InvalidName = "InvalidName", + SubscriptionIsDisabled = "SubscriptionIsDisabled", + NameInUse = "NameInUse", + NameInLockdown = "NameInLockdown", + TooManyNamespaceInCurrentSubscription = "TooManyNamespaceInCurrentSubscription" +} + +/** + * Defines values for UnavailableReason. \ + * {@link KnownUnavailableReason} can be used interchangeably with UnavailableReason, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **InvalidName** \ + * **SubscriptionIsDisabled** \ + * **NameInUse** \ + * **NameInLockdown** \ + * **TooManyNamespaceInCurrentSubscription** + */ +export type UnavailableReason = string; /** Defines values for EntityStatus. */ export type EntityStatus = | "Active" @@ -1124,16 +1323,6 @@ export type EntityStatus = | "Deleting" | "Renaming" | "Unknown"; -/** Defines values for FilterType. */ -export type FilterType = "SqlFilter" | "CorrelationFilter"; -/** Defines values for UnavailableReason. */ -export type UnavailableReason = - | "None" - | "InvalidName" - | "SubscriptionIsDisabled" - | "NameInUse" - | "NameInLockdown" - | "TooManyNamespaceInCurrentSubscription"; /** Optional parameters. */ export interface NamespacesListOptionalParams diff --git a/sdk/servicebus/arm-servicebus/src/models/mappers.ts b/sdk/servicebus/arm-servicebus/src/models/mappers.ts index ea8928ac5ab7..76a825fa3536 100644 --- a/sdk/servicebus/arm-servicebus/src/models/mappers.ts +++ b/sdk/servicebus/arm-servicebus/src/models/mappers.ts @@ -44,15 +44,13 @@ export const SBSku: coreClient.CompositeMapper = { serializedName: "name", required: true, type: { - name: "Enum", - allowedValues: ["Basic", "Standard", "Premium"] + name: "String" } }, tier: { serializedName: "tier", type: { - name: "Enum", - allowedValues: ["Basic", "Standard", "Premium"] + name: "String" } }, capacity: { @@ -87,13 +85,7 @@ export const Identity: coreClient.CompositeMapper = { type: { serializedName: "type", type: { - name: "Enum", - allowedValues: [ - "SystemAssigned", - "UserAssigned", - "SystemAssigned, UserAssigned", - "None" - ] + name: "String" } }, userAssignedIdentities: { @@ -196,7 +188,6 @@ export const Encryption: coreClient.CompositeMapper = { }, keySource: { defaultValue: "Microsoft.KeyVault", - isConstant: true, serializedName: "keySource", type: { name: "String" @@ -929,8 +920,7 @@ export const RegenerateAccessKeyParameters: coreClient.CompositeMapper = { serializedName: "keyType", required: true, type: { - name: "Enum", - allowedValues: ["PrimaryKey", "SecondaryKey"] + name: "String" } }, key: { @@ -1286,15 +1276,7 @@ export const CheckNameAvailabilityResult: coreClient.CompositeMapper = { reason: { serializedName: "reason", type: { - name: "Enum", - allowedValues: [ - "None", - "InvalidName", - "SubscriptionIsDisabled", - "NameInUse", - "NameInLockdown", - "TooManyNamespaceInCurrentSubscription" - ] + name: "String" } } } @@ -1355,8 +1337,7 @@ export const ArmDisasterRecovery: coreClient.CompositeMapper = { serializedName: "properties.provisioningState", readOnly: true, type: { - name: "Enum", - allowedValues: ["Accepted", "Succeeded", "Failed"] + name: "String" } }, pendingReplicationOperationsCount: { @@ -1382,8 +1363,7 @@ export const ArmDisasterRecovery: coreClient.CompositeMapper = { serializedName: "properties.role", readOnly: true, type: { - name: "Enum", - allowedValues: ["Primary", "PrimaryNotReplicating", "Secondary"] + name: "String" } } } @@ -1519,8 +1499,7 @@ export const SBAuthorizationRule: coreClient.CompositeMapper = { name: "Sequence", element: { type: { - name: "Enum", - allowedValues: ["Manage", "Send", "Listen"] + name: "String" } } } @@ -1854,8 +1833,7 @@ export const Rule: coreClient.CompositeMapper = { filterType: { serializedName: "properties.filterType", type: { - name: "Enum", - allowedValues: ["SqlFilter", "CorrelationFilter"] + name: "String" } }, sqlFilter: { @@ -2108,6 +2086,12 @@ export const SBNamespace: coreClient.CompositeMapper = { className: "SystemData" } }, + minimumTlsVersion: { + serializedName: "properties.minimumTlsVersion", + type: { + name: "String" + } + }, provisioningState: { serializedName: "properties.provisioningState", readOnly: true, @@ -2186,6 +2170,13 @@ export const SBNamespace: coreClient.CompositeMapper = { type: { name: "String" } + }, + publicNetworkAccess: { + defaultValue: "Enabled", + serializedName: "properties.publicNetworkAccess", + type: { + name: "String" + } } } } diff --git a/sdk/servicebus/arm-servicebus/src/models/parameters.ts b/sdk/servicebus/arm-servicebus/src/models/parameters.ts index 67b35a71e23f..04f32a4feade 100644 --- a/sdk/servicebus/arm-servicebus/src/models/parameters.ts +++ b/sdk/servicebus/arm-servicebus/src/models/parameters.ts @@ -55,7 +55,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2021-11-01", + defaultValue: "2022-01-01-preview", isConstant: true, serializedName: "api-version", type: { diff --git a/sdk/servicebus/arm-servicebus/src/serviceBusManagementClient.ts b/sdk/servicebus/arm-servicebus/src/serviceBusManagementClient.ts index ccc1de365f09..ecaad0bae275 100644 --- a/sdk/servicebus/arm-servicebus/src/serviceBusManagementClient.ts +++ b/sdk/servicebus/arm-servicebus/src/serviceBusManagementClient.ts @@ -8,6 +8,11 @@ import * as coreClient from "@azure/core-client"; import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { NamespacesImpl, @@ -68,7 +73,7 @@ export class ServiceBusManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-servicebus/6.0.1`; + const packageDetails = `azsdk-js-arm-servicebus/6.1.0-beta.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -115,7 +120,7 @@ export class ServiceBusManagementClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-11-01"; + this.apiVersion = options.apiVersion || "2022-01-01-preview"; this.namespaces = new NamespacesImpl(this); this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this); this.privateLinkResources = new PrivateLinkResourcesImpl(this); @@ -126,6 +131,35 @@ export class ServiceBusManagementClient extends coreClient.ServiceClient { this.topics = new TopicsImpl(this); this.rules = new RulesImpl(this); this.subscriptions = new SubscriptionsImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return item.replace(/(?<==).*$/, apiVersion); + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); } namespaces: Namespaces; diff --git a/sdk/servicebus/arm-servicebus/test/sampleTest.ts b/sdk/servicebus/arm-servicebus/test/sampleTest.ts index 6daec06d4385..25aeb3ebcc36 100644 --- a/sdk/servicebus/arm-servicebus/test/sampleTest.ts +++ b/sdk/servicebus/arm-servicebus/test/sampleTest.ts @@ -7,143 +7,37 @@ */ import { - env, - record, - RecorderEnvironmentSetup, Recorder, - delay, - isPlaybackMode + RecorderStartOptions, + env } from "@azure-tools/test-recorder"; -import * as assert from "assert"; -import { ClientSecretCredential } from "@azure/identity"; -import { ServiceBusManagementClient } from "../src/serviceBusManagementClient"; - -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: [] +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" }; -export const testPollingOptions = { - updateIntervalInMs: isPlaybackMode() ? 0 : undefined, +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables }; -describe("ServiceBus test", () => { +describe("My test", () => { let recorder: Recorder; - let subscriptionId: string; - let client: ServiceBusManagementClient; - let location: string; - let resourceGroup: string; - let namespacesName: string; - let authorizationRuleName: string; - let queueName: string; - let topicName: string; - beforeEach(async function () { - recorder = record(this, recorderEnvSetup); - subscriptionId = env.SUBSCRIPTION_ID; - // This is an example of how the environment variables are used - const credential = new ClientSecretCredential( - env.AZURE_TENANT_ID, - env.AZURE_CLIENT_ID, - env.AZURE_CLIENT_SECRET - ); - client = new ServiceBusManagementClient(credential, subscriptionId); - location = "eastus"; - resourceGroup = "myjstest"; - namespacesName = "mynamespacexxx"; - authorizationRuleName = "myAuthoriztionRule"; - queueName = "myQueue"; - topicName = "mytopic"; + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); }); - afterEach(async function () { + afterEach(async function() { await recorder.stop(); }); - it("namespaces create test", async function () { - const res = await client.namespaces.beginCreateOrUpdateAndWait(resourceGroup, namespacesName, { - sku: { - name: "Standard", - tier: "Standard", - }, - location: location, - tags: { - tag1: "value1", - tag2: "value2", - } - }, testPollingOptions) - assert.equal(res.name, namespacesName); - }); - - it("queues create test", async function () { - const res = await client.queues.createOrUpdate(resourceGroup, namespacesName, queueName, { enablePartitioning: true }); - assert.equal(res.name, queueName); - }); - - it("queues get test", async function () { - const res = await client.queues.get(resourceGroup, namespacesName, queueName); - assert.equal(res.name, queueName); - }); - - it("queues list test", async function () { - const resArray = new Array(); - for await (let item of client.queues.listByNamespace(resourceGroup, namespacesName)) { - resArray.push(item); - } - assert.equal(resArray.length, 1); - }); - - it("topics create test", async function () { - const res = await client.topics.createOrUpdate(resourceGroup, namespacesName, topicName, { - enableExpress: true - }) - assert.equal(res.name, topicName); - }); - - it("topics get test", async function () { - const res = await client.topics.get(resourceGroup, namespacesName, topicName); - assert.equal(res.name, topicName); - }); - - it("topics list test", async function () { - const resArray = new Array(); - for await (let item of client.topics.listByNamespace(resourceGroup, namespacesName)) { - resArray.push(item); - } - assert.equal(resArray.length, 1); - }); - - it("queues delete test", async function () { - const res = await client.queues.delete(resourceGroup, namespacesName, queueName); - const resArray = new Array(); - for await (let item of client.queues.listByNamespace(resourceGroup, namespacesName)) { - resArray.push(item); - } - assert.equal(resArray.length, 0); - }); - - it("topics delete test", async function () { - const res = await client.topics.delete(resourceGroup, namespacesName, topicName); - const resArray = new Array(); - for await (let item of client.topics.listByNamespace(resourceGroup, namespacesName)) { - resArray.push(item); - } - assert.equal(resArray.length, 0); - }); - - it("namespaces delete test", async function () { - const res = await client.namespaces.beginDeleteAndWait(resourceGroup, namespacesName, testPollingOptions); + it("sample test", async function() { + console.log("Hi, I'm a test!"); }); }); diff --git a/sdk/servicebus/arm-servicebus/tsconfig.json b/sdk/servicebus/arm-servicebus/tsconfig.json index 035ce6434f28..3e6ae96443f3 100644 --- a/sdk/servicebus/arm-servicebus/tsconfig.json +++ b/sdk/servicebus/arm-servicebus/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-servicebus": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"