@azure/storage-blob 12.9.1-alpha.20220401.1 → 12.10.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +6 -3
  2. package/dist/index.js +442 -10
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/storage-blob/src/Clients.js +372 -6
  5. package/dist-esm/storage-blob/src/Clients.js.map +1 -1
  6. package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -1
  7. package/dist-esm/storage-blob/src/PageBlobRangeResponse.js.map +1 -1
  8. package/dist-esm/storage-blob/src/generated/src/models/index.js.map +1 -1
  9. package/dist-esm/storage-blob/src/generated/src/models/mappers.js +7 -0
  10. package/dist-esm/storage-blob/src/generated/src/models/mappers.js.map +1 -1
  11. package/dist-esm/storage-blob/src/generated/src/models/parameters.js +12 -1
  12. package/dist-esm/storage-blob/src/generated/src/models/parameters.js.map +1 -1
  13. package/dist-esm/storage-blob/src/generated/src/operations/blob.js +2 -1
  14. package/dist-esm/storage-blob/src/generated/src/operations/blob.js.map +1 -1
  15. package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js +1 -0
  16. package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js.map +1 -1
  17. package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js +4 -0
  18. package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js.map +1 -1
  19. package/dist-esm/storage-blob/src/generated/src/storageClientContext.js +2 -2
  20. package/dist-esm/storage-blob/src/generated/src/storageClientContext.js.map +1 -1
  21. package/dist-esm/storage-blob/src/generatedModels.js.map +1 -1
  22. package/dist-esm/storage-blob/src/utils/constants.js +3 -2
  23. package/dist-esm/storage-blob/src/utils/constants.js.map +1 -1
  24. package/dist-esm/storage-blob/src/utils/utils.common.js +42 -0
  25. package/dist-esm/storage-blob/src/utils/utils.common.js.map +1 -1
  26. package/package.json +9 -6
  27. package/types/3.1/storage-blob.d.ts +330 -1
  28. package/types/latest/storage-blob.d.ts +340 -1
@@ -1741,6 +1741,8 @@ export declare type BlobCopyFromURLResponse = BlobCopyFromURLHeaders & {
1741
1741
  parsedHeaders: BlobCopyFromURLHeaders;
1742
1742
  };
1743
1743
  };
1744
+ /** Defines values for BlobCopySourceTags. */
1745
+ export declare type BlobCopySourceTags = "REPLACE" | "COPY";
1744
1746
  /** Defines headers for Blob_createSnapshot operation. */
