From 7766d227d3f7ea20bd23338ecb5a82b01f26e351 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 17 Nov 2022 06:32:42 +0000 Subject: [PATCH] CodeGen from PR 21408 in Azure/azure-rest-api-specs Merge 23e2337a0979ad4dacc8e6ae5b8760d74e74fe48 into b32e1896f30e6ea155449cb49719a6286e32b961 --- common/config/rush/pnpm-lock.yaml | 11 +- .../arm-servicelinker/CHANGELOG.md | 31 +++-- sdk/servicelinker/arm-servicelinker/README.md | 5 +- .../arm-servicelinker/_meta.json | 8 +- .../arm-servicelinker/package.json | 29 ++--- .../review/arm-servicelinker.api.md | 111 ++++++------------ .../arm-servicelinker/src/models/index.ts | 96 ++++++++++----- .../src/serviceLinkerManagementClient.ts | 73 +++++++++--- .../arm-servicelinker/test/sampleTest.ts | 39 +++--- .../arm-servicelinker/tsconfig.json | 10 +- 10 files changed, 228 insertions(+), 185 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 24b3c65939b0..d0c50ad251e9 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -14687,7 +14687,7 @@ packages: dev: false file:projects/arm-servicelinker.tgz: - resolution: {integrity: sha512-HCv6wXEe8KfBGdx1MvI12pDmPAZDbdGYxtmZlnhOcpgXwruDp917grsMcLch+u0J3aSQVohuHQ/rXZHojKOF5Q==, tarball: file:projects/arm-servicelinker.tgz} + resolution: {integrity: sha512-BcAZV1UBBnH5Sw4naGJV1cD8N4YaoQ3TQtTQq0H1V0BMqe3wmyPHOPPG+ZiI+E28ntZHAUuGodbcs0cL2i7dRw==, tarball: file:projects/arm-servicelinker.tgz} name: '@rush-temp/arm-servicelinker' version: 0.0.0 dependencies: @@ -14698,6 +14698,8 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@2.79.1 '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.3 + chai: 4.3.6 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 @@ -14705,11 +14707,10 @@ packages: rollup: 2.79.1 rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.1 tslib: 2.4.1 - typescript: 4.2.4 + typescript: 4.6.4 uglify-js: 3.17.4 transitivePeerDependencies: - '@types/node' - - encoding - supports-color dev: false @@ -16249,7 +16250,7 @@ packages: '@azure/core-tracing': 1.0.0-preview.13 '@azure/logger-js': 1.3.2 '@microsoft/api-extractor': 7.33.5 - '@opentelemetry/api': 1.2.0 + '@opentelemetry/api': 1.3.0 '@types/chai': 4.3.3 '@types/express': 4.17.14 '@types/mocha': 7.0.2 @@ -16386,7 +16387,7 @@ packages: version: 0.0.0 dependencies: '@microsoft/api-extractor': 7.33.5 - '@opentelemetry/api': 1.2.0 + '@opentelemetry/api': 1.3.0 '@types/chai': 4.3.3 '@types/chai-as-promised': 7.1.5 '@types/mocha': 7.0.2 diff --git a/sdk/servicelinker/arm-servicelinker/CHANGELOG.md b/sdk/servicelinker/arm-servicelinker/CHANGELOG.md index 857eedffe4b3..20c2fadb4017 100644 --- a/sdk/servicelinker/arm-servicelinker/CHANGELOG.md +++ b/sdk/servicelinker/arm-servicelinker/CHANGELOG.md @@ -1,15 +1,26 @@ # Release History + +## 2.1.0 (2022-11-17) + +**Features** -## 2.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Added Interface AzureKeyVaultProperties + - Added Interface AzureResource + - Added Interface ConfluentBootstrapServer + - Added Interface ConfluentSchemaRegistry + - Added Interface KeyVaultSecretReferenceSecretInfo + - Added Interface KeyVaultSecretUriSecretInfo + - Added Interface LinkerResource + - Added Interface ProxyResource + - Added Interface SecretAuthInfo + - Added Interface ServicePrincipalCertificateAuthInfo + - Added Interface ServicePrincipalSecretAuthInfo + - Added Interface SystemAssignedIdentityAuthInfo + - Added Interface UserAssignedIdentityAuthInfo + - Added Interface ValueSecretInfo + - Enum KnownClientType has a new value KafkaSpringBoot + + ## 2.0.0 (2022-05-16) **Features** diff --git a/sdk/servicelinker/arm-servicelinker/README.md b/sdk/servicelinker/arm-servicelinker/README.md index 76e678253bc6..bd1e958daa3d 100644 --- a/sdk/servicelinker/arm-servicelinker/README.md +++ b/sdk/servicelinker/arm-servicelinker/README.md @@ -53,14 +53,15 @@ const { ServiceLinkerManagementClient } = require("@azure/arm-servicelinker"); const { DefaultAzureCredential } = require("@azure/identity"); // For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. -const client = new ServiceLinkerManagementClient(new DefaultAzureCredential()); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new ServiceLinkerManagementClient(new DefaultAzureCredential(), subscriptionId); // For client-side applications running in the browser, use this code instead: // const credential = new InteractiveBrowserCredential({ // tenantId: "", // clientId: "" // }); -// const client = new ServiceLinkerManagementClient(credential); +// const client = new ServiceLinkerManagementClient(credential, subscriptionId); ``` diff --git a/sdk/servicelinker/arm-servicelinker/_meta.json b/sdk/servicelinker/arm-servicelinker/_meta.json index 40029bbf045d..74c1a5b2b820 100644 --- a/sdk/servicelinker/arm-servicelinker/_meta.json +++ b/sdk/servicelinker/arm-servicelinker/_meta.json @@ -1,8 +1,8 @@ { - "commit": "3f456dba8358994af8251bfae2f911a127092e54", + "commit": "d52bcb92db97a5209cd7251ca7ae70d0b211447c", "readme": "specification/servicelinker/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\\servicelinker\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.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/servicelinker/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.2", "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.5.1", + "use": "@autorest/typescript@6.0.0-rc.2" } \ No newline at end of file diff --git a/sdk/servicelinker/arm-servicelinker/package.json b/sdk/servicelinker/arm-servicelinker/package.json index 54a3cc2e9b9c..c55841d4d203 100644 --- a/sdk/servicelinker/arm-servicelinker/package.json +++ b/sdk/servicelinker/arm-servicelinker/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ServiceLinkerManagementClient.", - "version": "2.0.1", + "version": "2.1.0", "engines": { "node": ">=14.0.0" }, @@ -36,13 +36,17 @@ "mkdirp": "^1.0.4", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", - "typescript": "~4.2.0", + "typescript": "~4.6.0", "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/servicelinker/arm-servicelinker", "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-servicelinker?view=azure-node-preview" - } -} + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/servicelinker/arm-servicelinker/review/arm-servicelinker.api.md b/sdk/servicelinker/arm-servicelinker/review/arm-servicelinker.api.md index 63e159d68ee5..19cc0cdb3d50 100644 --- a/sdk/servicelinker/arm-servicelinker/review/arm-servicelinker.api.md +++ b/sdk/servicelinker/arm-servicelinker/review/arm-servicelinker.api.md @@ -25,17 +25,17 @@ export type AuthInfoBaseUnion = AuthInfoBase | SecretAuthInfo | UserAssignedIden export type AuthType = string; // @public -export type AzureKeyVaultProperties = AzureResourcePropertiesBase & { - type: "KeyVault"; +export interface AzureKeyVaultProperties extends AzureResourcePropertiesBase { connectAsKubernetesCsiDriver?: boolean; -}; + type: "KeyVault"; +} // @public -export type AzureResource = TargetServiceBase & { - type: "AzureResource"; +export interface AzureResource extends TargetServiceBase { id?: string; resourceProperties?: AzureResourcePropertiesBaseUnion; -}; + type: "AzureResource"; +} // @public export interface AzureResourcePropertiesBase { @@ -52,16 +52,16 @@ export type AzureResourceType = string; export type ClientType = string; // @public -export type ConfluentBootstrapServer = TargetServiceBase & { - type: "ConfluentBootstrapServer"; +export interface ConfluentBootstrapServer extends TargetServiceBase { endpoint?: string; -}; + type: "ConfluentBootstrapServer"; +} // @public -export type ConfluentSchemaRegistry = TargetServiceBase & { - type: "ConfluentSchemaRegistry"; +export interface ConfluentSchemaRegistry extends TargetServiceBase { endpoint?: string; -}; + type: "ConfluentSchemaRegistry"; +} // @public export type CreatedByType = string; @@ -87,125 +87,91 @@ export interface ErrorResponse { } // @public -export type KeyVaultSecretReferenceSecretInfo = SecretInfoBase & { - secretType: "keyVaultSecretReference"; +export interface KeyVaultSecretReferenceSecretInfo extends SecretInfoBase { name?: string; + secretType: "keyVaultSecretReference"; version?: string; -}; +} // @public -export type KeyVaultSecretUriSecretInfo = SecretInfoBase & { +export interface KeyVaultSecretUriSecretInfo extends SecretInfoBase { secretType: "keyVaultSecretUri"; value?: string; -}; +} // @public export enum KnownActionType { - // (undocumented) Internal = "Internal" } // @public export enum KnownAuthType { - // (undocumented) Secret = "secret", - // (undocumented) ServicePrincipalCertificate = "servicePrincipalCertificate", - // (undocumented) ServicePrincipalSecret = "servicePrincipalSecret", - // (undocumented) SystemAssignedIdentity = "systemAssignedIdentity", - // (undocumented) UserAssignedIdentity = "userAssignedIdentity" } // @public export enum KnownAzureResourceType { - // (undocumented) KeyVault = "KeyVault" } // @public export enum KnownClientType { - // (undocumented) Django = "django", - // (undocumented) Dotnet = "dotnet", - // (undocumented) Go = "go", - // (undocumented) Java = "java", - // (undocumented) + KafkaSpringBoot = "kafka-springBoot", Nodejs = "nodejs", - // (undocumented) None = "none", - // (undocumented) Php = "php", - // (undocumented) Python = "python", - // (undocumented) Ruby = "ruby", - // (undocumented) SpringBoot = "springBoot" } // @public export enum KnownCreatedByType { - // (undocumented) Application = "Application", - // (undocumented) Key = "Key", - // (undocumented) ManagedIdentity = "ManagedIdentity", - // (undocumented) User = "User" } // @public export enum KnownOrigin { - // (undocumented) System = "system", - // (undocumented) User = "user", - // (undocumented) UserSystem = "user,system" } // @public export enum KnownSecretType { - // (undocumented) KeyVaultSecretReference = "keyVaultSecretReference", - // (undocumented) KeyVaultSecretUri = "keyVaultSecretUri", - // (undocumented) RawValue = "rawValue" } // @public export enum KnownTargetServiceType { - // (undocumented) AzureResource = "AzureResource", - // (undocumented) ConfluentBootstrapServer = "ConfluentBootstrapServer", - // (undocumented) ConfluentSchemaRegistry = "ConfluentSchemaRegistry" } // @public export enum KnownValidationResultStatus { - // (undocumented) Failure = "failure", - // (undocumented) Success = "success", - // (undocumented) Warning = "warning" } // @public export enum KnownVNetSolutionType { - // (undocumented) PrivateLink = "privateLink", - // (undocumented) ServiceEndpoint = "serviceEndpoint" } @@ -285,16 +251,16 @@ export interface LinkerPatch { } // @public -export type LinkerResource = ProxyResource & { - readonly systemData?: SystemData; - targetService?: TargetServiceBaseUnion; +export interface LinkerResource extends ProxyResource { authInfo?: AuthInfoBaseUnion; clientType?: ClientType; readonly provisioningState?: string; - vNetSolution?: VNetSolution; - secretStore?: SecretStore; scope?: string; -}; + secretStore?: SecretStore; + readonly systemData?: SystemData; + targetService?: TargetServiceBaseUnion; + vNetSolution?: VNetSolution; +} // @public export interface LinkerUpdateOptionalParams extends coreClient.OperationOptions { @@ -360,7 +326,8 @@ export type OperationsListResponse = OperationListResult; export type Origin = string; // @public -export type ProxyResource = Resource & {}; +export interface ProxyResource extends Resource { +} // @public export interface Resource { @@ -370,11 +337,11 @@ export interface Resource { } // @public -export type SecretAuthInfo = AuthInfoBase & { +export interface SecretAuthInfo extends AuthInfoBase { authType: "secret"; name?: string; secretInfo?: SecretInfoBaseUnion; -}; +} // @public export interface SecretInfoBase { @@ -413,20 +380,20 @@ export interface ServiceLinkerManagementClientOptionalParams extends coreClient. } // @public -export type ServicePrincipalCertificateAuthInfo = AuthInfoBase & { +export interface ServicePrincipalCertificateAuthInfo extends AuthInfoBase { authType: "servicePrincipalCertificate"; + certificate: string; clientId: string; principalId: string; - certificate: string; -}; +} // @public -export type ServicePrincipalSecretAuthInfo = AuthInfoBase & { +export interface ServicePrincipalSecretAuthInfo extends AuthInfoBase { authType: "servicePrincipalSecret"; clientId: string; principalId: string; secret: string; -}; +} // @public export interface SourceConfiguration { @@ -440,9 +407,9 @@ export interface SourceConfigurationResult { } // @public -export type SystemAssignedIdentityAuthInfo = AuthInfoBase & { +export interface SystemAssignedIdentityAuthInfo extends AuthInfoBase { authType: "systemAssignedIdentity"; -}; +} // @public export interface SystemData { @@ -466,11 +433,11 @@ export type TargetServiceBaseUnion = TargetServiceBase | AzureResource | Conflue export type TargetServiceType = string; // @public -export type UserAssignedIdentityAuthInfo = AuthInfoBase & { +export interface UserAssignedIdentityAuthInfo extends AuthInfoBase { authType: "userAssignedIdentity"; clientId?: string; subscriptionId?: string; -}; +} // @public export interface ValidateOperationResult { @@ -499,10 +466,10 @@ export interface ValidationResultItem { export type ValidationResultStatus = string; // @public -export type ValueSecretInfo = SecretInfoBase & { +export interface ValueSecretInfo extends SecretInfoBase { secretType: "rawValue"; value?: string; -}; +} // @public export interface VNetSolution { diff --git a/sdk/servicelinker/arm-servicelinker/src/models/index.ts b/sdk/servicelinker/arm-servicelinker/src/models/index.ts index 356845f6f275..196be09d82d4 100644 --- a/sdk/servicelinker/arm-servicelinker/src/models/index.ts +++ b/sdk/servicelinker/arm-servicelinker/src/models/index.ts @@ -303,59 +303,59 @@ export interface SecretInfoBase { } /** The azure resource info when target service type is AzureResource */ -export type AzureResource = TargetServiceBase & { +export interface AzureResource extends TargetServiceBase { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "AzureResource"; /** The Id of azure resource. */ id?: string; /** The azure resource connection related properties. */ resourceProperties?: AzureResourcePropertiesBaseUnion; -}; +} /** The service properties when target service type is ConfluentBootstrapServer */ -export type ConfluentBootstrapServer = TargetServiceBase & { +export interface ConfluentBootstrapServer extends TargetServiceBase { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "ConfluentBootstrapServer"; /** The endpoint of service. */ endpoint?: string; -}; +} /** The service properties when target service type is ConfluentSchemaRegistry */ -export type ConfluentSchemaRegistry = TargetServiceBase & { +export interface ConfluentSchemaRegistry extends TargetServiceBase { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "ConfluentSchemaRegistry"; /** The endpoint of service. */ endpoint?: string; -}; +} /** The authentication info when authType is secret */ -export type SecretAuthInfo = AuthInfoBase & { +export interface SecretAuthInfo extends AuthInfoBase { /** Polymorphic discriminator, which specifies the different types this object can be */ authType: "secret"; /** Username or account name for secret auth. */ name?: string; /** Password or key vault secret for secret auth. */ secretInfo?: SecretInfoBaseUnion; -}; +} /** The authentication info when authType is userAssignedIdentity */ -export type UserAssignedIdentityAuthInfo = AuthInfoBase & { +export interface UserAssignedIdentityAuthInfo extends AuthInfoBase { /** Polymorphic discriminator, which specifies the different types this object can be */ authType: "userAssignedIdentity"; /** Client Id for userAssignedIdentity. */ clientId?: string; /** Subscription id for userAssignedIdentity. */ subscriptionId?: string; -}; +} /** The authentication info when authType is systemAssignedIdentity */ -export type SystemAssignedIdentityAuthInfo = AuthInfoBase & { +export interface SystemAssignedIdentityAuthInfo extends AuthInfoBase { /** Polymorphic discriminator, which specifies the different types this object can be */ authType: "systemAssignedIdentity"; -}; +} /** The authentication info when authType is servicePrincipal secret */ -export type ServicePrincipalSecretAuthInfo = AuthInfoBase & { +export interface ServicePrincipalSecretAuthInfo extends AuthInfoBase { /** Polymorphic discriminator, which specifies the different types this object can be */ authType: "servicePrincipalSecret"; /** ServicePrincipal application clientId for servicePrincipal auth. */ @@ -364,10 +364,10 @@ export type ServicePrincipalSecretAuthInfo = AuthInfoBase & { principalId: string; /** Secret for servicePrincipal auth. */ secret: string; -}; +} /** The authentication info when authType is servicePrincipal certificate */ -export type ServicePrincipalCertificateAuthInfo = AuthInfoBase & { +export interface ServicePrincipalCertificateAuthInfo extends AuthInfoBase { /** Polymorphic discriminator, which specifies the different types this object can be */ authType: "servicePrincipalCertificate"; /** Application clientId for servicePrincipal auth. */ @@ -376,47 +376,47 @@ export type ServicePrincipalCertificateAuthInfo = AuthInfoBase & { principalId: string; /** ServicePrincipal certificate for servicePrincipal auth. */ certificate: string; -}; +} /** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ -export type ProxyResource = Resource & {}; +export interface ProxyResource extends Resource {} /** The resource properties when type is Azure Key Vault */ -export type AzureKeyVaultProperties = AzureResourcePropertiesBase & { +export interface AzureKeyVaultProperties extends AzureResourcePropertiesBase { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "KeyVault"; /** True if connect via Kubernetes CSI Driver. */ connectAsKubernetesCsiDriver?: boolean; -}; +} /** The secret info when type is rawValue. It's for scenarios that user input the secret. */ -export type ValueSecretInfo = SecretInfoBase & { +export interface ValueSecretInfo extends SecretInfoBase { /** Polymorphic discriminator, which specifies the different types this object can be */ secretType: "rawValue"; /** The actual value of the secret. */ value?: string; -}; +} /** The secret info when type is keyVaultSecretReference. It's for scenario that user provides a secret stored in user's keyvault and source is Azure Kubernetes. The key Vault's resource id is linked to secretStore.keyVaultId. */ -export type KeyVaultSecretReferenceSecretInfo = SecretInfoBase & { +export interface KeyVaultSecretReferenceSecretInfo extends SecretInfoBase { /** Polymorphic discriminator, which specifies the different types this object can be */ secretType: "keyVaultSecretReference"; /** Name of the Key Vault secret. */ name?: string; /** Version of the Key Vault secret. */ version?: string; -}; +} /** The secret info when type is keyVaultSecretUri. It's for scenario that user provides a secret stored in user's keyvault and source is Web App, Spring Cloud or Container App. */ -export type KeyVaultSecretUriSecretInfo = SecretInfoBase & { +export interface KeyVaultSecretUriSecretInfo extends SecretInfoBase { /** Polymorphic discriminator, which specifies the different types this object can be */ secretType: "keyVaultSecretUri"; /** URI to the keyvault secret */ value?: string; -}; +} /** Linker of source and target resource */ -export type LinkerResource = ProxyResource & { +export interface LinkerResource extends ProxyResource { /** * The system data. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -439,12 +439,15 @@ export type LinkerResource = ProxyResource & { secretStore?: SecretStore; /** connection scope in source service. */ scope?: string; -}; +} /** Known values of {@link TargetServiceType} that the service accepts. */ export enum KnownTargetServiceType { + /** AzureResource */ AzureResource = "AzureResource", + /** ConfluentBootstrapServer */ ConfluentBootstrapServer = "ConfluentBootstrapServer", + /** ConfluentSchemaRegistry */ ConfluentSchemaRegistry = "ConfluentSchemaRegistry" } @@ -461,10 +464,15 @@ export type TargetServiceType = string; /** Known values of {@link AuthType} that the service accepts. */ export enum KnownAuthType { + /** SystemAssignedIdentity */ SystemAssignedIdentity = "systemAssignedIdentity", + /** UserAssignedIdentity */ UserAssignedIdentity = "userAssignedIdentity", + /** ServicePrincipalSecret */ ServicePrincipalSecret = "servicePrincipalSecret", + /** ServicePrincipalCertificate */ ServicePrincipalCertificate = "servicePrincipalCertificate", + /** Secret */ Secret = "secret" } @@ -483,16 +491,28 @@ export type AuthType = string; /** Known values of {@link ClientType} that the service accepts. */ export enum KnownClientType { + /** None */ None = "none", + /** Dotnet */ Dotnet = "dotnet", + /** Java */ Java = "java", + /** Python */ Python = "python", + /** Go */ Go = "go", + /** Php */ Php = "php", + /** Ruby */ Ruby = "ruby", + /** Django */ Django = "django", + /** Nodejs */ Nodejs = "nodejs", - SpringBoot = "springBoot" + /** SpringBoot */ + SpringBoot = "springBoot", + /** KafkaSpringBoot */ + KafkaSpringBoot = "kafka-springBoot" } /** @@ -509,13 +529,16 @@ export enum KnownClientType { * **ruby** \ * **django** \ * **nodejs** \ - * **springBoot** + * **springBoot** \ + * **kafka-springBoot** */ export type ClientType = string; /** Known values of {@link VNetSolutionType} that the service accepts. */ export enum KnownVNetSolutionType { + /** ServiceEndpoint */ ServiceEndpoint = "serviceEndpoint", + /** PrivateLink */ PrivateLink = "privateLink" } @@ -531,9 +554,13 @@ export type VNetSolutionType = 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" } @@ -551,8 +578,11 @@ export type CreatedByType = string; /** Known values of {@link ValidationResultStatus} that the service accepts. */ export enum KnownValidationResultStatus { + /** Success */ Success = "success", + /** Failure */ Failure = "failure", + /** Warning */ Warning = "warning" } @@ -569,8 +599,11 @@ export type ValidationResultStatus = string; /** Known values of {@link Origin} that the service accepts. */ export enum KnownOrigin { + /** User */ User = "user", + /** System */ System = "system", + /** UserSystem */ UserSystem = "user,system" } @@ -587,6 +620,7 @@ export type Origin = string; /** Known values of {@link ActionType} that the service accepts. */ export enum KnownActionType { + /** Internal */ Internal = "Internal" } @@ -601,6 +635,7 @@ export type ActionType = string; /** Known values of {@link AzureResourceType} that the service accepts. */ export enum KnownAzureResourceType { + /** KeyVault */ KeyVault = "KeyVault" } @@ -615,8 +650,11 @@ export type AzureResourceType = string; /** Known values of {@link SecretType} that the service accepts. */ export enum KnownSecretType { + /** RawValue */ RawValue = "rawValue", + /** KeyVaultSecretUri */ KeyVaultSecretUri = "keyVaultSecretUri", + /** KeyVaultSecretReference */ KeyVaultSecretReference = "keyVaultSecretReference" } diff --git a/sdk/servicelinker/arm-servicelinker/src/serviceLinkerManagementClient.ts b/sdk/servicelinker/arm-servicelinker/src/serviceLinkerManagementClient.ts index 0526378a613c..178ba4f6bcf3 100644 --- a/sdk/servicelinker/arm-servicelinker/src/serviceLinkerManagementClient.ts +++ b/sdk/servicelinker/arm-servicelinker/src/serviceLinkerManagementClient.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 { LinkerImpl, OperationsImpl } from "./operations"; import { Linker, Operations } from "./operationsInterfaces"; @@ -39,7 +44,7 @@ export class ServiceLinkerManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-servicelinker/2.0.1`; + const packageDetails = `azsdk-js-arm-servicelinker/2.1.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -59,27 +64,34 @@ export class ServiceLinkerManagementClient extends coreClient.ServiceClient { }; super(optionsWithDefaults); + let bearerTokenAuthenticationPolicyFound: boolean = false; if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); - const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( (pipelinePolicy) => pipelinePolicy.name === coreRestPipeline.bearerTokenAuthenticationPolicyName ); - if (!bearerTokenAuthenticationPolicyFound) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - scopes: `${optionsWithDefaults.baseUri}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge - } - }) - ); - } + } + 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 + } + }) + ); } // Assigning values to Constant parameters @@ -87,6 +99,35 @@ export class ServiceLinkerManagementClient extends coreClient.ServiceClient { this.apiVersion = options.apiVersion || "2022-05-01"; this.linker = new LinkerImpl(this); this.operations = new OperationsImpl(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 "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); } linker: Linker; diff --git a/sdk/servicelinker/arm-servicelinker/test/sampleTest.ts b/sdk/servicelinker/arm-servicelinker/test/sampleTest.ts index 7ed89b043e1b..25aeb3ebcc36 100644 --- a/sdk/servicelinker/arm-servicelinker/test/sampleTest.ts +++ b/sdk/servicelinker/arm-servicelinker/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/servicelinker/arm-servicelinker/tsconfig.json b/sdk/servicelinker/arm-servicelinker/tsconfig.json index 5c861ab691f6..3e6ae96443f3 100644 --- a/sdk/servicelinker/arm-servicelinker/tsconfig.json +++ b/sdk/servicelinker/arm-servicelinker/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-servicelinker": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"