@azure/storage-blob 12.9.1-alpha.20220330.1 → 12.9.1-alpha.20220418.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 (26) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/dist/index.js +437 -5
  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 +11 -0
  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/generatedModels.js.map +1 -1
  20. package/dist-esm/storage-blob/src/utils/constants.js +1 -0
  21. package/dist-esm/storage-blob/src/utils/constants.js.map +1 -1
  22. package/dist-esm/storage-blob/src/utils/utils.common.js +42 -0
  23. package/dist-esm/storage-blob/src/utils/utils.common.js.map +1 -1
  24. package/package.json +5 -2
  25. package/types/3.1/storage-blob.d.ts +330 -1
  26. package/types/latest/storage-blob.d.ts +340 -1
@@ -1790,6 +1790,9 @@ export declare type BlobCopyFromURLResponse = BlobCopyFromURLHeaders & {
1790
1790
  };
1791
1791
  };
1792
1792
 
1793
+ /** Defines values for BlobCopySourceTags. */
1794
+ export declare type BlobCopySourceTags = "REPLACE" | "COPY";
1795
+
1793
1796
  /** Defines headers for Blob_createSnapshot operation. */
1794
1797
  export declare interface BlobCreateSnapshotHeaders {
1795
1798
  /** Uniquely identifies the snapshot and indicates the snapshot version. It may be used in subsequent requests to access the snapshot */
@@ -3990,6 +3993,10 @@ export declare interface BlobSyncCopyFromURLOptions extends CommonOptions {
3990
3993
  * 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.
3991
3994
  */
3992
3995
  encryptionScope?: string;
3996
+ /**
3997
+ * Optional. Default 'REPLACE'. Indicates if source tags should be copied or replaced with the tags specified by {@link tags}.
3998
+ */
3999
+ copySourceTags?: BlobCopySourceTags;
3993
4000
  }
3994
4001
 
3995
4002
  export declare interface BlobTag {
@@ -4873,6 +4880,10 @@ export declare interface BlockBlobSyncUploadFromURLOptions extends CommonOptions
4873
4880
  * Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source.
4874
4881
  */
4875
4882
  sourceAuthorization?: HttpAuthorization;
4883
+ /**
4884
+ * Optional, default 'replace'. Indicates if source tags should be copied or replaced with the tags specified by {@link tags}.
4885
+ */
4886
+ copySourceTags?: BlobCopySourceTags;
4876
4887
  }
4877
4888
 
4878
4889
  /**
@@ -5051,6 +5062,11 @@ export declare interface BlockList {
5051
5062
  /** Defines values for BlockListType. */
5052
5063
  export declare type BlockListType = "committed" | "uncommitted" | "all";
5053
5064
 
5065
+ declare interface ClearRange {
5066
+ start: number;
5067
+ end: number;
5068
+ }
5069
+
5054
5070
  /**
5055
5071
  * Common options of {@link BlobGenerateSasUrlOptions} and {@link ContainerGenerateSasUrlOptions}.
5056
5072
  */
@@ -6612,7 +6628,7 @@ export declare interface CpkInfo {
6612
6628
  encryptionKey?: string;
6613
6629
  /** The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. */
6614
6630
  encryptionKeySha256?: string;
6615
- /** 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. */
6631
+ /** 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. */
6616
6632
  encryptionAlgorithm?: EncryptionAlgorithmType;
6617
6633
  }
6618
6634
 
@@ -7360,6 +7376,114 @@ export declare class PageBlobClient extends BlobClient {
7360
7376
  * @returns Response data for the Page Blob Get Ranges operation.
7361
7377
  */
7362
7378
  getPageRanges(offset?: number, count?: number, options?: PageBlobGetPageRangesOptions): Promise<PageBlobGetPageRangesResponse>;
7379
+ /**
7380
+ * getPageRangesSegment returns a single segment of page ranges starting from the
7381
+ * specified Marker. Use an empty Marker to start enumeration from the beginning.
7382
+ * After getting a segment, process it, and then call getPageRangesSegment again
7383
+ * (passing the the previously-returned Marker) to get the next segment.
7384
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
7385
+ *
7386
+ * @param offset - Starting byte position of the page ranges.
7387
+ * @param count - Number of bytes to get.
7388
+ * @param marker - A string value that identifies the portion of the list to be returned with the next list operation.
7389
+ * @param options - Options to PageBlob Get Page Ranges Segment operation.
7390
+ */
7391
+ private listPageRangesSegment;
7392
+ /**
7393
+ * Returns an AsyncIterableIterator for {@link PageBlobGetPageRangesResponseModel}
7394
+ *
7395
+ * @param offset - Starting byte position of the page ranges.
7396
+ * @param count - Number of bytes to get.
7397
+ * @param marker - A string value that identifies the portion of
7398
+ * the get of page ranges to be returned with the next getting operation. The
7399
+ * operation returns the ContinuationToken value within the response body if the
7400
+ * getting operation did not return all page ranges remaining within the current page.
7401
+ * The ContinuationToken value can be used as the value for
7402
+ * the marker parameter in a subsequent call to request the next page of get
7403
+ * items. The marker value is opaque to the client.
7404
+ * @param options - Options to List Page Ranges operation.
7405
+ */
7406
+ private listPageRangeItemSegments;
7407
+ /**
7408
+ * Returns an AsyncIterableIterator of {@link PageRangeInfo} objects
7409
+ *
7410
+ * @param offset - Starting byte position of the page ranges.
7411
+ * @param count - Number of bytes to get.
7412
+ * @param options - Options to List Page Ranges operation.
7413
+ */
7414
+ private listPageRangeItems;
7415
+ /**
7416
+ * Returns an async iterable iterator to list of page ranges for a page blob.
7417
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
7418
+ *
7419
+ * .byPage() returns an async iterable iterator to list of page ranges for a page blob.
7420
+ *
7421
+ * Example using `for await` syntax:
7422
+ *
7423
+ * ```js
7424
+ * // Get the pageBlobClient before you run these snippets,
7425
+ * // Can be obtained from `blobServiceClient.getContainerClient("<your-container-name>").getPageBlobClient("<your-blob-name>");`
7426
+ * let i = 1;
7427
+ * for await (const pageRange of pageBlobClient.listPageRanges()) {
7428
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7429
+ * }
7430
+ * ```
7431
+ *
7432
+ * Example using `iter.next()`:
7433
+ *
7434
+ * ```js
7435
+ * let i = 1;
7436
+ * let iter = pageBlobClient.listPageRanges();
7437
+ * let pageRangeItem = await iter.next();
7438
+ * while (!pageRangeItem.done) {
7439
+ * console.log(`Page range ${i++}: ${pageRangeItem.value.start} - ${pageRangeItem.value.end}, IsClear: ${pageRangeItem.value.isClear}`);
7440
+ * pageRangeItem = await iter.next();
7441
+ * }
7442
+ * ```
7443
+ *
7444
+ * Example using `byPage()`:
7445
+ *
7446
+ * ```js
7447
+ * // passing optional maxPageSize in the page settings
7448
+ * let i = 1;
7449
+ * for await (const response of pageBlobClient.listPageRanges().byPage({ maxPageSize: 20 })) {
7450
+ * for (const pageRange of response) {
7451
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7452
+ * }
7453
+ * }
7454
+ * ```
7455
+ *
7456
+ * Example using paging with a marker:
7457
+ *
7458
+ * ```js
7459
+ * let i = 1;
7460
+ * let iterator = pageBlobClient.listPageRanges().byPage({ maxPageSize: 2 });
7461
+ * let response = (await iterator.next()).value;
7462
+ *
7463
+ * // Prints 2 page ranges
7464
+ * for (const pageRange of response) {
7465
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7466
+ * }
7467
+ *
7468
+ * // Gets next marker
7469
+ * let marker = response.continuationToken;
7470
+ *
7471
+ * // Passing next marker as continuationToken
7472
+ *
7473
+ * iterator = pageBlobClient.listPageRanges().byPage({ continuationToken: marker, maxPageSize: 10 });
7474
+ * response = (await iterator.next()).value;
7475
+ *
7476
+ * // Prints 10 page ranges
7477
+ * for (const blob of response) {
7478
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7479
+ * }
7480
+ * ```
7481
+ * @param offset - Starting byte position of the page ranges.
7482
+ * @param count - Number of bytes to get.
7483
+ * @param options - Options to the Page Blob Get Ranges operation.
7484
+ * @returns An asyncIterableIterator that supports paging.
7485
+ */
7486
+ listPageRanges(offset?: number, count?: number, options?: PageBlobListPageRangesOptions): PagedAsyncIterableIterator<PageRangeInfo, PageBlobGetPageRangesResponseModel>;
7363
7487
  /**
7364
7488
  * Gets the collection of page ranges that differ between a specified snapshot and this page blob.
7365
7489
  * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
@@ -7371,6 +7495,120 @@ export declare class PageBlobClient extends BlobClient {
7371
7495
  * @returns Response data for the Page Blob Get Page Range Diff operation.
7372
7496
  */
7373
7497
  getPageRangesDiff(offset: number, count: number, prevSnapshot: string, options?: PageBlobGetPageRangesDiffOptions): Promise<PageBlobGetPageRangesDiffResponse>;
7498
+ /**
7499
+ * getPageRangesDiffSegment returns a single segment of page ranges starting from the
7500
+ * specified Marker for difference between previous snapshot and the target page blob.
7501
+ * Use an empty Marker to start enumeration from the beginning.
7502
+ * After getting a segment, process it, and then call getPageRangesDiffSegment again
7503
+ * (passing the the previously-returned Marker) to get the next segment.
7504
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
7505
+ *
7506
+ * @param offset - Starting byte position of the page ranges.
7507
+ * @param count - Number of bytes to get.
7508
+ * @param prevSnapshotOrUrl - Timestamp of snapshot to retrieve the difference or URL of snapshot to retrieve the difference.
7509
+ * @param marker - A string value that identifies the portion of the get to be returned with the next get operation.
7510
+ * @param options - Options to the Page Blob Get Page Ranges Diff operation.
7511
+ */
7512
+ private listPageRangesDiffSegment;
7513
+ /**
7514
+ * Returns an AsyncIterableIterator for {@link PageBlobGetPageRangesDiffResponseModel}
7515
+ *
7516
+ *
7517
+ * @param offset - Starting byte position of the page ranges.
7518
+ * @param count - Number of bytes to get.
7519
+ * @param prevSnapshotOrUrl - Timestamp of snapshot to retrieve the difference or URL of snapshot to retrieve the difference.
7520
+ * @param marker - A string value that identifies the portion of
7521
+ * the get of page ranges to be returned with the next getting operation. The
7522
+ * operation returns the ContinuationToken value within the response body if the
7523
+ * getting operation did not return all page ranges remaining within the current page.
7524
+ * The ContinuationToken value can be used as the value for
7525
+ * the marker parameter in a subsequent call to request the next page of get
7526
+ * items. The marker value is opaque to the client.
7527
+ * @param options - Options to the Page Blob Get Page Ranges Diff operation.
7528
+ */
7529
+ private listPageRangeDiffItemSegments;
7530
+ /**
7531
+ * Returns an AsyncIterableIterator of {@link PageRangeInfo} objects
7532
+ *
7533
+ * @param offset - Starting byte position of the page ranges.
7534
+ * @param count - Number of bytes to get.
7535
+ * @param prevSnapshotOrUrl - Timestamp of snapshot to retrieve the difference or URL of snapshot to retrieve the difference.
7536
+ * @param options - Options to the Page Blob Get Page Ranges Diff operation.
7537
+ */
7538
+ private listPageRangeDiffItems;
7539
+ /**
7540
+ * Returns an async iterable iterator to list of page ranges that differ between a specified snapshot and this page blob.
7541
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
7542
+ *
7543
+ * .byPage() returns an async iterable iterator to list of page ranges that differ between a specified snapshot and this page blob.
7544
+ *
7545
+ * Example using `for await` syntax:
7546
+ *
7547
+ * ```js
7548
+ * // Get the pageBlobClient before you run these snippets,
7549
+ * // Can be obtained from `blobServiceClient.getContainerClient("<your-container-name>").getPageBlobClient("<your-blob-name>");`
7550
+ * let i = 1;
7551
+ * for await (const pageRange of pageBlobClient.listPageRangesDiff()) {
7552
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7553
+ * }
7554
+ * ```
7555
+ *
7556
+ * Example using `iter.next()`:
7557
+ *
7558
+ * ```js
7559
+ * let i = 1;
7560
+ * let iter = pageBlobClient.listPageRangesDiff();
7561
+ * let pageRangeItem = await iter.next();
7562
+ * while (!pageRangeItem.done) {
7563
+ * console.log(`Page range ${i++}: ${pageRangeItem.value.start} - ${pageRangeItem.value.end}, IsClear: ${pageRangeItem.value.isClear}`);
7564
+ * pageRangeItem = await iter.next();
7565
+ * }
7566
+ * ```
7567
+ *
7568
+ * Example using `byPage()`:
7569
+ *
7570
+ * ```js
7571
+ * // passing optional maxPageSize in the page settings
7572
+ * let i = 1;
7573
+ * for await (const response of pageBlobClient.listPageRangesDiff().byPage({ maxPageSize: 20 })) {
7574
+ * for (const pageRange of response) {
7575
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7576
+ * }
7577
+ * }
7578
+ * ```
7579
+ *
7580
+ * Example using paging with a marker:
7581
+ *
7582
+ * ```js
7583
+ * let i = 1;
7584
+ * let iterator = pageBlobClient.listPageRangesDiff().byPage({ maxPageSize: 2 });
7585
+ * let response = (await iterator.next()).value;
7586
+ *
7587
+ * // Prints 2 page ranges
7588
+ * for (const pageRange of response) {
7589
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7590
+ * }
7591
+ *
7592
+ * // Gets next marker
7593
+ * let marker = response.continuationToken;
7594
+ *
7595
+ * // Passing next marker as continuationToken
7596
+ *
7597
+ * iterator = pageBlobClient.listPageRangesDiff().byPage({ continuationToken: marker, maxPageSize: 10 });
7598
+ * response = (await iterator.next()).value;
7599
+ *
7600
+ * // Prints 10 page ranges
7601
+ * for (const blob of response) {
7602
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
7603
+ * }
7604
+ * ```
7605
+ * @param offset - Starting byte position of the page ranges.
7606
+ * @param count - Number of bytes to get.
7607
+ * @param prevSnapshot - Timestamp of snapshot to retrieve the difference.
7608
+ * @param options - Options to the Page Blob Get Ranges operation.
7609
+ * @returns An asyncIterableIterator that supports paging.
7610
+ */
7611
+ listPageRangesDiff(offset: number, count: number, prevSnapshot: string, options?: PageBlobListPageRangesDiffOptions): PagedAsyncIterableIterator<PageRangeInfo, PageBlobGetPageRangesDiffResponseModel>;
7374
7612
  /**
7375
7613
  * Gets the collection of page ranges that differ between a specified snapshot and this page blob for managed disks.
7376
7614
  * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
@@ -7607,6 +7845,33 @@ export declare type PageBlobCreateResponse = PageBlobCreateHeaders & {
7607
7845
  };
7608
7846
  };
7609
7847
 
7848
+ /**
7849
+ * Options to configure the {@link PageBlobClient.getPageRanges} operation.
7850
+ */
7851
+ export declare interface PageBlobGetPageRangesDiffForManagedDisksInPagesOptions extends CommonOptions {
7852
+ /**
7853
+ * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.
7854
+ * For example, use the &commat;azure/abort-controller to create an `AbortSignal`.
7855
+ */
7856
+ abortSignal?: AbortSignalLike;
7857
+ /**
7858
+ * Conditions to meet when getting page ranges diff.
7859
+ */
7860
+ conditions?: BlobRequestConditions;
7861
+ /**
7862
+ * Starting byte position of the page ranges.
7863
+ */
7864
+ offset: number;
7865
+ /**
7866
+ * Number of bytes to get.
7867
+ */
7868
+ count: number;
7869
+ /**
7870
+ * URL of snapshot to retrieve the difference.
7871
+ */
7872
+ prevSnapshotUrl: string;
7873
+ }
7874
+
7610
7875
  /** Defines headers for PageBlob_getPageRangesDiff operation. */
7611
7876
  export declare interface PageBlobGetPageRangesDiffHeaders {
7612
7877
  /** 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. */
@@ -7669,6 +7934,19 @@ export declare interface PageBlobGetPageRangesDiffResponse extends PageList, Pag
7669
7934
  };
7670
7935
  }
7671
7936
 
7937
+ /** Contains response data for the getPageRangesDiff operation. */
7938
+ export declare type PageBlobGetPageRangesDiffResponseModel = PageBlobGetPageRangesDiffHeaders & PageList_2 & {
7939
+ /** The underlying HTTP response. */
7940
+ _response: coreHttp.HttpResponse & {
7941
+ /** The response body as text (string format) */
7942
+ bodyAsText: string;
7943
+ /** The response body as parsed JSON or XML */
7944
+ parsedBody: PageList_2;
7945
+ /** The parsed HTTP response headers. */
7946
+ parsedHeaders: PageBlobGetPageRangesDiffHeaders;
7947
+ };
7948
+ };
7949
+
7672
7950
  /** Defines headers for PageBlob_getPageRanges operation. */
7673
7951
  export declare interface PageBlobGetPageRangesHeaders {
7674
7952
  /** 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. */
@@ -7727,6 +8005,49 @@ export declare interface PageBlobGetPageRangesResponse extends PageList, PageBlo
7727
8005
  };
7728
8006
  }
