@azure/storage-blob 12.9.0-alpha.20220128.2 → 12.9.0-alpha.20220211.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.
Files changed (25) hide show
  1. package/CHANGELOG.md +12 -3
  2. package/dist/index.js +322 -7
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/storage-blob/src/BlobServiceClient.js.map +1 -1
  5. package/dist-esm/storage-blob/src/ContainerClient.js +201 -0
  6. package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -1
  7. package/dist-esm/storage-blob/src/generated/src/models/index.js.map +1 -1
  8. package/dist-esm/storage-blob/src/generated/src/models/mappers.js +53 -0
  9. package/dist-esm/storage-blob/src/generated/src/models/mappers.js.map +1 -1
  10. package/dist-esm/storage-blob/src/generated/src/models/parameters.js +1 -1
  11. package/dist-esm/storage-blob/src/generated/src/models/parameters.js.map +1 -1
  12. package/dist-esm/storage-blob/src/generated/src/operations/container.js +41 -0
  13. package/dist-esm/storage-blob/src/generated/src/operations/container.js.map +1 -1
  14. package/dist-esm/storage-blob/src/generated/src/storageClientContext.js +2 -2
  15. package/dist-esm/storage-blob/src/generated/src/storageClientContext.js.map +1 -1
  16. package/dist-esm/storage-blob/src/generatedModels.js.map +1 -1
  17. package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js +5 -0
  18. package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js.map +1 -1
  19. package/dist-esm/storage-blob/src/sas/ContainerSASPermissions.js +13 -0
  20. package/dist-esm/storage-blob/src/sas/ContainerSASPermissions.js.map +1 -1
  21. package/dist-esm/storage-blob/src/utils/constants.js +2 -2
  22. package/dist-esm/storage-blob/src/utils/constants.js.map +1 -1
  23. package/package.json +1 -1
  24. package/types/3.1/storage-blob.d.ts +174 -0
  25. package/types/latest/storage-blob.d.ts +177 -0
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Release History
2
2
 
3
- ## 12.9.0-beta.3 (Unreleased)
3
+ ## 12.9.0-beta.4 (Unreleased)
4
4
 
5
5
  ### Features Added
6
6
 
@@ -8,10 +8,19 @@
8
8
 
9
9
  ### Bugs Fixed
10
10
 
11
- - Fixed a bug where customized `ProxyOptions` is overwrited by a default one when initializing `BlobServiceClient`, `BlobClient`, `AppendBlobClient`, `BlockBlobClient`, `PageBlobClient` or `ContainerClient` with connection string.
12
-
13
11
  ### Other Changes
14
12
 
13
+ ## 12.9.0-beta.3 (2022-02-11)
14
+
15
+ ### Features Added
16
+
17
+ - Added support for service version 2021-04-10.
18
+ - Added support for finding blobs by tags in a container.
19
+
20
+ ### Bugs Fixed
21
+
22
+ - Fixed a bug where customized `ProxyOptions` is overwrited by a default one when initializing `BlobServiceClient`, `BlobClient`, `AppendBlobClient`, `BlockBlobClient`, `PageBlobClient` or `ContainerClient` with connection string.
23
+
15
24
  ## 12.9.0-beta.2 (2021-12-03)
16
25
 
17
26
  ### Features Added
package/dist/index.js CHANGED
@@ -3164,6 +3164,59 @@ const ContainerSubmitBatchExceptionHeaders = {
3164
3164
  }
3165
3165
  }
3166
3166
  };
