diff --git a/sdk/keyvault/keyvault-admin/swagger/README.md b/sdk/keyvault/keyvault-admin/swagger/README.md index e5f1a75f7bc9..c84db1921a02 100644 --- a/sdk/keyvault/keyvault-admin/swagger/README.md +++ b/sdk/keyvault/keyvault-admin/swagger/README.md @@ -11,8 +11,8 @@ generate-metadata: false add-credentials: false license-header: MICROSOFT_MIT_NO_VERSION input-file: - - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f7879713cbd89efb2c68c6b6f2566b49db97d832/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.2-preview/rbac.json - - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f7879713cbd89efb2c68c6b6f2566b49db97d832/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.2-preview/backuprestore.json + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/1e2c9f3ec93078da8078389941531359e274f32a/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.2/rbac.json + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/1e2c9f3ec93078da8078389941531359e274f32a/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.2/backuprestore.json output-folder: ../ source-code-folder-path: ./src/generated ``` diff --git a/sdk/keyvault/keyvault-certificates/CHANGELOG.md b/sdk/keyvault/keyvault-certificates/CHANGELOG.md index 2e73a6606ec9..22cea2c63930 100644 --- a/sdk/keyvault/keyvault-certificates/CHANGELOG.md +++ b/sdk/keyvault/keyvault-certificates/CHANGELOG.md @@ -2,6 +2,7 @@ ## 4.2.0-beta.4 (Unreleased) +- Marked `ErrorModel` as deprecated. It was erronously exported publicly in 4.1 and should not be used. Please change the type to use `CertificateOperationError` instead. ## 4.2.0-beta.3 (2021-04-06) diff --git a/sdk/keyvault/keyvault-certificates/review/keyvault-certificates.api.md b/sdk/keyvault/keyvault-certificates/review/keyvault-certificates.api.md index 1624a0b05a86..f2f71d0345d4 100644 --- a/sdk/keyvault/keyvault-certificates/review/keyvault-certificates.api.md +++ b/sdk/keyvault/keyvault-certificates/review/keyvault-certificates.api.md @@ -250,7 +250,7 @@ export type DeleteIssuerOptions = coreHttp.OperationOptions; // @public export type DeletionRecoveryLevel = string; -// @public +// @public @deprecated export interface ErrorModel { readonly code?: string; readonly innerError?: ErrorModel; diff --git a/sdk/keyvault/keyvault-certificates/src/certificatesModels.ts b/sdk/keyvault/keyvault-certificates/src/certificatesModels.ts index f2840d4bc623..5349e5e07e5c 100644 --- a/sdk/keyvault/keyvault-certificates/src/certificatesModels.ts +++ b/sdk/keyvault/keyvault-certificates/src/certificatesModels.ts @@ -44,6 +44,28 @@ export interface CertificateOperationError { readonly innerError?: CertificateOperationError; } +/** + * The key vault server error model. + * @deprecated - Please use {@link CertificateOperationError} instead. + */ +// This was re-exported as-is from generated code in 4.1; however, we should only be using `CertificateOperationError`. +export interface ErrorModel { + /** + * The error code. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly code?: string; + /** + * The error message. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly message?: string; + /** + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly innerError?: ErrorModel; +} + /** * A certificate operation is returned in case of asynchronous requests. */ diff --git a/sdk/keyvault/keyvault-certificates/src/generated/keyVaultClient.ts b/sdk/keyvault/keyvault-certificates/src/generated/keyVaultClient.ts index 1e0bbf6882bf..63734d71537b 100644 --- a/sdk/keyvault/keyvault-certificates/src/generated/keyVaultClient.ts +++ b/sdk/keyvault/keyvault-certificates/src/generated/keyVaultClient.ts @@ -12,7 +12,7 @@ import * as Mappers from "./models/mappers"; import { KeyVaultClientContext } from "./keyVaultClientContext"; import { KeyVaultClientOptionalParams, - ApiVersion72Preview, + ApiVersion72, KeyVaultClientGetCertificatesOptionalParams, KeyVaultClientGetCertificatesResponse, KeyVaultClientDeleteCertificateResponse, @@ -69,7 +69,7 @@ export class KeyVaultClient extends KeyVaultClientContext { * @param options The parameter options */ constructor( - apiVersion: ApiVersion72Preview, + apiVersion: ApiVersion72, options?: KeyVaultClientOptionalParams ) { super(apiVersion, options); diff --git a/sdk/keyvault/keyvault-certificates/src/generated/keyVaultClientContext.ts b/sdk/keyvault/keyvault-certificates/src/generated/keyVaultClientContext.ts index 68622fcd4075..012dc13595e7 100644 --- a/sdk/keyvault/keyvault-certificates/src/generated/keyVaultClientContext.ts +++ b/sdk/keyvault/keyvault-certificates/src/generated/keyVaultClientContext.ts @@ -7,14 +7,14 @@ */ import * as coreHttp from "@azure/core-http"; -import { ApiVersion72Preview, KeyVaultClientOptionalParams } from "./models"; +import { ApiVersion72, KeyVaultClientOptionalParams } from "./models"; const packageName = "@azure/keyvault-certificates"; export const packageVersion = "4.2.0-beta.4"; /** @hidden */ export class KeyVaultClientContext extends coreHttp.ServiceClient { - apiVersion: ApiVersion72Preview; + apiVersion: ApiVersion72; /** * Initializes a new instance of the KeyVaultClientContext class. @@ -22,7 +22,7 @@ export class KeyVaultClientContext extends coreHttp.ServiceClient { * @param options The parameter options */ constructor( - apiVersion: ApiVersion72Preview, + apiVersion: ApiVersion72, options?: KeyVaultClientOptionalParams ) { if (apiVersion === undefined) { diff --git a/sdk/keyvault/keyvault-certificates/src/generated/models/index.ts b/sdk/keyvault/keyvault-certificates/src/generated/models/index.ts index d90e81e03b84..b22928740562 100644 --- a/sdk/keyvault/keyvault-certificates/src/generated/models/index.ts +++ b/sdk/keyvault/keyvault-certificates/src/generated/models/index.ts @@ -60,7 +60,7 @@ export interface KeyVaultError { * The key vault server error. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly error?: ErrorModel; + readonly error?: ErrorModel | null; } /** The key vault server error. */ @@ -79,7 +79,7 @@ export interface ErrorModel { * The key vault server error. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly innerError?: ErrorModel; + readonly innerError?: ErrorModel | null; } /** A certificate bundle consists of a certificate (X509) plus its attributes. */ @@ -142,7 +142,7 @@ export interface CertificatePolicy { /** Properties of the key pair backing a certificate. */ export interface KeyProperties { - /** Indicates if the private key can be exported. */ + /** Not supported in this version. Indicates if the private key can be exported. */ exportable?: boolean; /** The type of key pair to be used for the certificate. */ keyType?: JsonWebKeyType; @@ -372,7 +372,7 @@ export interface CertificateOperation { /** The status details of the certificate operation. */ statusDetails?: string; /** Error encountered, if any, during the certificate operation. */ - error?: ErrorModel; + error?: ErrorModel | null; /** Location which contains the result of the certificate operation. */ target?: string; /** Identifier for the certificate operation. */ @@ -503,20 +503,20 @@ export type DeletedCertificateBundle = CertificateBundle & { readonly deletedDate?: Date; }; -/** Known values of {@link ApiVersion72Preview} that the service accepts. */ -export const enum KnownApiVersion72Preview { - /** Api Version '7.2-preview' */ - Seven2Preview = "7.2-preview" +/** Known values of {@link ApiVersion72} that the service accepts. */ +export const enum KnownApiVersion72 { + /** Api Version '7.2' */ + Seven2 = "7.2" } /** - * Defines values for ApiVersion72Preview. \ - * {@link KnownApiVersion72Preview} can be used interchangeably with ApiVersion72Preview, + * Defines values for ApiVersion72. \ + * {@link KnownApiVersion72} can be used interchangeably with ApiVersion72, * this enum contains the known values that the service supports. * ### Know values supported by the service - * **7.2-preview**: Api Version '7.2-preview' + * **7.2**: Api Version '7.2' */ -export type ApiVersion72Preview = string; +export type ApiVersion72 = string; /** Known values of {@link DeletionRecoveryLevel} that the service accepts. */ export const enum KnownDeletionRecoveryLevel { diff --git a/sdk/keyvault/keyvault-certificates/src/index.ts b/sdk/keyvault/keyvault-certificates/src/index.ts index 6f9613e08341..96e9b76514b4 100644 --- a/sdk/keyvault/keyvault-certificates/src/index.ts +++ b/sdk/keyvault/keyvault-certificates/src/index.ts @@ -50,6 +50,7 @@ import { CertificateTags, ImportCertificateOptions, ListPropertiesOfCertificatesOptions, + ErrorModel, ListPropertiesOfCertificateVersionsOptions, ListPropertiesOfIssuersOptions, ListDeletedCertificatesOptions, @@ -89,7 +90,6 @@ import { KeyVaultClientSetCertificateIssuerOptionalParams, BackupCertificateResult, KeyVaultClientGetDeletedCertificatesOptionalParams, - ErrorModel, IssuerParameters, IssuerCredentials, IssuerAttributes, diff --git a/sdk/keyvault/keyvault-certificates/src/transformations.ts b/sdk/keyvault/keyvault-certificates/src/transformations.ts index b7d8f016442d..585a05d82cc3 100644 --- a/sdk/keyvault/keyvault-certificates/src/transformations.ts +++ b/sdk/keyvault/keyvault-certificates/src/transformations.ts @@ -12,7 +12,8 @@ import { KeyVaultCertificate, KeyVaultCertificateWithPolicy, SubjectAlternativeNames, - CertificateContact + CertificateContact, + CertificateOperationError } from "./certificatesModels"; import { CertificateAttributes, @@ -26,7 +27,8 @@ import { X509CertificateProperties, CertificateOperation as CoreCertificateOperation, Contacts as CoreContacts, - JsonWebKeyType as CertificateKeyType + JsonWebKeyType as CertificateKeyType, + ErrorModel } from "./generated/models"; import { parseKeyVaultCertificateId } from "./identifier"; @@ -307,6 +309,19 @@ export function getDeletedCertificateFromItem(item: DeletedCertificateItem): Del }; } +function getCertificateOperationErrorFromErrorModel( + error?: ErrorModel | null +): CertificateOperationError | undefined { + if (error) { + return { + code: error.code, + innerError: getCertificateOperationErrorFromErrorModel(error.innerError), + message: error.message + }; + } + return undefined; +} + export function getCertificateOperationFromCoreOperation( certificateName: string, vaultUrl: string, @@ -323,7 +338,7 @@ export function getCertificateOperationFromCoreOperation( ? operation.issuerParameters.certificateType : undefined, csr: operation.csr, - error: operation.error, + error: getCertificateOperationErrorFromErrorModel(operation.error), id: operation.id, requestId: operation.requestId, status: operation.status, diff --git a/sdk/keyvault/keyvault-certificates/swagger/README.md b/sdk/keyvault/keyvault-certificates/swagger/README.md index 3cbb4086bfe8..521b8979a07d 100644 --- a/sdk/keyvault/keyvault-certificates/swagger/README.md +++ b/sdk/keyvault/keyvault-certificates/swagger/README.md @@ -14,7 +14,7 @@ azure-arm: false generate-metadata: false add-credentials: false license-header: MICROSOFT_MIT_NO_VERSION -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f9caf92527ccff06c5b66380e6f2b4f50f5e82b3/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.2-preview/certificates.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/1e2c9f3ec93078da8078389941531359e274f32a/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.2/certificates.json output-folder: ../ source-code-folder-path: ./src/generated hide-clients: true diff --git a/sdk/keyvault/keyvault-certificates/test/internal/transformations.spec.ts b/sdk/keyvault/keyvault-certificates/test/internal/transformations.spec.ts new file mode 100644 index 000000000000..347da988ee1b --- /dev/null +++ b/sdk/keyvault/keyvault-certificates/test/internal/transformations.spec.ts @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { assert } from "chai"; +import { CertificateOperation as CoreCertificateOperation } from "../../src/generated/models"; +import { getCertificateOperationFromCoreOperation } from "../../src/transformations"; + +describe("transformations", function() { + describe("getCertificateOperationFromCoreOperation", function() { + it("transforms null error to undefined", function() { + const input: CoreCertificateOperation = { + error: null + }; + + assert.isUndefined(getCertificateOperationFromCoreOperation("", "", input).error); + }); + + it("transforms null inner error to undefined", function() { + const input: CoreCertificateOperation = { + error: { + innerError: null + } + }; + + const output = getCertificateOperationFromCoreOperation("", "", input); + assert.isDefined(output.error); + assert.isUndefined(output.error!.innerError); + }); + + it("transforms errors correctly when present", function() { + const input: CoreCertificateOperation = { + error: { + code: "outer error", + message: "The outer error message", + innerError: { + code: "inner error", + innerError: undefined, + message: "The inner error message" + } + } + }; + + const output = getCertificateOperationFromCoreOperation("", "", input); + assert.deepNestedInclude(output, input); + }); + }); +}); diff --git a/sdk/keyvault/keyvault-keys/src/generated/keyVaultClient.ts b/sdk/keyvault/keyvault-keys/src/generated/keyVaultClient.ts index 6a254fc91232..6c9549b8ca0d 100644 --- a/sdk/keyvault/keyvault-keys/src/generated/keyVaultClient.ts +++ b/sdk/keyvault/keyvault-keys/src/generated/keyVaultClient.ts @@ -12,7 +12,7 @@ import * as Mappers from "./models/mappers"; import { KeyVaultClientContext } from "./keyVaultClientContext"; import { KeyVaultClientOptionalParams, - ApiVersion72Preview, + ApiVersion72, JsonWebKeyType, KeyVaultClientCreateKeyOptionalParams, KeyVaultClientCreateKeyResponse, @@ -61,7 +61,7 @@ export class KeyVaultClient extends KeyVaultClientContext { * @param options The parameter options */ constructor( - apiVersion: ApiVersion72Preview, + apiVersion: ApiVersion72, options?: KeyVaultClientOptionalParams ) { super(apiVersion, options); diff --git a/sdk/keyvault/keyvault-keys/src/generated/keyVaultClientContext.ts b/sdk/keyvault/keyvault-keys/src/generated/keyVaultClientContext.ts index 8333ac48aa3d..7b3a1cd93e1f 100644 --- a/sdk/keyvault/keyvault-keys/src/generated/keyVaultClientContext.ts +++ b/sdk/keyvault/keyvault-keys/src/generated/keyVaultClientContext.ts @@ -7,14 +7,14 @@ */ import * as coreHttp from "@azure/core-http"; -import { ApiVersion72Preview, KeyVaultClientOptionalParams } from "./models"; +import { ApiVersion72, KeyVaultClientOptionalParams } from "./models"; const packageName = "@azure/keyvault-keys"; export const packageVersion = "4.2.0-beta.6"; /** @hidden */ export class KeyVaultClientContext extends coreHttp.ServiceClient { - apiVersion: ApiVersion72Preview; + apiVersion: ApiVersion72; /** * Initializes a new instance of the KeyVaultClientContext class. @@ -22,7 +22,7 @@ export class KeyVaultClientContext extends coreHttp.ServiceClient { * @param options The parameter options */ constructor( - apiVersion: ApiVersion72Preview, + apiVersion: ApiVersion72, options?: KeyVaultClientOptionalParams ) { if (apiVersion === undefined) { diff --git a/sdk/keyvault/keyvault-keys/src/generated/models/index.ts b/sdk/keyvault/keyvault-keys/src/generated/models/index.ts index a058fe71833c..6686df771d5a 100644 --- a/sdk/keyvault/keyvault-keys/src/generated/models/index.ts +++ b/sdk/keyvault/keyvault-keys/src/generated/models/index.ts @@ -261,6 +261,8 @@ export interface DeletedKeyListResult { /** Properties of the key pair backing a certificate. */ export interface KeyProperties { + /** Not supported in this version. Indicates if the private key can be exported. */ + exportable?: boolean; /** The type of key pair to be used for the certificate. */ keyType?: JsonWebKeyType; /** The key size in bits. For example: 2048, 3072, or 4096 for RSA. */ @@ -317,20 +319,20 @@ export type DeletedKeyItem = KeyItem & { readonly deletedDate?: Date; }; -/** Known values of {@link ApiVersion72Preview} that the service accepts. */ -export const enum KnownApiVersion72Preview { - /** Api Version '7.2-preview' */ - Seven2Preview = "7.2-preview" +/** Known values of {@link ApiVersion72} that the service accepts. */ +export const enum KnownApiVersion72 { + /** Api Version '7.2' */ + Seven2 = "7.2" } /** - * Defines values for ApiVersion72Preview. \ - * {@link KnownApiVersion72Preview} can be used interchangeably with ApiVersion72Preview, + * Defines values for ApiVersion72. \ + * {@link KnownApiVersion72} can be used interchangeably with ApiVersion72, * this enum contains the known values that the service supports. * ### Know values supported by the service - * **7.2-preview**: Api Version '7.2-preview' + * **7.2**: Api Version '7.2' */ -export type ApiVersion72Preview = string; +export type ApiVersion72 = string; /** Known values of {@link JsonWebKeyType} that the service accepts. */ export const enum KnownJsonWebKeyType { diff --git a/sdk/keyvault/keyvault-keys/src/generated/models/mappers.ts b/sdk/keyvault/keyvault-keys/src/generated/models/mappers.ts index 15b441de7df9..597309054153 100644 --- a/sdk/keyvault/keyvault-keys/src/generated/models/mappers.ts +++ b/sdk/keyvault/keyvault-keys/src/generated/models/mappers.ts @@ -656,6 +656,12 @@ export const KeyProperties: coreHttp.CompositeMapper = { name: "Composite", className: "KeyProperties", modelProperties: { + exportable: { + serializedName: "exportable", + type: { + name: "Boolean" + } + }, keyType: { serializedName: "kty", type: { diff --git a/sdk/keyvault/keyvault-keys/swagger/README.md b/sdk/keyvault/keyvault-keys/swagger/README.md index a89879e76a1f..39edcd9ae3c1 100644 --- a/sdk/keyvault/keyvault-keys/swagger/README.md +++ b/sdk/keyvault/keyvault-keys/swagger/README.md @@ -11,7 +11,7 @@ azure-arm: false generate-metadata: false add-credentials: false license-header: MICROSOFT_MIT_NO_VERSION -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/612f78afd05911d0e1e82ba72b41781f655dbffb/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.2-preview/keys.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/1e2c9f3ec93078da8078389941531359e274f32a/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.2/keys.json output-folder: ../ source-code-folder-path: ./src/generated disable-async-iterators: true diff --git a/sdk/keyvault/keyvault-secrets/swagger/README.md b/sdk/keyvault/keyvault-secrets/swagger/README.md index 68cef4f88c58..03aa84e67515 100644 --- a/sdk/keyvault/keyvault-secrets/swagger/README.md +++ b/sdk/keyvault/keyvault-secrets/swagger/README.md @@ -14,7 +14,7 @@ azure-arm: false generate-metadata: false add-credentials: false license-header: MICROSOFT_MIT_NO_VERSION -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f9caf92527ccff06c5b66380e6f2b4f50f5e82b3/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.2-preview/secrets.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/1e2c9f3ec93078da8078389941531359e274f32a/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.2/secrets.json output-folder: ../ source-code-folder-path: ./src/generated hide-clients: true