From 331cae36691b6521bb64162157080b8c24c6b36e Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Tue, 24 Mar 2020 16:40:13 +0800 Subject: [PATCH] undo 'add snapshot to options' --- .../storage-blob/review/storage-blob.api.md | 4 --- sdk/storage/storage-blob/src/Clients.ts | 34 ------------------- .../storage-blob/test/blobversioning.spec.ts | 14 +++----- 3 files changed, 5 insertions(+), 47 deletions(-) diff --git a/sdk/storage/storage-blob/review/storage-blob.api.md b/sdk/storage/storage-blob/review/storage-blob.api.md index e3cbe4fa6434..543ab6e247f6 100644 --- a/sdk/storage/storage-blob/review/storage-blob.api.md +++ b/sdk/storage/storage-blob/review/storage-blob.api.md @@ -454,7 +454,6 @@ export interface BlobDeleteOptions extends CommonOptions { conditions?: BlobRequestConditions; customerProvidedKey?: CpkInfo; deleteSnapshots?: DeleteSnapshotsOptionType; - snapshot?: string; versionId?: string; } @@ -553,7 +552,6 @@ export interface BlobDownloadToBufferOptions extends CommonOptions { customerProvidedKey?: CpkInfo; maxRetryRequestsPerBlock?: number; onProgress?: (progress: TransferProgressEvent) => void; - snapshot?: string; versionId?: string; } @@ -562,7 +560,6 @@ export interface BlobExistsOptions extends CommonOptions { abortSignal?: AbortSignalLike; conditions?: BlobRequestConditions; customerProvidedKey?: CpkInfo; - snapshot?: string; versionId?: string; } @@ -625,7 +622,6 @@ export interface BlobGetPropertiesOptions extends CommonOptions { abortSignal?: AbortSignalLike; conditions?: BlobRequestConditions; customerProvidedKey?: CpkInfo; - snapshot?: string; versionId?: string; } diff --git a/sdk/storage/storage-blob/src/Clients.ts b/sdk/storage/storage-blob/src/Clients.ts index 4f13701acf6a..7b8080653422 100644 --- a/sdk/storage/storage-blob/src/Clients.ts +++ b/sdk/storage/storage-blob/src/Clients.ts @@ -298,14 +298,6 @@ export interface BlobExistsOptions extends CommonOptions { * @memberof BlobExistsOptions */ conditions?: BlobRequestConditions; - /** - * An opaque DateTime value that, when present, specifies the blob - * snapshot to retrieve. - * - * @type {string} - * @memberof BlobExistsOptions - */ - snapshot?: string; /** * An opaque DateTime value that, when present, specifies the version * of the blob to retrieve. It's for service version 2019-10-10 and newer. @@ -345,14 +337,6 @@ export interface BlobGetPropertiesOptions extends CommonOptions { * @memberof BlobGetPropertiesOptions */ customerProvidedKey?: CpkInfo; - /** - * An opaque DateTime value that, when present, specifies the blob - * snapshot to retrieve. - * - * @type {string} - * @memberof BlobGetPropertiesOptions - */ - snapshot?: string; /** * An opaque DateTime value that, when present, specifies the version * of the blob to retrieve. It's for service version 2019-10-10 and newer. @@ -401,13 +385,6 @@ export interface BlobDeleteOptions extends CommonOptions { * @memberof BlobDeleteOptions */ customerProvidedKey?: CpkInfo; - /** - * An opaque DateTime value that, when present, specifies the blob snapshot to delete. - * - * @type {string} - * @memberof BlobDeleteOptions - */ - snapshot?: string; /** * An opaque DateTime value that, when present, specifies the version * of the blob to delete. It's for service version 2019-10-10 and newer. @@ -913,13 +890,6 @@ export interface BlobDownloadToBufferOptions extends CommonOptions { * @memberof BlobDownloadToBufferOptions */ customerProvidedKey?: CpkInfo; - /** - * An opaque DateTime string value that, when present, specifies the blob snapshot to retrieve. - * - * @type {string} - * @memberof BlobDownloadToBufferOptions - */ - snapshot?: string; /** * An opaque DateTime string value that, when present, specifies the version of the blob * to retrieve. It's for service version 2019-10-10 and newer. @@ -1360,7 +1330,6 @@ export class BlobClient extends StorageClient { abortSignal: options.abortSignal, customerProvidedKey: options.customerProvidedKey, versionId: options.versionId, - snapshot: options.snapshot, conditions: options.conditions, tracingOptions: { ...options.tracingOptions, @@ -1412,7 +1381,6 @@ export class BlobClient extends StorageClient { leaseAccessConditions: options.conditions, modifiedAccessConditions: options.conditions, cpkInfo: options.customerProvidedKey, - snapshot: options.snapshot, versionId: options.versionId, spanOptions }); @@ -1447,7 +1415,6 @@ export class BlobClient extends StorageClient { deleteSnapshots: options.deleteSnapshots, leaseAccessConditions: options.conditions, modifiedAccessConditions: options.conditions, - snapshot: options.snapshot, versionId: options.versionId, spanOptions }); @@ -1969,7 +1936,6 @@ export class BlobClient extends StorageClient { conditions: options.conditions, maxRetryRequests: options.maxRetryRequestsPerBlock, customerProvidedKey: options.customerProvidedKey, - snapshot: options.snapshot, versionId: options.versionId, tracingOptions: { ...options.tracingOptions, diff --git a/sdk/storage/storage-blob/test/blobversioning.spec.ts b/sdk/storage/storage-blob/test/blobversioning.spec.ts index 5cdbea4653fa..f04cea396cce 100644 --- a/sdk/storage/storage-blob/test/blobversioning.spec.ts +++ b/sdk/storage/storage-blob/test/blobversioning.spec.ts @@ -138,9 +138,8 @@ describe("Blob versioning", () => { const snapshotRes = await blobClient.createSnapshot(); let exceptionCaught = false; try { - await blobClient.getProperties({ + await blobClient.withSnapshot(snapshotRes.snapshot!).getProperties({ versionId: uploadRes.versionId, - snapshot: snapshotRes.snapshot }); } catch (err) { assert.equal(err.details.errorCode, "MutuallyExclusiveQueryParameters"); @@ -249,10 +248,9 @@ describe("Blob versioning", () => { assert.ok(result.snapshot); assert.ok(result.versionId); - await blobClient.delete({ snapshot: result.snapshot }); - const snapshotExists = await blobClient.exists({ - snapshot: result.snapshot, - }); + const snapshotClient = blobClient.withSnapshot(result.snapshot!); + await snapshotClient.delete(); + const snapshotExists = await snapshotClient.exists(); assert.ok(!snapshotExists); const rootExists = await blobClient.exists(); @@ -273,9 +271,7 @@ describe("Blob versioning", () => { assert.ok(exceptionCaught); blobClient.delete({ deleteSnapshots: "include" }); - const snapshotExists = await blobClient.exists({ - snapshot: result.snapshot, - }); + const snapshotExists = await blobClient.withSnapshot(result.snapshot!).exists(); assert.ok(!snapshotExists); const rootExists = await blobClient.exists(); assert.ok(!rootExists);