From 138e8b8b5f4d5be723cb8332fbbc53c5ae171a28 Mon Sep 17 00:00:00 2001 From: Sarangan Rajamanickam Date: Fri, 8 Jan 2021 02:03:53 +0000 Subject: [PATCH 1/2] Remove version value back to previous method --- sdk/keyvault/keyvault-keys/review/keyvault-keys.api.md | 10 +--------- sdk/keyvault/keyvault-keys/src/index.ts | 7 ++----- sdk/keyvault/keyvault-keys/src/keysModels.ts | 8 ++++++-- .../test/internal/serviceVersionParameter.spec.ts | 4 ++-- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/sdk/keyvault/keyvault-keys/review/keyvault-keys.api.md b/sdk/keyvault/keyvault-keys/review/keyvault-keys.api.md index ce78468dbf59..7d6f5602aea6 100644 --- a/sdk/keyvault/keyvault-keys/review/keyvault-keys.api.md +++ b/sdk/keyvault/keyvault-keys/review/keyvault-keys.api.md @@ -12,9 +12,6 @@ import { PollerLike } from '@azure/core-lro'; import { PollOperationState } from '@azure/core-lro'; import { TokenCredential } from '@azure/core-http'; -// @public -export type ApiVersion = string; - // @public export interface BackupKeyOptions extends coreHttp.OperationOptions { } @@ -178,7 +175,7 @@ export class KeyClient { // @public export interface KeyClientOptions extends coreHttp.PipelineOptions { - serviceVersion?: ApiVersion; + serviceVersion?: "7.0" | "7.1" | "7.2-preview"; } // @public @@ -242,11 +239,6 @@ export interface KeyVaultKeyId { // @public export type KeyWrapAlgorithm = "RSA-OAEP" | "RSA-OAEP-256" | "RSA1_5"; -// @public -export const enum KnownApiVersions { - Seven2Preview = "7.2-preview" -} - // @public export const enum KnownDeletionRecoveryLevel { CustomizedRecoverable = "CustomizedRecoverable", diff --git a/sdk/keyvault/keyvault-keys/src/index.ts b/sdk/keyvault/keyvault-keys/src/index.ts index c492f4170cc6..b1a237beac75 100644 --- a/sdk/keyvault/keyvault-keys/src/index.ts +++ b/sdk/keyvault/keyvault-keys/src/index.ts @@ -30,8 +30,7 @@ import { KeyVaultClientGetKeysOptionalParams, KeyVaultClientRestoreKeyResponse, KeyVaultClientUpdateKeyResponse, - KnownApiVersion72Preview as KnownApiVersions, - ApiVersion72Preview as ApiVersion + KnownApiVersion72Preview as KnownApiVersions } from "./generated/models"; import { KeyVaultClient } from "./generated/keyVaultClient"; import { SDK_VERSION } from "./constants"; @@ -165,9 +164,7 @@ export { VerifyResult, WrapKeyOptions, WrapResult, - logger, - KnownApiVersions, - ApiVersion + logger }; /** diff --git a/sdk/keyvault/keyvault-keys/src/keysModels.ts b/sdk/keyvault/keyvault-keys/src/keysModels.ts index 41a483e0281b..840426fcf903 100644 --- a/sdk/keyvault/keyvault-keys/src/keysModels.ts +++ b/sdk/keyvault/keyvault-keys/src/keysModels.ts @@ -3,7 +3,6 @@ import * as coreHttp from "@azure/core-http"; import { - ApiVersion72Preview as ApiVersion, DeletionRecoveryLevel, JsonWebKeyType as KeyType, KnownJsonWebKeyType as KnownKeyTypes, @@ -14,6 +13,11 @@ import { KeyCurveName } from "./cryptographyClientModels"; export { KeyType, KnownKeyTypes, KeyOperation, KnownKeyOperations }; +/** + * The latest supported Key Vault service API version + */ +export const LATEST_API_VERSION = "7.2-preview"; + /** * The optional parameters accepted by the KeyVault's KeyClient */ @@ -21,7 +25,7 @@ export interface KeyClientOptions extends coreHttp.PipelineOptions { /** * The accepted versions of the KeyVault's service API. */ - serviceVersion?: ApiVersion; + serviceVersion?: "7.0" | "7.1" | "7.2-preview"; } /** diff --git a/sdk/keyvault/keyvault-keys/test/internal/serviceVersionParameter.spec.ts b/sdk/keyvault/keyvault-keys/test/internal/serviceVersionParameter.spec.ts index 257f9b7fe0ba..adc24d14bfdc 100644 --- a/sdk/keyvault/keyvault-keys/test/internal/serviceVersionParameter.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/internal/serviceVersionParameter.spec.ts @@ -4,7 +4,7 @@ import * as assert from "assert"; import { createSandbox, SinonSandbox, SinonSpy } from "sinon"; import { KeyClient } from "../../src"; -import { KnownApiVersions } from "../../src/"; +import { LATEST_API_VERSION } from "../../src/keysModels"; import { HttpClient, HttpOperationResponse, WebResourceLike, HttpHeaders } from "@azure/core-http"; import { ClientSecretCredential } from "@azure/identity"; import { env } from "@azure/test-utils-recorder"; @@ -54,7 +54,7 @@ describe("The Keys client should set the serviceVersion", () => { const calls = spy.getCalls(); assert.equal( calls[0].args[0].url, - `https://keyVaultName.vault.azure.net/keys/keyName/create?api-version=${KnownApiVersions.Seven2Preview}` + `https://keyVaultName.vault.azure.net/keys/keyName/create?api-version=${LATEST_API_VERSION}` ); }); From d2da2cf3219f080345c17b83815122163c3e68c8 Mon Sep 17 00:00:00 2001 From: Sarangan Rajamanickam Date: Fri, 8 Jan 2021 19:07:09 +0000 Subject: [PATCH 2/2] Modify Latest API Version --- sdk/keyvault/keyvault-keys/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/keyvault/keyvault-keys/src/index.ts b/sdk/keyvault/keyvault-keys/src/index.ts index b1a237beac75..c804c9367985 100644 --- a/sdk/keyvault/keyvault-keys/src/index.ts +++ b/sdk/keyvault/keyvault-keys/src/index.ts @@ -29,8 +29,7 @@ import { KeyItem, KeyVaultClientGetKeysOptionalParams, KeyVaultClientRestoreKeyResponse, - KeyVaultClientUpdateKeyResponse, - KnownApiVersion72Preview as KnownApiVersions + KeyVaultClientUpdateKeyResponse } from "./generated/models"; import { KeyVaultClient } from "./generated/keyVaultClient"; import { SDK_VERSION } from "./constants"; @@ -70,7 +69,8 @@ import { RestoreKeyBackupOptions, UpdateKeyPropertiesOptions, KeyClientOptions, - CryptographyClientOptions + CryptographyClientOptions, + LATEST_API_VERSION } from "./keysModels"; import { CryptographyClient } from "./cryptographyClient"; @@ -239,7 +239,7 @@ export class KeyClient { }; this.client = new KeyVaultClient( - pipelineOptions.serviceVersion || KnownApiVersions.Seven2Preview, + pipelineOptions.serviceVersion || LATEST_API_VERSION, createPipelineFromOptions(internalPipelineOptions, authPolicy) ); }