@azure/storage-blob 12.13.0 → 12.20.0-alpha.20230306.3
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 +13103 -13682
- 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 +3 -2
- package/dist-esm/storage-blob/src/BatchResponseParser.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobBatch.js +74 -87
- package/dist-esm/storage-blob/src/BlobBatch.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobBatchClient.js +10 -23
- package/dist-esm/storage-blob/src/BlobBatchClient.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobDownloadResponse.js +1 -9
- package/dist-esm/storage-blob/src/BlobDownloadResponse.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobLeaseClient.js +54 -83
- 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 +67 -165
- package/dist-esm/storage-blob/src/BlobServiceClient.js.map +1 -1
- package/dist-esm/storage-blob/src/Clients.js +651 -889
- package/dist-esm/storage-blob/src/Clients.js.map +1 -1
- package/dist-esm/storage-blob/src/ContainerClient.js +115 -238
- 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 +194 -40
- 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 +4 -17
- 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/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 +248 -1
- 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 +13 -18
- 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 +11 -27
- 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 +28 -110
- 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 +16 -43
- 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 +22 -86
- 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 +16 -54
- 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 +12 -42
- package/dist-esm/storage-blob/src/generated/src/operations/service.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/appendBlob.js +9 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/appendBlob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blob.js +9 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blockBlob.js +9 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blockBlob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/container.js +9 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/container.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/index.js +14 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/pageBlob.js +9 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/pageBlob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/service.js +9 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/service.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/storageClient.js +32 -10
- package/dist-esm/storage-blob/src/generated/src/storageClient.js.map +1 -1
- package/dist-esm/storage-blob/src/generatedModels.js +1 -5
- package/dist-esm/storage-blob/src/generatedModels.js.map +1 -1
- package/dist-esm/storage-blob/src/index.browser.js +3 -2
- package/dist-esm/storage-blob/src/index.browser.js.map +1 -1
- package/dist-esm/storage-blob/src/index.js +3 -2
- 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/PathParameterWorkaroundPolicy.js +25 -0
- package/dist-esm/storage-blob/src/policies/PathParameterWorkaroundPolicy.js.map +1 -0
- package/dist-esm/storage-blob/src/policies/RequestPolicy.js +40 -0
- package/dist-esm/storage-blob/src/policies/RequestPolicy.js.map +1 -0
- package/dist-esm/storage-blob/src/policies/StorageBrowserPolicy.js +2 -1
- package/dist-esm/storage-blob/src/policies/StorageBrowserPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/StorageBrowserPolicyV2.js +31 -0
- package/dist-esm/storage-blob/src/policies/StorageBrowserPolicyV2.js.map +1 -0
- 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/StorageRetryPolicyV2.js +165 -0
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js.map +1 -0
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.browser.js +18 -0
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.js +131 -0
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.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 +10 -2
- package/dist-esm/storage-blob/src/utils/RetriableReadableStream.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/cache.js +5 -2
- package/dist-esm/storage-blob/src/utils/cache.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/constants.js +1 -1
- package/dist-esm/storage-blob/src/utils/constants.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/tracing.js +5 -18
- package/dist-esm/storage-blob/src/utils/tracing.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/utils.common.js +84 -44
- package/dist-esm/storage-blob/src/utils/utils.common.js.map +1 -1
- package/package.json +22 -17
- package/types/3.1/storage-blob.d.ts +2310 -609
- package/types/latest/storage-blob.d.ts +2550 -670
- package/dist-esm/storage-blob/src/TelemetryPolicyFactory.js +0 -50
- package/dist-esm/storage-blob/src/TelemetryPolicyFactory.js.map +0 -1
- package/dist-esm/storage-blob/src/generated/src/storageClientContext.js +0 -39
- package/dist-esm/storage-blob/src/generated/src/storageClientContext.js.map +0 -1
- package/dist-esm/storage-blob/src/policies/StorageBearerTokenChallengeAuthenticationPolicy.js +0 -245
- package/dist-esm/storage-blob/src/policies/StorageBearerTokenChallengeAuthenticationPolicy.js.map +0 -1
- package/dist-esm/storage-blob/src/policies/TelemetryPolicy.js +0 -36
- package/dist-esm/storage-blob/src/policies/TelemetryPolicy.js.map +0 -1
@@ -1,13 +1,13 @@
|
|
1
1
|
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
2
|
-
import { getDefaultProxySettings,
|
3
|
-
import {
|
2
|
+
import { getDefaultProxySettings, } from "@azure/core-rest-pipeline";
|
3
|
+
import { isNode } from "@azure/core-util";
|
4
|
+
import { isTokenCredential } from "@azure/core-auth";
|
4
5
|
import { AnonymousCredential } from "./credentials/AnonymousCredential";
|
5
6
|
import { StorageSharedKeyCredential } from "./credentials/StorageSharedKeyCredential";
|
6
|
-
import { Container } from "./generated/src/operations";
|
7
7
|
import { newPipeline, isPipelineLike } from "./Pipeline";
|
8
8
|
import { StorageClient } from "./StorageClient";
|
9
|
-
import {
|
10
|
-
import { appendToURLPath, appendToURLQuery, BlobNameToString, ConvertInternalResponseOfListBlobFlat, ConvertInternalResponseOfListBlobHierarchy, EscapePath, extractConnectionStringParts, isIpEndpointStyle, parseObjectReplicationRecord, toTags, truncatedISO8061Date, } from "./utils/utils.common";
|
9
|
+
import { tracingClient } from "./utils/tracing";
|
10
|
+
import { appendToURLPath, appendToURLQuery, assertResponse, BlobNameToString, ConvertInternalResponseOfListBlobFlat, ConvertInternalResponseOfListBlobHierarchy, EscapePath, extractConnectionStringParts, isIpEndpointStyle, parseObjectReplicationRecord, toTags, truncatedISO8061Date, } from "./utils/utils.common";
|
11
11
|
import { generateBlobSASQueryParameters } from "./sas/BlobSASSignatureValues";
|
12
12
|
import { BlobLeaseClient } from "./BlobLeaseClient";
|
13
13
|
import { AppendBlobClient, BlobClient, BlockBlobClient, PageBlobClient, } from "./Clients";
|
@@ -76,7 +76,7 @@ export class ContainerClient extends StorageClient {
|
|
76
76
|
}
|
77
77
|
super(url, pipeline);
|
78
78
|
this._containerName = this.getContainerNameFromUrl();
|
79
|
-
this.containerContext =
|
79
|
+
this.containerContext = this.storageClientContext.container;
|
80
80
|
}
|
81
81
|
/**
|
82
82
|
* The name of the container.
|
@@ -102,22 +102,9 @@ export class ContainerClient extends StorageClient {
|
|
102
102
|
* ```
|
103
103
|
*/
|
104
104
|
async create(options = {}) {
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
// this will filter out unwanted properties from the response object into result object
|
109
|
-
return await this.containerContext.create(Object.assign(Object.assign({}, options), convertTracingToRequestOptionsBase(updatedOptions)));
|
110
|
-
}
|
111
|
-
catch (e) {
|
112
|
-
span.setStatus({
|
113
|
-
code: SpanStatusCode.ERROR,
|
114
|
-
message: e.message,
|
115
|
-
});
|
116
|
-
throw e;
|
117
|
-
}
|
118
|
-
finally {
|
119
|
-
span.end();
|
120
|
-
}
|
105
|
+
return tracingClient.withSpan("ContainerClient-create", options, async (updatedOptions) => {
|
106
|
+
return assertResponse(await this.containerContext.create(updatedOptions));
|
107
|
+
});
|
121
108
|
}
|
122
109
|
/**
|
123
110
|
* Creates a new container under the specified account. If the container with
|
@@ -128,29 +115,21 @@ export class ContainerClient extends StorageClient {
|
|
128
115
|
* @param options -
|
129
116
|
*/
|
130
117
|
async createIfNotExists(options = {}) {
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
}
|
137
|
-
catch (e) {
|
138
|
-
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerAlreadyExists") {
|
139
|
-
span.setStatus({
|
140
|
-
code: SpanStatusCode.ERROR,
|
141
|
-
message: "Expected exception when creating a container only if it does not already exist.",
|
142
|
-
});
|
143
|
-
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 });
|
144
123
|
}
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
}
|
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
|
+
});
|
154
133
|
}
|
155
134
|
/**
|
156
135
|
* Returns true if the Azure container resource represented by this client exists; false otherwise.
|
@@ -162,31 +141,21 @@ export class ContainerClient extends StorageClient {
|
|
162
141
|
* @param options -
|
163
142
|
*/
|
164
143
|
async exists(options = {}) {
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
});
|
171
|
-
return true;
|
172
|
-
}
|
173
|
-
catch (e) {
|
174
|
-
if (e.statusCode === 404) {
|
175
|
-
span.setStatus({
|
176
|
-
code: SpanStatusCode.ERROR,
|
177
|
-
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,
|
178
149
|
});
|
179
|
-
return
|
150
|
+
return true;
|
180
151
|
}
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
span.end();
|
189
|
-
}
|
152
|
+
catch (e) {
|
153
|
+
if (e.statusCode === 404) {
|
154
|
+
return false;
|
155
|
+
}
|
156
|
+
throw e;
|
157
|
+
}
|
158
|
+
});
|
190
159
|
}
|
191
160
|
/**
|
192
161
|
* Creates a {@link BlobClient}
|
@@ -247,20 +216,9 @@ export class ContainerClient extends StorageClient {
|
|
247
216
|
if (!options.conditions) {
|
248
217
|
options.conditions = {};
|
249
218
|
}
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
}
|
254
|
-
catch (e) {
|
255
|
-
span.setStatus({
|
256
|
-
code: SpanStatusCode.ERROR,
|
257
|
-
message: e.message,
|
258
|
-
});
|
259
|
-
throw e;
|
260
|
-
}
|
261
|
-
finally {
|
262
|
-
span.end();
|
263
|
-
}
|
219
|
+
return tracingClient.withSpan("ContainerClient-getProperties", options, async (updatedOptions) => {
|
220
|
+
return assertResponse(await this.containerContext.getProperties(Object.assign(Object.assign({ abortSignal: options.abortSignal }, options.conditions), { tracingOptions: updatedOptions.tracingOptions })));
|
221
|
+
});
|
264
222
|
}
|
265
223
|
/**
|
266
224
|
* Marks the specified container for deletion. The container and any blobs
|
@@ -273,20 +231,14 @@ export class ContainerClient extends StorageClient {
|
|
273
231
|
if (!options.conditions) {
|
274
232
|
options.conditions = {};
|
275
233
|
}
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
});
|
285
|
-
throw e;
|
286
|
-
}
|
287
|
-
finally {
|
288
|
-
span.end();
|
289
|
-
}
|
234
|
+
return tracingClient.withSpan("ContainerClient-delete", options, async (updatedOptions) => {
|
235
|
+
return assertResponse(await this.containerContext.delete({
|
236
|
+
abortSignal: options.abortSignal,
|
237
|
+
leaseAccessConditions: options.conditions,
|
238
|
+
modifiedAccessConditions: options.conditions,
|
239
|
+
tracingOptions: updatedOptions.tracingOptions,
|
240
|
+
}));
|
241
|
+
});
|
290
242
|
}
|
291
243
|
/**
|
292
244
|
* Marks the specified container for deletion if it exists. The container and any blobs
|
@@ -296,29 +248,19 @@ export class ContainerClient extends StorageClient {
|
|
296
248
|
* @param options - Options to Container Delete operation.
|
297
249
|
*/
|
298
250
|
async deleteIfExists(options = {}) {
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
}
|
305
|
-
catch (e) {
|
306
|
-
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerNotFound") {
|
307
|
-
span.setStatus({
|
308
|
-
code: SpanStatusCode.ERROR,
|
309
|
-
message: "Expected exception when deleting a container only if it exists.",
|
310
|
-
});
|
311
|
-
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 });
|
312
256
|
}
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
span.end();
|
321
|
-
}
|
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
|
+
});
|
322
264
|
}
|
323
265
|
/**
|
324
266
|
* Sets one or more user-defined name-value pairs for the specified container.
|
@@ -339,20 +281,15 @@ export class ContainerClient extends StorageClient {
|
|
339
281
|
if (options.conditions.ifUnmodifiedSince) {
|
340
282
|
throw new RangeError("the IfUnmodifiedSince must have their default values because they are ignored by the blob service");
|
341
283
|
}
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
throw e;
|
352
|
-
}
|
353
|
-
finally {
|
354
|
-
span.end();
|
355
|
-
}
|
284
|
+
return tracingClient.withSpan("ContainerClient-setMetadata", options, async (updatedOptions) => {
|
285
|
+
return assertResponse(await this.containerContext.setMetadata({
|
286
|
+
abortSignal: options.abortSignal,
|
287
|
+
leaseAccessConditions: options.conditions,
|
288
|
+
metadata,
|
289
|
+
modifiedAccessConditions: options.conditions,
|
290
|
+
tracingOptions: updatedOptions.tracingOptions,
|
291
|
+
}));
|
292
|
+
});
|
356
293
|
}
|
357
294
|
/**
|
358
295
|
* Gets the permissions for the specified container. The permissions indicate
|
@@ -369,9 +306,12 @@ export class ContainerClient extends StorageClient {
|
|
369
306
|
if (!options.conditions) {
|
370
307
|
options.conditions = {};
|
371
308
|
}
|
372
|
-
|
373
|
-
|
374
|
-
|
309
|
+
return tracingClient.withSpan("ContainerClient-getAccessPolicy", options, async (updatedOptions) => {
|
310
|
+
const response = assertResponse(await this.containerContext.getAccessPolicy({
|
311
|
+
abortSignal: options.abortSignal,
|
312
|
+
leaseAccessConditions: options.conditions,
|
313
|
+
tracingOptions: updatedOptions.tracingOptions,
|
314
|
+
}));
|
375
315
|
const res = {
|
376
316
|
_response: response._response,
|
377
317
|
blobPublicAccess: response.blobPublicAccess,
|
@@ -403,17 +343,7 @@ export class ContainerClient extends StorageClient {
|
|
403
343
|
});
|
404
344
|
}
|
405
345
|
return res;
|
406
|
-
}
|
407
|
-
catch (e) {
|
408
|
-
span.setStatus({
|
409
|
-
code: SpanStatusCode.ERROR,
|
410
|
-
message: e.message,
|
411
|
-
});
|
412
|
-
throw e;
|
413
|
-
}
|
414
|
-
finally {
|
415
|
-
span.end();
|
416
|
-
}
|
346
|
+
});
|
417
347
|
}
|
418
348
|
/**
|
419
349
|
* Sets the permissions for the specified container. The permissions indicate
|
@@ -434,8 +364,7 @@ export class ContainerClient extends StorageClient {
|
|
434
364
|
*/
|
435
365
|
async setAccessPolicy(access, containerAcl, options = {}) {
|
436
366
|
options.conditions = options.conditions || {};
|
437
|
-
|
438
|
-
try {
|
367
|
+
return tracingClient.withSpan("ContainerClient-setAccessPolicy", options, async (updatedOptions) => {
|
439
368
|
const acl = [];
|
440
369
|
for (const identifier of containerAcl || []) {
|
441
370
|
acl.push({
|
@@ -451,18 +380,15 @@ export class ContainerClient extends StorageClient {
|
|
451
380
|
id: identifier.id,
|
452
381
|
});
|
453
382
|
}
|
454
|
-
return await this.containerContext.setAccessPolicy(
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
}
|
463
|
-
finally {
|
464
|
-
span.end();
|
465
|
-
}
|
383
|
+
return assertResponse(await this.containerContext.setAccessPolicy({
|
384
|
+
abortSignal: options.abortSignal,
|
385
|
+
access,
|
386
|
+
containerAcl: acl,
|
387
|
+
leaseAccessConditions: options.conditions,
|
388
|
+
modifiedAccessConditions: options.conditions,
|
389
|
+
tracingOptions: updatedOptions.tracingOptions,
|
390
|
+
}));
|
391
|
+
});
|
466
392
|
}
|
467
393
|
/**
|
468
394
|
* Get a {@link BlobLeaseClient} that manages leases on the container.
|
@@ -496,25 +422,14 @@ export class ContainerClient extends StorageClient {
|
|
496
422
|
* @returns Block Blob upload response data and the corresponding BlockBlobClient instance.
|
497
423
|
*/
|
498
424
|
async uploadBlockBlob(blobName, body, contentLength, options = {}) {
|
499
|
-
|
500
|
-
try {
|
425
|
+
return tracingClient.withSpan("ContainerClient-uploadBlockBlob", options, async (updatedOptions) => {
|
501
426
|
const blockBlobClient = this.getBlockBlobClient(blobName);
|
502
427
|
const response = await blockBlobClient.upload(body, contentLength, updatedOptions);
|
503
428
|
return {
|
504
429
|
blockBlobClient,
|
505
430
|
response,
|
506
431
|
};
|
507
|
-
}
|
508
|
-
catch (e) {
|
509
|
-
span.setStatus({
|
510
|
-
code: SpanStatusCode.ERROR,
|
511
|
-
message: e.message,
|
512
|
-
});
|
513
|
-
throw e;
|
514
|
-
}
|
515
|
-
finally {
|
516
|
-
span.end();
|
517
|
-
}
|
432
|
+
});
|
518
433
|
}
|
519
434
|
/**
|
520
435
|
* Marks the specified blob or snapshot for deletion. The blob is later deleted
|
@@ -528,24 +443,13 @@ export class ContainerClient extends StorageClient {
|
|
528
443
|
* @returns Block blob deletion response data.
|
529
444
|
*/
|
530
445
|
async deleteBlob(blobName, options = {}) {
|
531
|
-
|
532
|
-
try {
|
446
|
+
return tracingClient.withSpan("ContainerClient-deleteBlob", options, async (updatedOptions) => {
|
533
447
|
let blobClient = this.getBlobClient(blobName);
|
534
448
|
if (options.versionId) {
|
535
449
|
blobClient = blobClient.withVersion(options.versionId);
|
536
450
|
}
|
537
|
-
return
|
538
|
-
}
|
539
|
-
catch (e) {
|
540
|
-
span.setStatus({
|
541
|
-
code: SpanStatusCode.ERROR,
|
542
|
-
message: e.message,
|
543
|
-
});
|
544
|
-
throw e;
|
545
|
-
}
|
546
|
-
finally {
|
547
|
-
span.end();
|
548
|
-
}
|
451
|
+
return blobClient.delete(updatedOptions);
|
452
|
+
});
|
549
453
|
}
|
550
454
|
/**
|
551
455
|
* listBlobFlatSegment returns a single segment of blobs starting from the
|
@@ -558,25 +462,14 @@ export class ContainerClient extends StorageClient {
|
|
558
462
|
* @param options - Options to Container List Blob Flat Segment operation.
|
559
463
|
*/
|
560
464
|
async listBlobFlatSegment(marker, options = {}) {
|
561
|
-
|
562
|
-
|
563
|
-
const
|
564
|
-
|
565
|
-
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name), tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
|
465
|
+
return tracingClient.withSpan("ContainerClient-listBlobFlatSegment", options, async (updatedOptions) => {
|
466
|
+
const response = assertResponse(await this.containerContext.listBlobFlatSegment(Object.assign(Object.assign({ marker }, options), { tracingOptions: updatedOptions.tracingOptions })));
|
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) => {
|
468
|
+
const blobItem = Object.assign(Object.assign({}, blobItemInternal), { name: BlobNameToString(blobItemInternal.name), tags: toTags(blobItemInternal.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInternal.objectReplicationMetadata) });
|
566
469
|
return blobItem;
|
567
470
|
}) }) });
|
568
471
|
return wrappedResponse;
|
569
|
-
}
|
570
|
-
catch (e) {
|
571
|
-
span.setStatus({
|
572
|
-
code: SpanStatusCode.ERROR,
|
573
|
-
message: e.message,
|
574
|
-
});
|
575
|
-
throw e;
|
576
|
-
}
|
577
|
-
finally {
|
578
|
-
span.end();
|
579
|
-
}
|
472
|
+
});
|
580
473
|
}
|
581
474
|
/**
|
582
475
|
* listBlobHierarchySegment returns a single segment of blobs starting from
|
@@ -590,12 +483,11 @@ export class ContainerClient extends StorageClient {
|
|
590
483
|
* @param options - Options to Container List Blob Hierarchy Segment operation.
|
591
484
|
*/
|
592
485
|
async listBlobHierarchySegment(delimiter, marker, options = {}) {
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
const
|
597
|
-
|
598
|
-
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name), tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
|
486
|
+
return tracingClient.withSpan("ContainerClient-listBlobHierarchySegment", options, async (updatedOptions) => {
|
487
|
+
var _a;
|
488
|
+
const response = assertResponse(await this.containerContext.listBlobHierarchySegment(delimiter, Object.assign(Object.assign({ marker }, options), { tracingOptions: updatedOptions.tracingOptions })));
|
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) => {
|
490
|
+
const blobItem = Object.assign(Object.assign({}, blobItemInternal), { name: BlobNameToString(blobItemInternal.name), tags: toTags(blobItemInternal.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInternal.objectReplicationMetadata) });
|
599
491
|
return blobItem;
|
600
492
|
}), blobPrefixes: (_a = response.segment.blobPrefixes) === null || _a === void 0 ? void 0 : _a.map((blobPrefixInternal) => {
|
601
493
|
const blobPrefix = {
|
@@ -604,17 +496,7 @@ export class ContainerClient extends StorageClient {
|
|
604
496
|
return blobPrefix;
|
605
497
|
}) }) });
|
606
498
|
return wrappedResponse;
|
607
|
-
}
|
608
|
-
catch (e) {
|
609
|
-
span.setStatus({
|
610
|
-
code: SpanStatusCode.ERROR,
|
611
|
-
message: e.message,
|
612
|
-
});
|
613
|
-
throw e;
|
614
|
-
}
|
615
|
-
finally {
|
616
|
-
span.end();
|
617
|
-
}
|
499
|
+
});
|
618
500
|
}
|
619
501
|
/**
|
620
502
|
* Returns an AsyncIterableIterator for ContainerListBlobFlatSegmentResponse
|
@@ -1009,9 +891,14 @@ export class ContainerClient extends StorageClient {
|
|
1009
891
|
* @param options - Options to find blobs by tags.
|
1010
892
|
*/
|
1011
893
|
async findBlobsByTagsSegment(tagFilterSqlExpression, marker, options = {}) {
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
894
|
+
return tracingClient.withSpan("ContainerClient-findBlobsByTagsSegment", options, async (updatedOptions) => {
|
895
|
+
const response = assertResponse(await this.containerContext.filterBlobs({
|
896
|
+
abortSignal: options.abortSignal,
|
897
|
+
where: tagFilterSqlExpression,
|
898
|
+
marker,
|
899
|
+
maxPageSize: options.maxPageSize,
|
900
|
+
tracingOptions: updatedOptions.tracingOptions,
|
901
|
+
}));
|
1015
902
|
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, blobs: response.blobs.map((blob) => {
|
1016
903
|
var _a;
|
1017
904
|
let tagValue = "";
|
@@ -1021,17 +908,7 @@ export class ContainerClient extends StorageClient {
|
|
1021
908
|
return Object.assign(Object.assign({}, blob), { tags: toTags(blob.tags), tagValue });
|
1022
909
|
}) });
|
1023
910
|
return wrappedResponse;
|
1024
|
-
}
|
1025
|
-
catch (e) {
|
1026
|
-
span.setStatus({
|
1027
|
-
code: SpanStatusCode.ERROR,
|
1028
|
-
message: e.message,
|
1029
|
-
});
|
1030
|
-
throw e;
|
1031
|
-
}
|
1032
|
-
finally {
|
1033
|
-
span.end();
|
1034
|
-
}
|
911
|
+
});
|
1035
912
|
}
|
1036
913
|
/**
|
1037
914
|
* Returns an AsyncIterableIterator for ContainerFindBlobsByTagsSegmentResponse.
|
@@ -1200,23 +1077,23 @@ export class ContainerClient extends StorageClient {
|
|
1200
1077
|
// "https://myaccount.blob.core.windows.net/mycontainer";
|
1201
1078
|
// IPv4/IPv6 address hosts, Endpoints - `http://127.0.0.1:10000/devstoreaccount1/containername`
|
1202
1079
|
// http://localhost:10001/devstoreaccount1/containername
|
1203
|
-
const parsedUrl =
|
1204
|
-
if (parsedUrl.
|
1080
|
+
const parsedUrl = new URL(this.url);
|
1081
|
+
if (parsedUrl.hostname.split(".")[1] === "blob") {
|
1205
1082
|
// "https://myaccount.blob.core.windows.net/containername".
|
1206
1083
|
// "https://customdomain.com/containername".
|
1207
1084
|
// .getPath() -> /containername
|
1208
|
-
containerName = parsedUrl.
|
1085
|
+
containerName = parsedUrl.pathname.split("/")[1];
|
1209
1086
|
}
|
1210
1087
|
else if (isIpEndpointStyle(parsedUrl)) {
|
1211
1088
|
// IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/containername
|
1212
1089
|
// Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/containername
|
1213
1090
|
// .getPath() -> /devstoreaccount1/containername
|
1214
|
-
containerName = parsedUrl.
|
1091
|
+
containerName = parsedUrl.pathname.split("/")[2];
|
1215
1092
|
}
|
1216
1093
|
else {
|
1217
1094
|
// "https://customdomain.com/containername".
|
1218
1095
|
// .getPath() -> /containername
|
1219
|
-
containerName = parsedUrl.
|
1096
|
+
containerName = parsedUrl.pathname.split("/")[1];
|
1220
1097
|
}
|
1221
1098
|
// decode the encoded containerName - to get all the special characters that might be present in it
|
1222
1099
|
containerName = decodeURIComponent(containerName);
|