@azure/storage-blob 12.9.0-alpha.20220111.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 (29) hide show
  1. package/CHANGELOG.md +17 -6
  2. package/README.md +11 -10
  3. package/dist/index.js +582 -225
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/storage-blob/src/BlobServiceClient.js +3 -1
  6. package/dist-esm/storage-blob/src/BlobServiceClient.js.map +1 -1
  7. package/dist-esm/storage-blob/src/Clients.js +12 -4
  8. package/dist-esm/storage-blob/src/Clients.js.map +1 -1
  9. package/dist-esm/storage-blob/src/ContainerClient.js +204 -1
  10. package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -1
  11. package/dist-esm/storage-blob/src/generated/src/models/index.js.map +1 -1
  12. package/dist-esm/storage-blob/src/generated/src/models/mappers.js +53 -0
  13. package/dist-esm/storage-blob/src/generated/src/models/mappers.js.map +1 -1
  14. package/dist-esm/storage-blob/src/generated/src/models/parameters.js +1 -1
  15. package/dist-esm/storage-blob/src/generated/src/models/parameters.js.map +1 -1
  16. package/dist-esm/storage-blob/src/generated/src/operations/container.js +41 -0
  17. package/dist-esm/storage-blob/src/generated/src/operations/container.js.map +1 -1
  18. package/dist-esm/storage-blob/src/generated/src/storageClientContext.js +2 -2
  19. package/dist-esm/storage-blob/src/generated/src/storageClientContext.js.map +1 -1
  20. package/dist-esm/storage-blob/src/generatedModels.js.map +1 -1
  21. package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js +5 -0
  22. package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js.map +1 -1
  23. package/dist-esm/storage-blob/src/sas/ContainerSASPermissions.js +13 -0
  24. package/dist-esm/storage-blob/src/sas/ContainerSASPermissions.js.map +1 -1
  25. package/dist-esm/storage-blob/src/utils/constants.js +2 -2
  26. package/dist-esm/storage-blob/src/utils/constants.js.map +1 -1
  27. package/package.json +32 -37
  28. package/{typings → types}/3.1/storage-blob.d.ts +174 -0
  29. package/{typings → types}/latest/storage-blob.d.ts +177 -0
@@ -51,7 +51,9 @@ export class ContainerClient extends StorageClient {
51
51
  if (isNode) {
52
52
  const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
53
53
  url = appendToURLPath(extractedCreds.url, encodeURIComponent(containerName));
54
- options.proxyOptions = getDefaultProxySettings(extractedCreds.proxyUri);
54
+ if (!options.proxyOptions) {
55
+ options.proxyOptions = getDefaultProxySettings(extractedCreds.proxyUri);
56
+ }
55
57
  pipeline = newPipeline(sharedKeyCredential, options);
56
58
  }
57
59
  else {
@@ -999,6 +1001,207 @@ export class ContainerClient extends StorageClient {
999
1001
  },
1000
1002
  };
1001
1003
  }