7729
8007
 
8008
+ /** Contains response data for the getPageRanges operation. */
8009
+ export declare type PageBlobGetPageRangesResponseModel = PageBlobGetPageRangesHeaders & PageList_2 & {
8010
+ /** The underlying HTTP response. */
8011
+ _response: coreHttp.HttpResponse & {
8012
+ /** The response body as text (string format) */
8013
+ bodyAsText: string;
8014
+ /** The response body as parsed JSON or XML */
8015
+ parsedBody: PageList_2;
8016
+ /** The parsed HTTP response headers. */
8017
+ parsedHeaders: PageBlobGetPageRangesHeaders;
8018
+ };
8019
+ };
8020
+
8021
+ /**
8022
+ * Options to configure the {@link PageBlobClient.listPageRangesDiff} operation.
8023
+ */
8024
+ export declare interface PageBlobListPageRangesDiffOptions extends CommonOptions {
8025
+ /**
8026
+ * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.
8027
+ * For example, use the &commat;azure/abort-controller to create an `AbortSignal`.
8028
+ */
8029
+ abortSignal?: AbortSignalLike;
8030
+ /**
8031
+ * Conditions to meet when getting page ranges diff.
8032
+ */
8033
+ conditions?: BlobRequestConditions;
8034
+ }
8035
+
8036
+ /**
8037
+ * Options to configure the {@link PageBlobClient.listPageRanges} operation.
8038
+ */
8039
+ export declare interface PageBlobListPageRangesOptions extends CommonOptions {
8040
+ /**
8041
+ * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.
8042
+ * For example, use the &commat;azure/abort-controller to create an `AbortSignal`.
8043
+ */
8044
+ abortSignal?: AbortSignalLike;
8045
+ /**
8046
+ * Conditions to meet when getting page ranges.
8047
+ */
8048
+ conditions?: BlobRequestConditions;
8049
+ }
8050
+
7730
8051
  /**
7731
8052
  * Conditions to add to the creation of this page blob.
7732
8053
  */
@@ -8028,6 +8349,24 @@ export declare interface PageList {
8028
8349
  clearRange?: Range_2[];
8029
8350
  }
8030
8351
 
8352
+ /** the list of pages */
8353
+ declare interface PageList_2 {
8354
+ pageRange?: PageRange[];
8355
+ clearRange?: ClearRange[];
8356
+ continuationToken?: string;
8357
+ }
8358
+
8359
+ declare interface PageRange {
8360
+ start: number;
8361
+ end: number;
8362
+ }
8363
+
8364
+ export declare interface PageRangeInfo {
8365
+ start: number;
8366
+ end: number;
8367
+ isClear: boolean;
8368
+ }
8369
+
8031
8370
  /**
8032
8371
  * The multipart/mixed response which contains the response for each subrequest.
8033
8372
  */