@azure/storage-file-share 12.14.0 → 12.20.0-alpha.20230607.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 +5739 -6320
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-blob/src/BatchResponse.js +4 -0
- package/dist-esm/storage-blob/src/BatchResponse.js.map +1 -0
- package/dist-esm/storage-blob/src/BatchResponseParser.js +137 -0
- package/dist-esm/storage-blob/src/BatchResponseParser.js.map +1 -0
- package/dist-esm/storage-blob/src/BatchUtils.browser.js +11 -0
- package/dist-esm/storage-blob/src/BatchUtils.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/BatchUtils.js +15 -0
- package/dist-esm/storage-blob/src/BatchUtils.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobBatch.js +267 -0
- package/dist-esm/storage-blob/src/BlobBatch.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobBatchClient.js +140 -0
- package/dist-esm/storage-blob/src/BlobBatchClient.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobDownloadResponse.browser.js +7 -0
- package/dist-esm/storage-blob/src/BlobDownloadResponse.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobDownloadResponse.js +455 -0
- package/dist-esm/storage-blob/src/BlobDownloadResponse.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobLeaseClient.js +192 -0
- package/dist-esm/storage-blob/src/BlobLeaseClient.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobQueryResponse.browser.js +362 -0
- package/dist-esm/storage-blob/src/BlobQueryResponse.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobQueryResponse.js +367 -0
- package/dist-esm/storage-blob/src/BlobQueryResponse.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobServiceClient.js +702 -0
- package/dist-esm/storage-blob/src/BlobServiceClient.js.map +1 -0
- package/dist-esm/storage-blob/src/Clients.js +2527 -0
- package/dist-esm/storage-blob/src/Clients.js.map +1 -0
- package/dist-esm/storage-blob/src/ContainerClient.js +1161 -0
- package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -0
- package/dist-esm/storage-blob/src/PageBlobRangeResponse.js +24 -0
- package/dist-esm/storage-blob/src/PageBlobRangeResponse.js.map +1 -0
- package/dist-esm/storage-blob/src/Pipeline.js +259 -0
- package/dist-esm/storage-blob/src/Pipeline.js.map +1 -0
- package/dist-esm/storage-blob/src/Range.js +21 -0
- package/dist-esm/storage-blob/src/Range.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/StorageBrowserPolicyFactory.js +1 -1
- package/dist-esm/storage-blob/src/StorageBrowserPolicyFactory.js.map +1 -0
- package/dist-esm/storage-blob/src/StorageClient.js +29 -0
- package/dist-esm/storage-blob/src/StorageClient.js.map +1 -0
- package/dist-esm/storage-blob/src/StorageContextClient.js +17 -0
- package/dist-esm/storage-blob/src/StorageContextClient.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/StorageRetryPolicyFactory.js +2 -1
- package/dist-esm/storage-blob/src/StorageRetryPolicyFactory.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/credentials/AnonymousCredential.js +1 -1
- package/dist-esm/storage-blob/src/credentials/AnonymousCredential.js.map +1 -0
- package/dist-esm/storage-blob/src/credentials/Credential.js.map +1 -0
- package/dist-esm/storage-blob/src/credentials/StorageSharedKeyCredential.browser.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/credentials/StorageSharedKeyCredential.js +1 -1
- package/dist-esm/storage-blob/src/credentials/StorageSharedKeyCredential.js.map +1 -0
- package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.browser.js +5 -0
- package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.js +31 -0
- package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/generated/src/index.js +1 -1
- package/dist-esm/storage-blob/src/generated/src/index.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/models/index.js +256 -0
- package/dist-esm/storage-blob/src/generated/src/models/index.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/models/mappers.js +8196 -0
- package/dist-esm/storage-blob/src/generated/src/models/mappers.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/models/parameters.js +1610 -0
- package/dist-esm/storage-blob/src/generated/src/models/parameters.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/appendBlob.js +221 -0
- package/dist-esm/storage-blob/src/generated/src/operations/appendBlob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/blob.js +997 -0
- package/dist-esm/storage-blob/src/generated/src/operations/blob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js +365 -0
- package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/container.js +705 -0
- package/dist-esm/storage-blob/src/generated/src/operations/container.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/index.js +14 -0
- package/dist-esm/storage-blob/src/generated/src/operations/index.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js +456 -0
- package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/service.js +315 -0
- package/dist-esm/storage-blob/src/generated/src/operations/service.js.map +1 -0
- 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/{src/generated/src/models/index.js → storage-blob/src/generated/src/operationsInterfaces/blob.js} +1 -1
- 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 +49 -0
- package/dist-esm/storage-blob/src/generated/src/storageClient.js.map +1 -0
- package/dist-esm/storage-blob/src/generatedModels.js +4 -0
- package/dist-esm/storage-blob/src/generatedModels.js.map +1 -0
- package/dist-esm/storage-blob/src/index.browser.js +23 -0
- package/dist-esm/storage-blob/src/index.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/index.js +33 -0
- package/dist-esm/storage-blob/src/index.js.map +1 -0
- package/dist-esm/storage-blob/src/log.js +8 -0
- package/dist-esm/storage-blob/src/log.js.map +1 -0
- package/dist-esm/storage-blob/src/models.js +108 -0
- package/dist-esm/storage-blob/src/models.js.map +1 -0
- package/dist-esm/storage-blob/src/policies/AnonymousCredentialPolicy.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/policies/CredentialPolicy.js +1 -1
- package/dist-esm/storage-blob/src/policies/CredentialPolicy.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/{src → storage-blob/src}/policies/StorageBrowserPolicy.js +2 -1
- package/dist-esm/{src → 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/{src → storage-blob/src}/policies/StorageRetryPolicy.js +15 -6
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js.map +1 -0
- 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 -0
- 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 +130 -0
- package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/AccountSASPermissions.js +227 -0
- package/dist-esm/storage-blob/src/sas/AccountSASPermissions.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/AccountSASResourceTypes.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/AccountSASServices.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/AccountSASSignatureValues.js +93 -0
- package/dist-esm/storage-blob/src/sas/AccountSASSignatureValues.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/BlobSASPermissions.js +195 -0
- package/dist-esm/storage-blob/src/sas/BlobSASPermissions.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js +555 -0
- package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/ContainerSASPermissions.js +221 -0
- package/dist-esm/storage-blob/src/sas/ContainerSASPermissions.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/SASQueryParameters.js +234 -0
- package/dist-esm/storage-blob/src/sas/SASQueryParameters.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/SasIPRange.js +13 -0
- package/dist-esm/storage-blob/src/sas/SasIPRange.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/Batch.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/BlobQuickQueryStream.js +111 -0
- package/dist-esm/storage-blob/src/utils/BlobQuickQueryStream.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/Mutex.js +66 -0
- package/dist-esm/storage-blob/src/utils/Mutex.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/RetriableReadableStream.js +119 -0
- package/dist-esm/storage-blob/src/utils/RetriableReadableStream.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/cache.js +11 -0
- package/dist-esm/storage-blob/src/utils/cache.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/constants.js +223 -0
- package/dist-esm/storage-blob/src/utils/constants.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/tracing.js +14 -0
- package/dist-esm/storage-blob/src/utils/tracing.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/utils.browser.js +48 -0
- package/dist-esm/storage-blob/src/utils/utils.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/utils.common.js +754 -0
- package/dist-esm/storage-blob/src/utils/utils.common.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/utils.node.js +132 -0
- package/dist-esm/storage-blob/src/utils/utils.node.js.map +1 -0
- package/dist-esm/storage-file-share/src/AccountSASPermissions.js.map +1 -0
- package/dist-esm/storage-file-share/src/AccountSASResourceTypes.js +72 -0
- package/dist-esm/storage-file-share/src/AccountSASResourceTypes.js.map +1 -0
- package/dist-esm/storage-file-share/src/AccountSASServices.js +80 -0
- package/dist-esm/storage-file-share/src/AccountSASServices.js.map +1 -0
- package/dist-esm/storage-file-share/src/AccountSASSignatureValues.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/Clients.js +476 -1253
- package/dist-esm/storage-file-share/src/Clients.js.map +1 -0
- package/dist-esm/storage-file-share/src/FileDownloadResponse.browser.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/FileDownloadResponse.js +15 -14
- package/dist-esm/storage-file-share/src/FileDownloadResponse.js.map +1 -0
- package/dist-esm/storage-file-share/src/FileSASPermissions.js.map +1 -0
- package/dist-esm/storage-file-share/src/FileSASSignatureValues.js.map +1 -0
- package/dist-esm/storage-file-share/src/FileSystemAttributes.js.map +1 -0
- package/dist-esm/storage-file-share/src/Range.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/SASQueryParameters.js +14 -14
- package/dist-esm/storage-file-share/src/SASQueryParameters.js.map +1 -0
- package/dist-esm/storage-file-share/src/SasIPRange.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/ShareClientInternal.js +1 -2
- package/dist-esm/storage-file-share/src/ShareClientInternal.js.map +1 -0
- package/dist-esm/storage-file-share/src/ShareSASPermissions.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/ShareServiceClient.js +58 -121
- package/dist-esm/storage-file-share/src/ShareServiceClient.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/StorageClient.js +20 -14
- package/dist-esm/storage-file-share/src/StorageClient.js.map +1 -0
- package/dist-esm/storage-file-share/src/StorageContextClient.js +18 -0
- package/dist-esm/storage-file-share/src/StorageContextClient.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/index.js +11 -0
- package/dist-esm/storage-file-share/src/generated/src/index.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/models/index.js +144 -0
- package/dist-esm/storage-file-share/src/generated/src/models/index.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/generated/src/models/mappers.js +16 -49
- package/dist-esm/storage-file-share/src/generated/src/models/mappers.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/generated/src/models/parameters.js +17 -37
- package/dist-esm/storage-file-share/src/generated/src/models/parameters.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/generated/src/operations/directory.js +17 -73
- package/dist-esm/storage-file-share/src/generated/src/operations/directory.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/generated/src/operations/file.js +33 -142
- package/dist-esm/storage-file-share/src/generated/src/operations/file.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/operations/index.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/generated/src/operations/service.js +7 -17
- package/dist-esm/storage-file-share/src/generated/src/operations/service.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/generated/src/operations/share.js +26 -85
- package/dist-esm/storage-file-share/src/generated/src/operations/share.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/directory.js +9 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/directory.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/file.js +9 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/file.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/index.js +12 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/service.js +9 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/service.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/share.js +9 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/share.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/storageClient.js +48 -0
- package/dist-esm/storage-file-share/src/generated/src/storageClient.js.map +1 -0
- package/dist-esm/storage-file-share/src/generatedModels.js +4 -0
- package/dist-esm/storage-file-share/src/generatedModels.js.map +1 -0
- package/dist-esm/storage-file-share/src/index.browser.js +18 -0
- package/dist-esm/storage-file-share/src/index.browser.js.map +1 -0
- package/dist-esm/storage-file-share/src/index.js +28 -0
- package/dist-esm/storage-file-share/src/index.js.map +1 -0
- package/dist-esm/storage-file-share/src/log.js.map +1 -0
- package/dist-esm/storage-file-share/src/models.js.map +1 -0
- package/dist-esm/storage-file-share/src/utils/Batch.js +122 -0
- package/dist-esm/storage-file-share/src/utils/Batch.js.map +1 -0
- package/dist-esm/storage-file-share/src/utils/BufferScheduler.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/utils/RetriableReadableStream.js +51 -48
- package/dist-esm/storage-file-share/src/utils/RetriableReadableStream.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/utils/constants.js +2 -6
- package/dist-esm/storage-file-share/src/utils/constants.js.map +1 -0
- package/dist-esm/storage-file-share/src/utils/tracing.js +14 -0
- package/dist-esm/storage-file-share/src/utils/tracing.js.map +1 -0
- package/dist-esm/storage-file-share/src/utils/utils.browser.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/utils/utils.common.js +82 -95
- package/dist-esm/storage-file-share/src/utils/utils.common.js.map +1 -0
- package/dist-esm/storage-file-share/src/utils/utils.node.js.map +1 -0
- package/package.json +31 -25
- package/types/3.1/storage-file-share.d.ts +1454 -529
- package/types/latest/storage-file-share.d.ts +1580 -549
- package/dist-esm/src/AccountSASPermissions.js.map +0 -1
- package/dist-esm/src/AccountSASResourceTypes.js.map +0 -1
- package/dist-esm/src/AccountSASServices.js.map +0 -1
- package/dist-esm/src/AccountSASSignatureValues.js.map +0 -1
- package/dist-esm/src/Clients.js.map +0 -1
- package/dist-esm/src/FileDownloadResponse.browser.js.map +0 -1
- package/dist-esm/src/FileDownloadResponse.js.map +0 -1
- package/dist-esm/src/FileSASPermissions.js.map +0 -1
- package/dist-esm/src/FileSASSignatureValues.js.map +0 -1
- package/dist-esm/src/FileSystemAttributes.js.map +0 -1
- package/dist-esm/src/Pipeline.js +0 -88
- package/dist-esm/src/Pipeline.js.map +0 -1
- package/dist-esm/src/Range.js.map +0 -1
- package/dist-esm/src/SASQueryParameters.js.map +0 -1
- package/dist-esm/src/SasIPRange.js.map +0 -1
- package/dist-esm/src/ShareClientInternal.js.map +0 -1
- package/dist-esm/src/ShareSASPermissions.js.map +0 -1
- package/dist-esm/src/ShareServiceClient.js.map +0 -1
- package/dist-esm/src/StorageBrowserPolicyFactory.js.map +0 -1
- package/dist-esm/src/StorageClient.js.map +0 -1
- package/dist-esm/src/StorageRetryPolicyFactory.js.map +0 -1
- package/dist-esm/src/TelemetryPolicyFactory.js +0 -50
- package/dist-esm/src/TelemetryPolicyFactory.js.map +0 -1
- package/dist-esm/src/credentials/AnonymousCredential.js.map +0 -1
- package/dist-esm/src/credentials/Credential.js.map +0 -1
- package/dist-esm/src/credentials/StorageSharedKeyCredential.browser.js.map +0 -1
- package/dist-esm/src/credentials/StorageSharedKeyCredential.js.map +0 -1
- package/dist-esm/src/generated/src/index.js.map +0 -1
- package/dist-esm/src/generated/src/models/index.js.map +0 -1
- package/dist-esm/src/generated/src/models/mappers.js.map +0 -1
- package/dist-esm/src/generated/src/models/parameters.js.map +0 -1
- package/dist-esm/src/generated/src/operations/directory.js.map +0 -1
- package/dist-esm/src/generated/src/operations/file.js.map +0 -1
- package/dist-esm/src/generated/src/operations/index.js.map +0 -1
- package/dist-esm/src/generated/src/operations/service.js.map +0 -1
- package/dist-esm/src/generated/src/operations/share.js.map +0 -1
- package/dist-esm/src/generated/src/storageClient.js +0 -25
- package/dist-esm/src/generated/src/storageClient.js.map +0 -1
- package/dist-esm/src/generated/src/storageClientContext.js +0 -40
- package/dist-esm/src/generated/src/storageClientContext.js.map +0 -1
- package/dist-esm/src/generatedModels.js +0 -8
- package/dist-esm/src/generatedModels.js.map +0 -1
- package/dist-esm/src/index.browser.js +0 -17
- package/dist-esm/src/index.browser.js.map +0 -1
- package/dist-esm/src/index.js +0 -27
- package/dist-esm/src/index.js.map +0 -1
- package/dist-esm/src/log.js.map +0 -1
- package/dist-esm/src/models.js.map +0 -1
- package/dist-esm/src/policies/AnonymousCredentialPolicy.js.map +0 -1
- package/dist-esm/src/policies/CredentialPolicy.js.map +0 -1
- package/dist-esm/src/policies/StorageRetryPolicy.js.map +0 -1
- package/dist-esm/src/policies/StorageSharedKeyCredentialPolicy.js.map +0 -1
- package/dist-esm/src/policies/TelemetryPolicy.js +0 -36
- package/dist-esm/src/policies/TelemetryPolicy.js.map +0 -1
- package/dist-esm/src/utils/Batch.js.map +0 -1
- package/dist-esm/src/utils/BufferScheduler.js.map +0 -1
- package/dist-esm/src/utils/RetriableReadableStream.js.map +0 -1
- package/dist-esm/src/utils/cache.js +0 -8
- package/dist-esm/src/utils/cache.js.map +0 -1
- package/dist-esm/src/utils/constants.js.map +0 -1
- package/dist-esm/src/utils/tracing.js +0 -27
- package/dist-esm/src/utils/tracing.js.map +0 -1
- package/dist-esm/src/utils/utils.browser.js.map +0 -1
- package/dist-esm/src/utils/utils.common.js.map +0 -1
- package/dist-esm/src/utils/utils.node.js.map +0 -1
- /package/dist-esm/{src → storage-blob/src}/credentials/Credential.js +0 -0
- /package/dist-esm/{src → storage-blob/src}/credentials/StorageSharedKeyCredential.browser.js +0 -0
- /package/dist-esm/{src → storage-blob/src}/policies/AnonymousCredentialPolicy.js +0 -0
- /package/dist-esm/{src → storage-blob/src}/policies/StorageSharedKeyCredentialPolicy.js +0 -0
- /package/dist-esm/{src → storage-blob/src/sas}/AccountSASResourceTypes.js +0 -0
- /package/dist-esm/{src → storage-blob/src/sas}/AccountSASServices.js +0 -0
- /package/dist-esm/{src → storage-blob/src}/utils/Batch.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/AccountSASPermissions.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/AccountSASSignatureValues.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/FileDownloadResponse.browser.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/FileSASPermissions.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/FileSASSignatureValues.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/FileSystemAttributes.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/Range.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/SasIPRange.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/ShareSASPermissions.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/generated/src/operations/index.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/log.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/models.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/utils/BufferScheduler.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/utils/utils.browser.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/utils/utils.node.js +0 -0
@@ -0,0 +1,1161 @@
|
|
1
|
+
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
2
|
+
import { getDefaultProxySettings, } from "@azure/core-rest-pipeline";
|
3
|
+
import { isNode } from "@azure/core-util";
|
4
|
+
import { isTokenCredential } from "@azure/core-auth";
|
5
|
+
import { AnonymousCredential } from "./credentials/AnonymousCredential";
|
6
|
+
import { StorageSharedKeyCredential } from "./credentials/StorageSharedKeyCredential";
|
7
|
+
import { newPipeline, isPipelineLike } from "./Pipeline";
|
8
|
+
import { StorageClient } from "./StorageClient";
|
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
|
+
import { generateBlobSASQueryParameters } from "./sas/BlobSASSignatureValues";
|
12
|
+
import { BlobLeaseClient } from "./BlobLeaseClient";
|
13
|
+
import { AppendBlobClient, BlobClient, BlockBlobClient, PageBlobClient, } from "./Clients";
|
14
|
+
import { BlobBatchClient } from "./BlobBatchClient";
|
15
|
+
/**
|
16
|
+
* A ContainerClient represents a URL to the Azure Storage container allowing you to manipulate its blobs.
|
17
|
+
*/
|
18
|
+
export class ContainerClient extends StorageClient {
|
19
|
+
/**
|
20
|
+
* The name of the container.
|
21
|
+
*/
|
22
|
+
get containerName() {
|
23
|
+
return this._containerName;
|
24
|
+
}
|
25
|
+
constructor(urlOrConnectionString, credentialOrPipelineOrContainerName,
|
26
|
+
// Legacy, no fix for eslint error without breaking. Disable it for this interface.
|
27
|
+
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/
|
28
|
+
options) {
|
29
|
+
let pipeline;
|
30
|
+
let url;
|
31
|
+
options = options || {};
|
32
|
+
if (isPipelineLike(credentialOrPipelineOrContainerName)) {
|
33
|
+
// (url: string, pipeline: Pipeline)
|
34
|
+
url = urlOrConnectionString;
|
35
|
+
pipeline = credentialOrPipelineOrContainerName;
|
36
|
+
}
|
37
|
+
else if ((isNode && credentialOrPipelineOrContainerName instanceof StorageSharedKeyCredential) ||
|
38
|
+
credentialOrPipelineOrContainerName instanceof AnonymousCredential ||
|
39
|
+
isTokenCredential(credentialOrPipelineOrContainerName)) {
|
40
|
+
// (url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions)
|
41
|
+
url = urlOrConnectionString;
|
42
|
+
pipeline = newPipeline(credentialOrPipelineOrContainerName, options);
|
43
|
+
}
|
44
|
+
else if (!credentialOrPipelineOrContainerName &&
|
45
|
+
typeof credentialOrPipelineOrContainerName !== "string") {
|
46
|
+
// (url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions)
|
47
|
+
// The second parameter is undefined. Use anonymous credential.
|
48
|
+
url = urlOrConnectionString;
|
49
|
+
pipeline = newPipeline(new AnonymousCredential(), options);
|
50
|
+
}
|
51
|
+
else if (credentialOrPipelineOrContainerName &&
|
52
|
+
typeof credentialOrPipelineOrContainerName === "string") {
|
53
|
+
// (connectionString: string, containerName: string, blobName: string, options?: StoragePipelineOptions)
|
54
|
+
const containerName = credentialOrPipelineOrContainerName;
|
55
|
+
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
|
56
|
+
if (extractedCreds.kind === "AccountConnString") {
|
57
|
+
if (isNode) {
|
58
|
+
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
59
|
+
url = appendToURLPath(extractedCreds.url, encodeURIComponent(containerName));
|
60
|
+
if (!options.proxyOptions) {
|
61
|
+
options.proxyOptions = getDefaultProxySettings(extractedCreds.proxyUri);
|
62
|
+
}
|
63
|
+
pipeline = newPipeline(sharedKeyCredential, options);
|
64
|
+
}
|
65
|
+
else {
|
66
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
67
|
+
}
|
68
|
+
}
|
69
|
+
else if (extractedCreds.kind === "SASConnString") {
|
70
|
+
url =
|
71
|
+
appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)) +
|
72
|
+
"?" +
|
73
|
+
extractedCreds.accountSas;
|
74
|
+
pipeline = newPipeline(new AnonymousCredential(), options);
|
75
|
+
}
|
76
|
+
else {
|
77
|
+
throw new Error("Connection string must be either an Account connection string or a SAS connection string");
|
78
|
+
}
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
throw new Error("Expecting non-empty strings for containerName parameter");
|
82
|
+
}
|
83
|
+
super(url, pipeline);
|
84
|
+
this._containerName = this.getContainerNameFromUrl();
|
85
|
+
this.containerContext = this.storageClientContext.container;
|
86
|
+
}
|
87
|
+
/**
|
88
|
+
* Creates a new container under the specified account. If the container with
|
89
|
+
* the same name already exists, the operation fails.
|
90
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-container
|
91
|
+
* Naming rules: @see https://learn.microsoft.com/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata
|
92
|
+
*
|
93
|
+
* @param options - Options to Container Create operation.
|
94
|
+
*
|
95
|
+
*
|
96
|
+
* Example usage:
|
97
|
+
*
|
98
|
+
* ```js
|
99
|
+
* const containerClient = blobServiceClient.getContainerClient("<container name>");
|
100
|
+
* const createContainerResponse = await containerClient.create();
|
101
|
+
* console.log("Container was created successfully", createContainerResponse.requestId);
|
102
|
+
* ```
|
103
|
+
*/
|
104
|
+
async create(options = {}) {
|
105
|
+
return tracingClient.withSpan("ContainerClient-create", options, async (updatedOptions) => {
|
106
|
+
return assertResponse(await this.containerContext.create(updatedOptions));
|
107
|
+
});
|
108
|
+
}
|
109
|
+
/**
|
110
|
+
* Creates a new container under the specified account. If the container with
|
111
|
+
* the same name already exists, it is not changed.
|
112
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-container
|
113
|
+
* Naming rules: @see https://learn.microsoft.com/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata
|
114
|
+
*
|
115
|
+
* @param options -
|
116
|
+
*/
|
117
|
+
async createIfNotExists(options = {}) {
|
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 });
|
123
|
+
}
|
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
|
+
});
|
133
|
+
}
|
134
|
+
/**
|
135
|
+
* Returns true if the Azure container resource represented by this client exists; false otherwise.
|
136
|
+
*
|
137
|
+
* NOTE: use this function with care since an existing container might be deleted by other clients or
|
138
|
+
* applications. Vice versa new containers with the same name might be added by other clients or
|
139
|
+
* applications after this function completes.
|
140
|
+
*
|
141
|
+
* @param options -
|
142
|
+
*/
|
143
|
+
async exists(options = {}) {
|
144
|
+
return tracingClient.withSpan("ContainerClient-exists", options, async (updatedOptions) => {
|
145
|
+
try {
|
146
|
+
await this.getProperties({
|
147
|
+
abortSignal: options.abortSignal,
|
148
|
+
tracingOptions: updatedOptions.tracingOptions,
|
149
|
+
});
|
150
|
+
return true;
|
151
|
+
}
|
152
|
+
catch (e) {
|
153
|
+
if (e.statusCode === 404) {
|
154
|
+
return false;
|
155
|
+
}
|
156
|
+
throw e;
|
157
|
+
}
|
158
|
+
});
|
159
|
+
}
|
160
|
+
/**
|
161
|
+
* Creates a {@link BlobClient}
|
162
|
+
*
|
163
|
+
* @param blobName - A blob name
|
164
|
+
* @returns A new BlobClient object for the given blob name.
|
165
|
+
*/
|
166
|
+
getBlobClient(blobName) {
|
167
|
+
return new BlobClient(appendToURLPath(this.url, EscapePath(blobName)), this.pipeline);
|
168
|
+
}
|
169
|
+
/**
|
170
|
+
* Creates an {@link AppendBlobClient}
|
171
|
+
*
|
172
|
+
* @param blobName - An append blob name
|
173
|
+
*/
|
174
|
+
getAppendBlobClient(blobName) {
|
175
|
+
return new AppendBlobClient(appendToURLPath(this.url, EscapePath(blobName)), this.pipeline);
|
176
|
+
}
|
177
|
+
/**
|
178
|
+
* Creates a {@link BlockBlobClient}
|
179
|
+
*
|
180
|
+
* @param blobName - A block blob name
|
181
|
+
*
|
182
|
+
*
|
183
|
+
* Example usage:
|
184
|
+
*
|
185
|
+
* ```js
|
186
|
+
* const content = "Hello world!";
|
187
|
+
*
|
188
|
+
* const blockBlobClient = containerClient.getBlockBlobClient("<blob name>");
|
189
|
+
* const uploadBlobResponse = await blockBlobClient.upload(content, content.length);
|
190
|
+
* ```
|
191
|
+
*/
|
192
|
+
getBlockBlobClient(blobName) {
|
193
|
+
return new BlockBlobClient(appendToURLPath(this.url, EscapePath(blobName)), this.pipeline);
|
194
|
+
}
|
195
|
+
/**
|
196
|
+
* Creates a {@link PageBlobClient}
|
197
|
+
*
|
198
|
+
* @param blobName - A page blob name
|
199
|
+
*/
|
200
|
+
getPageBlobClient(blobName) {
|
201
|
+
return new PageBlobClient(appendToURLPath(this.url, EscapePath(blobName)), this.pipeline);
|
202
|
+
}
|
203
|
+
/**
|
204
|
+
* Returns all user-defined metadata and system properties for the specified
|
205
|
+
* container. The data returned does not include the container's list of blobs.
|
206
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-properties
|
207
|
+
*
|
208
|
+
* WARNING: The `metadata` object returned in the response will have its keys in lowercase, even if
|
209
|
+
* they originally contained uppercase characters. This differs from the metadata keys returned by
|
210
|
+
* the `listContainers` method of {@link BlobServiceClient} using the `includeMetadata` option, which
|
211
|
+
* will retain their original casing.
|
212
|
+
*
|
213
|
+
* @param options - Options to Container Get Properties operation.
|
214
|
+
*/
|
215
|
+
async getProperties(options = {}) {
|
216
|
+
if (!options.conditions) {
|
217
|
+
options.conditions = {};
|
218
|
+
}
|
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
|
+
});
|
222
|
+
}
|
223
|
+
/**
|
224
|
+
* Marks the specified container for deletion. The container and any blobs
|
225
|
+
* contained within it are later deleted during garbage collection.
|
226
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-container
|
227
|
+
*
|
228
|
+
* @param options - Options to Container Delete operation.
|
229
|
+
*/
|
230
|
+
async delete(options = {}) {
|
231
|
+
if (!options.conditions) {
|
232
|
+
options.conditions = {};
|
233
|
+
}
|
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
|
+
});
|
242
|
+
}
|
243
|
+
/**
|
244
|
+
* Marks the specified container for deletion if it exists. The container and any blobs
|
245
|
+
* contained within it are later deleted during garbage collection.
|
246
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-container
|
247
|
+
*
|
248
|
+
* @param options - Options to Container Delete operation.
|
249
|
+
*/
|
250
|
+
async deleteIfExists(options = {}) {
|
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 });
|
256
|
+
}
|
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
|
+
});
|
264
|
+
}
|
265
|
+
/**
|
266
|
+
* Sets one or more user-defined name-value pairs for the specified container.
|
267
|
+
*
|
268
|
+
* If no option provided, or no metadata defined in the parameter, the container
|
269
|
+
* metadata will be removed.
|
270
|
+
*
|
271
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-container-metadata
|
272
|
+
*
|
273
|
+
* @param metadata - Replace existing metadata with this value.
|
274
|
+
* If no value provided the existing metadata will be removed.
|
275
|
+
* @param options - Options to Container Set Metadata operation.
|
276
|
+
*/
|
277
|
+
async setMetadata(metadata, options = {}) {
|
278
|
+
if (!options.conditions) {
|
279
|
+
options.conditions = {};
|
280
|
+
}
|
281
|
+
if (options.conditions.ifUnmodifiedSince) {
|
282
|
+
throw new RangeError("the IfUnmodifiedSince must have their default values because they are ignored by the blob service");
|
283
|
+
}
|
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
|
+
});
|
293
|
+
}
|
294
|
+
/**
|
295
|
+
* Gets the permissions for the specified container. The permissions indicate
|
296
|
+
* whether container data may be accessed publicly.
|
297
|
+
*
|
298
|
+
* WARNING: JavaScript Date will potentially lose precision when parsing startsOn and expiresOn strings.
|
299
|
+
* For example, new Date("2018-12-31T03:44:23.8827891Z").toISOString() will get "2018-12-31T03:44:23.882Z".
|
300
|
+
*
|
301
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-acl
|
302
|
+
*
|
303
|
+
* @param options - Options to Container Get Access Policy operation.
|
304
|
+
*/
|
305
|
+
async getAccessPolicy(options = {}) {
|
306
|
+
if (!options.conditions) {
|
307
|
+
options.conditions = {};
|
308
|
+
}
|
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
|
+
}));
|
315
|
+
const res = {
|
316
|
+
_response: response._response,
|
317
|
+
blobPublicAccess: response.blobPublicAccess,
|
318
|
+
date: response.date,
|
319
|
+
etag: response.etag,
|
320
|
+
errorCode: response.errorCode,
|
321
|
+
lastModified: response.lastModified,
|
322
|
+
requestId: response.requestId,
|
323
|
+
clientRequestId: response.clientRequestId,
|
324
|
+
signedIdentifiers: [],
|
325
|
+
version: response.version,
|
326
|
+
};
|
327
|
+
for (const identifier of response) {
|
328
|
+
let accessPolicy = undefined;
|
329
|
+
if (identifier.accessPolicy) {
|
330
|
+
accessPolicy = {
|
331
|
+
permissions: identifier.accessPolicy.permissions,
|
332
|
+
};
|
333
|
+
if (identifier.accessPolicy.expiresOn) {
|
334
|
+
accessPolicy.expiresOn = new Date(identifier.accessPolicy.expiresOn);
|
335
|
+
}
|
336
|
+
if (identifier.accessPolicy.startsOn) {
|
337
|
+
accessPolicy.startsOn = new Date(identifier.accessPolicy.startsOn);
|
338
|
+
}
|
339
|
+
}
|
340
|
+
res.signedIdentifiers.push({
|
341
|
+
accessPolicy,
|
342
|
+
id: identifier.id,
|
343
|
+
});
|
344
|
+
}
|
345
|
+
return res;
|
346
|
+
});
|
347
|
+
}
|
348
|
+
/**
|
349
|
+
* Sets the permissions for the specified container. The permissions indicate
|
350
|
+
* whether blobs in a container may be accessed publicly.
|
351
|
+
*
|
352
|
+
* When you set permissions for a container, the existing permissions are replaced.
|
353
|
+
* If no access or containerAcl provided, the existing container ACL will be
|
354
|
+
* removed.
|
355
|
+
*
|
356
|
+
* When you establish a stored access policy on a container, it may take up to 30 seconds to take effect.
|
357
|
+
* During this interval, a shared access signature that is associated with the stored access policy will
|
358
|
+
* fail with status code 403 (Forbidden), until the access policy becomes active.
|
359
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-container-acl
|
360
|
+
*
|
361
|
+
* @param access - The level of public access to data in the container.
|
362
|
+
* @param containerAcl - Array of elements each having a unique Id and details of the access policy.
|
363
|
+
* @param options - Options to Container Set Access Policy operation.
|
364
|
+
*/
|
365
|
+
async setAccessPolicy(access, containerAcl, options = {}) {
|
366
|
+
options.conditions = options.conditions || {};
|
367
|
+
return tracingClient.withSpan("ContainerClient-setAccessPolicy", options, async (updatedOptions) => {
|
368
|
+
const acl = [];
|
369
|
+
for (const identifier of containerAcl || []) {
|
370
|
+
acl.push({
|
371
|
+
accessPolicy: {
|
372
|
+
expiresOn: identifier.accessPolicy.expiresOn
|
373
|
+
? truncatedISO8061Date(identifier.accessPolicy.expiresOn)
|
374
|
+
: "",
|
375
|
+
permissions: identifier.accessPolicy.permissions,
|
376
|
+
startsOn: identifier.accessPolicy.startsOn
|
377
|
+
? truncatedISO8061Date(identifier.accessPolicy.startsOn)
|
378
|
+
: "",
|
379
|
+
},
|
380
|
+
id: identifier.id,
|
381
|
+
});
|
382
|
+
}
|
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
|
+
});
|
392
|
+
}
|
393
|
+
/**
|
394
|
+
* Get a {@link BlobLeaseClient} that manages leases on the container.
|
395
|
+
*
|
396
|
+
* @param proposeLeaseId - Initial proposed lease Id.
|
397
|
+
* @returns A new BlobLeaseClient object for managing leases on the container.
|
398
|
+
*/
|
399
|
+
getBlobLeaseClient(proposeLeaseId) {
|
400
|
+
return new BlobLeaseClient(this, proposeLeaseId);
|
401
|
+
}
|
402
|
+
/**
|
403
|
+
* Creates a new block blob, or updates the content of an existing block blob.
|
404
|
+
*
|
405
|
+
* Updating an existing block blob overwrites any existing metadata on the blob.
|
406
|
+
* Partial updates are not supported; the content of the existing blob is
|
407
|
+
* overwritten with the new content. To perform a partial update of a block blob's,
|
408
|
+
* use {@link BlockBlobClient.stageBlock} and {@link BlockBlobClient.commitBlockList}.
|
409
|
+
*
|
410
|
+
* This is a non-parallel uploading method, please use {@link BlockBlobClient.uploadFile},
|
411
|
+
* {@link BlockBlobClient.uploadStream} or {@link BlockBlobClient.uploadBrowserData} for better
|
412
|
+
* performance with concurrency uploading.
|
413
|
+
*
|
414
|
+
* @see https://docs.microsoft.com/rest/api/storageservices/put-blob
|
415
|
+
*
|
416
|
+
* @param blobName - Name of the block blob to create or update.
|
417
|
+
* @param body - Blob, string, ArrayBuffer, ArrayBufferView or a function
|
418
|
+
* which returns a new Readable stream whose offset is from data source beginning.
|
419
|
+
* @param contentLength - Length of body in bytes. Use Buffer.byteLength() to calculate body length for a
|
420
|
+
* string including non non-Base64/Hex-encoded characters.
|
421
|
+
* @param options - Options to configure the Block Blob Upload operation.
|
422
|
+
* @returns Block Blob upload response data and the corresponding BlockBlobClient instance.
|
423
|
+
*/
|
424
|
+
async uploadBlockBlob(blobName, body, contentLength, options = {}) {
|
425
|
+
return tracingClient.withSpan("ContainerClient-uploadBlockBlob", options, async (updatedOptions) => {
|
426
|
+
const blockBlobClient = this.getBlockBlobClient(blobName);
|
427
|
+
const response = await blockBlobClient.upload(body, contentLength, updatedOptions);
|
428
|
+
return {
|
429
|
+
blockBlobClient,
|
430
|
+
response,
|
431
|
+
};
|
432
|
+
});
|
433
|
+
}
|
434
|
+
/**
|
435
|
+
* Marks the specified blob or snapshot for deletion. The blob is later deleted
|
436
|
+
* during garbage collection. Note that in order to delete a blob, you must delete
|
437
|
+
* all of its snapshots. You can delete both at the same time with the Delete
|
438
|
+
* Blob operation.
|
439
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-blob
|
440
|
+
*
|
441
|
+
* @param blobName -
|
442
|
+
* @param options - Options to Blob Delete operation.
|
443
|
+
* @returns Block blob deletion response data.
|
444
|
+
*/
|
445
|
+
async deleteBlob(blobName, options = {}) {
|
446
|
+
return tracingClient.withSpan("ContainerClient-deleteBlob", options, async (updatedOptions) => {
|
447
|
+
let blobClient = this.getBlobClient(blobName);
|
448
|
+
if (options.versionId) {
|
449
|
+
blobClient = blobClient.withVersion(options.versionId);
|
450
|
+
}
|
451
|
+
return blobClient.delete(updatedOptions);
|
452
|
+
});
|
453
|
+
}
|
454
|
+
/**
|
455
|
+
* listBlobFlatSegment returns a single segment of blobs starting from the
|
456
|
+
* specified Marker. Use an empty Marker to start enumeration from the beginning.
|
457
|
+
* After getting a segment, process it, and then call listBlobsFlatSegment again
|
458
|
+
* (passing the the previously-returned Marker) to get the next segment.
|
459
|
+
* @see https://docs.microsoft.com/rest/api/storageservices/list-blobs
|
460
|
+
*
|
461
|
+
* @param marker - A string value that identifies the portion of the list to be returned with the next list operation.
|
462
|
+
* @param options - Options to Container List Blob Flat Segment operation.
|
463
|
+
*/
|
464
|
+
async listBlobFlatSegment(marker, options = {}) {
|
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) });
|
469
|
+
return blobItem;
|
470
|
+
}) }) });
|
471
|
+
return wrappedResponse;
|
472
|
+
});
|
473
|
+
}
|
474
|
+
/**
|
475
|
+
* listBlobHierarchySegment returns a single segment of blobs starting from
|
476
|
+
* the specified Marker. Use an empty Marker to start enumeration from the
|
477
|
+
* beginning. After getting a segment, process it, and then call listBlobsHierarchicalSegment
|
478
|
+
* again (passing the the previously-returned Marker) to get the next segment.
|
479
|
+
* @see https://docs.microsoft.com/rest/api/storageservices/list-blobs
|
480
|
+
*
|
481
|
+
* @param delimiter - The character or string used to define the virtual hierarchy
|
482
|
+
* @param marker - A string value that identifies the portion of the list to be returned with the next list operation.
|
483
|
+
* @param options - Options to Container List Blob Hierarchy Segment operation.
|
484
|
+
*/
|
485
|
+
async listBlobHierarchySegment(delimiter, marker, options = {}) {
|
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) });
|
491
|
+
return blobItem;
|
492
|
+
}), blobPrefixes: (_a = response.segment.blobPrefixes) === null || _a === void 0 ? void 0 : _a.map((blobPrefixInternal) => {
|
493
|
+
const blobPrefix = {
|
494
|
+
name: BlobNameToString(blobPrefixInternal.name),
|
495
|
+
};
|
496
|
+
return blobPrefix;
|
497
|
+
}) }) });
|
498
|
+
return wrappedResponse;
|
499
|
+
});
|
500
|
+
}
|
501
|
+
/**
|
502
|
+
* Returns an AsyncIterableIterator for ContainerListBlobFlatSegmentResponse
|
503
|
+
*
|
504
|
+
* @param marker - A string value that identifies the portion of
|
505
|
+
* the list of blobs to be returned with the next listing operation. The
|
506
|
+
* operation returns the ContinuationToken value within the response body if the
|
507
|
+
* listing operation did not return all blobs remaining to be listed
|
508
|
+
* with the current page. The ContinuationToken value can be used as the value for
|
509
|
+
* the marker parameter in a subsequent call to request the next page of list
|
510
|
+
* items. The marker value is opaque to the client.
|
511
|
+
* @param options - Options to list blobs operation.
|
512
|
+
*/
|
513
|
+
listSegments(marker, options = {}) {
|
514
|
+
return __asyncGenerator(this, arguments, function* listSegments_1() {
|
515
|
+
let listBlobsFlatSegmentResponse;
|
516
|
+
if (!!marker || marker === undefined) {
|
517
|
+
do {
|
518
|
+
listBlobsFlatSegmentResponse = yield __await(this.listBlobFlatSegment(marker, options));
|
519
|
+
marker = listBlobsFlatSegmentResponse.continuationToken;
|
520
|
+
yield yield __await(yield __await(listBlobsFlatSegmentResponse));
|
521
|
+
} while (marker);
|
522
|
+
}
|
523
|
+
});
|
524
|
+
}
|
525
|
+
/**
|
526
|
+
* Returns an AsyncIterableIterator of {@link BlobItem} objects
|
527
|
+
*
|
528
|
+
* @param options - Options to list blobs operation.
|
529
|
+
*/
|
530
|
+
listItems(options = {}) {
|
531
|
+
return __asyncGenerator(this, arguments, function* listItems_1() {
|
532
|
+
var _a, e_1, _b, _c;
|
533
|
+
let marker;
|
534
|
+
try {
|
535
|
+
for (var _d = true, _e = __asyncValues(this.listSegments(marker, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
536
|
+
_c = _f.value;
|
537
|
+
_d = false;
|
538
|
+
try {
|
539
|
+
const listBlobsFlatSegmentResponse = _c;
|
540
|
+
yield __await(yield* __asyncDelegator(__asyncValues(listBlobsFlatSegmentResponse.segment.blobItems)));
|
541
|
+
}
|
542
|
+
finally {
|
543
|
+
_d = true;
|
544
|
+
}
|
545
|
+
}
|
546
|
+
}
|
547
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
548
|
+
finally {
|
549
|
+
try {
|
550
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
551
|
+
}
|
552
|
+
finally { if (e_1) throw e_1.error; }
|
553
|
+
}
|
554
|
+
});
|
555
|
+
}
|
556
|
+
/**
|
557
|
+
* Returns an async iterable iterator to list all the blobs
|
558
|
+
* under the specified account.
|
559
|
+
*
|
560
|
+
* .byPage() returns an async iterable iterator to list the blobs in pages.
|
561
|
+
*
|
562
|
+
* Example using `for await` syntax:
|
563
|
+
*
|
564
|
+
* ```js
|
565
|
+
* // Get the containerClient before you run these snippets,
|
566
|
+
* // Can be obtained from `blobServiceClient.getContainerClient("<your-container-name>");`
|
567
|
+
* let i = 1;
|
568
|
+
* for await (const blob of containerClient.listBlobsFlat()) {
|
569
|
+
* console.log(`Blob ${i++}: ${blob.name}`);
|
570
|
+
* }
|
571
|
+
* ```
|
572
|
+
*
|
573
|
+
* Example using `iter.next()`:
|
574
|
+
*
|
575
|
+
* ```js
|
576
|
+
* let i = 1;
|
577
|
+
* let iter = containerClient.listBlobsFlat();
|
578
|
+
* let blobItem = await iter.next();
|
579
|
+
* while (!blobItem.done) {
|
580
|
+
* console.log(`Blob ${i++}: ${blobItem.value.name}`);
|
581
|
+
* blobItem = await iter.next();
|
582
|
+
* }
|
583
|
+
* ```
|
584
|
+
*
|
585
|
+
* Example using `byPage()`:
|
586
|
+
*
|
587
|
+
* ```js
|
588
|
+
* // passing optional maxPageSize in the page settings
|
589
|
+
* let i = 1;
|
590
|
+
* for await (const response of containerClient.listBlobsFlat().byPage({ maxPageSize: 20 })) {
|
591
|
+
* for (const blob of response.segment.blobItems) {
|
592
|
+
* console.log(`Blob ${i++}: ${blob.name}`);
|
593
|
+
* }
|
594
|
+
* }
|
595
|
+
* ```
|
596
|
+
*
|
597
|
+
* Example using paging with a marker:
|
598
|
+
*
|
599
|
+
* ```js
|
600
|
+
* let i = 1;
|
601
|
+
* let iterator = containerClient.listBlobsFlat().byPage({ maxPageSize: 2 });
|
602
|
+
* let response = (await iterator.next()).value;
|
603
|
+
*
|
604
|
+
* // Prints 2 blob names
|
605
|
+
* for (const blob of response.segment.blobItems) {
|
606
|
+
* console.log(`Blob ${i++}: ${blob.name}`);
|
607
|
+
* }
|
608
|
+
*
|
609
|
+
* // Gets next marker
|
610
|
+
* let marker = response.continuationToken;
|
611
|
+
*
|
612
|
+
* // Passing next marker as continuationToken
|
613
|
+
*
|
614
|
+
* iterator = containerClient.listBlobsFlat().byPage({ continuationToken: marker, maxPageSize: 10 });
|
615
|
+
* response = (await iterator.next()).value;
|
616
|
+
*
|
617
|
+
* // Prints 10 blob names
|
618
|
+
* for (const blob of response.segment.blobItems) {
|
619
|
+
* console.log(`Blob ${i++}: ${blob.name}`);
|
620
|
+
* }
|
621
|
+
* ```
|
622
|
+
*
|
623
|
+
* @param options - Options to list blobs.
|
624
|
+
* @returns An asyncIterableIterator that supports paging.
|
625
|
+
*/
|
626
|
+
listBlobsFlat(options = {}) {
|
627
|
+
const include = [];
|
628
|
+
if (options.includeCopy) {
|
629
|
+
include.push("copy");
|
630
|
+
}
|
631
|
+
if (options.includeDeleted) {
|
632
|
+
include.push("deleted");
|
633
|
+
}
|
634
|
+
if (options.includeMetadata) {
|
635
|
+
include.push("metadata");
|
636
|
+
}
|
637
|
+
if (options.includeSnapshots) {
|
638
|
+
include.push("snapshots");
|
639
|
+
}
|
640
|
+
if (options.includeVersions) {
|
641
|
+
include.push("versions");
|
642
|
+
}
|
643
|
+
if (options.includeUncommitedBlobs) {
|
644
|
+
include.push("uncommittedblobs");
|
645
|
+
}
|
646
|
+
if (options.includeTags) {
|
647
|
+
include.push("tags");
|
648
|
+
}
|
649
|
+
if (options.includeDeletedWithVersions) {
|
650
|
+
include.push("deletedwithversions");
|
651
|
+
}
|
652
|
+
if (options.includeImmutabilityPolicy) {
|
653
|
+
include.push("immutabilitypolicy");
|
654
|
+
}
|
655
|
+
if (options.includeLegalHold) {
|
656
|
+
include.push("legalhold");
|
657
|
+
}
|
658
|
+
if (options.prefix === "") {
|
659
|
+
options.prefix = undefined;
|
660
|
+
}
|
661
|
+
const updatedOptions = Object.assign(Object.assign({}, options), (include.length > 0 ? { include: include } : {}));
|
662
|
+
// AsyncIterableIterator to iterate over blobs
|
663
|
+
const iter = this.listItems(updatedOptions);
|
664
|
+
return {
|
665
|
+
/**
|
666
|
+
* The next method, part of the iteration protocol
|
667
|
+
*/
|
668
|
+
next() {
|
669
|
+
return iter.next();
|
670
|
+
},
|
671
|
+
/**
|
672
|
+
* The connection to the async iterator, part of the iteration protocol
|
673
|
+
*/
|
674
|
+
[Symbol.asyncIterator]() {
|
675
|
+
return this;
|
676
|
+
},
|
677
|
+
/**
|
678
|
+
* Return an AsyncIterableIterator that works a page at a time
|
679
|
+
*/
|
680
|
+
byPage: (settings = {}) => {
|
681
|
+
return this.listSegments(settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, updatedOptions));
|
682
|
+
},
|
683
|
+
};
|
684
|
+
}
|
685
|
+
/**
|
686
|
+
* Returns an AsyncIterableIterator for ContainerListBlobHierarchySegmentResponse
|
687
|
+
*
|
688
|
+
* @param delimiter - The character or string used to define the virtual hierarchy
|
689
|
+
* @param marker - A string value that identifies the portion of
|
690
|
+
* the list of blobs to be returned with the next listing operation. The
|
691
|
+
* operation returns the ContinuationToken value within the response body if the
|
692
|
+
* listing operation did not return all blobs remaining to be listed
|
693
|
+
* with the current page. The ContinuationToken value can be used as the value for
|
694
|
+
* the marker parameter in a subsequent call to request the next page of list
|
695
|
+
* items. The marker value is opaque to the client.
|
696
|
+
* @param options - Options to list blobs operation.
|
697
|
+
*/
|
698
|
+
listHierarchySegments(delimiter, marker, options = {}) {
|
699
|
+
return __asyncGenerator(this, arguments, function* listHierarchySegments_1() {
|
700
|
+
let listBlobsHierarchySegmentResponse;
|
701
|
+
if (!!marker || marker === undefined) {
|
702
|
+
do {
|
703
|
+
listBlobsHierarchySegmentResponse = yield __await(this.listBlobHierarchySegment(delimiter, marker, options));
|
704
|
+
marker = listBlobsHierarchySegmentResponse.continuationToken;
|
705
|
+
yield yield __await(yield __await(listBlobsHierarchySegmentResponse));
|
706
|
+
} while (marker);
|
707
|
+
}
|
708
|
+
});
|
709
|
+
}
|
710
|
+
/**
|
711
|
+
* Returns an AsyncIterableIterator for {@link BlobPrefix} and {@link BlobItem} objects.
|
712
|
+
*
|
713
|
+
* @param delimiter - The character or string used to define the virtual hierarchy
|
714
|
+
* @param options - Options to list blobs operation.
|
715
|
+
*/
|
716
|
+
listItemsByHierarchy(delimiter, options = {}) {
|
717
|
+
return __asyncGenerator(this, arguments, function* listItemsByHierarchy_1() {
|
718
|
+
var _a, e_2, _b, _c;
|
719
|
+
let marker;
|
720
|
+
try {
|
721
|
+
for (var _d = true, _e = __asyncValues(this.listHierarchySegments(delimiter, marker, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
722
|
+
_c = _f.value;
|
723
|
+
_d = false;
|
724
|
+
try {
|
725
|
+
const listBlobsHierarchySegmentResponse = _c;
|
726
|
+
const segment = listBlobsHierarchySegmentResponse.segment;
|
727
|
+
if (segment.blobPrefixes) {
|
728
|
+
for (const prefix of segment.blobPrefixes) {
|
729
|
+
yield yield __await(Object.assign({ kind: "prefix" }, prefix));
|
730
|
+
}
|
731
|
+
}
|
732
|
+
for (const blob of segment.blobItems) {
|
733
|
+
yield yield __await(Object.assign({ kind: "blob" }, blob));
|
734
|
+
}
|
735
|
+
}
|
736
|
+
finally {
|
737
|
+
_d = true;
|
738
|
+
}
|
739
|
+
}
|
740
|
+
}
|
741
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
742
|
+
finally {
|
743
|
+
try {
|
744
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
745
|
+
}
|
746
|
+
finally { if (e_2) throw e_2.error; }
|
747
|
+
}
|
748
|
+
});
|
749
|
+
}
|
750
|
+
/**
|
751
|
+
* Returns an async iterable iterator to list all the blobs by hierarchy.
|
752
|
+
* under the specified account.
|
753
|
+
*
|
754
|
+
* .byPage() returns an async iterable iterator to list the blobs by hierarchy in pages.
|
755
|
+
*
|
756
|
+
* Example using `for await` syntax:
|
757
|
+
*
|
758
|
+
* ```js
|
759
|
+
* for await (const item of containerClient.listBlobsByHierarchy("/")) {
|
760
|
+
* if (item.kind === "prefix") {
|
761
|
+
* console.log(`\tBlobPrefix: ${item.name}`);
|
762
|
+
* } else {
|
763
|
+
* console.log(`\tBlobItem: name - ${item.name}`);
|
764
|
+
* }
|
765
|
+
* }
|
766
|
+
* ```
|
767
|
+
*
|
768
|
+
* Example using `iter.next()`:
|
769
|
+
*
|
770
|
+
* ```js
|
771
|
+
* let iter = containerClient.listBlobsByHierarchy("/", { prefix: "prefix1/" });
|
772
|
+
* let entity = await iter.next();
|
773
|
+
* while (!entity.done) {
|
774
|
+
* let item = entity.value;
|
775
|
+
* if (item.kind === "prefix") {
|
776
|
+
* console.log(`\tBlobPrefix: ${item.name}`);
|
777
|
+
* } else {
|
778
|
+
* console.log(`\tBlobItem: name - ${item.name}`);
|
779
|
+
* }
|
780
|
+
* entity = await iter.next();
|
781
|
+
* }
|
782
|
+
* ```
|
783
|
+
*
|
784
|
+
* Example using `byPage()`:
|
785
|
+
*
|
786
|
+
* ```js
|
787
|
+
* console.log("Listing blobs by hierarchy by page");
|
788
|
+
* for await (const response of containerClient.listBlobsByHierarchy("/").byPage()) {
|
789
|
+
* const segment = response.segment;
|
790
|
+
* if (segment.blobPrefixes) {
|
791
|
+
* for (const prefix of segment.blobPrefixes) {
|
792
|
+
* console.log(`\tBlobPrefix: ${prefix.name}`);
|
793
|
+
* }
|
794
|
+
* }
|
795
|
+
* for (const blob of response.segment.blobItems) {
|
796
|
+
* console.log(`\tBlobItem: name - ${blob.name}`);
|
797
|
+
* }
|
798
|
+
* }
|
799
|
+
* ```
|
800
|
+
*
|
801
|
+
* Example using paging with a max page size:
|
802
|
+
*
|
803
|
+
* ```js
|
804
|
+
* console.log("Listing blobs by hierarchy by page, specifying a prefix and a max page size");
|
805
|
+
*
|
806
|
+
* let i = 1;
|
807
|
+
* for await (const response of containerClient
|
808
|
+
* .listBlobsByHierarchy("/", { prefix: "prefix2/sub1/" })
|
809
|
+
* .byPage({ maxPageSize: 2 })) {
|
810
|
+
* console.log(`Page ${i++}`);
|
811
|
+
* const segment = response.segment;
|
812
|
+
*
|
813
|
+
* if (segment.blobPrefixes) {
|
814
|
+
* for (const prefix of segment.blobPrefixes) {
|
815
|
+
* console.log(`\tBlobPrefix: ${prefix.name}`);
|
816
|
+
* }
|
817
|
+
* }
|
818
|
+
*
|
819
|
+
* for (const blob of response.segment.blobItems) {
|
820
|
+
* console.log(`\tBlobItem: name - ${blob.name}`);
|
821
|
+
* }
|
822
|
+
* }
|
823
|
+
* ```
|
824
|
+
*
|
825
|
+
* @param delimiter - The character or string used to define the virtual hierarchy
|
826
|
+
* @param options - Options to list blobs operation.
|
827
|
+
*/
|
828
|
+
listBlobsByHierarchy(delimiter, options = {}) {
|
829
|
+
if (delimiter === "") {
|
830
|
+
throw new RangeError("delimiter should contain one or more characters");
|
831
|
+
}
|
832
|
+
const include = [];
|
833
|
+
if (options.includeCopy) {
|
834
|
+
include.push("copy");
|
835
|
+
}
|
836
|
+
if (options.includeDeleted) {
|
837
|
+
include.push("deleted");
|
838
|
+
}
|
839
|
+
if (options.includeMetadata) {
|
840
|
+
include.push("metadata");
|
841
|
+
}
|
842
|
+
if (options.includeSnapshots) {
|
843
|
+
include.push("snapshots");
|
844
|
+
}
|
845
|
+
if (options.includeVersions) {
|
846
|
+
include.push("versions");
|
847
|
+
}
|
848
|
+
if (options.includeUncommitedBlobs) {
|
849
|
+
include.push("uncommittedblobs");
|
850
|
+
}
|
851
|
+
if (options.includeTags) {
|
852
|
+
include.push("tags");
|
853
|
+
}
|
854
|
+
if (options.includeDeletedWithVersions) {
|
855
|
+
include.push("deletedwithversions");
|
856
|
+
}
|
857
|
+
if (options.includeImmutabilityPolicy) {
|
858
|
+
include.push("immutabilitypolicy");
|
859
|
+
}
|
860
|
+
if (options.includeLegalHold) {
|
861
|
+
include.push("legalhold");
|
862
|
+
}
|
863
|
+
if (options.prefix === "") {
|
864
|
+
options.prefix = undefined;
|
865
|
+
}
|
866
|
+
const updatedOptions = Object.assign(Object.assign({}, options), (include.length > 0 ? { include: include } : {}));
|
867
|
+
// AsyncIterableIterator to iterate over blob prefixes and blobs
|
868
|
+
const iter = this.listItemsByHierarchy(delimiter, updatedOptions);
|
869
|
+
return {
|
870
|
+
/**
|
871
|
+
* The next method, part of the iteration protocol
|
872
|
+
*/
|
873
|
+
async next() {
|
874
|
+
return iter.next();
|
875
|
+
},
|
876
|
+
/**
|
877
|
+
* The connection to the async iterator, part of the iteration protocol
|
878
|
+
*/
|
879
|
+
[Symbol.asyncIterator]() {
|
880
|
+
return this;
|
881
|
+
},
|
882
|
+
/**
|
883
|
+
* Return an AsyncIterableIterator that works a page at a time
|
884
|
+
*/
|
885
|
+
byPage: (settings = {}) => {
|
886
|
+
return this.listHierarchySegments(delimiter, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, updatedOptions));
|
887
|
+
},
|
888
|
+
};
|
889
|
+
}
|
890
|
+
/**
|
891
|
+
* The Filter Blobs operation enables callers to list blobs in the container whose tags
|
892
|
+
* match a given search expression.
|
893
|
+
*
|
894
|
+
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
|
895
|
+
* The given expression must evaluate to true for a blob to be returned in the results.
|
896
|
+
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
|
897
|
+
* however, only a subset of the OData filter syntax is supported in the Blob service.
|
898
|
+
* @param marker - A string value that identifies the portion of
|
899
|
+
* the list of blobs to be returned with the next listing operation. The
|
900
|
+
* operation returns the continuationToken value within the response body if the
|
901
|
+
* listing operation did not return all blobs remaining to be listed
|
902
|
+
* with the current page. The continuationToken value can be used as the value for
|
903
|
+
* the marker parameter in a subsequent call to request the next page of list
|
904
|
+
* items. The marker value is opaque to the client.
|
905
|
+
* @param options - Options to find blobs by tags.
|
906
|
+
*/
|
907
|
+
async findBlobsByTagsSegment(tagFilterSqlExpression, marker, options = {}) {
|
908
|
+
return tracingClient.withSpan("ContainerClient-findBlobsByTagsSegment", options, async (updatedOptions) => {
|
909
|
+
const response = assertResponse(await this.containerContext.filterBlobs({
|
910
|
+
abortSignal: options.abortSignal,
|
911
|
+
where: tagFilterSqlExpression,
|
912
|
+
marker,
|
913
|
+
maxPageSize: options.maxPageSize,
|
914
|
+
tracingOptions: updatedOptions.tracingOptions,
|
915
|
+
}));
|
916
|
+
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, blobs: response.blobs.map((blob) => {
|
917
|
+
var _a;
|
918
|
+
let tagValue = "";
|
919
|
+
if (((_a = blob.tags) === null || _a === void 0 ? void 0 : _a.blobTagSet.length) === 1) {
|
920
|
+
tagValue = blob.tags.blobTagSet[0].value;
|
921
|
+
}
|
922
|
+
return Object.assign(Object.assign({}, blob), { tags: toTags(blob.tags), tagValue });
|
923
|
+
}) });
|
924
|
+
return wrappedResponse;
|
925
|
+
});
|
926
|
+
}
|
927
|
+
/**
|
928
|
+
* Returns an AsyncIterableIterator for ContainerFindBlobsByTagsSegmentResponse.
|
929
|
+
*
|
930
|
+
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
|
931
|
+
* The given expression must evaluate to true for a blob to be returned in the results.
|
932
|
+
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
|
933
|
+
* however, only a subset of the OData filter syntax is supported in the Blob service.
|
934
|
+
* @param marker - A string value that identifies the portion of
|
935
|
+
* the list of blobs to be returned with the next listing operation. The
|
936
|
+
* operation returns the continuationToken value within the response body if the
|
937
|
+
* listing operation did not return all blobs remaining to be listed
|
938
|
+
* with the current page. The continuationToken value can be used as the value for
|
939
|
+
* the marker parameter in a subsequent call to request the next page of list
|
940
|
+
* items. The marker value is opaque to the client.
|
941
|
+
* @param options - Options to find blobs by tags.
|
942
|
+
*/
|
943
|
+
findBlobsByTagsSegments(tagFilterSqlExpression, marker, options = {}) {
|
944
|
+
return __asyncGenerator(this, arguments, function* findBlobsByTagsSegments_1() {
|
945
|
+
let response;
|
946
|
+
if (!!marker || marker === undefined) {
|
947
|
+
do {
|
948
|
+
response = yield __await(this.findBlobsByTagsSegment(tagFilterSqlExpression, marker, options));
|
949
|
+
response.blobs = response.blobs || [];
|
950
|
+
marker = response.continuationToken;
|
951
|
+
yield yield __await(response);
|
952
|
+
} while (marker);
|
953
|
+
}
|
954
|
+
});
|
955
|
+
}
|
956
|
+
/**
|
957
|
+
* Returns an AsyncIterableIterator for blobs.
|
958
|
+
*
|
959
|
+
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
|
960
|
+
* The given expression must evaluate to true for a blob to be returned in the results.
|
961
|
+
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
|
962
|
+
* however, only a subset of the OData filter syntax is supported in the Blob service.
|
963
|
+
* @param options - Options to findBlobsByTagsItems.
|
964
|
+
*/
|
965
|
+
findBlobsByTagsItems(tagFilterSqlExpression, options = {}) {
|
966
|
+
return __asyncGenerator(this, arguments, function* findBlobsByTagsItems_1() {
|
967
|
+
var _a, e_3, _b, _c;
|
968
|
+
let marker;
|
969
|
+
try {
|
970
|
+
for (var _d = true, _e = __asyncValues(this.findBlobsByTagsSegments(tagFilterSqlExpression, marker, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
971
|
+
_c = _f.value;
|
972
|
+
_d = false;
|
973
|
+
try {
|
974
|
+
const segment = _c;
|
975
|
+
yield __await(yield* __asyncDelegator(__asyncValues(segment.blobs)));
|
976
|
+
}
|
977
|
+
finally {
|
978
|
+
_d = true;
|
979
|
+
}
|
980
|
+
}
|
981
|
+
}
|
982
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
983
|
+
finally {
|
984
|
+
try {
|
985
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
986
|
+
}
|
987
|
+
finally { if (e_3) throw e_3.error; }
|
988
|
+
}
|
989
|
+
});
|
990
|
+
}
|
991
|
+
/**
|
992
|
+
* Returns an async iterable iterator to find all blobs with specified tag
|
993
|
+
* under the specified container.
|
994
|
+
*
|
995
|
+
* .byPage() returns an async iterable iterator to list the blobs in pages.
|
996
|
+
*
|
997
|
+
* Example using `for await` syntax:
|
998
|
+
*
|
999
|
+
* ```js
|
1000
|
+
* let i = 1;
|
1001
|
+
* for await (const blob of containerClient.findBlobsByTags("tagkey='tagvalue'")) {
|
1002
|
+
* console.log(`Blob ${i++}: ${blob.name}`);
|
1003
|
+
* }
|
1004
|
+
* ```
|
1005
|
+
*
|
1006
|
+
* Example using `iter.next()`:
|
1007
|
+
*
|
1008
|
+
* ```js
|
1009
|
+
* let i = 1;
|
1010
|
+
* const iter = containerClient.findBlobsByTags("tagkey='tagvalue'");
|
1011
|
+
* let blobItem = await iter.next();
|
1012
|
+
* while (!blobItem.done) {
|
1013
|
+
* console.log(`Blob ${i++}: ${blobItem.value.name}`);
|
1014
|
+
* blobItem = await iter.next();
|
1015
|
+
* }
|
1016
|
+
* ```
|
1017
|
+
*
|
1018
|
+
* Example using `byPage()`:
|
1019
|
+
*
|
1020
|
+
* ```js
|
1021
|
+
* // passing optional maxPageSize in the page settings
|
1022
|
+
* let i = 1;
|
1023
|
+
* for await (const response of containerClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 20 })) {
|
1024
|
+
* if (response.blobs) {
|
1025
|
+
* for (const blob of response.blobs) {
|
1026
|
+
* console.log(`Blob ${i++}: ${blob.name}`);
|
1027
|
+
* }
|
1028
|
+
* }
|
1029
|
+
* }
|
1030
|
+
* ```
|
1031
|
+
*
|
1032
|
+
* Example using paging with a marker:
|
1033
|
+
*
|
1034
|
+
* ```js
|
1035
|
+
* let i = 1;
|
1036
|
+
* let iterator = containerClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 2 });
|
1037
|
+
* let response = (await iterator.next()).value;
|
1038
|
+
*
|
1039
|
+
* // Prints 2 blob names
|
1040
|
+
* if (response.blobs) {
|
1041
|
+
* for (const blob of response.blobs) {
|
1042
|
+
* console.log(`Blob ${i++}: ${blob.name}`);
|
1043
|
+
* }
|
1044
|
+
* }
|
1045
|
+
*
|
1046
|
+
* // Gets next marker
|
1047
|
+
* let marker = response.continuationToken;
|
1048
|
+
* // Passing next marker as continuationToken
|
1049
|
+
* iterator = containerClient
|
1050
|
+
* .findBlobsByTags("tagkey='tagvalue'")
|
1051
|
+
* .byPage({ continuationToken: marker, maxPageSize: 10 });
|
1052
|
+
* response = (await iterator.next()).value;
|
1053
|
+
*
|
1054
|
+
* // Prints blob names
|
1055
|
+
* if (response.blobs) {
|
1056
|
+
* for (const blob of response.blobs) {
|
1057
|
+
* console.log(`Blob ${i++}: ${blob.name}`);
|
1058
|
+
* }
|
1059
|
+
* }
|
1060
|
+
* ```
|
1061
|
+
*
|
1062
|
+
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
|
1063
|
+
* The given expression must evaluate to true for a blob to be returned in the results.
|
1064
|
+
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
|
1065
|
+
* however, only a subset of the OData filter syntax is supported in the Blob service.
|
1066
|
+
* @param options - Options to find blobs by tags.
|
1067
|
+
*/
|
1068
|
+
findBlobsByTags(tagFilterSqlExpression, options = {}) {
|
1069
|
+
// AsyncIterableIterator to iterate over blobs
|
1070
|
+
const listSegmentOptions = Object.assign({}, options);
|
1071
|
+
const iter = this.findBlobsByTagsItems(tagFilterSqlExpression, listSegmentOptions);
|
1072
|
+
return {
|
1073
|
+
/**
|
1074
|
+
* The next method, part of the iteration protocol
|
1075
|
+
*/
|
1076
|
+
next() {
|
1077
|
+
return iter.next();
|
1078
|
+
},
|
1079
|
+
/**
|
1080
|
+
* The connection to the async iterator, part of the iteration protocol
|
1081
|
+
*/
|
1082
|
+
[Symbol.asyncIterator]() {
|
1083
|
+
return this;
|
1084
|
+
},
|
1085
|
+
/**
|
1086
|
+
* Return an AsyncIterableIterator that works a page at a time
|
1087
|
+
*/
|
1088
|
+
byPage: (settings = {}) => {
|
1089
|
+
return this.findBlobsByTagsSegments(tagFilterSqlExpression, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, listSegmentOptions));
|
1090
|
+
},
|
1091
|
+
};
|
1092
|
+
}
|
1093
|
+
getContainerNameFromUrl() {
|
1094
|
+
let containerName;
|
1095
|
+
try {
|
1096
|
+
// URL may look like the following
|
1097
|
+
// "https://myaccount.blob.core.windows.net/mycontainer?sasString";
|
1098
|
+
// "https://myaccount.blob.core.windows.net/mycontainer";
|
1099
|
+
// IPv4/IPv6 address hosts, Endpoints - `http://127.0.0.1:10000/devstoreaccount1/containername`
|
1100
|
+
// http://localhost:10001/devstoreaccount1/containername
|
1101
|
+
const parsedUrl = new URL(this.url);
|
1102
|
+
if (parsedUrl.hostname.split(".")[1] === "blob") {
|
1103
|
+
// "https://myaccount.blob.core.windows.net/containername".
|
1104
|
+
// "https://customdomain.com/containername".
|
1105
|
+
// .getPath() -> /containername
|
1106
|
+
containerName = parsedUrl.pathname.split("/")[1];
|
1107
|
+
}
|
1108
|
+
else if (isIpEndpointStyle(parsedUrl)) {
|
1109
|
+
// IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/containername
|
1110
|
+
// Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/containername
|
1111
|
+
// .getPath() -> /devstoreaccount1/containername
|
1112
|
+
containerName = parsedUrl.pathname.split("/")[2];
|
1113
|
+
}
|
1114
|
+
else {
|
1115
|
+
// "https://customdomain.com/containername".
|
1116
|
+
// .getPath() -> /containername
|
1117
|
+
containerName = parsedUrl.pathname.split("/")[1];
|
1118
|
+
}
|
1119
|
+
// decode the encoded containerName - to get all the special characters that might be present in it
|
1120
|
+
containerName = decodeURIComponent(containerName);
|
1121
|
+
if (!containerName) {
|
1122
|
+
throw new Error("Provided containerName is invalid.");
|
1123
|
+
}
|
1124
|
+
return containerName;
|
1125
|
+
}
|
1126
|
+
catch (error) {
|
1127
|
+
throw new Error("Unable to extract containerName with provided information.");
|
1128
|
+
}
|
1129
|
+
}
|
1130
|
+
/**
|
1131
|
+
* Only available for ContainerClient constructed with a shared key credential.
|
1132
|
+
*
|
1133
|
+
* Generates a Blob Container Service Shared Access Signature (SAS) URI based on the client properties
|
1134
|
+
* and parameters passed in. The SAS is signed by the shared key credential of the client.
|
1135
|
+
*
|
1136
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
|
1137
|
+
*
|
1138
|
+
* @param options - Optional parameters.
|
1139
|
+
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
|
1140
|
+
*/
|
1141
|
+
generateSasUrl(options) {
|
1142
|
+
return new Promise((resolve) => {
|
1143
|
+
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
1144
|
+
throw new RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
1145
|
+
}
|
1146
|
+
const sas = generateBlobSASQueryParameters(Object.assign({ containerName: this._containerName }, options), this.credential).toString();
|
1147
|
+
resolve(appendToURLQuery(this.url, sas));
|
1148
|
+
});
|
1149
|
+
}
|
1150
|
+
/**
|
1151
|
+
* Creates a BlobBatchClient object to conduct batch operations.
|
1152
|
+
*
|
1153
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/blob-batch
|
1154
|
+
*
|
1155
|
+
* @returns A new BlobBatchClient object for this container.
|
1156
|
+
*/
|
1157
|
+
getBlobBatchClient() {
|
1158
|
+
return new BlobBatchClient(this.url, this.pipeline);
|
1159
|
+
}
|
1160
|
+
}
|
1161
|
+
//# sourceMappingURL=ContainerClient.js.map
|