@azure/storage-blob 12.13.0-alpha.20230126.2 → 12.13.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5893 -5343
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-blob/src/BatchResponse.js.map +1 -1
- package/dist-esm/storage-blob/src/BatchResponseParser.js +2 -3
- package/dist-esm/storage-blob/src/BatchResponseParser.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobBatch.js +87 -74
- package/dist-esm/storage-blob/src/BlobBatch.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobBatchClient.js +23 -10
- package/dist-esm/storage-blob/src/BlobBatchClient.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobDownloadResponse.js +1 -1
- package/dist-esm/storage-blob/src/BlobDownloadResponse.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobLeaseClient.js +83 -54
- package/dist-esm/storage-blob/src/BlobLeaseClient.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobQueryResponse.browser.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobQueryResponse.js +1 -1
- package/dist-esm/storage-blob/src/BlobQueryResponse.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobServiceClient.js +165 -67
- package/dist-esm/storage-blob/src/BlobServiceClient.js.map +1 -1
- package/dist-esm/storage-blob/src/Clients.js +889 -651
- package/dist-esm/storage-blob/src/Clients.js.map +1 -1
- package/dist-esm/storage-blob/src/ContainerClient.js +238 -115
- package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -1
- package/dist-esm/storage-blob/src/PageBlobRangeResponse.js.map +1 -1
- package/dist-esm/storage-blob/src/Pipeline.js +40 -194
- package/dist-esm/storage-blob/src/Pipeline.js.map +1 -1
- package/dist-esm/storage-blob/src/StorageBrowserPolicyFactory.js.map +1 -1
- package/dist-esm/storage-blob/src/StorageClient.js +17 -4
- package/dist-esm/storage-blob/src/StorageClient.js.map +1 -1
- package/dist-esm/storage-blob/src/StorageRetryPolicyFactory.js.map +1 -1
- package/dist-esm/storage-blob/src/TelemetryPolicyFactory.js +50 -0
- package/dist-esm/storage-blob/src/TelemetryPolicyFactory.js.map +1 -0
- package/dist-esm/storage-blob/src/credentials/AnonymousCredential.js.map +1 -1
- package/dist-esm/storage-blob/src/credentials/Credential.js.map +1 -1
- package/dist-esm/storage-blob/src/credentials/StorageSharedKeyCredential.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/index.js +1 -1
- package/dist-esm/storage-blob/src/generated/src/index.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/models/index.js +1 -248
- package/dist-esm/storage-blob/src/generated/src/models/index.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/models/mappers.js +11 -13
- package/dist-esm/storage-blob/src/generated/src/models/mappers.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/models/parameters.js +5 -5
- package/dist-esm/storage-blob/src/generated/src/models/parameters.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/operations/appendBlob.js +27 -11
- package/dist-esm/storage-blob/src/generated/src/operations/appendBlob.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/operations/blob.js +110 -28
- package/dist-esm/storage-blob/src/generated/src/operations/blob.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js +43 -16
- package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/operations/container.js +86 -22
- package/dist-esm/storage-blob/src/generated/src/operations/container.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js +54 -16
- package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/operations/service.js +42 -12
- package/dist-esm/storage-blob/src/generated/src/operations/service.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/storageClient.js +10 -32
- package/dist-esm/storage-blob/src/generated/src/storageClient.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/storageClientContext.js +39 -0
- package/dist-esm/storage-blob/src/generated/src/storageClientContext.js.map +1 -0
- package/dist-esm/storage-blob/src/generatedModels.js.map +1 -1
- package/dist-esm/storage-blob/src/index.browser.js +2 -3
- package/dist-esm/storage-blob/src/index.browser.js.map +1 -1
- package/dist-esm/storage-blob/src/index.js +2 -3
- package/dist-esm/storage-blob/src/index.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/AnonymousCredentialPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/CredentialPolicy.js +1 -1
- package/dist-esm/storage-blob/src/policies/CredentialPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/StorageBearerTokenChallengeAuthenticationPolicy.js +245 -0
- package/dist-esm/storage-blob/src/policies/StorageBearerTokenChallengeAuthenticationPolicy.js.map +1 -0
- package/dist-esm/storage-blob/src/policies/StorageBrowserPolicy.js +1 -2
- package/dist-esm/storage-blob/src/policies/StorageBrowserPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js +1 -1
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/TelemetryPolicy.js +36 -0
- package/dist-esm/storage-blob/src/policies/TelemetryPolicy.js.map +1 -0
- package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js +1 -1
- package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/BlobQuickQueryStream.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/RetriableReadableStream.js +2 -10
- package/dist-esm/storage-blob/src/utils/RetriableReadableStream.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/cache.js +2 -8
- package/dist-esm/storage-blob/src/utils/cache.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/constants.js +2 -2
- package/dist-esm/storage-blob/src/utils/constants.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/tracing.js +18 -5
- package/dist-esm/storage-blob/src/utils/tracing.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/utils.common.js +42 -91
- package/dist-esm/storage-blob/src/utils/utils.common.js.map +1 -1
- package/package.json +8 -16
- package/types/3.1/storage-blob.d.ts +625 -2332
- package/types/latest/storage-blob.d.ts +606 -2493
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/appendBlob.js +0 -9
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/appendBlob.js.map +0 -1
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blob.js +0 -9
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blob.js.map +0 -1
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blockBlob.js +0 -9
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blockBlob.js.map +0 -1
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/container.js +0 -9
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/container.js.map +0 -1
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/index.js +0 -14
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/index.js.map +0 -1
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/pageBlob.js +0 -9
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/pageBlob.js.map +0 -1
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/service.js +0 -9
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/service.js.map +0 -1
- package/dist-esm/storage-blob/src/policies/PathParameterWorkaroundPolicy.js +0 -25
- package/dist-esm/storage-blob/src/policies/PathParameterWorkaroundPolicy.js.map +0 -1
- package/dist-esm/storage-blob/src/policies/RequestPolicy.js +0 -40
- package/dist-esm/storage-blob/src/policies/RequestPolicy.js.map +0 -1
- package/dist-esm/storage-blob/src/policies/StorageBrowserPolicyV2.js +0 -31
- package/dist-esm/storage-blob/src/policies/StorageBrowserPolicyV2.js.map +0 -1
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js +0 -165
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js.map +0 -1
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.browser.js +0 -18
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.browser.js.map +0 -1
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.js +0 -131
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.js.map +0 -1
@@ -1,12 +1,11 @@
|
|
1
1
|
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
2
|
-
import { getDefaultProxySettings, } from "@azure/core-
|
3
|
-
import {
|
4
|
-
import { isNode } from "@azure/core-util";
|
5
|
-
import { v4 as generateUuid } from "uuid";
|
2
|
+
import { generateUuid, getDefaultProxySettings, isNode, isTokenCredential, URLBuilder, } from "@azure/core-http";
|
3
|
+
import { SpanStatusCode } from "@azure/core-tracing";
|
6
4
|
import { BlobDownloadResponse } from "./BlobDownloadResponse";
|
7
5
|
import { BlobQueryResponse } from "./BlobQueryResponse";
|
8
6
|
import { AnonymousCredential } from "./credentials/AnonymousCredential";
|
9
7
|
import { StorageSharedKeyCredential } from "./credentials/StorageSharedKeyCredential";
|
8
|
+
import { AppendBlob, Blob as StorageBlob, BlockBlob, PageBlob } from "./generated/src/operations";
|
10
9
|
import { ensureCpkIfSpecified, toAccessTier, } from "./models";
|
11
10
|
import { rangeResponseFromModel, } from "./PageBlobRangeResponse";
|
12
11
|
import { newPipeline, isPipelineLike } from "./Pipeline";
|
@@ -16,8 +15,8 @@ import { StorageClient } from "./StorageClient";
|
|
16
15
|
import { Batch } from "./utils/Batch";
|
17
16
|
import { BufferScheduler } from "../../storage-common/src";
|
18
17
|
import { BlobDoesNotUseCustomerSpecifiedEncryption, BlobUsesCustomerSpecifiedEncryptionMsg, BLOCK_BLOB_MAX_BLOCKS, BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES, BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES, DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES, DEFAULT_BLOCK_BUFFER_SIZE_BYTES, DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS, ETagAny, URLConstants, } from "./utils/constants";
|
19
|
-
import {
|
20
|
-
import { appendToURLPath, appendToURLQuery,
|
18
|
+
import { createSpan, convertTracingToRequestOptionsBase } from "./utils/tracing";
|
19
|
+
import { appendToURLPath, appendToURLQuery, extractConnectionStringParts, ExtractPageRangeInfoItems, generateBlockID, getURLParameter, httpAuthorizationToString, isIpEndpointStyle, parseObjectReplicationRecord, setURLParameter, toBlobTags, toBlobTagsString, toQuerySerialization, toTags, } from "./utils/utils.common";
|
21
20
|
import { fsCreateReadStream, fsStat, readStreamToLocalFile, streamToBuffer, } from "./utils/utils.node";
|
22
21
|
import { generateBlobSASQueryParameters } from "./sas/BlobSASSignatureValues";
|
23
22
|
import { BlobLeaseClient } from "./BlobLeaseClient";
|
@@ -91,7 +90,7 @@ export class BlobClient extends StorageClient {
|
|
91
90
|
super(url, pipeline);
|
92
91
|
({ blobName: this._name, containerName: this._containerName } =
|
93
92
|
this.getBlobAndContainerNamesFromUrl());
|
94
|
-
this.blobContext = this.storageClientContext
|
93
|
+
this.blobContext = new StorageBlob(this.storageClientContext);
|
95
94
|
this._snapshot = getURLParameter(this.url, URLConstants.Parameters.SNAPSHOT);
|
96
95
|
this._versionId = getURLParameter(this.url, URLConstants.Parameters.VERSIONID);
|
97
96
|
}
|
@@ -208,25 +207,15 @@ export class BlobClient extends StorageClient {
|
|
208
207
|
* ```
|
209
208
|
*/
|
210
209
|
async download(offset = 0, count, options = {}) {
|
210
|
+
var _a;
|
211
211
|
options.conditions = options.conditions || {};
|
212
212
|
options.conditions = options.conditions || {};
|
213
213
|
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
214
|
-
|
215
|
-
|
216
|
-
const res =
|
217
|
-
abortSignal: options.abortSignal,
|
218
|
-
leaseAccessConditions: options.conditions,
|
219
|
-
modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }),
|
220
|
-
requestOptions: {
|
214
|
+
const { span, updatedOptions } = createSpan("BlobClient-download", options);
|
215
|
+
try {
|
216
|
+
const res = await this.blobContext.download(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), requestOptions: {
|
221
217
|
onDownloadProgress: isNode ? undefined : options.onProgress, // for Node.js, progress is reported by RetriableReadableStream
|
222
|
-
},
|
223
|
-
range: offset === 0 && !count ? undefined : rangeToString({ offset, count }),
|
224
|
-
rangeGetContentMD5: options.rangeGetContentMD5,
|
225
|
-
rangeGetContentCRC64: options.rangeGetContentCrc64,
|
226
|
-
snapshot: options.snapshot,
|
227
|
-
cpkInfo: options.customerProvidedKey,
|
228
|
-
tracingOptions: updatedOptions.tracingOptions,
|
229
|
-
}));
|
218
|
+
}, range: offset === 0 && !count ? undefined : rangeToString({ offset, count }), rangeGetContentMD5: options.rangeGetContentMD5, rangeGetContentCRC64: options.rangeGetContentCrc64, snapshot: options.snapshot, cpkInfo: options.customerProvidedKey }, convertTracingToRequestOptionsBase(updatedOptions)));
|
230
219
|
const wrappedRes = Object.assign(Object.assign({}, res), { _response: res._response, objectReplicationDestinationPolicyId: res.objectReplicationPolicyId, objectReplicationSourceProperties: parseObjectReplicationRecord(res.objectReplicationRules) });
|
231
220
|
// Return browser response immediately
|
232
221
|
if (!isNode) {
|
@@ -278,7 +267,17 @@ export class BlobClient extends StorageClient {
|
|
278
267
|
maxRetryRequests: options.maxRetryRequests,
|
279
268
|
onProgress: options.onProgress,
|
280
269
|
});
|
281
|
-
}
|
270
|
+
}
|
271
|
+
catch (e) {
|
272
|
+
span.setStatus({
|
273
|
+
code: SpanStatusCode.ERROR,
|
274
|
+
message: e.message,
|
275
|
+
});
|
276
|
+
throw e;
|
277
|
+
}
|
278
|
+
finally {
|
279
|
+
span.end();
|
280
|
+
}
|
282
281
|
}
|
283
282
|
/**
|
284
283
|
* Returns true if the Azure blob resource represented by this client exists; false otherwise.
|
@@ -290,31 +289,37 @@ export class BlobClient extends StorageClient {
|
|
290
289
|
* @param options - options to Exists operation.
|
291
290
|
*/
|
292
291
|
async exists(options = {}) {
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
292
|
+
const { span, updatedOptions } = createSpan("BlobClient-exists", options);
|
293
|
+
try {
|
294
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
295
|
+
await this.getProperties({
|
296
|
+
abortSignal: options.abortSignal,
|
297
|
+
customerProvidedKey: options.customerProvidedKey,
|
298
|
+
conditions: options.conditions,
|
299
|
+
tracingOptions: updatedOptions.tracingOptions,
|
300
|
+
});
|
301
|
+
return true;
|
302
|
+
}
|
303
|
+
catch (e) {
|
304
|
+
if (e.statusCode === 404) {
|
305
|
+
// Expected exception when checking blob existence
|
306
|
+
return false;
|
303
307
|
}
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
else if (e.statusCode === 409 &&
|
310
|
-
(e.details.errorCode === BlobUsesCustomerSpecifiedEncryptionMsg ||
|
311
|
-
e.details.errorCode === BlobDoesNotUseCustomerSpecifiedEncryption)) {
|
312
|
-
// Expected exception when checking blob existence
|
313
|
-
return true;
|
314
|
-
}
|
315
|
-
throw e;
|
308
|
+
else if (e.statusCode === 409 &&
|
309
|
+
(e.details.errorCode === BlobUsesCustomerSpecifiedEncryptionMsg ||
|
310
|
+
e.details.errorCode === BlobDoesNotUseCustomerSpecifiedEncryption)) {
|
311
|
+
// Expected exception when checking blob existence
|
312
|
+
return true;
|
316
313
|
}
|
317
|
-
|
314
|
+
span.setStatus({
|
315
|
+
code: SpanStatusCode.ERROR,
|
316
|
+
message: e.message,
|
317
|
+
});
|
318
|
+
throw e;
|
319
|
+
}
|
320
|
+
finally {
|
321
|
+
span.end();
|
322
|
+
}
|
318
323
|
}
|
319
324
|
/**
|
320
325
|
* Returns all user-defined metadata, standard HTTP properties, and system properties
|
@@ -329,19 +334,24 @@ export class BlobClient extends StorageClient {
|
|
329
334
|
* @param options - Optional options to Get Properties operation.
|
330
335
|
*/
|
331
336
|
async getProperties(options = {}) {
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
leaseAccessConditions: options.conditions,
|
339
|
-
modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }),
|
340
|
-
cpkInfo: options.customerProvidedKey,
|
341
|
-
tracingOptions: updatedOptions.tracingOptions,
|
342
|
-
}));
|
337
|
+
var _a;
|
338
|
+
const { span, updatedOptions } = createSpan("BlobClient-getProperties", options);
|
339
|
+
try {
|
340
|
+
options.conditions = options.conditions || {};
|
341
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
342
|
+
const res = await this.blobContext.getProperties(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey }, convertTracingToRequestOptionsBase(updatedOptions)));
|
343
343
|
return Object.assign(Object.assign({}, res), { _response: res._response, objectReplicationDestinationPolicyId: res.objectReplicationPolicyId, objectReplicationSourceProperties: parseObjectReplicationRecord(res.objectReplicationRules) });
|
344
|
-
}
|
344
|
+
}
|
345
|
+
catch (e) {
|
346
|
+
span.setStatus({
|
347
|
+
code: SpanStatusCode.ERROR,
|
348
|
+
message: e.message,
|
349
|
+
});
|
350
|
+
throw e;
|
351
|
+
}
|
352
|
+
finally {
|
353
|
+
span.end();
|
354
|
+
}
|
345
355
|
}
|
346
356
|
/**
|
347
357
|
* Marks the specified blob or snapshot for deletion. The blob is later deleted
|
@@ -353,17 +363,22 @@ export class BlobClient extends StorageClient {
|
|
353
363
|
* @param options - Optional options to Blob Delete operation.
|
354
364
|
*/
|
355
365
|
async delete(options = {}) {
|
366
|
+
var _a;
|
367
|
+
const { span, updatedOptions } = createSpan("BlobClient-delete", options);
|
356
368
|
options.conditions = options.conditions || {};
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
}
|
369
|
+
try {
|
370
|
+
return await this.blobContext.delete(Object.assign({ abortSignal: options.abortSignal, deleteSnapshots: options.deleteSnapshots, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }) }, convertTracingToRequestOptionsBase(updatedOptions)));
|
371
|
+
}
|
372
|
+
catch (e) {
|
373
|
+
span.setStatus({
|
374
|
+
code: SpanStatusCode.ERROR,
|
375
|
+
message: e.message,
|
376
|
+
});
|
377
|
+
throw e;
|
378
|
+
}
|
379
|
+
finally {
|
380
|
+
span.end();
|
381
|
+
}
|
367
382
|
}
|
368
383
|
/**
|
369
384
|
* Marks the specified blob or snapshot for deletion if it exists. The blob is later deleted
|
@@ -375,19 +390,29 @@ export class BlobClient extends StorageClient {
|
|
375
390
|
* @param options - Optional options to Blob Delete operation.
|
376
391
|
*/
|
377
392
|
async deleteIfExists(options = {}) {
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
393
|
+
var _a, _b;
|
394
|
+
const { span, updatedOptions } = createSpan("BlobClient-deleteIfExists", options);
|
395
|
+
try {
|
396
|
+
const res = await this.delete(updatedOptions);
|
397
|
+
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
|
398
|
+
}
|
399
|
+
catch (e) {
|
400
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobNotFound") {
|
401
|
+
span.setStatus({
|
402
|
+
code: SpanStatusCode.ERROR,
|
403
|
+
message: "Expected exception when deleting a blob or snapshot only if it exists.",
|
404
|
+
});
|
405
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
389
406
|
}
|
390
|
-
|
407
|
+
span.setStatus({
|
408
|
+
code: SpanStatusCode.ERROR,
|
409
|
+
message: e.message,
|
410
|
+
});
|
411
|
+
throw e;
|
412
|
+
}
|
413
|
+
finally {
|
414
|
+
span.end();
|
415
|
+
}
|
391
416
|
}
|
392
417
|
/**
|
393
418
|
* Restores the contents and metadata of soft deleted blob and any associated
|
@@ -398,12 +423,20 @@ export class BlobClient extends StorageClient {
|
|
398
423
|
* @param options - Optional options to Blob Undelete operation.
|
399
424
|
*/
|
400
425
|
async undelete(options = {}) {
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
426
|
+
const { span, updatedOptions } = createSpan("BlobClient-undelete", options);
|
427
|
+
try {
|
428
|
+
return await this.blobContext.undelete(Object.assign({ abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)));
|
429
|
+
}
|
430
|
+
catch (e) {
|
431
|
+
span.setStatus({
|
432
|
+
code: SpanStatusCode.ERROR,
|
433
|
+
message: e.message,
|
434
|
+
});
|
435
|
+
throw e;
|
436
|
+
}
|
437
|
+
finally {
|
438
|
+
span.end();
|
439
|
+
}
|
407
440
|
}
|
408
441
|
/**
|
409
442
|
* Sets system properties on the blob.
|
@@ -421,19 +454,23 @@ export class BlobClient extends StorageClient {
|
|
421
454
|
* @param options - Optional options to Blob Set HTTP Headers operation.
|
422
455
|
*/
|
423
456
|
async setHTTPHeaders(blobHTTPHeaders, options = {}) {
|
457
|
+
var _a;
|
458
|
+
const { span, updatedOptions } = createSpan("BlobClient-setHTTPHeaders", options);
|
424
459
|
options.conditions = options.conditions || {};
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
460
|
+
try {
|
461
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
462
|
+
return await this.blobContext.setHttpHeaders(Object.assign({ abortSignal: options.abortSignal, blobHttpHeaders: blobHTTPHeaders, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }) }, convertTracingToRequestOptionsBase(updatedOptions)));
|
463
|
+
}
|
464
|
+
catch (e) {
|
465
|
+
span.setStatus({
|
466
|
+
code: SpanStatusCode.ERROR,
|
467
|
+
message: e.message,
|
468
|
+
});
|
469
|
+
throw e;
|
470
|
+
}
|
471
|
+
finally {
|
472
|
+
span.end();
|
473
|
+
}
|
437
474
|
}
|
438
475
|
/**
|
439
476
|
* Sets user-defined metadata for the specified blob as one or more name-value pairs.
|
@@ -447,20 +484,23 @@ export class BlobClient extends StorageClient {
|
|
447
484
|
* @param options - Optional options to Set Metadata operation.
|
448
485
|
*/
|
449
486
|
async setMetadata(metadata, options = {}) {
|
487
|
+
var _a;
|
488
|
+
const { span, updatedOptions } = createSpan("BlobClient-setMetadata", options);
|
450
489
|
options.conditions = options.conditions || {};
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
490
|
+
try {
|
491
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
492
|
+
return await this.blobContext.setMetadata(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, metadata, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
|
493
|
+
}
|
494
|
+
catch (e) {
|
495
|
+
span.setStatus({
|
496
|
+
code: SpanStatusCode.ERROR,
|
497
|
+
message: e.message,
|
498
|
+
});
|
499
|
+
throw e;
|
500
|
+
}
|
501
|
+
finally {
|
502
|
+
span.end();
|
503
|
+
}
|
464
504
|
}
|
465
505
|
/**
|
466
506
|
* Sets tags on the underlying blob.
|
@@ -472,16 +512,21 @@ export class BlobClient extends StorageClient {
|
|
472
512
|
* @param options -
|
473
513
|
*/
|
474
514
|
async setTags(tags, options = {}) {
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
515
|
+
var _a;
|
516
|
+
const { span, updatedOptions } = createSpan("BlobClient-setTags", options);
|
517
|
+
try {
|
518
|
+
return await this.blobContext.setTags(Object.assign(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }) }, convertTracingToRequestOptionsBase(updatedOptions)), { tags: toBlobTags(tags) }));
|
519
|
+
}
|
520
|
+
catch (e) {
|
521
|
+
span.setStatus({
|
522
|
+
code: SpanStatusCode.ERROR,
|
523
|
+
message: e.message,
|
524
|
+
});
|
525
|
+
throw e;
|
526
|
+
}
|
527
|
+
finally {
|
528
|
+
span.end();
|
529
|
+
}
|
485
530
|
}
|
486
531
|
/**
|
487
532
|
* Gets the tags associated with the underlying blob.
|
@@ -489,17 +534,23 @@ export class BlobClient extends StorageClient {
|
|
489
534
|
* @param options -
|
490
535
|
*/
|
491
536
|
async getTags(options = {}) {
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
leaseAccessConditions: options.conditions,
|
497
|
-
modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }),
|
498
|
-
tracingOptions: updatedOptions.tracingOptions,
|
499
|
-
}));
|
537
|
+
var _a;
|
538
|
+
const { span, updatedOptions } = createSpan("BlobClient-getTags", options);
|
539
|
+
try {
|
540
|
+
const response = await this.blobContext.getTags(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }) }, convertTracingToRequestOptionsBase(updatedOptions)));
|
500
541
|
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, tags: toTags({ blobTagSet: response.blobTagSet }) || {} });
|
501
542
|
return wrappedResponse;
|
502
|
-
}
|
543
|
+
}
|
544
|
+
catch (e) {
|
545
|
+
span.setStatus({
|
546
|
+
code: SpanStatusCode.ERROR,
|
547
|
+
message: e.message,
|
548
|
+
});
|
549
|
+
throw e;
|
550
|
+
}
|
551
|
+
finally {
|
552
|
+
span.end();
|
553
|
+
}
|
503
554
|
}
|
504
555
|
/**
|
505
556
|
* Get a {@link BlobLeaseClient} that manages leases on the blob.
|
@@ -517,20 +568,23 @@ export class BlobClient extends StorageClient {
|
|
517
568
|
* @param options - Optional options to the Blob Create Snapshot operation.
|
518
569
|
*/
|
519
570
|
async createSnapshot(options = {}) {
|
571
|
+
var _a;
|
572
|
+
const { span, updatedOptions } = createSpan("BlobClient-createSnapshot", options);
|
520
573
|
options.conditions = options.conditions || {};
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
574
|
+
try {
|
575
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
576
|
+
return await this.blobContext.createSnapshot(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, metadata: options.metadata, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
|
577
|
+
}
|
578
|
+
catch (e) {
|
579
|
+
span.setStatus({
|
580
|
+
code: SpanStatusCode.ERROR,
|
581
|
+
message: e.message,
|
582
|
+
});
|
583
|
+
throw e;
|
584
|
+
}
|
585
|
+
finally {
|
586
|
+
span.end();
|
587
|
+
}
|
534
588
|
}
|
535
589
|
/**
|
536
590
|
* Asynchronously copies a blob to a destination within the storage account.
|
@@ -632,13 +686,20 @@ export class BlobClient extends StorageClient {
|
|
632
686
|
* @param options - Optional options to the Blob Abort Copy From URL operation.
|
633
687
|
*/
|
634
688
|
async abortCopyFromURL(copyId, options = {}) {
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
689
|
+
const { span, updatedOptions } = createSpan("BlobClient-abortCopyFromURL", options);
|
690
|
+
try {
|
691
|
+
return await this.blobContext.abortCopyFromURL(copyId, Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions }, convertTracingToRequestOptionsBase(updatedOptions)));
|
692
|
+
}
|
693
|
+
catch (e) {
|
694
|
+
span.setStatus({
|
695
|
+
code: SpanStatusCode.ERROR,
|
696
|
+
message: e.message,
|
697
|
+
});
|
698
|
+
throw e;
|
699
|
+
}
|
700
|
+
finally {
|
701
|
+
span.end();
|
702
|
+
}
|
642
703
|
}
|
643
704
|
/**
|
644
705
|
* The synchronous Copy From URL operation copies a blob or an internet resource to a new blob. It will not
|
@@ -649,33 +710,28 @@ export class BlobClient extends StorageClient {
|
|
649
710
|
* @param options -
|
650
711
|
*/
|
651
712
|
async syncCopyFromURL(copySource, options = {}) {
|
713
|
+
var _a, _b, _c;
|
714
|
+
const { span, updatedOptions } = createSpan("BlobClient-syncCopyFromURL", options);
|
652
715
|
options.conditions = options.conditions || {};
|
653
716
|
options.sourceConditions = options.sourceConditions || {};
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
immutabilityPolicyMode: (_g = options.immutabilityPolicy) === null || _g === void 0 ? void 0 : _g.policyMode,
|
673
|
-
legalHold: options.legalHold,
|
674
|
-
encryptionScope: options.encryptionScope,
|
675
|
-
copySourceTags: options.copySourceTags,
|
676
|
-
tracingOptions: updatedOptions.tracingOptions,
|
677
|
-
}));
|
678
|
-
});
|
717
|
+
try {
|
718
|
+
return await this.blobContext.copyFromURL(copySource, Object.assign({ abortSignal: options.abortSignal, metadata: options.metadata, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), sourceModifiedAccessConditions: {
|
719
|
+
sourceIfMatch: options.sourceConditions.ifMatch,
|
720
|
+
sourceIfModifiedSince: options.sourceConditions.ifModifiedSince,
|
721
|
+
sourceIfNoneMatch: options.sourceConditions.ifNoneMatch,
|
722
|
+
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince,
|
723
|
+
}, sourceContentMD5: options.sourceContentMD5, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags), immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, encryptionScope: options.encryptionScope, copySourceTags: options.copySourceTags }, convertTracingToRequestOptionsBase(updatedOptions)));
|
724
|
+
}
|
725
|
+
catch (e) {
|
726
|
+
span.setStatus({
|
727
|
+
code: SpanStatusCode.ERROR,
|
728
|
+
message: e.message,
|
729
|
+
});
|
730
|
+
throw e;
|
731
|
+
}
|
732
|
+
finally {
|
733
|
+
span.end();
|
734
|
+
}
|
679
735
|
}
|
680
736
|
/**
|
681
737
|
* Sets the tier on a blob. The operation is allowed on a page blob in a premium
|
@@ -689,19 +745,23 @@ export class BlobClient extends StorageClient {
|
|
689
745
|
* @param options - Optional options to the Blob Set Tier operation.
|
690
746
|
*/
|
691
747
|
async setAccessTier(tier, options = {}) {
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
748
|
+
var _a;
|
749
|
+
const { span, updatedOptions } = createSpan("BlobClient-setAccessTier", options);
|
750
|
+
try {
|
751
|
+
return await this.blobContext.setTier(toAccessTier(tier), Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), rehydratePriority: options.rehydratePriority }, convertTracingToRequestOptionsBase(updatedOptions)));
|
752
|
+
}
|
753
|
+
catch (e) {
|
754
|
+
span.setStatus({
|
755
|
+
code: SpanStatusCode.ERROR,
|
756
|
+
message: e.message,
|
757
|
+
});
|
758
|
+
throw e;
|
759
|
+
}
|
760
|
+
finally {
|
761
|
+
span.end();
|
762
|
+
}
|
702
763
|
}
|
703
764
|
async downloadToBuffer(param1, param2, param3, param4 = {}) {
|
704
|
-
var _a;
|
705
765
|
let buffer;
|
706
766
|
let offset = 0;
|
707
767
|
let count = 0;
|
@@ -716,26 +776,29 @@ export class BlobClient extends StorageClient {
|
|
716
776
|
count = typeof param2 === "number" ? param2 : 0;
|
717
777
|
options = param3 || {};
|
718
778
|
}
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
blockSize
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
779
|
+
const { span, updatedOptions } = createSpan("BlobClient-downloadToBuffer", options);
|
780
|
+
try {
|
781
|
+
if (!options.blockSize) {
|
782
|
+
options.blockSize = 0;
|
783
|
+
}
|
784
|
+
if (options.blockSize < 0) {
|
785
|
+
throw new RangeError("blockSize option must be >= 0");
|
786
|
+
}
|
787
|
+
if (options.blockSize === 0) {
|
788
|
+
options.blockSize = DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES;
|
789
|
+
}
|
790
|
+
if (offset < 0) {
|
791
|
+
throw new RangeError("offset option must be >= 0");
|
792
|
+
}
|
793
|
+
if (count && count <= 0) {
|
794
|
+
throw new RangeError("count option must be greater than 0");
|
795
|
+
}
|
796
|
+
if (!options.conditions) {
|
797
|
+
options.conditions = {};
|
798
|
+
}
|
736
799
|
// Customer doesn't specify length, get it
|
737
800
|
if (!count) {
|
738
|
-
const response = await this.getProperties(Object.assign(Object.assign({}, options), { tracingOptions:
|
801
|
+
const response = await this.getProperties(Object.assign(Object.assign({}, options), { tracingOptions: Object.assign(Object.assign({}, options.tracingOptions), convertTracingToRequestOptionsBase(updatedOptions)) }));
|
739
802
|
count = response.contentLength - offset;
|
740
803
|
if (count < 0) {
|
741
804
|
throw new RangeError(`offset ${offset} shouldn't be larger than blob size ${response.contentLength}`);
|
@@ -755,19 +818,19 @@ export class BlobClient extends StorageClient {
|
|
755
818
|
}
|
756
819
|
let transferProgress = 0;
|
757
820
|
const batch = new Batch(options.concurrency);
|
758
|
-
for (let off = offset; off < offset + count; off = off + blockSize) {
|
821
|
+
for (let off = offset; off < offset + count; off = off + options.blockSize) {
|
759
822
|
batch.addOperation(async () => {
|
760
823
|
// Exclusive chunk end position
|
761
824
|
let chunkEnd = offset + count;
|
762
|
-
if (off + blockSize < chunkEnd) {
|
763
|
-
chunkEnd = off + blockSize;
|
825
|
+
if (off + options.blockSize < chunkEnd) {
|
826
|
+
chunkEnd = off + options.blockSize;
|
764
827
|
}
|
765
828
|
const response = await this.download(off, chunkEnd - off, {
|
766
829
|
abortSignal: options.abortSignal,
|
767
830
|
conditions: options.conditions,
|
768
831
|
maxRetryRequests: options.maxRetryRequestsPerBlock,
|
769
832
|
customerProvidedKey: options.customerProvidedKey,
|
770
|
-
tracingOptions:
|
833
|
+
tracingOptions: Object.assign(Object.assign({}, options.tracingOptions), convertTracingToRequestOptionsBase(updatedOptions)),
|
771
834
|
});
|
772
835
|
const stream = response.readableStreamBody;
|
773
836
|
await streamToBuffer(stream, buffer, off - offset, chunkEnd - offset);
|
@@ -782,7 +845,17 @@ export class BlobClient extends StorageClient {
|
|
782
845
|
}
|
783
846
|
await batch.do();
|
784
847
|
return buffer;
|
785
|
-
}
|
848
|
+
}
|
849
|
+
catch (e) {
|
850
|
+
span.setStatus({
|
851
|
+
code: SpanStatusCode.ERROR,
|
852
|
+
message: e.message,
|
853
|
+
});
|
854
|
+
throw e;
|
855
|
+
}
|
856
|
+
finally {
|
857
|
+
span.end();
|
858
|
+
}
|
786
859
|
}
|
787
860
|
/**
|
788
861
|
* ONLY AVAILABLE IN NODE.JS RUNTIME.
|
@@ -801,15 +874,26 @@ export class BlobClient extends StorageClient {
|
|
801
874
|
* at the specified path.
|
802
875
|
*/
|
803
876
|
async downloadToFile(filePath, offset = 0, count, options = {}) {
|
804
|
-
|
805
|
-
|
877
|
+
const { span, updatedOptions } = createSpan("BlobClient-downloadToFile", options);
|
878
|
+
try {
|
879
|
+
const response = await this.download(offset, count, Object.assign(Object.assign({}, options), { tracingOptions: Object.assign(Object.assign({}, options.tracingOptions), convertTracingToRequestOptionsBase(updatedOptions)) }));
|
806
880
|
if (response.readableStreamBody) {
|
807
881
|
await readStreamToLocalFile(response.readableStreamBody, filePath);
|
808
882
|
}
|
809
883
|
// The stream is no longer accessible so setting it to undefined.
|
810
884
|
response.blobDownloadStream = undefined;
|
811
885
|
return response;
|
812
|
-
}
|
886
|
+
}
|
887
|
+
catch (e) {
|
888
|
+
span.setStatus({
|
889
|
+
code: SpanStatusCode.ERROR,
|
890
|
+
message: e.message,
|
891
|
+
});
|
892
|
+
throw e;
|
893
|
+
}
|
894
|
+
finally {
|
895
|
+
span.end();
|
896
|
+
}
|
813
897
|
}
|
814
898
|
getBlobAndContainerNamesFromUrl() {
|
815
899
|
let containerName;
|
@@ -822,11 +906,11 @@ export class BlobClient extends StorageClient {
|
|
822
906
|
// "https://myaccount.blob.core.windows.net/mycontainer/blob/a.txt";
|
823
907
|
// IPv4/IPv6 address hosts, Endpoints - `http://127.0.0.1:10000/devstoreaccount1/containername/blob`
|
824
908
|
// http://localhost:10001/devstoreaccount1/containername/blob
|
825
|
-
const parsedUrl =
|
826
|
-
if (parsedUrl.
|
909
|
+
const parsedUrl = URLBuilder.parse(this.url);
|
910
|
+
if (parsedUrl.getHost().split(".")[1] === "blob") {
|
827
911
|
// "https://myaccount.blob.core.windows.net/containername/blob".
|
828
912
|
// .getPath() -> /containername/blob
|
829
|
-
const pathComponents = parsedUrl.
|
913
|
+
const pathComponents = parsedUrl.getPath().match("/([^/]*)(/(.*))?");
|
830
914
|
containerName = pathComponents[1];
|
831
915
|
blobName = pathComponents[3];
|
832
916
|
}
|
@@ -834,14 +918,14 @@ export class BlobClient extends StorageClient {
|
|
834
918
|
// IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/containername/blob
|
835
919
|
// Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/containername/blob
|
836
920
|
// .getPath() -> /devstoreaccount1/containername/blob
|
837
|
-
const pathComponents = parsedUrl.
|
921
|
+
const pathComponents = parsedUrl.getPath().match("/([^/]*)/([^/]*)(/(.*))?");
|
838
922
|
containerName = pathComponents[2];
|
839
923
|
blobName = pathComponents[4];
|
840
924
|
}
|
841
925
|
else {
|
842
926
|
// "https://customdomain.com/containername/blob".
|
843
927
|
// .getPath() -> /containername/blob
|
844
|
-
const pathComponents = parsedUrl.
|
928
|
+
const pathComponents = parsedUrl.getPath().match("/([^/]*)(/(.*))?");
|
845
929
|
containerName = pathComponents[1];
|
846
930
|
blobName = pathComponents[3];
|
847
931
|
}
|
@@ -874,32 +958,29 @@ export class BlobClient extends StorageClient {
|
|
874
958
|
* @param options - Optional options to the Blob Start Copy From URL operation.
|
875
959
|
*/
|
876
960
|
async startCopyFromURL(copySource, options = {}) {
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
leaseAccessConditions: options.conditions,
|
884
|
-
metadata: options.metadata,
|
885
|
-
modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }),
|
886
|
-
sourceModifiedAccessConditions: {
|
961
|
+
var _a, _b, _c;
|
962
|
+
const { span, updatedOptions } = createSpan("BlobClient-startCopyFromURL", options);
|
963
|
+
options.conditions = options.conditions || {};
|
964
|
+
options.sourceConditions = options.sourceConditions || {};
|
965
|
+
try {
|
966
|
+
return await this.blobContext.startCopyFromURL(copySource, Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, metadata: options.metadata, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), sourceModifiedAccessConditions: {
|
887
967
|
sourceIfMatch: options.sourceConditions.ifMatch,
|
888
968
|
sourceIfModifiedSince: options.sourceConditions.ifModifiedSince,
|
889
969
|
sourceIfNoneMatch: options.sourceConditions.ifNoneMatch,
|
890
970
|
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince,
|
891
971
|
sourceIfTags: options.sourceConditions.tagConditions,
|
892
|
-
},
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
972
|
+
}, immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, rehydratePriority: options.rehydratePriority, tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags), sealBlob: options.sealBlob }, convertTracingToRequestOptionsBase(updatedOptions)));
|
973
|
+
}
|
974
|
+
catch (e) {
|
975
|
+
span.setStatus({
|
976
|
+
code: SpanStatusCode.ERROR,
|
977
|
+
message: e.message,
|
978
|
+
});
|
979
|
+
throw e;
|
980
|
+
}
|
981
|
+
finally {
|
982
|
+
span.end();
|
983
|
+
}
|
903
984
|
}
|
904
985
|
/**
|
905
986
|
* Only available for BlobClient constructed with a shared key credential.
|
@@ -926,38 +1007,63 @@ export class BlobClient extends StorageClient {
|
|
926
1007
|
*
|
927
1008
|
* @param options - Optional options to delete immutability policy on the blob.
|
928
1009
|
*/
|
929
|
-
async deleteImmutabilityPolicy(options
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
1010
|
+
async deleteImmutabilityPolicy(options) {
|
1011
|
+
const { span, updatedOptions } = createSpan("BlobClient-deleteImmutabilityPolicy", options);
|
1012
|
+
try {
|
1013
|
+
return await this.blobContext.deleteImmutabilityPolicy(Object.assign({ abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1014
|
+
}
|
1015
|
+
catch (e) {
|
1016
|
+
span.setStatus({
|
1017
|
+
code: SpanStatusCode.ERROR,
|
1018
|
+
message: e.message,
|
1019
|
+
});
|
1020
|
+
throw e;
|
1021
|
+
}
|
1022
|
+
finally {
|
1023
|
+
span.end();
|
1024
|
+
}
|
935
1025
|
}
|
936
1026
|
/**
|
937
|
-
* Set
|
1027
|
+
* Set immutablility policy on the blob.
|
938
1028
|
*
|
939
1029
|
* @param options - Optional options to set immutability policy on the blob.
|
940
1030
|
*/
|
941
|
-
async setImmutabilityPolicy(immutabilityPolicy, options
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
1031
|
+
async setImmutabilityPolicy(immutabilityPolicy, options) {
|
1032
|
+
const { span, updatedOptions } = createSpan("BlobClient-setImmutabilityPolicy", options);
|
1033
|
+
try {
|
1034
|
+
return await this.blobContext.setImmutabilityPolicy(Object.assign({ abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal, immutabilityPolicyExpiry: immutabilityPolicy.expiriesOn, immutabilityPolicyMode: immutabilityPolicy.policyMode, modifiedAccessConditions: options === null || options === void 0 ? void 0 : options.modifiedAccessCondition }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1035
|
+
}
|
1036
|
+
catch (e) {
|
1037
|
+
span.setStatus({
|
1038
|
+
code: SpanStatusCode.ERROR,
|
1039
|
+
message: e.message,
|
1040
|
+
});
|
1041
|
+
throw e;
|
1042
|
+
}
|
1043
|
+
finally {
|
1044
|
+
span.end();
|
1045
|
+
}
|
949
1046
|
}
|
950
1047
|
/**
|
951
1048
|
* Set legal hold on the blob.
|
952
1049
|
*
|
953
1050
|
* @param options - Optional options to set legal hold on the blob.
|
954
1051
|
*/
|
955
|
-
async setLegalHold(legalHoldEnabled, options
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
1052
|
+
async setLegalHold(legalHoldEnabled, options) {
|
1053
|
+
const { span, updatedOptions } = createSpan("BlobClient-setLegalHold", options);
|
1054
|
+
try {
|
1055
|
+
return await this.blobContext.setLegalHold(legalHoldEnabled, Object.assign({ abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1056
|
+
}
|
1057
|
+
catch (e) {
|
1058
|
+
span.setStatus({
|
1059
|
+
code: SpanStatusCode.ERROR,
|
1060
|
+
message: e.message,
|
1061
|
+
});
|
1062
|
+
throw e;
|
1063
|
+
}
|
1064
|
+
finally {
|
1065
|
+
span.end();
|
1066
|
+
}
|
961
1067
|
}
|
962
1068
|
}
|
963
1069
|
/**
|
@@ -1029,7 +1135,7 @@ export class AppendBlobClient extends BlobClient {
|
|
1029
1135
|
throw new Error("Expecting non-empty strings for containerName and blobName parameters");
|
1030
1136
|
}
|
1031
1137
|
super(url, pipeline);
|
1032
|
-
this.appendBlobContext = this.storageClientContext
|
1138
|
+
this.appendBlobContext = new AppendBlob(this.storageClientContext);
|
1033
1139
|
}
|
1034
1140
|
/**
|
1035
1141
|
* Creates a new AppendBlobClient object identical to the source but with the
|
@@ -1057,25 +1163,23 @@ export class AppendBlobClient extends BlobClient {
|
|
1057
1163
|
* ```
|
1058
1164
|
*/
|
1059
1165
|
async create(options = {}) {
|
1166
|
+
var _a, _b, _c;
|
1167
|
+
const { span, updatedOptions } = createSpan("AppendBlobClient-create", options);
|
1060
1168
|
options.conditions = options.conditions || {};
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
blobTagsString: toBlobTagsString(options.tags),
|
1076
|
-
tracingOptions: updatedOptions.tracingOptions,
|
1077
|
-
}));
|
1078
|
-
});
|
1169
|
+
try {
|
1170
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
1171
|
+
return await this.appendBlobContext.create(0, Object.assign({ abortSignal: options.abortSignal, blobHttpHeaders: options.blobHTTPHeaders, leaseAccessConditions: options.conditions, metadata: options.metadata, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, blobTagsString: toBlobTagsString(options.tags) }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1172
|
+
}
|
1173
|
+
catch (e) {
|
1174
|
+
span.setStatus({
|
1175
|
+
code: SpanStatusCode.ERROR,
|
1176
|
+
message: e.message,
|
1177
|
+
});
|
1178
|
+
throw e;
|
1179
|
+
}
|
1180
|
+
finally {
|
1181
|
+
span.end();
|
1182
|
+
}
|
1079
1183
|
}
|
1080
1184
|
/**
|
1081
1185
|
* Creates a 0-length append blob. Call AppendBlock to append data to an append blob.
|
@@ -1085,20 +1189,30 @@ export class AppendBlobClient extends BlobClient {
|
|
1085
1189
|
* @param options -
|
1086
1190
|
*/
|
1087
1191
|
async createIfNotExists(options = {}) {
|
1192
|
+
var _a, _b;
|
1193
|
+
const { span, updatedOptions } = createSpan("AppendBlobClient-createIfNotExists", options);
|
1088
1194
|
const conditions = { ifNoneMatch: ETagAny };
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
}
|
1099
|
-
|
1195
|
+
try {
|
1196
|
+
const res = await this.create(Object.assign(Object.assign({}, updatedOptions), { conditions }));
|
1197
|
+
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
|
1198
|
+
}
|
1199
|
+
catch (e) {
|
1200
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") {
|
1201
|
+
span.setStatus({
|
1202
|
+
code: SpanStatusCode.ERROR,
|
1203
|
+
message: "Expected exception when creating a blob only if it does not already exist.",
|
1204
|
+
});
|
1205
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
1100
1206
|
}
|
1101
|
-
|
1207
|
+
span.setStatus({
|
1208
|
+
code: SpanStatusCode.ERROR,
|
1209
|
+
message: e.message,
|
1210
|
+
});
|
1211
|
+
throw e;
|
1212
|
+
}
|
1213
|
+
finally {
|
1214
|
+
span.end();
|
1215
|
+
}
|
1102
1216
|
}
|
1103
1217
|
/**
|
1104
1218
|
* Seals the append blob, making it read only.
|
@@ -1106,17 +1220,22 @@ export class AppendBlobClient extends BlobClient {
|
|
1106
1220
|
* @param options -
|
1107
1221
|
*/
|
1108
1222
|
async seal(options = {}) {
|
1223
|
+
var _a;
|
1224
|
+
const { span, updatedOptions } = createSpan("AppendBlobClient-seal", options);
|
1109
1225
|
options.conditions = options.conditions || {};
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
}
|
1226
|
+
try {
|
1227
|
+
return await this.appendBlobContext.seal(Object.assign({ abortSignal: options.abortSignal, appendPositionAccessConditions: options.conditions, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }) }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1228
|
+
}
|
1229
|
+
catch (e) {
|
1230
|
+
span.setStatus({
|
1231
|
+
code: SpanStatusCode.ERROR,
|
1232
|
+
message: e.message,
|
1233
|
+
});
|
1234
|
+
throw e;
|
1235
|
+
}
|
1236
|
+
finally {
|
1237
|
+
span.end();
|
1238
|
+
}
|
1120
1239
|
}
|
1121
1240
|
/**
|
1122
1241
|
* Commits a new block of data to the end of the existing append blob.
|
@@ -1143,25 +1262,25 @@ export class AppendBlobClient extends BlobClient {
|
|
1143
1262
|
* ```
|
1144
1263
|
*/
|
1145
1264
|
async appendBlock(body, contentLength, options = {}) {
|
1265
|
+
var _a;
|
1266
|
+
const { span, updatedOptions } = createSpan("AppendBlobClient-appendBlock", options);
|
1146
1267
|
options.conditions = options.conditions || {};
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
return assertResponse(await this.appendBlobContext.appendBlock(contentLength, body, {
|
1151
|
-
abortSignal: options.abortSignal,
|
1152
|
-
appendPositionAccessConditions: options.conditions,
|
1153
|
-
leaseAccessConditions: options.conditions,
|
1154
|
-
modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }),
|
1155
|
-
requestOptions: {
|
1268
|
+
try {
|
1269
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
1270
|
+
return await this.appendBlobContext.appendBlock(contentLength, body, Object.assign({ abortSignal: options.abortSignal, appendPositionAccessConditions: options.conditions, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), requestOptions: {
|
1156
1271
|
onUploadProgress: options.onProgress,
|
1157
|
-
},
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
})
|
1164
|
-
|
1272
|
+
}, transactionalContentMD5: options.transactionalContentMD5, transactionalContentCrc64: options.transactionalContentCrc64, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1273
|
+
}
|
1274
|
+
catch (e) {
|
1275
|
+
span.setStatus({
|
1276
|
+
code: SpanStatusCode.ERROR,
|
1277
|
+
message: e.message,
|
1278
|
+
});
|
1279
|
+
throw e;
|
1280
|
+
}
|
1281
|
+
finally {
|
1282
|
+
span.end();
|
1283
|
+
}
|
1165
1284
|
}
|
1166
1285
|
/**
|
1167
1286
|
* The Append Block operation commits a new block of data to the end of an existing append blob
|
@@ -1178,31 +1297,29 @@ export class AppendBlobClient extends BlobClient {
|
|
1178
1297
|
* @param options -
|
1179
1298
|
*/
|
1180
1299
|
async appendBlockFromURL(sourceURL, sourceOffset, count, options = {}) {
|
1300
|
+
var _a;
|
1301
|
+
const { span, updatedOptions } = createSpan("AppendBlobClient-appendBlockFromURL", options);
|
1181
1302
|
options.conditions = options.conditions || {};
|
1182
1303
|
options.sourceConditions = options.sourceConditions || {};
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
encryptionScope: options.encryptionScope,
|
1203
|
-
tracingOptions: updatedOptions.tracingOptions,
|
1204
|
-
}));
|
1205
|
-
});
|
1304
|
+
try {
|
1305
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
1306
|
+
return await this.appendBlobContext.appendBlockFromUrl(sourceURL, 0, Object.assign({ abortSignal: options.abortSignal, sourceRange: rangeToString({ offset: sourceOffset, count }), sourceContentMD5: options.sourceContentMD5, sourceContentCrc64: options.sourceContentCrc64, leaseAccessConditions: options.conditions, appendPositionAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), sourceModifiedAccessConditions: {
|
1307
|
+
sourceIfMatch: options.sourceConditions.ifMatch,
|
1308
|
+
sourceIfModifiedSince: options.sourceConditions.ifModifiedSince,
|
1309
|
+
sourceIfNoneMatch: options.sourceConditions.ifNoneMatch,
|
1310
|
+
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince,
|
1311
|
+
}, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1312
|
+
}
|
1313
|
+
catch (e) {
|
1314
|
+
span.setStatus({
|
1315
|
+
code: SpanStatusCode.ERROR,
|
1316
|
+
message: e.message,
|
1317
|
+
});
|
1318
|
+
throw e;
|
1319
|
+
}
|
1320
|
+
finally {
|
1321
|
+
span.end();
|
1322
|
+
}
|
1206
1323
|
}
|
1207
1324
|
}
|
1208
1325
|
/**
|
@@ -1274,8 +1391,8 @@ export class BlockBlobClient extends BlobClient {
|
|
1274
1391
|
throw new Error("Expecting non-empty strings for containerName and blobName parameters");
|
1275
1392
|
}
|
1276
1393
|
super(url, pipeline);
|
1277
|
-
this.blockBlobContext = this.storageClientContext
|
1278
|
-
this._blobContext = this.storageClientContext
|
1394
|
+
this.blockBlobContext = new BlockBlob(this.storageClientContext);
|
1395
|
+
this._blobContext = new StorageBlob(this.storageClientContext);
|
1279
1396
|
}
|
1280
1397
|
/**
|
1281
1398
|
* Creates a new BlockBlobClient object identical to the source but with the
|
@@ -1319,31 +1436,36 @@ export class BlockBlobClient extends BlobClient {
|
|
1319
1436
|
* @param options -
|
1320
1437
|
*/
|
1321
1438
|
async query(query, options = {}) {
|
1439
|
+
var _a;
|
1322
1440
|
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
queryRequest: {
|
1441
|
+
const { span, updatedOptions } = createSpan("BlockBlobClient-query", options);
|
1442
|
+
try {
|
1443
|
+
if (!isNode) {
|
1444
|
+
throw new Error("This operation currently is only supported in Node.js.");
|
1445
|
+
}
|
1446
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
1447
|
+
const response = await this._blobContext.query(Object.assign({ abortSignal: options.abortSignal, queryRequest: {
|
1331
1448
|
queryType: "SQL",
|
1332
1449
|
expression: query,
|
1333
1450
|
inputSerialization: toQuerySerialization(options.inputTextConfiguration),
|
1334
1451
|
outputSerialization: toQuerySerialization(options.outputTextConfiguration),
|
1335
|
-
},
|
1336
|
-
leaseAccessConditions: options.conditions,
|
1337
|
-
modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }),
|
1338
|
-
cpkInfo: options.customerProvidedKey,
|
1339
|
-
tracingOptions: updatedOptions.tracingOptions,
|
1340
|
-
}));
|
1452
|
+
}, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1341
1453
|
return new BlobQueryResponse(response, {
|
1342
1454
|
abortSignal: options.abortSignal,
|
1343
1455
|
onProgress: options.onProgress,
|
1344
1456
|
onError: options.onError,
|
1345
1457
|
});
|
1346
|
-
}
|
1458
|
+
}
|
1459
|
+
catch (e) {
|
1460
|
+
span.setStatus({
|
1461
|
+
code: SpanStatusCode.ERROR,
|
1462
|
+
message: e.message,
|
1463
|
+
});
|
1464
|
+
throw e;
|
1465
|
+
}
|
1466
|
+
finally {
|
1467
|
+
span.end();
|
1468
|
+
}
|
1347
1469
|
}
|
1348
1470
|
/**
|
1349
1471
|
* Creates a new block blob, or updates the content of an existing block blob.
|
@@ -1373,29 +1495,25 @@ export class BlockBlobClient extends BlobClient {
|
|
1373
1495
|
* ```
|
1374
1496
|
*/
|
1375
1497
|
async upload(body, contentLength, options = {}) {
|
1498
|
+
var _a, _b, _c;
|
1376
1499
|
options.conditions = options.conditions || {};
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
return
|
1381
|
-
abortSignal: options.abortSignal,
|
1382
|
-
blobHttpHeaders: options.blobHTTPHeaders,
|
1383
|
-
leaseAccessConditions: options.conditions,
|
1384
|
-
metadata: options.metadata,
|
1385
|
-
modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }),
|
1386
|
-
requestOptions: {
|
1500
|
+
const { span, updatedOptions } = createSpan("BlockBlobClient-upload", options);
|
1501
|
+
try {
|
1502
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
1503
|
+
return await this.blockBlobContext.upload(contentLength, body, Object.assign({ abortSignal: options.abortSignal, blobHttpHeaders: options.blobHTTPHeaders, leaseAccessConditions: options.conditions, metadata: options.metadata, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), requestOptions: {
|
1387
1504
|
onUploadProgress: options.onProgress,
|
1388
|
-
},
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1505
|
+
}, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags) }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1506
|
+
}
|
1507
|
+
catch (e) {
|
1508
|
+
span.setStatus({
|
1509
|
+
code: SpanStatusCode.ERROR,
|
1510
|
+
message: e.message,
|
1511
|
+
});
|
1512
|
+
throw e;
|
1513
|
+
}
|
1514
|
+
finally {
|
1515
|
+
span.end();
|
1516
|
+
}
|
1399
1517
|
}
|
1400
1518
|
/**
|
1401
1519
|
* Creates a new Block Blob where the contents of the blob are read from a given URL.
|
@@ -1416,18 +1534,29 @@ export class BlockBlobClient extends BlobClient {
|
|
1416
1534
|
* @param options - Optional parameters.
|
1417
1535
|
*/
|
1418
1536
|
async syncUploadFromURL(sourceURL, options = {}) {
|
1537
|
+
var _a, _b, _c, _d, _e;
|
1419
1538
|
options.conditions = options.conditions || {};
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
return
|
1424
|
-
sourceIfMatch: (
|
1425
|
-
sourceIfModifiedSince: (
|
1426
|
-
sourceIfNoneMatch: (
|
1427
|
-
sourceIfUnmodifiedSince: (
|
1428
|
-
sourceIfTags: (
|
1429
|
-
}, cpkInfo: options.customerProvidedKey, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags), copySourceTags: options.copySourceTags,
|
1430
|
-
}
|
1539
|
+
const { span, updatedOptions } = createSpan("BlockBlobClient-syncUploadFromURL", options);
|
1540
|
+
try {
|
1541
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
1542
|
+
return await this.blockBlobContext.putBlobFromUrl(0, sourceURL, Object.assign(Object.assign(Object.assign({}, options), { blobHttpHeaders: options.blobHTTPHeaders, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: options.conditions.tagConditions }), sourceModifiedAccessConditions: {
|
1543
|
+
sourceIfMatch: (_a = options.sourceConditions) === null || _a === void 0 ? void 0 : _a.ifMatch,
|
1544
|
+
sourceIfModifiedSince: (_b = options.sourceConditions) === null || _b === void 0 ? void 0 : _b.ifModifiedSince,
|
1545
|
+
sourceIfNoneMatch: (_c = options.sourceConditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch,
|
1546
|
+
sourceIfUnmodifiedSince: (_d = options.sourceConditions) === null || _d === void 0 ? void 0 : _d.ifUnmodifiedSince,
|
1547
|
+
sourceIfTags: (_e = options.sourceConditions) === null || _e === void 0 ? void 0 : _e.tagConditions,
|
1548
|
+
}, cpkInfo: options.customerProvidedKey, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags), copySourceTags: options.copySourceTags }), convertTracingToRequestOptionsBase(updatedOptions)));
|
1549
|
+
}
|
1550
|
+
catch (e) {
|
1551
|
+
span.setStatus({
|
1552
|
+
code: SpanStatusCode.ERROR,
|
1553
|
+
message: e.message,
|
1554
|
+
});
|
1555
|
+
throw e;
|
1556
|
+
}
|
1557
|
+
finally {
|
1558
|
+
span.end();
|
1559
|
+
}
|
1431
1560
|
}
|
1432
1561
|
/**
|
1433
1562
|
* Uploads the specified block to the block blob's "staging area" to be later
|
@@ -1441,21 +1570,23 @@ export class BlockBlobClient extends BlobClient {
|
|
1441
1570
|
* @returns Response data for the Block Blob Stage Block operation.
|
1442
1571
|
*/
|
1443
1572
|
async stageBlock(blockId, body, contentLength, options = {}) {
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
leaseAccessConditions: options.conditions,
|
1449
|
-
requestOptions: {
|
1573
|
+
const { span, updatedOptions } = createSpan("BlockBlobClient-stageBlock", options);
|
1574
|
+
try {
|
1575
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
1576
|
+
return await this.blockBlobContext.stageBlock(blockId, contentLength, body, Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, requestOptions: {
|
1450
1577
|
onUploadProgress: options.onProgress,
|
1451
|
-
},
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
})
|
1458
|
-
|
1578
|
+
}, transactionalContentMD5: options.transactionalContentMD5, transactionalContentCrc64: options.transactionalContentCrc64, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1579
|
+
}
|
1580
|
+
catch (e) {
|
1581
|
+
span.setStatus({
|
1582
|
+
code: SpanStatusCode.ERROR,
|
1583
|
+
message: e.message,
|
1584
|
+
});
|
1585
|
+
throw e;
|
1586
|
+
}
|
1587
|
+
finally {
|
1588
|
+
span.end();
|
1589
|
+
}
|
1459
1590
|
}
|
1460
1591
|
/**
|
1461
1592
|
* The Stage Block From URL operation creates a new block to be committed as part
|
@@ -1479,20 +1610,21 @@ export class BlockBlobClient extends BlobClient {
|
|
1479
1610
|
* @returns Response data for the Block Blob Stage Block From URL operation.
|
1480
1611
|
*/
|
1481
1612
|
async stageBlockFromURL(blockId, sourceURL, offset = 0, count, options = {}) {
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1613
|
+
const { span, updatedOptions } = createSpan("BlockBlobClient-stageBlockFromURL", options);
|
1614
|
+
try {
|
1615
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
1616
|
+
return await this.blockBlobContext.stageBlockFromURL(blockId, 0, sourceURL, Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, sourceContentMD5: options.sourceContentMD5, sourceContentCrc64: options.sourceContentCrc64, sourceRange: offset === 0 && !count ? undefined : rangeToString({ offset, count }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization) }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1617
|
+
}
|
1618
|
+
catch (e) {
|
1619
|
+
span.setStatus({
|
1620
|
+
code: SpanStatusCode.ERROR,
|
1621
|
+
message: e.message,
|
1622
|
+
});
|
1623
|
+
throw e;
|
1624
|
+
}
|
1625
|
+
finally {
|
1626
|
+
span.end();
|
1627
|
+
}
|
1496
1628
|
}
|
1497
1629
|
/**
|
1498
1630
|
* Writes a blob by specifying the list of block IDs that make up the blob.
|
@@ -1507,26 +1639,23 @@ export class BlockBlobClient extends BlobClient {
|
|
1507
1639
|
* @returns Response data for the Block Blob Commit Block List operation.
|
1508
1640
|
*/
|
1509
1641
|
async commitBlockList(blocks, options = {}) {
|
1642
|
+
var _a, _b, _c;
|
1510
1643
|
options.conditions = options.conditions || {};
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
return
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
blobTagsString: toBlobTagsString(options.tags),
|
1527
|
-
tracingOptions: updatedOptions.tracingOptions,
|
1528
|
-
}));
|
1529
|
-
});
|
1644
|
+
const { span, updatedOptions } = createSpan("BlockBlobClient-commitBlockList", options);
|
1645
|
+
try {
|
1646
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
1647
|
+
return await this.blockBlobContext.commitBlockList({ latest: blocks }, Object.assign({ abortSignal: options.abortSignal, blobHttpHeaders: options.blobHTTPHeaders, leaseAccessConditions: options.conditions, metadata: options.metadata, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags) }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1648
|
+
}
|
1649
|
+
catch (e) {
|
1650
|
+
span.setStatus({
|
1651
|
+
code: SpanStatusCode.ERROR,
|
1652
|
+
message: e.message,
|
1653
|
+
});
|
1654
|
+
throw e;
|
1655
|
+
}
|
1656
|
+
finally {
|
1657
|
+
span.end();
|
1658
|
+
}
|
1530
1659
|
}
|
1531
1660
|
/**
|
1532
1661
|
* Returns the list of blocks that have been uploaded as part of a block blob
|
@@ -1539,14 +1668,10 @@ export class BlockBlobClient extends BlobClient {
|
|
1539
1668
|
* @returns Response data for the Block Blob Get Block List operation.
|
1540
1669
|
*/
|
1541
1670
|
async getBlockList(listType, options = {}) {
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
leaseAccessConditions: options.conditions,
|
1547
|
-
modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }),
|
1548
|
-
tracingOptions: updatedOptions.tracingOptions,
|
1549
|
-
}));
|
1671
|
+
var _a;
|
1672
|
+
const { span, updatedOptions } = createSpan("BlockBlobClient-getBlockList", options);
|
1673
|
+
try {
|
1674
|
+
const res = await this.blockBlobContext.getBlockList(listType, Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }) }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1550
1675
|
if (!res.committedBlocks) {
|
1551
1676
|
res.committedBlocks = [];
|
1552
1677
|
}
|
@@ -1554,7 +1679,17 @@ export class BlockBlobClient extends BlobClient {
|
|
1554
1679
|
res.uncommittedBlocks = [];
|
1555
1680
|
}
|
1556
1681
|
return res;
|
1557
|
-
}
|
1682
|
+
}
|
1683
|
+
catch (e) {
|
1684
|
+
span.setStatus({
|
1685
|
+
code: SpanStatusCode.ERROR,
|
1686
|
+
message: e.message,
|
1687
|
+
});
|
1688
|
+
throw e;
|
1689
|
+
}
|
1690
|
+
finally {
|
1691
|
+
span.end();
|
1692
|
+
}
|
1558
1693
|
}
|
1559
1694
|
// High level functions
|
1560
1695
|
/**
|
@@ -1573,7 +1708,8 @@ export class BlockBlobClient extends BlobClient {
|
|
1573
1708
|
* @param options -
|
1574
1709
|
*/
|
1575
1710
|
async uploadData(data, options = {}) {
|
1576
|
-
|
1711
|
+
const { span, updatedOptions } = createSpan("BlockBlobClient-uploadData", options);
|
1712
|
+
try {
|
1577
1713
|
if (isNode) {
|
1578
1714
|
let buffer;
|
1579
1715
|
if (data instanceof Buffer) {
|
@@ -1592,7 +1728,17 @@ export class BlockBlobClient extends BlobClient {
|
|
1592
1728
|
const browserBlob = new Blob([data]);
|
1593
1729
|
return this.uploadSeekableInternal((offset, size) => browserBlob.slice(offset, offset + size), browserBlob.size, updatedOptions);
|
1594
1730
|
}
|
1595
|
-
}
|
1731
|
+
}
|
1732
|
+
catch (e) {
|
1733
|
+
span.setStatus({
|
1734
|
+
code: SpanStatusCode.ERROR,
|
1735
|
+
message: e.message,
|
1736
|
+
});
|
1737
|
+
throw e;
|
1738
|
+
}
|
1739
|
+
finally {
|
1740
|
+
span.end();
|
1741
|
+
}
|
1596
1742
|
}
|
1597
1743
|
/**
|
1598
1744
|
* ONLY AVAILABLE IN BROWSERS.
|
@@ -1614,10 +1760,21 @@ export class BlockBlobClient extends BlobClient {
|
|
1614
1760
|
* @returns Response data for the Blob Upload operation.
|
1615
1761
|
*/
|
1616
1762
|
async uploadBrowserData(browserData, options = {}) {
|
1617
|
-
|
1763
|
+
const { span, updatedOptions } = createSpan("BlockBlobClient-uploadBrowserData", options);
|
1764
|
+
try {
|
1618
1765
|
const browserBlob = new Blob([browserData]);
|
1619
|
-
return this.uploadSeekableInternal((offset, size) => browserBlob.slice(offset, offset + size), browserBlob.size, updatedOptions);
|
1620
|
-
}
|
1766
|
+
return await this.uploadSeekableInternal((offset, size) => browserBlob.slice(offset, offset + size), browserBlob.size, updatedOptions);
|
1767
|
+
}
|
1768
|
+
catch (e) {
|
1769
|
+
span.setStatus({
|
1770
|
+
code: SpanStatusCode.ERROR,
|
1771
|
+
message: e.message,
|
1772
|
+
});
|
1773
|
+
throw e;
|
1774
|
+
}
|
1775
|
+
finally {
|
1776
|
+
span.end();
|
1777
|
+
}
|
1621
1778
|
}
|
1622
1779
|
/**
|
1623
1780
|
*
|
@@ -1635,23 +1792,27 @@ export class BlockBlobClient extends BlobClient {
|
|
1635
1792
|
* @returns Response data for the Blob Upload operation.
|
1636
1793
|
*/
|
1637
1794
|
async uploadSeekableInternal(bodyFactory, size, options = {}) {
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1795
|
+
if (!options.blockSize) {
|
1796
|
+
options.blockSize = 0;
|
1797
|
+
}
|
1798
|
+
if (options.blockSize < 0 || options.blockSize > BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES) {
|
1641
1799
|
throw new RangeError(`blockSize option must be >= 0 and <= ${BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES}`);
|
1642
1800
|
}
|
1643
|
-
|
1644
|
-
|
1801
|
+
if (options.maxSingleShotSize !== 0 && !options.maxSingleShotSize) {
|
1802
|
+
options.maxSingleShotSize = BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES;
|
1803
|
+
}
|
1804
|
+
if (options.maxSingleShotSize < 0 ||
|
1805
|
+
options.maxSingleShotSize > BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES) {
|
1645
1806
|
throw new RangeError(`maxSingleShotSize option must be >= 0 and <= ${BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES}`);
|
1646
1807
|
}
|
1647
|
-
if (blockSize === 0) {
|
1808
|
+
if (options.blockSize === 0) {
|
1648
1809
|
if (size > BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES * BLOCK_BLOB_MAX_BLOCKS) {
|
1649
1810
|
throw new RangeError(`${size} is too larger to upload to a block blob.`);
|
1650
1811
|
}
|
1651
|
-
if (size > maxSingleShotSize) {
|
1652
|
-
blockSize = Math.ceil(size / BLOCK_BLOB_MAX_BLOCKS);
|
1653
|
-
if (blockSize < DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES) {
|
1654
|
-
blockSize = DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES;
|
1812
|
+
if (size > options.maxSingleShotSize) {
|
1813
|
+
options.blockSize = Math.ceil(size / BLOCK_BLOB_MAX_BLOCKS);
|
1814
|
+
if (options.blockSize < DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES) {
|
1815
|
+
options.blockSize = DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES;
|
1655
1816
|
}
|
1656
1817
|
}
|
1657
1818
|
}
|
@@ -1661,11 +1822,12 @@ export class BlockBlobClient extends BlobClient {
|
|
1661
1822
|
if (!options.conditions) {
|
1662
1823
|
options.conditions = {};
|
1663
1824
|
}
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1825
|
+
const { span, updatedOptions } = createSpan("BlockBlobClient-uploadSeekableInternal", options);
|
1826
|
+
try {
|
1827
|
+
if (size <= options.maxSingleShotSize) {
|
1828
|
+
return await this.upload(bodyFactory(0, size), size, updatedOptions);
|
1667
1829
|
}
|
1668
|
-
const numBlocks = Math.floor((size - 1) / blockSize) + 1;
|
1830
|
+
const numBlocks = Math.floor((size - 1) / options.blockSize) + 1;
|
1669
1831
|
if (numBlocks > BLOCK_BLOB_MAX_BLOCKS) {
|
1670
1832
|
throw new RangeError(`The buffer's size is too big or the BlockSize is too small;` +
|
1671
1833
|
`the number of blocks must be <= ${BLOCK_BLOB_MAX_BLOCKS}`);
|
@@ -1677,8 +1839,8 @@ export class BlockBlobClient extends BlobClient {
|
|
1677
1839
|
for (let i = 0; i < numBlocks; i++) {
|
1678
1840
|
batch.addOperation(async () => {
|
1679
1841
|
const blockID = generateBlockID(blockIDPrefix, i);
|
1680
|
-
const start = blockSize * i;
|
1681
|
-
const end = i === numBlocks - 1 ? size : start + blockSize;
|
1842
|
+
const start = options.blockSize * i;
|
1843
|
+
const end = i === numBlocks - 1 ? size : start + options.blockSize;
|
1682
1844
|
const contentLength = end - start;
|
1683
1845
|
blockList.push(blockID);
|
1684
1846
|
await this.stageBlock(blockID, bodyFactory(start, contentLength), contentLength, {
|
@@ -1699,7 +1861,17 @@ export class BlockBlobClient extends BlobClient {
|
|
1699
1861
|
}
|
1700
1862
|
await batch.do();
|
1701
1863
|
return this.commitBlockList(blockList, updatedOptions);
|
1702
|
-
}
|
1864
|
+
}
|
1865
|
+
catch (e) {
|
1866
|
+
span.setStatus({
|
1867
|
+
code: SpanStatusCode.ERROR,
|
1868
|
+
message: e.message,
|
1869
|
+
});
|
1870
|
+
throw e;
|
1871
|
+
}
|
1872
|
+
finally {
|
1873
|
+
span.end();
|
1874
|
+
}
|
1703
1875
|
}
|
1704
1876
|
/**
|
1705
1877
|
* ONLY AVAILABLE IN NODE.JS RUNTIME.
|
@@ -1715,16 +1887,27 @@ export class BlockBlobClient extends BlobClient {
|
|
1715
1887
|
* @returns Response data for the Blob Upload operation.
|
1716
1888
|
*/
|
1717
1889
|
async uploadFile(filePath, options = {}) {
|
1718
|
-
|
1890
|
+
const { span, updatedOptions } = createSpan("BlockBlobClient-uploadFile", options);
|
1891
|
+
try {
|
1719
1892
|
const size = (await fsStat(filePath)).size;
|
1720
|
-
return this.uploadSeekableInternal((offset, count) => {
|
1893
|
+
return await this.uploadSeekableInternal((offset, count) => {
|
1721
1894
|
return () => fsCreateReadStream(filePath, {
|
1722
1895
|
autoClose: true,
|
1723
1896
|
end: count ? offset + count - 1 : Infinity,
|
1724
1897
|
start: offset,
|
1725
1898
|
});
|
1726
|
-
}, size, Object.assign(Object.assign({}, options), { tracingOptions:
|
1727
|
-
}
|
1899
|
+
}, size, Object.assign(Object.assign({}, options), { tracingOptions: Object.assign(Object.assign({}, options.tracingOptions), convertTracingToRequestOptionsBase(updatedOptions)) }));
|
1900
|
+
}
|
1901
|
+
catch (e) {
|
1902
|
+
span.setStatus({
|
1903
|
+
code: SpanStatusCode.ERROR,
|
1904
|
+
message: e.message,
|
1905
|
+
});
|
1906
|
+
throw e;
|
1907
|
+
}
|
1908
|
+
finally {
|
1909
|
+
span.end();
|
1910
|
+
}
|
1728
1911
|
}
|
1729
1912
|
/**
|
1730
1913
|
* ONLY AVAILABLE IN NODE.JS RUNTIME.
|
@@ -1749,7 +1932,8 @@ export class BlockBlobClient extends BlobClient {
|
|
1749
1932
|
if (!options.conditions) {
|
1750
1933
|
options.conditions = {};
|
1751
1934
|
}
|
1752
|
-
|
1935
|
+
const { span, updatedOptions } = createSpan("BlockBlobClient-uploadStream", options);
|
1936
|
+
try {
|
1753
1937
|
let blockNum = 0;
|
1754
1938
|
const blockIDPrefix = generateUuid();
|
1755
1939
|
let transferProgress = 0;
|
@@ -1775,8 +1959,18 @@ export class BlockBlobClient extends BlobClient {
|
|
1775
1959
|
// Outgoing queue shouldn't be empty.
|
1776
1960
|
Math.ceil((maxConcurrency / 4) * 3));
|
1777
1961
|
await scheduler.do();
|
1778
|
-
return
|
1779
|
-
}
|
1962
|
+
return await this.commitBlockList(blockList, Object.assign(Object.assign({}, options), { tracingOptions: Object.assign(Object.assign({}, options.tracingOptions), convertTracingToRequestOptionsBase(updatedOptions)) }));
|
1963
|
+
}
|
1964
|
+
catch (e) {
|
1965
|
+
span.setStatus({
|
1966
|
+
code: SpanStatusCode.ERROR,
|
1967
|
+
message: e.message,
|
1968
|
+
});
|
1969
|
+
throw e;
|
1970
|
+
}
|
1971
|
+
finally {
|
1972
|
+
span.end();
|
1973
|
+
}
|
1780
1974
|
}
|
1781
1975
|
}
|
1782
1976
|
/**
|
@@ -1848,7 +2042,7 @@ export class PageBlobClient extends BlobClient {
|
|
1848
2042
|
throw new Error("Expecting non-empty strings for containerName and blobName parameters");
|
1849
2043
|
}
|
1850
2044
|
super(url, pipeline);
|
1851
|
-
this.pageBlobContext = this.storageClientContext
|
2045
|
+
this.pageBlobContext = new PageBlob(this.storageClientContext);
|
1852
2046
|
}
|
1853
2047
|
/**
|
1854
2048
|
* Creates a new PageBlobClient object identical to the source but with the
|
@@ -1871,27 +2065,23 @@ export class PageBlobClient extends BlobClient {
|
|
1871
2065
|
* @returns Response data for the Page Blob Create operation.
|
1872
2066
|
*/
|
1873
2067
|
async create(size, options = {}) {
|
2068
|
+
var _a, _b, _c;
|
1874
2069
|
options.conditions = options.conditions || {};
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
return
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
tier: toAccessTier(options.tier),
|
1891
|
-
blobTagsString: toBlobTagsString(options.tags),
|
1892
|
-
tracingOptions: updatedOptions.tracingOptions,
|
1893
|
-
}));
|
1894
|
-
});
|
2070
|
+
const { span, updatedOptions } = createSpan("PageBlobClient-create", options);
|
2071
|
+
try {
|
2072
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
2073
|
+
return await this.pageBlobContext.create(0, size, Object.assign({ abortSignal: options.abortSignal, blobHttpHeaders: options.blobHTTPHeaders, blobSequenceNumber: options.blobSequenceNumber, leaseAccessConditions: options.conditions, metadata: options.metadata, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags) }, convertTracingToRequestOptionsBase(updatedOptions)));
|
2074
|
+
}
|
2075
|
+
catch (e) {
|
2076
|
+
span.setStatus({
|
2077
|
+
code: SpanStatusCode.ERROR,
|
2078
|
+
message: e.message,
|
2079
|
+
});
|
2080
|
+
throw e;
|
2081
|
+
}
|
2082
|
+
finally {
|
2083
|
+
span.end();
|
2084
|
+
}
|
1895
2085
|
}
|
1896
2086
|
/**
|
1897
2087
|
* Creates a page blob of the specified length. Call uploadPages to upload data
|
@@ -1903,20 +2093,30 @@ export class PageBlobClient extends BlobClient {
|
|
1903
2093
|
* @param options -
|
1904
2094
|
*/
|
1905
2095
|
async createIfNotExists(size, options = {}) {
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
2096
|
+
var _a, _b;
|
2097
|
+
const { span, updatedOptions } = createSpan("PageBlobClient-createIfNotExists", options);
|
2098
|
+
try {
|
2099
|
+
const conditions = { ifNoneMatch: ETagAny };
|
2100
|
+
const res = await this.create(size, Object.assign(Object.assign({}, options), { conditions, tracingOptions: updatedOptions.tracingOptions }));
|
2101
|
+
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
|
2102
|
+
}
|
2103
|
+
catch (e) {
|
2104
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") {
|
2105
|
+
span.setStatus({
|
2106
|
+
code: SpanStatusCode.ERROR,
|
2107
|
+
message: "Expected exception when creating a blob only if it does not already exist.",
|
2108
|
+
});
|
2109
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
1918
2110
|
}
|
1919
|
-
|
2111
|
+
span.setStatus({
|
2112
|
+
code: SpanStatusCode.ERROR,
|
2113
|
+
message: e.message,
|
2114
|
+
});
|
2115
|
+
throw e;
|
2116
|
+
}
|
2117
|
+
finally {
|
2118
|
+
span.end();
|
2119
|
+
}
|
1920
2120
|
}
|
1921
2121
|
/**
|
1922
2122
|
* Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512.
|
@@ -1929,26 +2129,25 @@ export class PageBlobClient extends BlobClient {
|
|
1929
2129
|
* @returns Response data for the Page Blob Upload Pages operation.
|
1930
2130
|
*/
|
1931
2131
|
async uploadPages(body, offset, count, options = {}) {
|
2132
|
+
var _a;
|
1932
2133
|
options.conditions = options.conditions || {};
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
return
|
1937
|
-
abortSignal: options.abortSignal,
|
1938
|
-
leaseAccessConditions: options.conditions,
|
1939
|
-
modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }),
|
1940
|
-
requestOptions: {
|
2134
|
+
const { span, updatedOptions } = createSpan("PageBlobClient-uploadPages", options);
|
2135
|
+
try {
|
2136
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
2137
|
+
return await this.pageBlobContext.uploadPages(count, body, Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), requestOptions: {
|
1941
2138
|
onUploadProgress: options.onProgress,
|
1942
|
-
},
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
2139
|
+
}, range: rangeToString({ offset, count }), sequenceNumberAccessConditions: options.conditions, transactionalContentMD5: options.transactionalContentMD5, transactionalContentCrc64: options.transactionalContentCrc64, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
|
2140
|
+
}
|
2141
|
+
catch (e) {
|
2142
|
+
span.setStatus({
|
2143
|
+
code: SpanStatusCode.ERROR,
|
2144
|
+
message: e.message,
|
2145
|
+
});
|
2146
|
+
throw e;
|
2147
|
+
}
|
2148
|
+
finally {
|
2149
|
+
span.end();
|
2150
|
+
}
|
1952
2151
|
}
|
1953
2152
|
/**
|
1954
2153
|
* The Upload Pages operation writes a range of pages to a page blob where the
|
@@ -1962,30 +2161,29 @@ export class PageBlobClient extends BlobClient {
|
|
1962
2161
|
* @param options -
|
1963
2162
|
*/
|
1964
2163
|
async uploadPagesFromURL(sourceURL, sourceOffset, destOffset, count, options = {}) {
|
2164
|
+
var _a;
|
1965
2165
|
options.conditions = options.conditions || {};
|
1966
2166
|
options.sourceConditions = options.sourceConditions || {};
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1970
|
-
return
|
1971
|
-
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
}));
|
1988
|
-
});
|
2167
|
+
const { span, updatedOptions } = createSpan("PageBlobClient-uploadPagesFromURL", options);
|
2168
|
+
try {
|
2169
|
+
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
2170
|
+
return await this.pageBlobContext.uploadPagesFromURL(sourceURL, rangeToString({ offset: sourceOffset, count }), 0, rangeToString({ offset: destOffset, count }), Object.assign({ abortSignal: options.abortSignal, sourceContentMD5: options.sourceContentMD5, sourceContentCrc64: options.sourceContentCrc64, leaseAccessConditions: options.conditions, sequenceNumberAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), sourceModifiedAccessConditions: {
|
2171
|
+
sourceIfMatch: options.sourceConditions.ifMatch,
|
2172
|
+
sourceIfModifiedSince: options.sourceConditions.ifModifiedSince,
|
2173
|
+
sourceIfNoneMatch: options.sourceConditions.ifNoneMatch,
|
2174
|
+
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince,
|
2175
|
+
}, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization) }, convertTracingToRequestOptionsBase(updatedOptions)));
|
2176
|
+
}
|
2177
|
+
catch (e) {
|
2178
|
+
span.setStatus({
|
2179
|
+
code: SpanStatusCode.ERROR,
|
2180
|
+
message: e.message,
|
2181
|
+
});
|
2182
|
+
throw e;
|
2183
|
+
}
|
2184
|
+
finally {
|
2185
|
+
span.end();
|
2186
|
+
}
|
1989
2187
|
}
|
1990
2188
|
/**
|
1991
2189
|
* Frees the specified pages from the page blob.
|
@@ -1997,20 +2195,22 @@ export class PageBlobClient extends BlobClient {
|
|
1997
2195
|
* @returns Response data for the Page Blob Clear Pages operation.
|
1998
2196
|
*/
|
1999
2197
|
async clearPages(offset = 0, count, options = {}) {
|
2198
|
+
var _a;
|
2000
2199
|
options.conditions = options.conditions || {};
|
2001
|
-
|
2002
|
-
|
2003
|
-
return
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2200
|
+
const { span, updatedOptions } = createSpan("PageBlobClient-clearPages", options);
|
2201
|
+
try {
|
2202
|
+
return await this.pageBlobContext.clearPages(0, Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), range: rangeToString({ offset, count }), sequenceNumberAccessConditions: options.conditions, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
|
2203
|
+
}
|
2204
|
+
catch (e) {
|
2205
|
+
span.setStatus({
|
2206
|
+
code: SpanStatusCode.ERROR,
|
2207
|
+
message: e.message,
|
2208
|
+
});
|
2209
|
+
throw e;
|
2210
|
+
}
|
2211
|
+
finally {
|
2212
|
+
span.end();
|
2213
|
+
}
|
2014
2214
|
}
|
2015
2215
|
/**
|
2016
2216
|
* Returns the list of valid page ranges for a page blob or snapshot of a page blob.
|
@@ -2022,18 +2222,24 @@ export class PageBlobClient extends BlobClient {
|
|
2022
2222
|
* @returns Response data for the Page Blob Get Ranges operation.
|
2023
2223
|
*/
|
2024
2224
|
async getPageRanges(offset = 0, count, options = {}) {
|
2225
|
+
var _a;
|
2025
2226
|
options.conditions = options.conditions || {};
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2029
|
-
abortSignal: options.abortSignal,
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2227
|
+
const { span, updatedOptions } = createSpan("PageBlobClient-getPageRanges", options);
|
2228
|
+
try {
|
2229
|
+
return await this.pageBlobContext
|
2230
|
+
.getPageRanges(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), range: rangeToString({ offset, count }) }, convertTracingToRequestOptionsBase(updatedOptions)))
|
2231
|
+
.then(rangeResponseFromModel);
|
2232
|
+
}
|
2233
|
+
catch (e) {
|
2234
|
+
span.setStatus({
|
2235
|
+
code: SpanStatusCode.ERROR,
|
2236
|
+
message: e.message,
|
2237
|
+
});
|
2238
|
+
throw e;
|
2239
|
+
}
|
2240
|
+
finally {
|
2241
|
+
span.end();
|
2242
|
+
}
|
2037
2243
|
}
|
2038
2244
|
/**
|
2039
2245
|
* getPageRangesSegment returns a single segment of page ranges starting from the
|
@@ -2048,18 +2254,21 @@ export class PageBlobClient extends BlobClient {
|
|
2048
2254
|
* @param options - Options to PageBlob Get Page Ranges Segment operation.
|
2049
2255
|
*/
|
2050
2256
|
async listPageRangesSegment(offset = 0, count, marker, options = {}) {
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
}
|
2257
|
+
var _a;
|
2258
|
+
const { span, updatedOptions } = createSpan("PageBlobClient-getPageRangesSegment", options);
|
2259
|
+
try {
|
2260
|
+
return await this.pageBlobContext.getPageRanges(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), range: rangeToString({ offset, count }), marker: marker, maxPageSize: options.maxPageSize }, convertTracingToRequestOptionsBase(updatedOptions)));
|
2261
|
+
}
|
2262
|
+
catch (e) {
|
2263
|
+
span.setStatus({
|
2264
|
+
code: SpanStatusCode.ERROR,
|
2265
|
+
message: e.message,
|
2266
|
+
});
|
2267
|
+
throw e;
|
2268
|
+
}
|
2269
|
+
finally {
|
2270
|
+
span.end();
|
2271
|
+
}
|
2063
2272
|
}
|
2064
2273
|
/**
|
2065
2274
|
* Returns an AsyncIterableIterator for {@link PageBlobGetPageRangesResponseModel}
|
@@ -2220,19 +2429,24 @@ export class PageBlobClient extends BlobClient {
|
|
2220
2429
|
* @returns Response data for the Page Blob Get Page Range Diff operation.
|
2221
2430
|
*/
|
2222
2431
|
async getPageRangesDiff(offset, count, prevSnapshot, options = {}) {
|
2432
|
+
var _a;
|
2223
2433
|
options.conditions = options.conditions || {};
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2227
|
-
abortSignal: options.abortSignal,
|
2228
|
-
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2232
|
-
|
2233
|
-
|
2234
|
-
|
2235
|
-
|
2434
|
+
const { span, updatedOptions } = createSpan("PageBlobClient-getPageRangesDiff", options);
|
2435
|
+
try {
|
2436
|
+
return await this.pageBlobContext
|
2437
|
+
.getPageRangesDiff(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), prevsnapshot: prevSnapshot, range: rangeToString({ offset, count }) }, convertTracingToRequestOptionsBase(updatedOptions)))
|
2438
|
+
.then(rangeResponseFromModel);
|
2439
|
+
}
|
2440
|
+
catch (e) {
|
2441
|
+
span.setStatus({
|
2442
|
+
code: SpanStatusCode.ERROR,
|
2443
|
+
message: e.message,
|
2444
|
+
});
|
2445
|
+
throw e;
|
2446
|
+
}
|
2447
|
+
finally {
|
2448
|
+
span.end();
|
2449
|
+
}
|
2236
2450
|
}
|
2237
2451
|
/**
|
2238
2452
|
* getPageRangesDiffSegment returns a single segment of page ranges starting from the
|
@@ -2248,23 +2462,25 @@ export class PageBlobClient extends BlobClient {
|
|
2248
2462
|
* @param marker - A string value that identifies the portion of the get to be returned with the next get operation.
|
2249
2463
|
* @param options - Options to the Page Blob Get Page Ranges Diff operation.
|
2250
2464
|
*/
|
2251
|
-
async listPageRangesDiffSegment(offset, count, prevSnapshotOrUrl, marker, options
|
2252
|
-
|
2253
|
-
|
2254
|
-
|
2255
|
-
|
2256
|
-
leaseAccessConditions: options === null || options === void 0 ? void 0 : options.conditions,
|
2257
|
-
modifiedAccessConditions: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.conditions), { ifTags: (_a = options === null || options === void 0 ? void 0 : options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }),
|
2258
|
-
prevsnapshot: prevSnapshotOrUrl,
|
2259
|
-
range: rangeToString({
|
2465
|
+
async listPageRangesDiffSegment(offset, count, prevSnapshotOrUrl, marker, options) {
|
2466
|
+
var _a;
|
2467
|
+
const { span, updatedOptions } = createSpan("PageBlobClient-getPageRangesDiffSegment", options);
|
2468
|
+
try {
|
2469
|
+
return await this.pageBlobContext.getPageRangesDiff(Object.assign({ abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal, leaseAccessConditions: options === null || options === void 0 ? void 0 : options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.conditions), { ifTags: (_a = options === null || options === void 0 ? void 0 : options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), prevsnapshot: prevSnapshotOrUrl, range: rangeToString({
|
2260
2470
|
offset: offset,
|
2261
2471
|
count: count,
|
2262
|
-
}),
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2472
|
+
}), marker: marker, maxPageSize: options === null || options === void 0 ? void 0 : options.maxPageSize }, convertTracingToRequestOptionsBase(updatedOptions)));
|
2473
|
+
}
|
2474
|
+
catch (e) {
|
2475
|
+
span.setStatus({
|
2476
|
+
code: SpanStatusCode.ERROR,
|
2477
|
+
message: e.message,
|
2478
|
+
});
|
2479
|
+
throw e;
|
2480
|
+
}
|
2481
|
+
finally {
|
2482
|
+
span.end();
|
2483
|
+
}
|
2268
2484
|
}
|
2269
2485
|
/**
|
2270
2486
|
* Returns an AsyncIterableIterator for {@link PageBlobGetPageRangesDiffResponseModel}
|
@@ -2429,19 +2645,24 @@ export class PageBlobClient extends BlobClient {
|
|
2429
2645
|
* @returns Response data for the Page Blob Get Page Range Diff operation.
|
2430
2646
|
*/
|
2431
2647
|
async getPageRangesDiffForManagedDisks(offset, count, prevSnapshotUrl, options = {}) {
|
2648
|
+
var _a;
|
2432
2649
|
options.conditions = options.conditions || {};
|
2433
|
-
|
2434
|
-
|
2435
|
-
|
2436
|
-
abortSignal: options.abortSignal,
|
2437
|
-
|
2438
|
-
|
2439
|
-
|
2440
|
-
|
2441
|
-
|
2442
|
-
|
2443
|
-
|
2444
|
-
|
2650
|
+
const { span, updatedOptions } = createSpan("PageBlobClient-GetPageRangesDiffForManagedDisks", options);
|
2651
|
+
try {
|
2652
|
+
return await this.pageBlobContext
|
2653
|
+
.getPageRangesDiff(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), prevSnapshotUrl, range: rangeToString({ offset, count }) }, convertTracingToRequestOptionsBase(updatedOptions)))
|
2654
|
+
.then(rangeResponseFromModel);
|
2655
|
+
}
|
2656
|
+
catch (e) {
|
2657
|
+
span.setStatus({
|
2658
|
+
code: SpanStatusCode.ERROR,
|
2659
|
+
message: e.message,
|
2660
|
+
});
|
2661
|
+
throw e;
|
2662
|
+
}
|
2663
|
+
finally {
|
2664
|
+
span.end();
|
2665
|
+
}
|
2445
2666
|
}
|
2446
2667
|
/**
|
2447
2668
|
* Resizes the page blob to the specified size (which must be a multiple of 512).
|
@@ -2452,17 +2673,22 @@ export class PageBlobClient extends BlobClient {
|
|
2452
2673
|
* @returns Response data for the Page Blob Resize operation.
|
2453
2674
|
*/
|
2454
2675
|
async resize(size, options = {}) {
|
2676
|
+
var _a;
|
2455
2677
|
options.conditions = options.conditions || {};
|
2456
|
-
|
2457
|
-
|
2458
|
-
return
|
2459
|
-
|
2460
|
-
|
2461
|
-
|
2462
|
-
|
2463
|
-
|
2464
|
-
})
|
2465
|
-
|
2678
|
+
const { span, updatedOptions } = createSpan("PageBlobClient-resize", options);
|
2679
|
+
try {
|
2680
|
+
return await this.pageBlobContext.resize(size, Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
|
2681
|
+
}
|
2682
|
+
catch (e) {
|
2683
|
+
span.setStatus({
|
2684
|
+
code: SpanStatusCode.ERROR,
|
2685
|
+
message: e.message,
|
2686
|
+
});
|
2687
|
+
throw e;
|
2688
|
+
}
|
2689
|
+
finally {
|
2690
|
+
span.end();
|
2691
|
+
}
|
2466
2692
|
}
|
2467
2693
|
/**
|
2468
2694
|
* Sets a page blob's sequence number.
|
@@ -2474,17 +2700,22 @@ export class PageBlobClient extends BlobClient {
|
|
2474
2700
|
* @returns Response data for the Page Blob Update Sequence Number operation.
|
2475
2701
|
*/
|
2476
2702
|
async updateSequenceNumber(sequenceNumberAction, sequenceNumber, options = {}) {
|
2703
|
+
var _a;
|
2477
2704
|
options.conditions = options.conditions || {};
|
2478
|
-
|
2479
|
-
|
2480
|
-
return
|
2481
|
-
|
2482
|
-
|
2483
|
-
|
2484
|
-
|
2485
|
-
|
2486
|
-
})
|
2487
|
-
|
2705
|
+
const { span, updatedOptions } = createSpan("PageBlobClient-updateSequenceNumber", options);
|
2706
|
+
try {
|
2707
|
+
return await this.pageBlobContext.updateSequenceNumber(sequenceNumberAction, Object.assign({ abortSignal: options.abortSignal, blobSequenceNumber: sequenceNumber, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }) }, convertTracingToRequestOptionsBase(updatedOptions)));
|
2708
|
+
}
|
2709
|
+
catch (e) {
|
2710
|
+
span.setStatus({
|
2711
|
+
code: SpanStatusCode.ERROR,
|
2712
|
+
message: e.message,
|
2713
|
+
});
|
2714
|
+
throw e;
|
2715
|
+
}
|
2716
|
+
finally {
|
2717
|
+
span.end();
|
2718
|
+
}
|
2488
2719
|
}
|
2489
2720
|
/**
|
2490
2721
|
* Begins an operation to start an incremental copy from one page blob's snapshot to this page blob.
|
@@ -2500,14 +2731,21 @@ export class PageBlobClient extends BlobClient {
|
|
2500
2731
|
* @returns Response data for the Page Blob Copy Incremental operation.
|
2501
2732
|
*/
|
2502
2733
|
async startCopyIncremental(copySource, options = {}) {
|
2503
|
-
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2734
|
+
var _a;
|
2735
|
+
const { span, updatedOptions } = createSpan("PageBlobClient-startCopyIncremental", options);
|
2736
|
+
try {
|
2737
|
+
return await this.pageBlobContext.copyIncremental(copySource, Object.assign({ abortSignal: options.abortSignal, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }) }, convertTracingToRequestOptionsBase(updatedOptions)));
|
2738
|
+
}
|
2739
|
+
catch (e) {
|
2740
|
+
span.setStatus({
|
2741
|
+
code: SpanStatusCode.ERROR,
|
2742
|
+
message: e.message,
|
2743
|
+
});
|
2744
|
+
throw e;
|
2745
|
+
}
|
2746
|
+
finally {
|
2747
|
+
span.end();
|
2748
|
+
}
|
2511
2749
|
}
|
2512
2750
|
}
|
2513
2751
|
//# sourceMappingURL=Clients.js.map
|