3167
+ const ContainerFilterBlobsHeaders = {
3168
+ serializedName: "Container_filterBlobsHeaders",
3169
+ type: {
3170
+ name: "Composite",
3171
+ className: "ContainerFilterBlobsHeaders",
3172
+ modelProperties: {
3173
+ clientRequestId: {
3174
+ serializedName: "x-ms-client-request-id",
3175
+ xmlName: "x-ms-client-request-id",
3176
+ type: {
3177
+ name: "String"
3178
+ }
3179
+ },
3180
+ requestId: {
3181
+ serializedName: "x-ms-request-id",
3182
+ xmlName: "x-ms-request-id",
3183
+ type: {
3184
+ name: "String"
3185
+ }
3186
+ },
3187
+ version: {
3188
+ serializedName: "x-ms-version",
3189
+ xmlName: "x-ms-version",
3190
+ type: {
3191
+ name: "String"
3192
+ }
3193
+ },
3194
+ date: {
3195
+ serializedName: "date",
3196
+ xmlName: "date",
3197
+ type: {
3198
+ name: "DateTimeRfc1123"
3199
+ }
3200
+ }
3201
+ }
3202
+ }
3203
+ };
3204
+ const ContainerFilterBlobsExceptionHeaders = {
3205
+ serializedName: "Container_filterBlobsExceptionHeaders",
3206
+ type: {
3207
+ name: "Composite",
3208
+ className: "ContainerFilterBlobsExceptionHeaders",
3209
+ modelProperties: {
3210
+ errorCode: {
3211
+ serializedName: "x-ms-error-code",
3212
+ xmlName: "x-ms-error-code",
3213
+ type: {
3214
+ name: "String"
3215
+ }
3216
+ }
3217
+ }
3218
+ }
3219
+ };
3167
3220
  const ContainerAcquireLeaseHeaders = {
3168
3221
  serializedName: "Container_acquireLeaseHeaders",
3169
3222
  type: {
@@ -8248,6 +8301,8 @@ var Mappers = /*#__PURE__*/Object.freeze({
8248
8301
  ContainerRenameExceptionHeaders: ContainerRenameExceptionHeaders,
8249
8302
  ContainerSubmitBatchHeaders: ContainerSubmitBatchHeaders,
8250
8303
  ContainerSubmitBatchExceptionHeaders: ContainerSubmitBatchExceptionHeaders,
8304
+ ContainerFilterBlobsHeaders: ContainerFilterBlobsHeaders,
8305
+ ContainerFilterBlobsExceptionHeaders: ContainerFilterBlobsExceptionHeaders,
8251
8306
  ContainerAcquireLeaseHeaders: ContainerAcquireLeaseHeaders,
8252
8307
  ContainerAcquireLeaseExceptionHeaders: ContainerAcquireLeaseExceptionHeaders,
8253
8308
  ContainerReleaseLeaseHeaders: ContainerReleaseLeaseHeaders,
@@ -8435,7 +8490,7 @@ const timeoutInSeconds = {
8435
8490
  const version = {
8436
8491
  parameterPath: "version",
8437
8492
  mapper: {
8438
- defaultValue: "2021-02-12",
8493
+ defaultValue: "2021-04-10",
8439
8494
  isConstant: true,
8440
8495
  serializedName: "x-ms-version",
8441
8496
  type: {
@@ -10060,7 +10115,7 @@ class Service {
10060
10115
  const operationArguments = {
10061
10116
  options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
10062
10117
  };
10063
- return this.client.sendOperationRequest(operationArguments, filterBlobsOperationSpec);
10118
+ return this.client.sendOperationRequest(operationArguments, filterBlobsOperationSpec$1);
10064
10119
  }
10065
10120
  }
10066
10121
  // Operation Specifications
@@ -10260,7 +10315,7 @@ const submitBatchOperationSpec$1 = {
10260
10315
  mediaType: "xml",
10261
10316
  serializer: xmlSerializer$5
10262
10317
  };
10263
- const filterBlobsOperationSpec = {
10318
+ const filterBlobsOperationSpec$1 = {
10264
10319
  path: "/",
10265
10320
  httpMethod: "GET",
10266
10321
  responses: {
@@ -10410,6 +10465,17 @@ class Container {
10410
10465
  };
10411
10466
  return this.client.sendOperationRequest(operationArguments, submitBatchOperationSpec);
10412
10467
  }
10468
+ /**
10469
+ * The Filter Blobs operation enables callers to list blobs in a container whose tags match a given
10470
+ * search expression. Filter blobs searches within the given container.
10471
+ * @param options The options parameters.
10472
+ */
10473
+ filterBlobs(options) {
10474
+ const operationArguments = {
10475
+ options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
10476
+ };
10477
+ return this.client.sendOperationRequest(operationArguments, filterBlobsOperationSpec);
10478
+ }
10413
10479
  /**
10414
10480
  * [Update] establishes and manages a lock on a container for delete operations. The lock duration can
10415
10481
  * be 15 to 60 seconds, or can be infinite
@@ -10781,6 +10847,36 @@ const submitBatchOperationSpec = {
10781
10847
  mediaType: "xml",
10782
10848
  serializer: xmlSerializer$4
10783
10849
  };
10850
+ const filterBlobsOperationSpec = {
10851
+ path: "/{containerName}",
10852
+ httpMethod: "GET",
10853
+ responses: {
10854
+ 200: {
10855
+ bodyMapper: FilterBlobSegment,
10856
+ headersMapper: ContainerFilterBlobsHeaders
10857
+ },
10858
+ default: {
10859
+ bodyMapper: StorageError,
10860
+ headersMapper: ContainerFilterBlobsExceptionHeaders
10861
+ }
10862
+ },
10863
+ queryParameters: [
10864
+ timeoutInSeconds,
10865
+ marker,
10866
+ maxPageSize,
10867
+ comp5,
10868
+ where,
10869
+ restype2
10870
+ ],
10871
+ urlParameters: [url],
10872
+ headerParameters: [
10873
+ version,
10874
+ requestId,
10875
+ accept1
10876
+ ],
10877
+ isXML: true,
10878
+ serializer: xmlSerializer$4
10879
+ };
10784
10880
  const acquireLeaseOperationSpec$1 = {
10785
10881
  path: "/{containerName}",
10786
10882
  httpMethod: "PUT",
@@ -13206,8 +13302,8 @@ const logger = logger$1.createClientLogger("storage-blob");
13206
13302
 
13207
13303
  // Copyright (c) Microsoft Corporation.
13208
13304
  // Licensed under the MIT license.
13209
- const SDK_VERSION = "12.9.0-beta.3";
13210
- const SERVICE_VERSION = "2021-02-12";
13305
+ const SDK_VERSION = "12.9.0-beta.4";
13306
+ const SERVICE_VERSION = "2021-04-10";
13211
13307
  const BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = 256 * 1024 * 1024; // 256MB
13212
13308
  const BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 4000 * 1024 * 1024; // 4000MB
13213
13309
  const BLOCK_BLOB_MAX_BLOCKS = 50000;
@@ -14902,7 +14998,7 @@ class StorageSharedKeyCredential extends Credential {
14902
14998
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
14903
14999
  */
14904
15000
  const packageName = "azure-storage-blob";
14905
- const packageVersion = "12.9.0-beta.3";
15001
+ const packageVersion = "12.9.0-beta.4";
14906
15002
  class StorageClientContext extends coreHttp__namespace.ServiceClient {
14907
15003
  /**
14908
15004
  * Initializes a new instance of the StorageClientContext class.
@@ -14928,7 +15024,7 @@ class StorageClientContext extends coreHttp__namespace.ServiceClient {
14928
15024
  // Parameter assignments
14929
15025
  this.url = url;
14930
15026
  // Assigning values to Constant parameters
14931
- this.version = options.version || "2021-02-12";
15027
+ this.version = options.version || "2021-04-10";
14932
15028
  }
14933
15029
  }
14934
15030
 
@@ -15247,6 +15343,10 @@ class ContainerSASPermissions {
15247
15343
  * Specifies that Permanent Delete is permitted.
15248
15344
  */
15249
15345
  this.permanentDelete = false;
15346
+ /**
15347
+ * Specifies that Filter Blobs by Tags is permitted.
15348
+ */
15349
+ this.filterByTags = false;
15250
15350
  }
15251
15351
  /**
15252
15352
  * Creates an {@link ContainerSASPermissions} from the specified permissions string. This method will throw an
@@ -15294,6 +15394,9 @@ class ContainerSASPermissions {
15294
15394
  case "y":
15295
15395
  containerSASPermissions.permanentDelete = true;
15296
15396
  break;
15397
+ case "f":
15398
+ containerSASPermissions.filterByTags = true;
15399
+ break;
15297
15400
  default:
15298
15401
  throw new RangeError(`Invalid permission ${char}`);
15299
15402
  }
@@ -15344,6 +15447,9 @@ class ContainerSASPermissions {
15344
15447
  if (permissionLike.permanentDelete) {
15345
15448
  containerSASPermissions.permanentDelete = true;
15346
15449
  }
15450
+ if (permissionLike.filterByTags) {
15451
+ containerSASPermissions.filterByTags = true;
15452
+ }
15347
15453
  return containerSASPermissions;
15348
15454
  }
15349
15455
  /**
@@ -15392,6 +15498,9 @@ class ContainerSASPermissions {
15392
15498
  if (this.permanentDelete) {
15393
15499
  permissions.push("y");
15394
15500
  }
15501
+ if (this.filterByTags) {
15502
+ permissions.push("f");
15503
+ }
15395
15504
  return permissions.join("");
15396
15505
  }
15397
15506
  }
@@ -16199,6 +16308,11 @@ function SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues) {
16199
16308
  (blobSASSignatureValues.permissions.move || blobSASSignatureValues.permissions.execute)) {
16200
16309
  throw RangeError("'version' must be >= '2020-02-10' when providing the 'm' or 'e' permission.");
16201
16310
  }
16311
+ if (version < "2021-04-10" &&
16312
+ blobSASSignatureValues.permissions &&
16313
+ blobSASSignatureValues.permissions.filterByTags) {
16314
+ throw RangeError("'version' must be >= '2021-04-10' when providing the 'f' permission.");
16315
+ }
16202
16316
  if (version < "2020-02-10" &&
16203
16317
  (blobSASSignatureValues.preauthorizedAgentObjectId || blobSASSignatureValues.correlationId)) {
16204
16318
  throw RangeError("'version' must be >= '2020-02-10' when providing 'preauthorizedAgentObjectId' or 'correlationId'.");
@@ -22844,6 +22958,207 @@ class ContainerClient extends StorageClient {
22844
22958
  },
22845
22959
  };
22846
22960
  }
22961
+ /**
22962
+ * The Filter Blobs operation enables callers to list blobs in the container whose tags
22963
+ * match a given search expression.
22964
+ *
22965
+ * @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
22966
+ * The given expression must evaluate to true for a blob to be returned in the results.
22967
+ * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
22968
+ * however, only a subset of the OData filter syntax is supported in the Blob service.
22969
+ * @param marker - A string value that identifies the portion of
22970
+ * the list of blobs to be returned with the next listing operation. The
22971
+ * operation returns the continuationToken value within the response body if the
22972
+ * listing operation did not return all blobs remaining to be listed
22973
+ * with the current page. The continuationToken value can be used as the value for
22974
+ * the marker parameter in a subsequent call to request the next page of list
22975
+ * items. The marker value is opaque to the client.
22976
+ * @param options - Options to find blobs by tags.
22977
+ */
22978
+ async findBlobsByTagsSegment(tagFilterSqlExpression, marker, options = {}) {
22979
+ const { span, updatedOptions } = createSpan("ContainerClient-findBlobsByTagsSegment", options);
22980
+ try {
22981
+ const response = await this.containerContext.filterBlobs(Object.assign({ abortSignal: options.abortSignal, where: tagFilterSqlExpression, marker, maxPageSize: options.maxPageSize }, convertTracingToRequestOptionsBase(updatedOptions)));
22982
+ const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, blobs: response.blobs.map((blob) => {
22983
+ var _a;
22984
+ let tagValue = "";
22985
+ if (((_a = blob.tags) === null || _a === void 0 ? void 0 : _a.blobTagSet.length) === 1) {
22986
+ tagValue = blob.tags.blobTagSet[0].value;
22987
+ }
22988
+ return Object.assign(Object.assign({}, blob), { tags: toTags(blob.tags), tagValue });
22989
+ }) });
22990
+ return wrappedResponse;
22991
+ }
22992
+ catch (e) {
22993
+ span.setStatus({
22994
+ code: coreTracing.SpanStatusCode.ERROR,
22995
+ message: e.message,
22996
+ });
22997
+ throw e;
22998
+ }
22999
+ finally {
23000
+ span.end();
23001
+ }
23002
+ }
23003
+ /**
23004
+ * Returns an AsyncIterableIterator for ContainerFindBlobsByTagsSegmentResponse.
23005
+ *
23006
+ * @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
23007
+ * The given expression must evaluate to true for a blob to be returned in the results.
23008
+ * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
23009
+ * however, only a subset of the OData filter syntax is supported in the Blob service.
23010
+ * @param marker - A string value that identifies the portion of
23011
+ * the list of blobs to be returned with the next listing operation. The
23012
+ * operation returns the continuationToken value within the response body if the
23013
+ * listing operation did not return all blobs remaining to be listed
23014
+ * with the current page. The continuationToken value can be used as the value for
23015
+ * the marker parameter in a subsequent call to request the next page of list
23016
+ * items. The marker value is opaque to the client.
23017
+ * @param options - Options to find blobs by tags.
23018
+ */
23019
+ findBlobsByTagsSegments(tagFilterSqlExpression, marker, options = {}) {
23020
+ return tslib.__asyncGenerator(this, arguments, function* findBlobsByTagsSegments_1() {
23021
+ let response;
23022
+ if (!!marker || marker === undefined) {
23023
+ do {
23024
+ response = yield tslib.__await(this.findBlobsByTagsSegment(tagFilterSqlExpression, marker, options));
23025
+ response.blobs = response.blobs || [];
23026
+ marker = response.continuationToken;
23027
+ yield yield tslib.__await(response);
23028
+ } while (marker);
23029
+ }
23030
+ });
23031
+ }
23032
+ /**
23033
+ * Returns an AsyncIterableIterator for blobs.
23034
+ *
23035
+ * @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
23036
+ * The given expression must evaluate to true for a blob to be returned in the results.
23037
+ * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
23038
+ * however, only a subset of the OData filter syntax is supported in the Blob service.
23039
+ * @param options - Options to findBlobsByTagsItems.
23040
+ */
23041
+ findBlobsByTagsItems(tagFilterSqlExpression, options = {}) {
23042
+ return tslib.__asyncGenerator(this, arguments, function* findBlobsByTagsItems_1() {
23043
+ var e_3, _a;
23044
+ let marker;
23045
+ try {
23046
+ for (var _b = tslib.__asyncValues(this.findBlobsByTagsSegments(tagFilterSqlExpression, marker, options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
23047
+ const segment = _c.value;
23048
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(segment.blobs)));
23049
+ }
23050
+ }
23051
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
23052
+ finally {
23053
+ try {
23054
+ if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
23055
+ }
23056
+ finally { if (e_3) throw e_3.error; }
23057
+ }
23058
+ });
23059
+ }
23060
+ /**
23061
+ * Returns an async iterable iterator to find all blobs with specified tag
23062
+ * under the specified container.
23063
+ *
23064
+ * .byPage() returns an async iterable iterator to list the blobs in pages.
23065
+ *
23066
+ * Example using `for await` syntax:
23067
+ *
23068
+ * ```js
23069
+ * let i = 1;
23070
+ * for await (const blob of containerClient.findBlobsByTags("tagkey='tagvalue'")) {
23071
+ * console.log(`Blob ${i++}: ${blob.name}`);
23072
+ * }
23073
+ * ```
23074
+ *
23075
+ * Example using `iter.next()`:
23076
+ *
23077
+ * ```js
23078
+ * let i = 1;
23079
+ * const iter = containerClient.findBlobsByTags("tagkey='tagvalue'");
23080
+ * let blobItem = await iter.next();
23081
+ * while (!blobItem.done) {
23082
+ * console.log(`Blob ${i++}: ${blobItem.value.name}`);
23083
+ * blobItem = await iter.next();
23084
+ * }
23085
+ * ```
23086
+ *
23087
+ * Example using `byPage()`:
23088
+ *
23089
+ * ```js
23090
+ * // passing optional maxPageSize in the page settings
23091
+ * let i = 1;
23092
+ * for await (const response of containerClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 20 })) {
23093
+ * if (response.blobs) {
23094
+ * for (const blob of response.blobs) {
23095
+ * console.log(`Blob ${i++}: ${blob.name}`);
23096
+ * }
23097
+ * }
23098
+ * }
23099
+ * ```
23100
+ *
23101
+ * Example using paging with a marker:
23102
+ *
23103
+ * ```js
23104
+ * let i = 1;
23105
+ * let iterator = containerClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 2 });
23106
+ * let response = (await iterator.next()).value;
23107
+ *
23108
+ * // Prints 2 blob names
23109
+ * if (response.blobs) {
23110
+ * for (const blob of response.blobs) {
23111
+ * console.log(`Blob ${i++}: ${blob.name}`);
23112
+ * }
23113
+ * }
23114
+ *
23115
+ * // Gets next marker
23116
+ * let marker = response.continuationToken;
23117
+ * // Passing next marker as continuationToken
23118
+ * iterator = containerClient
23119
+ * .findBlobsByTags("tagkey='tagvalue'")
23120
+ * .byPage({ continuationToken: marker, maxPageSize: 10 });
23121
+ * response = (await iterator.next()).value;
23122
+ *
23123
+ * // Prints blob names
23124
+ * if (response.blobs) {
23125
+ * for (const blob of response.blobs) {
23126
+ * console.log(`Blob ${i++}: ${blob.name}`);
23127
+ * }
23128
+ * }
23129
+ * ```
23130
+ *
23131
+ * @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
23132
+ * The given expression must evaluate to true for a blob to be returned in the results.
23133
+ * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
23134
+ * however, only a subset of the OData filter syntax is supported in the Blob service.
23135
+ * @param options - Options to find blobs by tags.
23136
+ */
23137
+ findBlobsByTags(tagFilterSqlExpression, options = {}) {
23138
+ // AsyncIterableIterator to iterate over blobs
23139
+ const listSegmentOptions = Object.assign({}, options);
23140
+ const iter = this.findBlobsByTagsItems(tagFilterSqlExpression, listSegmentOptions);
23141
+ return {
23142
+ /**
23143
+ * The next method, part of the iteration protocol
23144
+ */
23145
+ next() {
23146
+ return iter.next();
23147
+ },
23148
+ /**
23149
+ * The connection to the async iterator, part of the iteration protocol
23150
+ */
23151
+ [Symbol.asyncIterator]() {
23152
+ return this;
23153
+ },
23154
+ /**
23155
+ * Return an AsyncIterableIterator that works a page at a time
23156
+ */
23157
+ byPage: (settings = {}) => {
23158
+ return this.findBlobsByTagsSegments(tagFilterSqlExpression, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, listSegmentOptions));
23159
+ },
23160
+ };
23161
+ }
22847
23162
  getContainerNameFromUrl() {
22848
23163
  let containerName;
22849
23164
  try {