1745
1747
  export declare interface BlobCreateSnapshotHeaders {
1746
1748
  /** Uniquely identifies the snapshot and indicates the snapshot version. It may be used in subsequent requests to access the snapshot */
@@ -3865,6 +3867,10 @@ export declare interface BlobSyncCopyFromURLOptions extends CommonOptions {
3865
3867
  * Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services.
3866
3868
  */
3867
3869
  encryptionScope?: string;
3870
+ /**
3871
+ * Optional. Default 'REPLACE'. Indicates if source tags should be copied or replaced with the tags specified by {@link tags}.
3872
+ */
3873
+ copySourceTags?: BlobCopySourceTags;
3868
3874
  }
3869
3875
  export declare interface BlobTag {
3870
3876
  key: string;
@@ -4722,6 +4728,10 @@ export declare interface BlockBlobSyncUploadFromURLOptions extends CommonOptions
4722
4728
  * Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source.
4723
4729
  */
4724
4730
  sourceAuthorization?: HttpAuthorization;
4731
+ /**
4732
+ * Optional, default 'replace'. Indicates if source tags should be copied or replaced with the tags specified by {@link tags}.
4733
+ */
4734
+ copySourceTags?: BlobCopySourceTags;
4725
4735
  }
4726
4736
  /**
4727
4737
  * Represents the access tier on a blob.
@@ -4892,6 +4902,10 @@ export declare interface BlockList {
4892
4902
  }
4893
4903
  /** Defines values for BlockListType. */
4894
4904
  export declare type BlockListType = "committed" | "uncommitted" | "all";
4905
+ declare interface ClearRange {
4906
+ start: number;
4907
+ end: number;
4908
+ }
4895
4909
  /**
4896
4910
  * Common options of {@link BlobGenerateSasUrlOptions} and {@link ContainerGenerateSasUrlOptions}.
4897
4911
  */
@@ -6400,7 +6414,7 @@ export declare interface CpkInfo {
6400
6414
  encryptionKey?: string;
6401
6415
  /** The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. */
6402
6416
  encryptionKeySha256?: string;
6403
- /** The algorithm used to produce the encryption key hash. Currently, the only accepted value is \"AES256\". Must be provided if the x-ms-encryption-key header is provided. */
6417
+ /** The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. */
6404
6418
  encryptionAlgorithm?: EncryptionAlgorithmType;
6405
6419
  }
6406
6420
  /**
@@ -7099,6 +7113,114 @@ export declare class PageBlobClient extends BlobClient {
7099
7113
  * @returns Response data for the Page Blob Get Ranges operation.
7100
7114
  */
7101
7115
  getPageRanges(offset?: number, count?: number, options?: PageBlobGetPageRangesOptions): Promise<PageBlobGetPageRangesResponse>;
7116
+ /**
7117
+ * getPageRangesSegment returns a single segment of page ranges starting from the
7118
+ * specified Marker. Use an empty Marker to start enumeration from the beginning.
7119
+ * After getting a segment, process it, and then call getPageRangesSegment again
7120
+ * (passing the the previously-returned Marker) to get the next segment.
7121
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
7122
+ *
7123
+ * @param offset - Starting byte position of the page ranges.
7124
+ * @param count - Number of bytes to get.
7125
+ * @param marker - A string value that identifies the portion of the list to be returned with the next list operation.
7126
+ * @param options - Options to PageBlob Get Page Ranges Segment operation.
7127
+ */
7128
+ private listPageRangesSegment;
7129
+ /**
7130
+ * Returns an AsyncIterableIterator for {@link PageBlobGetPageRangesResponseModel}
7131
+ *
7132
+ * @param offset - Starting byte position of the page ranges.
7133
+ * @param count - Number of bytes to get.
7134
+ * @param marker - A string value that identifies the portion of
7135
+ * the get of page ranges to be returned with the next getting operation. The
7136
+ * operation returns the ContinuationToken value within the response body if the
7137
+ * getting operation did not return all page ranges remaining within the current page.
7138
+ * The ContinuationToken value can be used as the value for
7139
+ * the marker parameter in a subsequent call to request the next page of get
7140
+ * items. The marker value is opaque to the client.
7141
+ * @param options - Options to List Page Ranges operation.
7142
+ */
7143
+ private listPageRangeItemSegments;
7144
+ /**
7145
+ * Returns an AsyncIterableIterator of {@link PageRangeInfo} objects
7146
+ *
7147
+ * @param offset - Starting byte position of the page ranges.
7148
+ * @param count - Number of bytes to get.
7149
+ * @param options - Options to List Page Ranges operation.
7150
+ */
7151
+ private listPageRangeItems;
7152
+ /**
7153
+ * Returns an async iterable iterator to list of page ranges for a page blob.
7154
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
7155
+ *
7156
+ * .byPage() returns an async iterable iterator to list of page ranges for a page blob.
7157
+ *
7158
+ * Example using `for await` syntax:
7159
+ *
7160
+ * ```js
7161
+ * // Get the pageBlobClient before you run these snippets,
7162
+ * // Can be obtained from `blobServiceClient.getContainerClient("<your-container-name>").getPageBlobClient("<your-blob-name>");`
7163
+ * let i = 1;
7164
+ * for await (const pageRange of pageBlobClient.listPageRanges()) {
7165
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7166
+ * }
7167
+ * ```
7168
+ *
7169
+ * Example using `iter.next()`:
7170
+ *
7171
+ * ```js
7172
+ * let i = 1;
7173
+ * let iter = pageBlobClient.listPageRanges();
7174
+ * let pageRangeItem = await iter.next();
7175
+ * while (!pageRangeItem.done) {
7176
+ * console.log(`Page range ${i++}: ${pageRangeItem.value.start} - ${pageRangeItem.value.end}, IsClear: ${pageRangeItem.value.isClear}`);
7177
+ * pageRangeItem = await iter.next();
7178
+ * }
7179
+ * ```
7180
+ *
7181
+ * Example using `byPage()`:
7182
+ *
7183
+ * ```js
7184
+ * // passing optional maxPageSize in the page settings
7185
+ * let i = 1;
7186
+ * for await (const response of pageBlobClient.listPageRanges().byPage({ maxPageSize: 20 })) {
7187
+ * for (const pageRange of response) {
7188
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7189
+ * }
7190
+ * }
7191
+ * ```
7192
+ *
7193
+ * Example using paging with a marker:
7194
+ *
7195
+ * ```js
7196
+ * let i = 1;
7197
+ * let iterator = pageBlobClient.listPageRanges().byPage({ maxPageSize: 2 });
7198
+ * let response = (await iterator.next()).value;
7199
+ *
7200
+ * // Prints 2 page ranges
7201
+ * for (const pageRange of response) {
7202
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7203
+ * }
7204
+ *
7205
+ * // Gets next marker
7206
+ * let marker = response.continuationToken;
7207
+ *
7208
+ * // Passing next marker as continuationToken
7209
+ *
7210
+ * iterator = pageBlobClient.listPageRanges().byPage({ continuationToken: marker, maxPageSize: 10 });
7211
+ * response = (await iterator.next()).value;
7212
+ *
7213
+ * // Prints 10 page ranges
7214
+ * for (const blob of response) {
7215
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7216
+ * }
7217
+ * ```
7218
+ * @param offset - Starting byte position of the page ranges.
7219
+ * @param count - Number of bytes to get.
7220
+ * @param options - Options to the Page Blob Get Ranges operation.
7221
+ * @returns An asyncIterableIterator that supports paging.
7222
+ */
7223
+ listPageRanges(offset?: number, count?: number, options?: PageBlobListPageRangesOptions): PagedAsyncIterableIterator<PageRangeInfo, PageBlobGetPageRangesResponseModel>;
7102
7224
  /**
7103
7225
  * Gets the collection of page ranges that differ between a specified snapshot and this page blob.
7104
7226
  * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
@@ -7110,6 +7232,120 @@ export declare class PageBlobClient extends BlobClient {
7110
7232
  * @returns Response data for the Page Blob Get Page Range Diff operation.
7111
7233
  */
7112
7234
  getPageRangesDiff(offset: number, count: number, prevSnapshot: string, options?: PageBlobGetPageRangesDiffOptions): Promise<PageBlobGetPageRangesDiffResponse>;
7235
+ /**
7236
+ * getPageRangesDiffSegment returns a single segment of page ranges starting from the
7237
+ * specified Marker for difference between previous snapshot and the target page blob.
7238
+ * Use an empty Marker to start enumeration from the beginning.
7239
+ * After getting a segment, process it, and then call getPageRangesDiffSegment again
7240
+ * (passing the the previously-returned Marker) to get the next segment.
7241
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
7242
+ *
7243
+ * @param offset - Starting byte position of the page ranges.
7244
+ * @param count - Number of bytes to get.
7245
+ * @param prevSnapshotOrUrl - Timestamp of snapshot to retrieve the difference or URL of snapshot to retrieve the difference.
7246
+ * @param marker - A string value that identifies the portion of the get to be returned with the next get operation.
7247
+ * @param options - Options to the Page Blob Get Page Ranges Diff operation.
7248
+ */
7249
+ private listPageRangesDiffSegment;
7250
+ /**
7251
+ * Returns an AsyncIterableIterator for {@link PageBlobGetPageRangesDiffResponseModel}
7252
+ *
7253
+ *
7254
+ * @param offset - Starting byte position of the page ranges.
7255
+ * @param count - Number of bytes to get.
7256
+ * @param prevSnapshotOrUrl - Timestamp of snapshot to retrieve the difference or URL of snapshot to retrieve the difference.
7257
+ * @param marker - A string value that identifies the portion of
7258
+ * the get of page ranges to be returned with the next getting operation. The
7259
+ * operation returns the ContinuationToken value within the response body if the
7260
+ * getting operation did not return all page ranges remaining within the current page.
7261
+ * The ContinuationToken value can be used as the value for
7262
+ * the marker parameter in a subsequent call to request the next page of get
7263
+ * items. The marker value is opaque to the client.
7264
+ * @param options - Options to the Page Blob Get Page Ranges Diff operation.
7265
+ */
7266
+ private listPageRangeDiffItemSegments;
7267
+ /**
7268
+ * Returns an AsyncIterableIterator of {@link PageRangeInfo} objects
7269
+ *
7270
+ * @param offset - Starting byte position of the page ranges.
7271
+ * @param count - Number of bytes to get.
7272
+ * @param prevSnapshotOrUrl - Timestamp of snapshot to retrieve the difference or URL of snapshot to retrieve the difference.
7273
+ * @param options - Options to the Page Blob Get Page Ranges Diff operation.
7274
+ */
7275
+ private listPageRangeDiffItems;
7276
+ /**
7277
+ * Returns an async iterable iterator to list of page ranges that differ between a specified snapshot and this page blob.
7278
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
7279
+ *
7280
+ * .byPage() returns an async iterable iterator to list of page ranges that differ between a specified snapshot and this page blob.
7281
+ *
7282
+ * Example using `for await` syntax:
7283
+ *
7284
+ * ```js
7285
+ * // Get the pageBlobClient before you run these snippets,
7286
+ * // Can be obtained from `blobServiceClient.getContainerClient("<your-container-name>").getPageBlobClient("<your-blob-name>");`
7287
+ * let i = 1;
7288
+ * for await (const pageRange of pageBlobClient.listPageRangesDiff()) {
7289
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7290
+ * }
7291
+ * ```
7292
+ *
7293
+ * Example using `iter.next()`:
7294
+ *
7295
+ * ```js
7296
+ * let i = 1;
7297
+ * let iter = pageBlobClient.listPageRangesDiff();
7298
+ * let pageRangeItem = await iter.next();
7299
+ * while (!pageRangeItem.done) {
7300
+ * console.log(`Page range ${i++}: ${pageRangeItem.value.start} - ${pageRangeItem.value.end}, IsClear: ${pageRangeItem.value.isClear}`);
7301
+ * pageRangeItem = await iter.next();
7302
+ * }
7303
+ * ```
7304
+ *
7305
+ * Example using `byPage()`:
7306
+ *
7307
+ * ```js
7308
+ * // passing optional maxPageSize in the page settings
7309
+ * let i = 1;
7310
+ * for await (const response of pageBlobClient.listPageRangesDiff().byPage({ maxPageSize: 20 })) {
7311
+ * for (const pageRange of response) {
7312
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7313
+ * }
7314
+ * }
7315
+ * ```
7316
+ *
7317
+ * Example using paging with a marker:
7318
+ *
7319
+ * ```js
7320
+ * let i = 1;
7321
+ * let iterator = pageBlobClient.listPageRangesDiff().byPage({ maxPageSize: 2 });
7322
+ * let response = (await iterator.next()).value;
7323
+ *
7324
+ * // Prints 2 page ranges
7325
+ * for (const pageRange of response) {
7326
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7327
+ * }
7328
+ *
7329
+ * // Gets next marker
7330
+ * let marker = response.continuationToken;
7331
+ *
7332
+ * // Passing next marker as continuationToken
7333
+ *
7334
+ * iterator = pageBlobClient.listPageRangesDiff().byPage({ continuationToken: marker, maxPageSize: 10 });
7335
+ * response = (await iterator.next()).value;
7336
+ *
7337
+ * // Prints 10 page ranges
7338
+ * for (const blob of response) {
7339
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7340
+ * }
7341
+ * ```
7342
+ * @param offset - Starting byte position of the page ranges.
7343
+ * @param count - Number of bytes to get.
7344
+ * @param prevSnapshot - Timestamp of snapshot to retrieve the difference.
7345
+ * @param options - Options to the Page Blob Get Ranges operation.
7346
+ * @returns An asyncIterableIterator that supports paging.
7347
+ */
7348
+ listPageRangesDiff(offset: number, count: number, prevSnapshot: string, options?: PageBlobListPageRangesDiffOptions): PagedAsyncIterableIterator<PageRangeInfo, PageBlobGetPageRangesDiffResponseModel>;
7113
7349
  /**
7114
7350
  * Gets the collection of page ranges that differ between a specified snapshot and this page blob for managed disks.
7115
7351
  * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
@@ -7338,6 +7574,32 @@ export declare type PageBlobCreateResponse = PageBlobCreateHeaders & {
7338
7574
  parsedHeaders: PageBlobCreateHeaders;
7339
7575
  };
7340
7576
  };
7577
+ /**
7578
+ * Options to configure the {@link PageBlobClient.getPageRanges} operation.
7579
+ */
7580
+ export declare interface PageBlobGetPageRangesDiffForManagedDisksInPagesOptions extends CommonOptions {
7581
+ /**
7582
+ * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.
7583
+ * For example, use the &commat;azure/abort-controller to create an `AbortSignal`.
7584
+ */
7585
+ abortSignal?: AbortSignalLike;
7586
+ /**
7587
+ * Conditions to meet when getting page ranges diff.
7588
+ */
7589
+ conditions?: BlobRequestConditions;
7590
+ /**
7591
+ * Starting byte position of the page ranges.
7592
+ */
7593
+ offset: number;
7594
+ /**
7595
+ * Number of bytes to get.
7596
+ */
7597
+ count: number;
7598
+ /**
7599
+ * URL of snapshot to retrieve the difference.
7600
+ */
7601
+ prevSnapshotUrl: string;
7602
+ }
7341
7603
  /** Defines headers for PageBlob_getPageRangesDiff operation. */
7342
7604
  export declare interface PageBlobGetPageRangesDiffHeaders {
7343
7605
  /** Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob. */
@@ -7397,6 +7659,18 @@ export declare interface PageBlobGetPageRangesDiffResponse extends PageList, Pag
7397
7659
  parsedBody: PageList;
7398
7660
  };
7399
7661
  }