1004
+ /**
1005
+ * The Filter Blobs operation enables callers to list blobs in the container whose tags
1006
+ * match a given search expression.
1007
+ *
1008
+ * @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
1009
+ * The given expression must evaluate to true for a blob to be returned in the results.
1010
+ * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
1011
+ * however, only a subset of the OData filter syntax is supported in the Blob service.
1012
+ * @param marker - A string value that identifies the portion of
1013
+ * the list of blobs to be returned with the next listing operation. The
1014
+ * operation returns the continuationToken value within the response body if the
1015
+ * listing operation did not return all blobs remaining to be listed
1016
+ * with the current page. The continuationToken value can be used as the value for
1017
+ * the marker parameter in a subsequent call to request the next page of list
1018
+ * items. The marker value is opaque to the client.
1019
+ * @param options - Options to find blobs by tags.
1020
+ */
1021
+ async findBlobsByTagsSegment(tagFilterSqlExpression, marker, options = {}) {
1022
+ const { span, updatedOptions } = createSpan("ContainerClient-findBlobsByTagsSegment", options);
1023
+ try {
1024
+ const response = await this.containerContext.filterBlobs(Object.assign({ abortSignal: options.abortSignal, where: tagFilterSqlExpression, marker, maxPageSize: options.maxPageSize }, convertTracingToRequestOptionsBase(updatedOptions)));
1025
+ const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, blobs: response.blobs.map((blob) => {
1026
+ var _a;
1027
+ let tagValue = "";
1028
+ if (((_a = blob.tags) === null || _a === void 0 ? void 0 : _a.blobTagSet.length) === 1) {
1029
+ tagValue = blob.tags.blobTagSet[0].value;
1030
+ }
1031
+ return Object.assign(Object.assign({}, blob), { tags: toTags(blob.tags), tagValue });
1032
+ }) });
1033
+ return wrappedResponse;
1034
+ }
1035
+ catch (e) {
1036
+ span.setStatus({
1037
+ code: SpanStatusCode.ERROR,
1038
+ message: e.message,
1039
+ });
1040
+ throw e;
1041
+ }
1042
+ finally {
1043
+ span.end();
1044
+ }
1045
+ }
1046
+ /**
1047
+ * Returns an AsyncIterableIterator for ContainerFindBlobsByTagsSegmentResponse.
1048
+ *
1049
+ * @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
1050
+ * The given expression must evaluate to true for a blob to be returned in the results.
1051
+ * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
1052
+ * however, only a subset of the OData filter syntax is supported in the Blob service.
1053
+ * @param marker - A string value that identifies the portion of
1054
+ * the list of blobs to be returned with the next listing operation. The
1055
+ * operation returns the continuationToken value within the response body if the
1056
+ * listing operation did not return all blobs remaining to be listed
1057
+ * with the current page. The continuationToken value can be used as the value for
1058
+ * the marker parameter in a subsequent call to request the next page of list
1059
+ * items. The marker value is opaque to the client.
1060
+ * @param options - Options to find blobs by tags.
1061
+ */
1062
+ findBlobsByTagsSegments(tagFilterSqlExpression, marker, options = {}) {
1063
+ return __asyncGenerator(this, arguments, function* findBlobsByTagsSegments_1() {
1064
+ let response;
1065
+ if (!!marker || marker === undefined) {
1066
+ do {
1067
+ response = yield __await(this.findBlobsByTagsSegment(tagFilterSqlExpression, marker, options));
1068
+ response.blobs = response.blobs || [];
1069
+ marker = response.continuationToken;
1070
+ yield yield __await(response);
1071
+ } while (marker);
1072
+ }
1073
+ });
1074
+ }
1075
+ /**
1076
+ * Returns an AsyncIterableIterator for blobs.
1077
+ *
1078
+ * @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
1079
+ * The given expression must evaluate to true for a blob to be returned in the results.
1080
+ * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
1081
+ * however, only a subset of the OData filter syntax is supported in the Blob service.
1082
+ * @param options - Options to findBlobsByTagsItems.
1083
+ */
1084
+ findBlobsByTagsItems(tagFilterSqlExpression, options = {}) {
1085
+ return __asyncGenerator(this, arguments, function* findBlobsByTagsItems_1() {
1086
+ var e_3, _a;
1087
+ let marker;
1088
+ try {
1089
+ for (var _b = __asyncValues(this.findBlobsByTagsSegments(tagFilterSqlExpression, marker, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
1090
+ const segment = _c.value;
1091
+ yield __await(yield* __asyncDelegator(__asyncValues(segment.blobs)));
1092
+ }
1093
+ }
1094
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1095
+ finally {
1096
+ try {
1097
+ if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
1098
+ }
1099
+ finally { if (e_3) throw e_3.error; }
1100
+ }
1101
+ });
1102
+ }
1103
+ /**
1104
+ * Returns an async iterable iterator to find all blobs with specified tag
1105
+ * under the specified container.
1106
+ *
1107
+ * .byPage() returns an async iterable iterator to list the blobs in pages.
1108
+ *
1109
+ * Example using `for await` syntax:
1110
+ *
1111
+ * ```js
1112
+ * let i = 1;
1113
+ * for await (const blob of containerClient.findBlobsByTags("tagkey='tagvalue'")) {
1114
+ * console.log(`Blob ${i++}: ${blob.name}`);
1115
+ * }
1116
+ * ```
1117
+ *
1118
+ * Example using `iter.next()`:
1119
+ *
1120
+ * ```js
1121
+ * let i = 1;
1122
+ * const iter = containerClient.findBlobsByTags("tagkey='tagvalue'");
1123
+ * let blobItem = await iter.next();
1124
+ * while (!blobItem.done) {
1125
+ * console.log(`Blob ${i++}: ${blobItem.value.name}`);
1126
+ * blobItem = await iter.next();
1127
+ * }
1128
+ * ```
1129
+ *
1130
+ * Example using `byPage()`:
1131
+ *
1132
+ * ```js
1133
+ * // passing optional maxPageSize in the page settings
1134
+ * let i = 1;
1135
+ * for await (const response of containerClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 20 })) {
1136
+ * if (response.blobs) {
1137
+ * for (const blob of response.blobs) {
1138
+ * console.log(`Blob ${i++}: ${blob.name}`);
1139
+ * }
1140
+ * }
1141
+ * }
1142
+ * ```
1143
+ *
1144
+ * Example using paging with a marker:
1145
+ *
1146
+ * ```js
1147
+ * let i = 1;
1148
+ * let iterator = containerClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 2 });
1149
+ * let response = (await iterator.next()).value;
1150
+ *
1151
+ * // Prints 2 blob names
1152
+ * if (response.blobs) {
1153
+ * for (const blob of response.blobs) {
1154
+ * console.log(`Blob ${i++}: ${blob.name}`);
1155
+ * }
1156
+ * }
1157
+ *
1158
+ * // Gets next marker
1159
+ * let marker = response.continuationToken;
1160
+ * // Passing next marker as continuationToken
1161
+ * iterator = containerClient
1162
+ * .findBlobsByTags("tagkey='tagvalue'")
1163
+ * .byPage({ continuationToken: marker, maxPageSize: 10 });
1164
+ * response = (await iterator.next()).value;
1165
+ *
1166
+ * // Prints blob names
1167
+ * if (response.blobs) {
1168
+ * for (const blob of response.blobs) {
1169
+ * console.log(`Blob ${i++}: ${blob.name}`);
1170
+ * }
1171
+ * }
1172
+ * ```
1173
+ *
1174
+ * @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
1175
+ * The given expression must evaluate to true for a blob to be returned in the results.
1176
+ * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
1177
+ * however, only a subset of the OData filter syntax is supported in the Blob service.
1178
+ * @param options - Options to find blobs by tags.
1179
+ */
1180
+ findBlobsByTags(tagFilterSqlExpression, options = {}) {
1181
+ // AsyncIterableIterator to iterate over blobs
1182
+ const listSegmentOptions = Object.assign({}, options);
1183
+ const iter = this.findBlobsByTagsItems(tagFilterSqlExpression, listSegmentOptions);
1184
+ return {
1185
+ /**
1186
+ * The next method, part of the iteration protocol
1187
+ */
1188
+ next() {
1189
+ return iter.next();
1190
+ },
1191
+ /**
1192
+ * The connection to the async iterator, part of the iteration protocol
1193
+ */
1194
+ [Symbol.asyncIterator]() {
1195
+ return this;
1196
+ },
1197
+ /**
1198
+ * Return an AsyncIterableIterator that works a page at a time
1199
+ */
1200
+ byPage: (settings = {}) => {
1201
+ return this.findBlobsByTagsSegments(tagFilterSqlExpression, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, listSegmentOptions));
1202
+ },
1203
+ };
1204
+ }
1002
1205
  getContainerNameFromUrl() {
1003
1206
  let containerName;
1004
1207
  try {