@azure/storage-blob 12.13.0-alpha.20230120.2 → 12.13.0-alpha.20230124.2
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 +390 -1292
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobBatch.js +5 -28
- package/dist-esm/storage-blob/src/BlobBatch.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobBatchClient.js +3 -15
- package/dist-esm/storage-blob/src/BlobBatchClient.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobLeaseClient.js +27 -78
- package/dist-esm/storage-blob/src/BlobLeaseClient.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobServiceClient.js +25 -148
- package/dist-esm/storage-blob/src/BlobServiceClient.js.map +1 -1
- package/dist-esm/storage-blob/src/Clients.js +267 -816
- package/dist-esm/storage-blob/src/Clients.js.map +1 -1
- package/dist-esm/storage-blob/src/ContainerClient.js +65 -217
- package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/tracing.js +5 -3
- package/dist-esm/storage-blob/src/utils/tracing.js.map +1 -1
- package/package.json +2 -2
- package/types/3.1/storage-blob.d.ts +1 -1
- package/types/latest/storage-blob.d.ts +1 -1
@@ -2,12 +2,11 @@ import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tsli
|
|
2
2
|
import { getDefaultProxySettings, } from "@azure/core-rest-pipeline";
|
3
3
|
import { isNode } from "@azure/core-util";
|
4
4
|
import { isTokenCredential } from "@azure/core-auth";
|
5
|
-
import { SpanStatusCode } from "@azure/core-tracing";
|
6
5
|
import { AnonymousCredential } from "./credentials/AnonymousCredential";
|
7
6
|
import { StorageSharedKeyCredential } from "./credentials/StorageSharedKeyCredential";
|
8
7
|
import { newPipeline, isPipelineLike } from "./Pipeline";
|
9
8
|
import { StorageClient } from "./StorageClient";
|
10
|
-
import {
|
9
|
+
import { tracingClient } from "./utils/tracing";
|
11
10
|
import { appendToURLPath, appendToURLQuery, assertResponse, BlobNameToString, ConvertInternalResponseOfListBlobFlat, ConvertInternalResponseOfListBlobHierarchy, EscapePath, extractConnectionStringParts, isIpEndpointStyle, parseObjectReplicationRecord, toTags, truncatedISO8061Date, } from "./utils/utils.common";
|
12
11
|
import { generateBlobSASQueryParameters } from "./sas/BlobSASSignatureValues";
|
13
12
|
import { BlobLeaseClient } from "./BlobLeaseClient";
|
@@ -103,22 +102,9 @@ export class ContainerClient extends StorageClient {
|
|
103
102
|
* ```
|
104
103
|
*/
|
105
104
|
async create(options = {}) {
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
// this will filter out unwanted properties from the response object into result object
|
110
|
-
return assertResponse(await this.containerContext.create(Object.assign({}, updatedOptions)));
|
111
|
-
}
|
112
|
-
catch (e) {
|
113
|
-
span.setStatus({
|
114
|
-
code: SpanStatusCode.ERROR,
|
115
|
-
message: e.message,
|
116
|
-
});
|
117
|
-
throw e;
|
118
|
-
}
|
119
|
-
finally {
|
120
|
-
span.end();
|
121
|
-
}
|
105
|
+
return tracingClient.withSpan("ContainerClient-create", options, async (updatedOptions) => {
|
106
|
+
return assertResponse(await this.containerContext.create(updatedOptions));
|
107
|
+
});
|
122
108
|
}
|
123
109
|
/**
|
124
110
|
* Creates a new container under the specified account. If the container with
|
@@ -129,29 +115,21 @@ export class ContainerClient extends StorageClient {
|
|
129
115
|
* @param options -
|
130
116
|
*/
|
131
117
|
async createIfNotExists(options = {}) {
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
}
|
138
|
-
catch (e) {
|
139
|
-
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerAlreadyExists") {
|
140
|
-
span.setStatus({
|
141
|
-
code: SpanStatusCode.ERROR,
|
142
|
-
message: "Expected exception when creating a container only if it does not already exist.",
|
143
|
-
});
|
144
|
-
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
118
|
+
return tracingClient.withSpan("ContainerClient-createIfNotExists", options, async (updatedOptions) => {
|
119
|
+
var _a, _b;
|
120
|
+
try {
|
121
|
+
const res = await this.create(updatedOptions);
|
122
|
+
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
|
145
123
|
}
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
}
|
124
|
+
catch (e) {
|
125
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerAlreadyExists") {
|
126
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
127
|
+
}
|
128
|
+
else {
|
129
|
+
throw e;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
});
|
155
133
|
}
|
156
134
|
/**
|
157
135
|
* Returns true if the Azure container resource represented by this client exists; false otherwise.
|
@@ -163,31 +141,21 @@ export class ContainerClient extends StorageClient {
|
|
163
141
|
* @param options -
|
164
142
|
*/
|
165
143
|
async exists(options = {}) {
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
});
|
172
|
-
return true;
|
173
|
-
}
|
174
|
-
catch (e) {
|
175
|
-
if (e.statusCode === 404) {
|
176
|
-
span.setStatus({
|
177
|
-
code: SpanStatusCode.ERROR,
|
178
|
-
message: "Expected exception when checking container existence",
|
144
|
+
return tracingClient.withSpan("ContainerClient-exists", options, async (updatedOptions) => {
|
145
|
+
try {
|
146
|
+
await this.getProperties({
|
147
|
+
abortSignal: options.abortSignal,
|
148
|
+
tracingOptions: updatedOptions.tracingOptions,
|
179
149
|
});
|
180
|
-
return
|
150
|
+
return true;
|
181
151
|
}
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
span.end();
|
190
|
-
}
|
152
|
+
catch (e) {
|
153
|
+
if (e.statusCode === 404) {
|
154
|
+
return false;
|
155
|
+
}
|
156
|
+
throw e;
|
157
|
+
}
|
158
|
+
});
|
191
159
|
}
|
192
160
|
/**
|
193
161
|
* Creates a {@link BlobClient}
|
@@ -248,20 +216,9 @@ export class ContainerClient extends StorageClient {
|
|
248
216
|
if (!options.conditions) {
|
249
217
|
options.conditions = {};
|
250
218
|
}
|
251
|
-
|
252
|
-
try {
|
219
|
+
return tracingClient.withSpan("ContainerClient-getProperties", options, async (updatedOptions) => {
|
253
220
|
return assertResponse(await this.containerContext.getProperties(Object.assign(Object.assign({ abortSignal: options.abortSignal }, options.conditions), { tracingOptions: updatedOptions.tracingOptions })));
|
254
|
-
}
|
255
|
-
catch (e) {
|
256
|
-
span.setStatus({
|
257
|
-
code: SpanStatusCode.ERROR,
|
258
|
-
message: e.message,
|
259
|
-
});
|
260
|
-
throw e;
|
261
|
-
}
|
262
|
-
finally {
|
263
|
-
span.end();
|
264
|
-
}
|
221
|
+
});
|
265
222
|
}
|
266
223
|
/**
|
267
224
|
* Marks the specified container for deletion. The container and any blobs
|
@@ -274,25 +231,14 @@ export class ContainerClient extends StorageClient {
|
|
274
231
|
if (!options.conditions) {
|
275
232
|
options.conditions = {};
|
276
233
|
}
|
277
|
-
|
278
|
-
try {
|
234
|
+
return tracingClient.withSpan("ContainerClient-delete", options, async (updatedOptions) => {
|
279
235
|
return assertResponse(await this.containerContext.delete({
|
280
236
|
abortSignal: options.abortSignal,
|
281
237
|
leaseAccessConditions: options.conditions,
|
282
238
|
modifiedAccessConditions: options.conditions,
|
283
239
|
tracingOptions: updatedOptions.tracingOptions,
|
284
240
|
}));
|
285
|
-
}
|
286
|
-
catch (e) {
|
287
|
-
span.setStatus({
|
288
|
-
code: SpanStatusCode.ERROR,
|
289
|
-
message: e.message,
|
290
|
-
});
|
291
|
-
throw e;
|
292
|
-
}
|
293
|
-
finally {
|
294
|
-
span.end();
|
295
|
-
}
|
241
|
+
});
|
296
242
|
}
|
297
243
|
/**
|
298
244
|
* Marks the specified container for deletion if it exists. The container and any blobs
|
@@ -302,29 +248,19 @@ export class ContainerClient extends StorageClient {
|
|
302
248
|
* @param options - Options to Container Delete operation.
|
303
249
|
*/
|
304
250
|
async deleteIfExists(options = {}) {
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
}
|
311
|
-
catch (e) {
|
312
|
-
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerNotFound") {
|
313
|
-
span.setStatus({
|
314
|
-
code: SpanStatusCode.ERROR,
|
315
|
-
message: "Expected exception when deleting a container only if it exists.",
|
316
|
-
});
|
317
|
-
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
251
|
+
return tracingClient.withSpan("ContainerClient-deleteIfExists", options, async (updatedOptions) => {
|
252
|
+
var _a, _b;
|
253
|
+
try {
|
254
|
+
const res = await this.delete(updatedOptions);
|
255
|
+
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
|
318
256
|
}
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
span.end();
|
327
|
-
}
|
257
|
+
catch (e) {
|
258
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerNotFound") {
|
259
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
260
|
+
}
|
261
|
+
throw e;
|
262
|
+
}
|
263
|
+
});
|
328
264
|
}
|
329
265
|
/**
|
330
266
|
* Sets one or more user-defined name-value pairs for the specified container.
|
@@ -345,8 +281,7 @@ export class ContainerClient extends StorageClient {
|
|
345
281
|
if (options.conditions.ifUnmodifiedSince) {
|
346
282
|
throw new RangeError("the IfUnmodifiedSince must have their default values because they are ignored by the blob service");
|
347
283
|
}
|
348
|
-
|
349
|
-
try {
|
284
|
+
return tracingClient.withSpan("ContainerClient-setMetadata", options, async (updatedOptions) => {
|
350
285
|
return assertResponse(await this.containerContext.setMetadata({
|
351
286
|
abortSignal: options.abortSignal,
|
352
287
|
leaseAccessConditions: options.conditions,
|
@@ -354,17 +289,7 @@ export class ContainerClient extends StorageClient {
|
|
354
289
|
modifiedAccessConditions: options.conditions,
|
355
290
|
tracingOptions: updatedOptions.tracingOptions,
|
356
291
|
}));
|
357
|
-
}
|
358
|
-
catch (e) {
|
359
|
-
span.setStatus({
|
360
|
-
code: SpanStatusCode.ERROR,
|
361
|
-
message: e.message,
|
362
|
-
});
|
363
|
-
throw e;
|
364
|
-
}
|
365
|
-
finally {
|
366
|
-
span.end();
|
367
|
-
}
|
292
|
+
});
|
368
293
|
}
|
369
294
|
/**
|
370
295
|
* Gets the permissions for the specified container. The permissions indicate
|
@@ -381,8 +306,7 @@ export class ContainerClient extends StorageClient {
|
|
381
306
|
if (!options.conditions) {
|
382
307
|
options.conditions = {};
|
383
308
|
}
|
384
|
-
|
385
|
-
try {
|
309
|
+
return tracingClient.withSpan("ContainerClient-getAccessPolicy", options, async (updatedOptions) => {
|
386
310
|
const response = assertResponse(await this.containerContext.getAccessPolicy({
|
387
311
|
abortSignal: options.abortSignal,
|
388
312
|
leaseAccessConditions: options.conditions,
|
@@ -419,17 +343,7 @@ export class ContainerClient extends StorageClient {
|
|
419
343
|
});
|
420
344
|
}
|
421
345
|
return res;
|
422
|
-
}
|
423
|
-
catch (e) {
|
424
|
-
span.setStatus({
|
425
|
-
code: SpanStatusCode.ERROR,
|
426
|
-
message: e.message,
|
427
|
-
});
|
428
|
-
throw e;
|
429
|
-
}
|
430
|
-
finally {
|
431
|
-
span.end();
|
432
|
-
}
|
346
|
+
});
|
433
347
|
}
|
434
348
|
/**
|
435
349
|
* Sets the permissions for the specified container. The permissions indicate
|
@@ -450,8 +364,7 @@ export class ContainerClient extends StorageClient {
|
|
450
364
|
*/
|
451
365
|
async setAccessPolicy(access, containerAcl, options = {}) {
|
452
366
|
options.conditions = options.conditions || {};
|
453
|
-
|
454
|
-
try {
|
367
|
+
return tracingClient.withSpan("ContainerClient-setAccessPolicy", options, async (updatedOptions) => {
|
455
368
|
const acl = [];
|
456
369
|
for (const identifier of containerAcl || []) {
|
457
370
|
acl.push({
|
@@ -475,17 +388,7 @@ export class ContainerClient extends StorageClient {
|
|
475
388
|
modifiedAccessConditions: options.conditions,
|
476
389
|
tracingOptions: updatedOptions.tracingOptions,
|
477
390
|
}));
|
478
|
-
}
|
479
|
-
catch (e) {
|
480
|
-
span.setStatus({
|
481
|
-
code: SpanStatusCode.ERROR,
|
482
|
-
message: e.message,
|
483
|
-
});
|
484
|
-
throw e;
|
485
|
-
}
|
486
|
-
finally {
|
487
|
-
span.end();
|
488
|
-
}
|
391
|
+
});
|
489
392
|
}
|
490
393
|
/**
|
491
394
|
* Get a {@link BlobLeaseClient} that manages leases on the container.
|
@@ -519,25 +422,14 @@ export class ContainerClient extends StorageClient {
|
|
519
422
|
* @returns Block Blob upload response data and the corresponding BlockBlobClient instance.
|
520
423
|
*/
|
521
424
|
async uploadBlockBlob(blobName, body, contentLength, options = {}) {
|
522
|
-
|
523
|
-
try {
|
425
|
+
return tracingClient.withSpan("ContainerClient-uploadBlockBlob", options, async (updatedOptions) => {
|
524
426
|
const blockBlobClient = this.getBlockBlobClient(blobName);
|
525
427
|
const response = await blockBlobClient.upload(body, contentLength, updatedOptions);
|
526
428
|
return {
|
527
429
|
blockBlobClient,
|
528
430
|
response,
|
529
431
|
};
|
530
|
-
}
|
531
|
-
catch (e) {
|
532
|
-
span.setStatus({
|
533
|
-
code: SpanStatusCode.ERROR,
|
534
|
-
message: e.message,
|
535
|
-
});
|
536
|
-
throw e;
|
537
|
-
}
|
538
|
-
finally {
|
539
|
-
span.end();
|
540
|
-
}
|
432
|
+
});
|
541
433
|
}
|
542
434
|
/**
|
543
435
|
* Marks the specified blob or snapshot for deletion. The blob is later deleted
|
@@ -551,24 +443,13 @@ export class ContainerClient extends StorageClient {
|
|
551
443
|
* @returns Block blob deletion response data.
|
552
444
|
*/
|
553
445
|
async deleteBlob(blobName, options = {}) {
|
554
|
-
|
555
|
-
try {
|
446
|
+
return tracingClient.withSpan("ContainerClient-deleteBlob", options, async (updatedOptions) => {
|
556
447
|
let blobClient = this.getBlobClient(blobName);
|
557
448
|
if (options.versionId) {
|
558
449
|
blobClient = blobClient.withVersion(options.versionId);
|
559
450
|
}
|
560
|
-
return
|
561
|
-
}
|
562
|
-
catch (e) {
|
563
|
-
span.setStatus({
|
564
|
-
code: SpanStatusCode.ERROR,
|
565
|
-
message: e.message,
|
566
|
-
});
|
567
|
-
throw e;
|
568
|
-
}
|
569
|
-
finally {
|
570
|
-
span.end();
|
571
|
-
}
|
451
|
+
return blobClient.delete(updatedOptions);
|
452
|
+
});
|
572
453
|
}
|
573
454
|
/**
|
574
455
|
* listBlobFlatSegment returns a single segment of blobs starting from the
|
@@ -581,25 +462,14 @@ export class ContainerClient extends StorageClient {
|
|
581
462
|
* @param options - Options to Container List Blob Flat Segment operation.
|
582
463
|
*/
|
583
464
|
async listBlobFlatSegment(marker, options = {}) {
|
584
|
-
|
585
|
-
try {
|
465
|
+
return tracingClient.withSpan("ContainerClient-listBlobFlatSegment", options, async (updatedOptions) => {
|
586
466
|
const response = assertResponse(await this.containerContext.listBlobFlatSegment(Object.assign(Object.assign({ marker }, options), { tracingOptions: updatedOptions.tracingOptions })));
|
587
467
|
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListBlobFlat(response._response.parsedBody) }), segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInternal) => {
|
588
468
|
const blobItem = Object.assign(Object.assign({}, blobItemInternal), { name: BlobNameToString(blobItemInternal.name), tags: toTags(blobItemInternal.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInternal.objectReplicationMetadata) });
|
589
469
|
return blobItem;
|
590
470
|
}) }) });
|
591
471
|
return wrappedResponse;
|
592
|
-
}
|
593
|
-
catch (e) {
|
594
|
-
span.setStatus({
|
595
|
-
code: SpanStatusCode.ERROR,
|
596
|
-
message: e.message,
|
597
|
-
});
|
598
|
-
throw e;
|
599
|
-
}
|
600
|
-
finally {
|
601
|
-
span.end();
|
602
|
-
}
|
472
|
+
});
|
603
473
|
}
|
604
474
|
/**
|
605
475
|
* listBlobHierarchySegment returns a single segment of blobs starting from
|
@@ -613,9 +483,8 @@ export class ContainerClient extends StorageClient {
|
|
613
483
|
* @param options - Options to Container List Blob Hierarchy Segment operation.
|
614
484
|
*/
|
615
485
|
async listBlobHierarchySegment(delimiter, marker, options = {}) {
|
616
|
-
|
617
|
-
|
618
|
-
try {
|
486
|
+
return tracingClient.withSpan("ContainerClient-listBlobHierarchySegment", options, async (updatedOptions) => {
|
487
|
+
var _a;
|
619
488
|
const response = assertResponse(await this.containerContext.listBlobHierarchySegment(delimiter, Object.assign(Object.assign({ marker }, options), { tracingOptions: updatedOptions.tracingOptions })));
|
620
489
|
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListBlobHierarchy(response._response.parsedBody) }), segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInternal) => {
|
621
490
|
const blobItem = Object.assign(Object.assign({}, blobItemInternal), { name: BlobNameToString(blobItemInternal.name), tags: toTags(blobItemInternal.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInternal.objectReplicationMetadata) });
|
@@ -627,17 +496,7 @@ export class ContainerClient extends StorageClient {
|
|
627
496
|
return blobPrefix;
|
628
497
|
}) }) });
|
629
498
|
return wrappedResponse;
|
630
|
-
}
|
631
|
-
catch (e) {
|
632
|
-
span.setStatus({
|
633
|
-
code: SpanStatusCode.ERROR,
|
634
|
-
message: e.message,
|
635
|
-
});
|
636
|
-
throw e;
|
637
|
-
}
|
638
|
-
finally {
|
639
|
-
span.end();
|
640
|
-
}
|
499
|
+
});
|
641
500
|
}
|
642
501
|
/**
|
643
502
|
* Returns an AsyncIterableIterator for ContainerListBlobFlatSegmentResponse
|
@@ -1032,8 +891,7 @@ export class ContainerClient extends StorageClient {
|
|
1032
891
|
* @param options - Options to find blobs by tags.
|
1033
892
|
*/
|
1034
893
|
async findBlobsByTagsSegment(tagFilterSqlExpression, marker, options = {}) {
|
1035
|
-
|
1036
|
-
try {
|
894
|
+
return tracingClient.withSpan("ContainerClient-findBlobsByTagsSegment", options, async (updatedOptions) => {
|
1037
895
|
const response = assertResponse(await this.containerContext.filterBlobs({
|
1038
896
|
abortSignal: options.abortSignal,
|
1039
897
|
where: tagFilterSqlExpression,
|
@@ -1050,17 +908,7 @@ export class ContainerClient extends StorageClient {
|
|
1050
908
|
return Object.assign(Object.assign({}, blob), { tags: toTags(blob.tags), tagValue });
|
1051
909
|
}) });
|
1052
910
|
return wrappedResponse;
|
1053
|
-
}
|
1054
|
-
catch (e) {
|
1055
|
-
span.setStatus({
|
1056
|
-
code: SpanStatusCode.ERROR,
|
1057
|
-
message: e.message,
|
1058
|
-
});
|
1059
|
-
throw e;
|
1060
|
-
}
|
1061
|
-
finally {
|
1062
|
-
span.end();
|
1063
|
-
}
|
911
|
+
});
|
1064
912
|
}
|
1065
913
|
/**
|
1066
914
|
* Returns an AsyncIterableIterator for ContainerFindBlobsByTagsSegmentResponse.
|