7662
+ /** Contains response data for the getPageRangesDiff operation. */
7663
+ export declare type PageBlobGetPageRangesDiffResponseModel = PageBlobGetPageRangesDiffHeaders & PageList_2 & {
7664
+ /** The underlying HTTP response. */
7665
+ _response: coreHttp.HttpResponse & {
7666
+ /** The response body as text (string format) */
7667
+ bodyAsText: string;
7668
+ /** The response body as parsed JSON or XML */
7669
+ parsedBody: PageList_2;
7670
+ /** The parsed HTTP response headers. */
7671
+ parsedHeaders: PageBlobGetPageRangesDiffHeaders;
7672
+ };
7673
+ };
7400
7674
  /** Defines headers for PageBlob_getPageRanges operation. */
7401
7675
  export declare interface PageBlobGetPageRangesHeaders {
7402
7676
  /** Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob. */
@@ -7452,6 +7726,46 @@ export declare interface PageBlobGetPageRangesResponse extends PageList, PageBlo
7452
7726
  parsedBody: PageList;
7453
7727
  };
7454
7728
  }
7729
+ /** Contains response data for the getPageRanges operation. */
7730
+ export declare type PageBlobGetPageRangesResponseModel = PageBlobGetPageRangesHeaders & PageList_2 & {
7731
+ /** The underlying HTTP response. */
7732
+ _response: coreHttp.HttpResponse & {
7733
+ /** The response body as text (string format) */
7734
+ bodyAsText: string;
7735
+ /** The response body as parsed JSON or XML */
7736
+ parsedBody: PageList_2;
7737
+ /** The parsed HTTP response headers. */
7738
+ parsedHeaders: PageBlobGetPageRangesHeaders;
7739
+ };
7740
+ };
7741
+ /**
7742
+ * Options to configure the {@link PageBlobClient.listPageRangesDiff} operation.
7743
+ */
7744
+ export declare interface PageBlobListPageRangesDiffOptions extends CommonOptions {
7745
+ /**
7746
+ * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.
7747
+ * For example, use the &commat;azure/abort-controller to create an `AbortSignal`.
7748
+ */
7749
+ abortSignal?: AbortSignalLike;
7750
+ /**
7751
+ * Conditions to meet when getting page ranges diff.
7752
+ */
7753
+ conditions?: BlobRequestConditions;
7754
+ }
7755
+ /**
7756
+ * Options to configure the {@link PageBlobClient.listPageRanges} operation.
7757
+ */
7758
+ export declare interface PageBlobListPageRangesOptions extends CommonOptions {
7759
+ /**
7760
+ * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.
7761
+ * For example, use the &commat;azure/abort-controller to create an `AbortSignal`.
7762
+ */
7763
+ abortSignal?: AbortSignalLike;
7764
+ /**
7765
+ * Conditions to meet when getting page ranges.
7766
+ */
7767
+ conditions?: BlobRequestConditions;
7768
+ }
7455
7769
  /**
7456
7770
  * Conditions to add to the creation of this page blob.
7457
7771
  */
@@ -7738,6 +8052,21 @@ export declare interface PageList {
7738
8052
  */
7739
8053
  clearRange?: Range_2[];
7740
8054
  }
8055
+ /** the list of pages */
8056
+ declare interface PageList_2 {
8057
+ pageRange?: PageRange[];
8058
+ clearRange?: ClearRange[];
8059
+ continuationToken?: string;
8060
+ }
8061
+ declare interface PageRange {
8062
+ start: number;
8063
+ end: number;
8064
+ }
8065
+ export declare interface PageRangeInfo {
8066
+ start: number;
8067
+ end: number;
8068
+ isClear: boolean;
8069
+ }
7741
8070
  /**
7742
8071
  * The multipart/mixed response which contains the response for each subrequest.
7743
8072
  */