From 3be29f6b496bd047155460216e43891bc35ba49b Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Thu, 20 May 2021 21:28:07 +0000 Subject: [PATCH 1/3] selectiveRestore to selectiveKeyRestore --- .../review/keyvault-admin.api.md | 10 ++++++++-- ...estore.ts => backupSelectiveKeyRestore.ts} | 4 ++-- .../samples/v4/javascript/README.md | 4 ++-- ...estore.js => backupSelectiveKeyRestore.js} | 4 ++-- .../samples/v4/typescript/README.md | 4 ++-- ...estore.ts => backupSelectiveKeyRestore.ts} | 4 ++-- .../keyvault-admin/src/backupClient.ts | 19 +++++++++++-------- .../keyvault-admin/src/backupClientModels.ts | 15 +++++++++++++++ .../operation.ts | 6 +++--- .../poller.ts | 6 +++--- .../test/public/backupClient.abort.spec.ts | 4 ++-- .../test/public/backupClient.spec.ts | 16 ++++++++-------- 12 files changed, 60 insertions(+), 36 deletions(-) rename sdk/keyvault/keyvault-admin/samples-dev/{backupSelectiveRestore.ts => backupSelectiveKeyRestore.ts} (94%) rename sdk/keyvault/keyvault-admin/samples/v4/javascript/{backupSelectiveRestore.js => backupSelectiveKeyRestore.js} (94%) rename sdk/keyvault/keyvault-admin/samples/v4/typescript/src/{backupSelectiveRestore.ts => backupSelectiveKeyRestore.ts} (94%) rename sdk/keyvault/keyvault-admin/src/lro/{selectiveRestore => selectiveKeyRestore}/operation.ts (95%) rename sdk/keyvault/keyvault-admin/src/lro/{selectiveRestore => selectiveKeyRestore}/poller.ts (89%) diff --git a/sdk/keyvault/keyvault-admin/review/keyvault-admin.api.md b/sdk/keyvault/keyvault-admin/review/keyvault-admin.api.md index 9a28dd45ccbb..c699a290a773 100644 --- a/sdk/keyvault/keyvault-admin/review/keyvault-admin.api.md +++ b/sdk/keyvault/keyvault-admin/review/keyvault-admin.api.md @@ -63,7 +63,7 @@ export class KeyVaultBackupClient { constructor(vaultUrl: string, credential: TokenCredential, options?: KeyVaultBackupClientOptions); beginBackup(blobStorageUri: string, sasToken: string, options?: KeyVaultBeginBackupOptions): Promise>; beginRestore(folderUri: string, sasToken: string, options?: KeyVaultBeginRestoreOptions): Promise>; - beginSelectiveRestore(keyName: string, folderUri: string, sasToken: string, options?: KeyVaultBeginBackupOptions): Promise>; + beginSelectiveKeyRestore(keyName: string, folderUri: string, sasToken: string, options?: KeyVaultBeginBackupOptions): Promise>; readonly vaultUrl: string; } @@ -152,7 +152,13 @@ export interface KeyVaultRoleDefinition { export type KeyVaultRoleScope = "/" | "/keys" | string; // @public -export interface KeyVaultSelectiveRestoreOperationState extends KeyVaultAdminPollOperationState { +export interface KeyVaultSelectiveKeyRestoreResult { + endTime?: Date; + startTime: Date; +} + +// @public +export interface KeyVaultSelectiveRestoreOperationState extends KeyVaultAdminPollOperationState { } // @public diff --git a/sdk/keyvault/keyvault-admin/samples-dev/backupSelectiveRestore.ts b/sdk/keyvault/keyvault-admin/samples-dev/backupSelectiveKeyRestore.ts similarity index 94% rename from sdk/keyvault/keyvault-admin/samples-dev/backupSelectiveRestore.ts rename to sdk/keyvault/keyvault-admin/samples-dev/backupSelectiveKeyRestore.ts index b4004b042e61..367f82f7975f 100644 --- a/sdk/keyvault/keyvault-admin/samples-dev/backupSelectiveRestore.ts +++ b/sdk/keyvault/keyvault-admin/samples-dev/backupSelectiveKeyRestore.ts @@ -40,12 +40,12 @@ export async function main(): Promise { const backupPoller = await client.beginBackup(blobStorageUri, sasToken); await backupPoller.pollUntilDone(); - const selectiveRestorePoller = await client.beginSelectiveRestore( + const selectiveKeyRestorePoller = await client.beginSelectiveKeyRestore( key.name, blobStorageUri, sasToken ); - await selectiveRestorePoller.pollUntilDone(); + await selectiveKeyRestorePoller.pollUntilDone(); // Deleting and purging the key, just in case we want to create the same key again. const deleteKeyPoller = await keyClient.beginDeleteKey(keyName); diff --git a/sdk/keyvault/keyvault-admin/samples/v4/javascript/README.md b/sdk/keyvault/keyvault-admin/samples/v4/javascript/README.md index 4562b02649b1..978a2f8b5ab0 100644 --- a/sdk/keyvault/keyvault-admin/samples/v4/javascript/README.md +++ b/sdk/keyvault/keyvault-admin/samples/v4/javascript/README.md @@ -16,7 +16,7 @@ These sample programs show how to use the JavaScript client libraries for Azure | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | | [accessControlHelloWorld.js][accesscontrolhelloworld] | Uses an AccessControlClient to list, create, and assign roles to users. | | [backupRestoreHelloWorld.js][backuprestorehelloworld] | Uses a BackupClient to backup and fully restore an Azure Key Vault using Azure Storage Blob. | -| [backupSelectiveRestore.js][backupselectiverestore] | Uses a BackupClient to backup and restore a specific key in Azure Key Vault using Azure Storage Blob. | +| [backupSelectiveKeyRestore.js][backupselectiveKeyrestore] | Uses a BackupClient to backup and restore a specific key in Azure Key Vault using Azure Storage Blob. | ## Prerequisites @@ -66,7 +66,7 @@ Take a look at our [API Documentation][apiref] for more information about the AP [accesscontrolhelloworld]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/v4/javascript/accessControlHelloWorld.js [backuprestorehelloworld]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/v4/javascript/backupRestoreHelloWorld.js -[backupselectiverestore]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/v4/javascript/backupSelectiveRestore.js +[backupselectiveKeyrestore]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/v4/javascript/backupSelectiveKeyRestore.js [apiref]: https://docs.microsoft.com/javascript/api/@azure/keyvault-admin [freesub]: https://azure.microsoft.com/free/ [createinstance_azurekeyvault]: https://docs.microsoft.com/azure/key-vault/quick-create-portal diff --git a/sdk/keyvault/keyvault-admin/samples/v4/javascript/backupSelectiveRestore.js b/sdk/keyvault/keyvault-admin/samples/v4/javascript/backupSelectiveKeyRestore.js similarity index 94% rename from sdk/keyvault/keyvault-admin/samples/v4/javascript/backupSelectiveRestore.js rename to sdk/keyvault/keyvault-admin/samples/v4/javascript/backupSelectiveKeyRestore.js index 8807f9dde639..4e94e8218f3a 100644 --- a/sdk/keyvault/keyvault-admin/samples/v4/javascript/backupSelectiveRestore.js +++ b/sdk/keyvault/keyvault-admin/samples/v4/javascript/backupSelectiveKeyRestore.js @@ -40,12 +40,12 @@ async function main() { const backupPoller = await client.beginBackup(blobStorageUri, sasToken); await backupPoller.pollUntilDone(); - const selectiveRestorePoller = await client.beginSelectiveRestore( + const selectiveKeyRestorePoller = await client.beginSelectiveKeyRestore( key.name, blobStorageUri, sasToken ); - await selectiveRestorePoller.pollUntilDone(); + await selectiveKeyRestorePoller.pollUntilDone(); // Deleting and purging the key, just in case we want to create the same key again. const deleteKeyPoller = await keyClient.beginDeleteKey(keyName); diff --git a/sdk/keyvault/keyvault-admin/samples/v4/typescript/README.md b/sdk/keyvault/keyvault-admin/samples/v4/typescript/README.md index f9c9f0d9974d..9480414661ea 100644 --- a/sdk/keyvault/keyvault-admin/samples/v4/typescript/README.md +++ b/sdk/keyvault/keyvault-admin/samples/v4/typescript/README.md @@ -16,7 +16,7 @@ These sample programs show how to use the TypeScript client libraries for Azure | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | | [accessControlHelloWorld.ts][accesscontrolhelloworld] | Uses an AccessControlClient to list, create, and assign roles to users. | | [backupRestoreHelloWorld.ts][backuprestorehelloworld] | Uses a BackupClient to backup and fully restore an Azure Key Vault using Azure Storage Blob. | -| [backupSelectiveRestore.ts][backupselectiverestore] | Uses a BackupClient to backup and restore a specific key in Azure Key Vault using Azure Storage Blob. | +| [backupSelectiveKeyRestore.ts][backupselectiveKeyrestore] | Uses a BackupClient to backup and restore a specific key in Azure Key Vault using Azure Storage Blob. | ## Prerequisites @@ -78,7 +78,7 @@ Take a look at our [API Documentation][apiref] for more information about the AP [accesscontrolhelloworld]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/v4/typescript/src/accessControlHelloWorld.ts [backuprestorehelloworld]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/v4/typescript/src/backupRestoreHelloWorld.ts -[backupselectiverestore]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/v4/typescript/src/backupSelectiveRestore.ts +[backupselectiveKeyrestore]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/v4/typescript/src/backupSelectiveKeyRestore.ts [apiref]: https://docs.microsoft.com/javascript/api/@azure/keyvault-admin [freesub]: https://azure.microsoft.com/free/ [createinstance_azurekeyvault]: https://docs.microsoft.com/azure/key-vault/quick-create-portal diff --git a/sdk/keyvault/keyvault-admin/samples/v4/typescript/src/backupSelectiveRestore.ts b/sdk/keyvault/keyvault-admin/samples/v4/typescript/src/backupSelectiveKeyRestore.ts similarity index 94% rename from sdk/keyvault/keyvault-admin/samples/v4/typescript/src/backupSelectiveRestore.ts rename to sdk/keyvault/keyvault-admin/samples/v4/typescript/src/backupSelectiveKeyRestore.ts index b4004b042e61..367f82f7975f 100644 --- a/sdk/keyvault/keyvault-admin/samples/v4/typescript/src/backupSelectiveRestore.ts +++ b/sdk/keyvault/keyvault-admin/samples/v4/typescript/src/backupSelectiveKeyRestore.ts @@ -40,12 +40,12 @@ export async function main(): Promise { const backupPoller = await client.beginBackup(blobStorageUri, sasToken); await backupPoller.pollUntilDone(); - const selectiveRestorePoller = await client.beginSelectiveRestore( + const selectiveKeyRestorePoller = await client.beginSelectiveKeyRestore( key.name, blobStorageUri, sasToken ); - await selectiveRestorePoller.pollUntilDone(); + await selectiveKeyRestorePoller.pollUntilDone(); // Deleting and purging the key, just in case we want to create the same key again. const deleteKeyPoller = await keyClient.beginDeleteKey(keyName); diff --git a/sdk/keyvault/keyvault-admin/src/backupClient.ts b/sdk/keyvault/keyvault-admin/src/backupClient.ts index 60bbd6504e11..402f6c8d98ef 100644 --- a/sdk/keyvault/keyvault-admin/src/backupClient.ts +++ b/sdk/keyvault/keyvault-admin/src/backupClient.ts @@ -17,17 +17,18 @@ import { KeyVaultBackupResult, KeyVaultBeginBackupOptions, KeyVaultBeginRestoreOptions, - KeyVaultRestoreResult + KeyVaultRestoreResult, + KeyVaultSelectiveKeyRestoreResult } from "./backupClientModels"; import { LATEST_API_VERSION, SDK_VERSION } from "./constants"; import { logger } from "./log"; import { KeyVaultBackupPoller } from "./lro/backup/poller"; import { KeyVaultRestorePoller } from "./lro/restore/poller"; -import { KeyVaultSelectiveRestorePoller } from "./lro/selectiveRestore/poller"; +import { KeyVaultSelectiveKeyRestorePoller } from "./lro/selectiveKeyRestore/poller"; import { KeyVaultBackupOperationState } from "./lro/backup/operation"; import { KeyVaultRestoreOperationState } from "./lro/restore/operation"; import { KeyVaultAdminPollOperationState } from "./lro/keyVaultAdminPoller"; -import { KeyVaultSelectiveRestoreOperationState } from "./lro/selectiveRestore/operation"; +import { KeyVaultSelectiveRestoreOperationState } from "./lro/selectiveKeyRestore/operation"; import { KeyVaultClientOptionalParams } from "./generated/models"; import { mappings } from "./mappings"; @@ -233,7 +234,7 @@ export class KeyVaultBackupClient { * const blobStorageUri = ""; * const sasToken = ""; * const keyName = ""; - * const poller = await client.beginSelectiveRestore(keyName, blobStorageUri, sasToken); + * const poller = await client.beginSelectiveKeyRestore(keyName, blobStorageUri, sasToken); * * // Serializing the poller * // @@ -241,7 +242,7 @@ export class KeyVaultBackupClient { * // * // A new poller can be created with: * // - * // await client.beginSelectiveRestore(keyName, blobStorageUri, sasToken, { resumeFrom: serialized }); + * // await client.beginSelectiveKeyRestore(keyName, blobStorageUri, sasToken, { resumeFrom: serialized }); * // * * // Waiting until it's done @@ -253,13 +254,15 @@ export class KeyVaultBackupClient { * @param sasToken - The SAS token. * @param options - The optional parameters. */ - public async beginSelectiveRestore( + public async beginSelectiveKeyRestore( keyName: string, folderUri: string, sasToken: string, options: KeyVaultBeginBackupOptions = {} - ): Promise> { - const poller = new KeyVaultSelectiveRestorePoller({ + ): Promise< + PollerLike + > { + const poller = new KeyVaultSelectiveKeyRestorePoller({ ...mappings.folderUriParts(folderUri), keyName, sasToken, diff --git a/sdk/keyvault/keyvault-admin/src/backupClientModels.ts b/sdk/keyvault/keyvault-admin/src/backupClientModels.ts index ec41a583c743..f5ee495b2016 100644 --- a/sdk/keyvault/keyvault-admin/src/backupClientModels.ts +++ b/sdk/keyvault/keyvault-admin/src/backupClientModels.ts @@ -81,3 +81,18 @@ export interface KeyVaultRestoreResult { */ endTime?: Date; } + +/** + * An interface representing the result of a selective key restore operation. + */ +export interface KeyVaultSelectiveKeyRestoreResult { + /** + * The start time of the selective key restore operation. + */ + startTime: Date; + + /** + * The end time of the selective key restore operation. + */ + endTime?: Date; +} diff --git a/sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/operation.ts b/sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/operation.ts similarity index 95% rename from sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/operation.ts rename to sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/operation.ts index 0d5f845316f3..1cb77f6f77b8 100644 --- a/sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/operation.ts +++ b/sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/operation.ts @@ -14,20 +14,20 @@ import { KeyVaultAdminPollOperation, KeyVaultAdminPollOperationState } from "../keyVaultAdminPoller"; -import { KeyVaultRestoreResult } from "../../backupClientModels"; +import { KeyVaultSelectiveKeyRestoreResult } from "../../backupClientModels"; import { withTrace } from "./poller"; /** * An interface representing the publicly available properties of the state of a restore Key Vault's poll operation. */ export interface KeyVaultSelectiveRestoreOperationState - extends KeyVaultAdminPollOperationState {} + extends KeyVaultAdminPollOperationState {} /** * An internal interface representing the state of a restore Key Vault's poll operation. */ export interface KeyVaultSelectiveRestorePollOperationState - extends KeyVaultAdminPollOperationState { + extends KeyVaultAdminPollOperationState { /** * The name of a Key Vault Key. */ diff --git a/sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/poller.ts b/sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/poller.ts similarity index 89% rename from sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/poller.ts rename to sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/poller.ts index 984241a74eb0..67c341792ca6 100644 --- a/sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/poller.ts +++ b/sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/poller.ts @@ -7,7 +7,7 @@ import { KeyVaultSelectiveRestorePollOperationState } from "./operation"; import { KeyVaultAdminPollerOptions, KeyVaultAdminPoller } from "../keyVaultAdminPoller"; -import { KeyVaultRestoreResult } from "../../backupClientModels"; +import { KeyVaultSelectiveKeyRestoreResult } from "../../backupClientModels"; import { createTraceFunction } from "../../../../keyvault-common/src"; export interface KeyVaultSelectiveRestorePollerOptions extends KeyVaultAdminPollerOptions { @@ -25,9 +25,9 @@ export const withTrace = createTraceFunction("Azure.KeyVault.Admin.KeyVaultSelec /** * Class that creates a poller that waits until a key of a Key Vault backup ends up being restored. */ -export class KeyVaultSelectiveRestorePoller extends KeyVaultAdminPoller< +export class KeyVaultSelectiveKeyRestorePoller extends KeyVaultAdminPoller< KeyVaultSelectiveRestoreOperationState, - KeyVaultRestoreResult + KeyVaultSelectiveKeyRestoreResult > { constructor(options: KeyVaultSelectiveRestorePollerOptions) { const { diff --git a/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts b/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts index 9e1220da0972..4a26375a3d60 100644 --- a/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts @@ -57,14 +57,14 @@ describe("Aborting KeyVaultBackupClient's requests", () => { }); }); - it("can abort beginSelectiveRestore", async function() { + it("can abort beginSelectiveKeyRestore", async function() { const backupURI = `${blobStorageUri}/${generateFakeUUID()}`; const controller = new AbortController(); controller.abort(); await assertThrowsAbortError(async () => { - await client.beginSelectiveRestore("key-name", backupURI, blobSasToken, { + await client.beginSelectiveKeyRestore("key-name", backupURI, blobSasToken, { ...testPollerProperties, abortSignal: controller.signal }); diff --git a/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts index d54aafa0c035..542f9eee454f 100644 --- a/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts @@ -116,7 +116,7 @@ describe("KeyVaultBackupClient", () => { } }); - it("selectiveRestore completes successfully", async function() { + it("selectiveKeyRestore completes successfully", async function() { // This test can only be run in playback mode because running a backup // or restore puts the instance in a bad state (tracked in IcM). if (!isPlaybackMode()) { @@ -136,32 +136,32 @@ describe("KeyVaultBackupClient", () => { await (await keyClient.beginDeleteKey(keyName, testPollerProperties)).pollUntilDone(); await keyClient.purgeDeletedKey(keyName); - const selectiveRestorePoller = await client.beginSelectiveRestore( + const selectiveKeyRestorePoller = await client.beginSelectiveKeyRestore( keyName, backupURI.folderUri!, blobSasToken, testPollerProperties ); - await selectiveRestorePoller.poll(); + await selectiveKeyRestorePoller.poll(); // A poller can be serialized and then resumed - const resumedPoller = await client.beginSelectiveRestore( + const resumedPoller = await client.beginSelectiveKeyRestore( keyName, blobStorageUri, blobSasToken, { ...testPollerProperties, - resumeFrom: selectiveRestorePoller.toString() + resumeFrom: selectiveKeyRestorePoller.toString() } ); assert.isTrue(resumedPoller.getOperationState().isStarted); // without polling assert.equal( resumedPoller.getOperationState().jobId, - selectiveRestorePoller.getOperationState().jobId + selectiveKeyRestorePoller.getOperationState().jobId ); - await selectiveRestorePoller.pollUntilDone(); - const operationState = selectiveRestorePoller.getOperationState(); + await selectiveKeyRestorePoller.pollUntilDone(); + const operationState = selectiveKeyRestorePoller.getOperationState(); assert.equal(operationState.isCompleted, true); await keyClient.getKey(keyName); From 5f31c1a025ee0d0650c434b79a0ad4ba88c7a2c1 Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Thu, 20 May 2021 21:29:57 +0000 Subject: [PATCH 2/3] recording name --- ...restore.js => recording_can_abort_beginselectivekeyrestore.js} | 0 ...js => recording_selectivekeyrestore_completes_successfully.js} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/{recording_can_abort_beginselectiverestore.js => recording_can_abort_beginselectivekeyrestore.js} (100%) rename sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient_beginrestore/{recording_selectiverestore_completes_successfully.js => recording_selectivekeyrestore_completes_successfully.js} (100%) diff --git a/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginselectiverestore.js b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginselectivekeyrestore.js similarity index 100% rename from sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginselectiverestore.js rename to sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginselectivekeyrestore.js diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient_beginrestore/recording_selectiverestore_completes_successfully.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient_beginrestore/recording_selectivekeyrestore_completes_successfully.js similarity index 100% rename from sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient_beginrestore/recording_selectiverestore_completes_successfully.js rename to sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient_beginrestore/recording_selectivekeyrestore_completes_successfully.js From 5c42168f1aac25972a7beac9eada24dd5540515b Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Fri, 21 May 2021 19:13:39 +0000 Subject: [PATCH 3/3] feedback by Heath --- sdk/keyvault/keyvault-admin/CHANGELOG.md | 4 ++++ .../review/keyvault-admin.api.md | 12 +++++------ .../samples/v4/javascript/README.md | 6 +++--- .../samples/v4/typescript/README.md | 6 +++--- .../keyvault-admin/src/backupClient.ts | 9 +++++---- .../keyvault-admin/src/backupClientModels.ts | 4 ++-- .../src/lro/selectiveKeyRestore/operation.ts | 14 ++++++------- .../src/lro/selectiveKeyRestore/poller.ts | 20 ++++++++++--------- 8 files changed, 41 insertions(+), 34 deletions(-) diff --git a/sdk/keyvault/keyvault-admin/CHANGELOG.md b/sdk/keyvault/keyvault-admin/CHANGELOG.md index f102cae86b49..dd666fcb03d2 100644 --- a/sdk/keyvault/keyvault-admin/CHANGELOG.md +++ b/sdk/keyvault/keyvault-admin/CHANGELOG.md @@ -14,6 +14,10 @@ - Removed `folderName` from `beginSelectiveRestore`. Now the folder name will be inferred from the `folderUri`. - Reordered the parameters of `beginSelectiveRestore` to `keyName`, `folderUrl`, `sasToken`, `[options]`. - Renamed `KeyVaultBackupResult`'s `backupFolderUri` to `folderUri`. +- Renamed `beginSelectiveRestore` to `beginSelectiveKeyRestore`. +- Renamed `KeyVaultBeginSelectiveRestoreOptions` to `KeyVaultBeginSelectiveKeyRestoreOptions`. +- Renamed `KeyVaultSelectiveRestoreOperationState` to `KeyVaultSelectiveKeyRestoreOperationState`. +- Renamed `KeyVaultSelectiveRestoreResult` to `KeyVaultSelectiveKeyRestoreResult`. ## 4.0.0-beta.3 (2021-04-06) diff --git a/sdk/keyvault/keyvault-admin/review/keyvault-admin.api.md b/sdk/keyvault/keyvault-admin/review/keyvault-admin.api.md index c699a290a773..fba9a7261cb9 100644 --- a/sdk/keyvault/keyvault-admin/review/keyvault-admin.api.md +++ b/sdk/keyvault/keyvault-admin/review/keyvault-admin.api.md @@ -63,7 +63,7 @@ export class KeyVaultBackupClient { constructor(vaultUrl: string, credential: TokenCredential, options?: KeyVaultBackupClientOptions); beginBackup(blobStorageUri: string, sasToken: string, options?: KeyVaultBeginBackupOptions): Promise>; beginRestore(folderUri: string, sasToken: string, options?: KeyVaultBeginRestoreOptions): Promise>; - beginSelectiveKeyRestore(keyName: string, folderUri: string, sasToken: string, options?: KeyVaultBeginBackupOptions): Promise>; + beginSelectiveKeyRestore(keyName: string, folderUri: string, sasToken: string, options?: KeyVaultBeginSelectiveKeyRestoreOptions): Promise>; readonly vaultUrl: string; } @@ -97,7 +97,7 @@ export interface KeyVaultBeginRestoreOptions extends KeyVaultBackupPollerOptions } // @public -export interface KeyVaultBeginSelectiveRestoreOptions extends KeyVaultBackupPollerOptions { +export interface KeyVaultBeginSelectiveKeyRestoreOptions extends KeyVaultBackupPollerOptions { } // @public @@ -152,13 +152,13 @@ export interface KeyVaultRoleDefinition { export type KeyVaultRoleScope = "/" | "/keys" | string; // @public -export interface KeyVaultSelectiveKeyRestoreResult { - endTime?: Date; - startTime: Date; +export interface KeyVaultSelectiveKeyRestoreOperationState extends KeyVaultAdminPollOperationState { } // @public -export interface KeyVaultSelectiveRestoreOperationState extends KeyVaultAdminPollOperationState { +export interface KeyVaultSelectiveKeyRestoreResult { + endTime?: Date; + startTime: Date; } // @public diff --git a/sdk/keyvault/keyvault-admin/samples/v4/javascript/README.md b/sdk/keyvault/keyvault-admin/samples/v4/javascript/README.md index 978a2f8b5ab0..e82c896d4e59 100644 --- a/sdk/keyvault/keyvault-admin/samples/v4/javascript/README.md +++ b/sdk/keyvault/keyvault-admin/samples/v4/javascript/README.md @@ -14,9 +14,9 @@ These sample programs show how to use the JavaScript client libraries for Azure | **File Name** | **Description** | | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -| [accessControlHelloWorld.js][accesscontrolhelloworld] | Uses an AccessControlClient to list, create, and assign roles to users. | -| [backupRestoreHelloWorld.js][backuprestorehelloworld] | Uses a BackupClient to backup and fully restore an Azure Key Vault using Azure Storage Blob. | -| [backupSelectiveKeyRestore.js][backupselectiveKeyrestore] | Uses a BackupClient to backup and restore a specific key in Azure Key Vault using Azure Storage Blob. | +| [accessControlHelloWorld.js][accesscontrolhelloworld] | Uses an KeyVaultAccessControlClient to list, create, and assign roles to users. | +| [backupRestoreHelloWorld.js][backuprestorehelloworld] | Uses a KeyVaultBackupClient to backup and fully restore an Azure Key Vault using Azure Storage Blob. | +| [backupSelectiveKeyRestore.js][backupselectiveKeyrestore] | Uses a KeyVaultBackupClient to backup and restore a specific key in Azure Key Vault using Azure Storage Blob. | ## Prerequisites diff --git a/sdk/keyvault/keyvault-admin/samples/v4/typescript/README.md b/sdk/keyvault/keyvault-admin/samples/v4/typescript/README.md index 9480414661ea..1b0f91b66071 100644 --- a/sdk/keyvault/keyvault-admin/samples/v4/typescript/README.md +++ b/sdk/keyvault/keyvault-admin/samples/v4/typescript/README.md @@ -14,9 +14,9 @@ These sample programs show how to use the TypeScript client libraries for Azure | **File Name** | **Description** | | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -| [accessControlHelloWorld.ts][accesscontrolhelloworld] | Uses an AccessControlClient to list, create, and assign roles to users. | -| [backupRestoreHelloWorld.ts][backuprestorehelloworld] | Uses a BackupClient to backup and fully restore an Azure Key Vault using Azure Storage Blob. | -| [backupSelectiveKeyRestore.ts][backupselectiveKeyrestore] | Uses a BackupClient to backup and restore a specific key in Azure Key Vault using Azure Storage Blob. | +| [accessControlHelloWorld.ts][accesscontrolhelloworld] | Uses an KeyVaultAccessControlClient to list, create, and assign roles to users. | +| [backupRestoreHelloWorld.ts][backuprestorehelloworld] | Uses a KeyVaultBackupClient to backup and fully restore an Azure Key Vault using Azure Storage Blob. | +| [backupSelectiveKeyRestore.ts][backupselectiveKeyrestore] | Uses a KeyVaultBackupClient to backup and restore a specific key in Azure Key Vault using Azure Storage Blob. | ## Prerequisites diff --git a/sdk/keyvault/keyvault-admin/src/backupClient.ts b/sdk/keyvault/keyvault-admin/src/backupClient.ts index 402f6c8d98ef..0660b642dbcb 100644 --- a/sdk/keyvault/keyvault-admin/src/backupClient.ts +++ b/sdk/keyvault/keyvault-admin/src/backupClient.ts @@ -17,6 +17,7 @@ import { KeyVaultBackupResult, KeyVaultBeginBackupOptions, KeyVaultBeginRestoreOptions, + KeyVaultBeginSelectiveKeyRestoreOptions, KeyVaultRestoreResult, KeyVaultSelectiveKeyRestoreResult } from "./backupClientModels"; @@ -28,14 +29,14 @@ import { KeyVaultSelectiveKeyRestorePoller } from "./lro/selectiveKeyRestore/pol import { KeyVaultBackupOperationState } from "./lro/backup/operation"; import { KeyVaultRestoreOperationState } from "./lro/restore/operation"; import { KeyVaultAdminPollOperationState } from "./lro/keyVaultAdminPoller"; -import { KeyVaultSelectiveRestoreOperationState } from "./lro/selectiveKeyRestore/operation"; +import { KeyVaultSelectiveKeyRestoreOperationState } from "./lro/selectiveKeyRestore/operation"; import { KeyVaultClientOptionalParams } from "./generated/models"; import { mappings } from "./mappings"; export { KeyVaultBackupOperationState, KeyVaultRestoreOperationState, - KeyVaultSelectiveRestoreOperationState, + KeyVaultSelectiveKeyRestoreOperationState, KeyVaultAdminPollOperationState }; @@ -258,9 +259,9 @@ export class KeyVaultBackupClient { keyName: string, folderUri: string, sasToken: string, - options: KeyVaultBeginBackupOptions = {} + options: KeyVaultBeginSelectiveKeyRestoreOptions = {} ): Promise< - PollerLike + PollerLike > { const poller = new KeyVaultSelectiveKeyRestorePoller({ ...mappings.folderUriParts(folderUri), diff --git a/sdk/keyvault/keyvault-admin/src/backupClientModels.ts b/sdk/keyvault/keyvault-admin/src/backupClientModels.ts index f5ee495b2016..8ab3eac1cfe0 100644 --- a/sdk/keyvault/keyvault-admin/src/backupClientModels.ts +++ b/sdk/keyvault/keyvault-admin/src/backupClientModels.ts @@ -43,9 +43,9 @@ export interface KeyVaultBeginRestoreOptions extends KeyVaultBackupPollerOptions /** * An interface representing the optional parameters that can be - * passed to {@link beginSelectiveRestore} + * passed to {@link beginSelectiveKeyRestore} */ -export interface KeyVaultBeginSelectiveRestoreOptions extends KeyVaultBackupPollerOptions {} +export interface KeyVaultBeginSelectiveKeyRestoreOptions extends KeyVaultBackupPollerOptions {} /** * An interface representing the result of a backup operation. diff --git a/sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/operation.ts b/sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/operation.ts index 1cb77f6f77b8..254c597d1e70 100644 --- a/sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/operation.ts +++ b/sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/operation.ts @@ -20,13 +20,13 @@ import { withTrace } from "./poller"; /** * An interface representing the publicly available properties of the state of a restore Key Vault's poll operation. */ -export interface KeyVaultSelectiveRestoreOperationState +export interface KeyVaultSelectiveKeyRestoreOperationState extends KeyVaultAdminPollOperationState {} /** * An internal interface representing the state of a restore Key Vault's poll operation. */ -export interface KeyVaultSelectiveRestorePollOperationState +export interface KeyVaultSelectiveKeyRestorePollOperationState extends KeyVaultAdminPollOperationState { /** * The name of a Key Vault Key. @@ -49,12 +49,12 @@ export interface KeyVaultSelectiveRestorePollOperationState /** * The selective restore Key Vault's poll operation. */ -export class KeyVaultSelectiveRestorePollOperation extends KeyVaultAdminPollOperation< - KeyVaultSelectiveRestorePollOperationState, +export class KeyVaultSelectiveKeyRestorePollOperation extends KeyVaultAdminPollOperation< + KeyVaultSelectiveKeyRestorePollOperationState, string > { constructor( - public state: KeyVaultSelectiveRestorePollOperationState, + public state: KeyVaultSelectiveKeyRestorePollOperationState, private vaultUrl: string, private client: KeyVaultClient, private requestOptions: RequestOptionsBase = {} @@ -92,9 +92,9 @@ export class KeyVaultSelectiveRestorePollOperation extends KeyVaultAdminPollOper async update( options: { abortSignal?: AbortSignalLike; - fireProgress?: (state: KeyVaultSelectiveRestorePollOperationState) => void; + fireProgress?: (state: KeyVaultSelectiveKeyRestorePollOperationState) => void; } = {} - ): Promise { + ): Promise { const state = this.state; const { keyName, folderUri, sasToken, folderName } = state; diff --git a/sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/poller.ts b/sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/poller.ts index 67c341792ca6..eb7a53b3932f 100644 --- a/sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/poller.ts +++ b/sdk/keyvault/keyvault-admin/src/lro/selectiveKeyRestore/poller.ts @@ -2,15 +2,15 @@ // Licensed under the MIT license. import { - KeyVaultSelectiveRestorePollOperation, - KeyVaultSelectiveRestoreOperationState, - KeyVaultSelectiveRestorePollOperationState + KeyVaultSelectiveKeyRestorePollOperation, + KeyVaultSelectiveKeyRestoreOperationState, + KeyVaultSelectiveKeyRestorePollOperationState } from "./operation"; import { KeyVaultAdminPollerOptions, KeyVaultAdminPoller } from "../keyVaultAdminPoller"; import { KeyVaultSelectiveKeyRestoreResult } from "../../backupClientModels"; import { createTraceFunction } from "../../../../keyvault-common/src"; -export interface KeyVaultSelectiveRestorePollerOptions extends KeyVaultAdminPollerOptions { +export interface KeyVaultSelectiveKeyRestorePollerOptions extends KeyVaultAdminPollerOptions { keyName: string; folderUri: string; sasToken: string; @@ -20,16 +20,18 @@ export interface KeyVaultSelectiveRestorePollerOptions extends KeyVaultAdminPoll /** * @internal */ -export const withTrace = createTraceFunction("Azure.KeyVault.Admin.KeyVaultSelectiveRestorePoller"); +export const withTrace = createTraceFunction( + "Azure.KeyVault.Admin.KeyVaultSelectiveKeyRestorePoller" +); /** * Class that creates a poller that waits until a key of a Key Vault backup ends up being restored. */ export class KeyVaultSelectiveKeyRestorePoller extends KeyVaultAdminPoller< - KeyVaultSelectiveRestoreOperationState, + KeyVaultSelectiveKeyRestoreOperationState, KeyVaultSelectiveKeyRestoreResult > { - constructor(options: KeyVaultSelectiveRestorePollerOptions) { + constructor(options: KeyVaultSelectiveKeyRestorePollerOptions) { const { client, vaultUrl, @@ -42,13 +44,13 @@ export class KeyVaultSelectiveKeyRestorePoller extends KeyVaultAdminPoller< resumeFrom } = options; - let state: KeyVaultSelectiveRestorePollOperationState | undefined; + let state: KeyVaultSelectiveKeyRestorePollOperationState | undefined; if (resumeFrom) { state = JSON.parse(resumeFrom).state; } - const operation = new KeyVaultSelectiveRestorePollOperation( + const operation = new KeyVaultSelectiveKeyRestorePollOperation( { ...state, keyName,