Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Keys] Revert change that introduced enum for API version that had only the latest API version value #13115

Merged
merged 2 commits into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions sdk/keyvault/keyvault-keys/review/keyvault-keys.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 2 additions & 5 deletions sdk/keyvault/keyvault-keys/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import {
KeyVaultClientGetKeysOptionalParams,
KeyVaultClientRestoreKeyResponse,
KeyVaultClientUpdateKeyResponse,
KnownApiVersion72Preview as KnownApiVersions,
ApiVersion72Preview as ApiVersion
KnownApiVersion72Preview as KnownApiVersions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this file, KnownApiVersions to figure out the default value for the api version to use. Can we use the constant LATEST_API_VERSION instead like before?

} from "./generated/models";
import { KeyVaultClient } from "./generated/keyVaultClient";
import { SDK_VERSION } from "./constants";
Expand Down Expand Up @@ -165,9 +164,7 @@ export {
VerifyResult,
WrapKeyOptions,
WrapResult,
logger,
KnownApiVersions,
ApiVersion
logger
};

/**
Expand Down
8 changes: 6 additions & 2 deletions sdk/keyvault/keyvault-keys/src/keysModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import * as coreHttp from "@azure/core-http";
import {
ApiVersion72Preview as ApiVersion,
DeletionRecoveryLevel,
JsonWebKeyType as KeyType,
KnownJsonWebKeyType as KnownKeyTypes,
Expand All @@ -14,14 +13,19 @@ 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
*/
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";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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}`
);
});

Expand Down