@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
@@ -1,16 +1,14 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT license.
|
3
3
|
import { __asyncGenerator, __asyncValues, __await } from "tslib";
|
4
|
-
import { isNode
|
5
|
-
import {
|
6
|
-
import { Share, Directory, File } from "./generated/src/operations";
|
7
|
-
import { newPipeline, Pipeline } from "./Pipeline";
|
4
|
+
import { isNode } from "@azure/core-util";
|
5
|
+
import { newPipeline, Pipeline, } from "../../storage-blob/src/Pipeline";
|
8
6
|
import { DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS, DEFAULT_HIGH_LEVEL_CONCURRENCY, FILE_MAX_SIZE_BYTES, FILE_RANGE_MAX_SIZE_BYTES, URLConstants, FileAttributesPreserve, FileAttributesNone, } from "./utils/constants";
|
9
|
-
import { appendToURLPath, setURLParameter, truncatedISO8061Date, extractConnectionStringParts, getShareNameAndPathFromUrl, appendToURLQuery, httpAuthorizationToString, setURLPath, setURLQueries, EscapePath,
|
10
|
-
import { Credential } from "
|
11
|
-
import { StorageSharedKeyCredential } from "
|
12
|
-
import { AnonymousCredential } from "
|
13
|
-
import {
|
7
|
+
import { appendToURLPath, setURLParameter, truncatedISO8061Date, extractConnectionStringParts, getShareNameAndPathFromUrl, appendToURLQuery, httpAuthorizationToString, setURLPath, setURLQueries, EscapePath, assertResponse, } from "./utils/utils.common";
|
8
|
+
import { Credential } from "../../storage-blob/src/credentials/Credential";
|
9
|
+
import { StorageSharedKeyCredential } from "../../storage-blob/src/credentials/StorageSharedKeyCredential";
|
10
|
+
import { AnonymousCredential } from "../../storage-blob/src/credentials/AnonymousCredential";
|
11
|
+
import { tracingClient } from "./utils/tracing";
|
14
12
|
import { StorageClient } from "./StorageClient";
|
15
13
|
import "@azure/core-paging";
|
16
14
|
import { FileSystemAttributes } from "./FileSystemAttributes";
|
@@ -20,14 +18,18 @@ import { fileAttributesToString, fileCreationTimeToString, fileLastWriteTimeToSt
|
|
20
18
|
import { Batch } from "./utils/Batch";
|
21
19
|
import { BufferScheduler } from "./utils/BufferScheduler";
|
22
20
|
import { fsStat, fsCreateReadStream, readStreamToLocalFile, streamToBuffer, } from "./utils/utils.node";
|
23
|
-
import {
|
24
|
-
import { SERVICE_VERSION } from "./utils/constants";
|
25
|
-
import { generateUuid } from "@azure/core-http";
|
21
|
+
import { v4 as generateUuid } from "uuid";
|
26
22
|
import { generateFileSASQueryParameters } from "./FileSASSignatureValues";
|
27
23
|
/**
|
28
24
|
* A ShareClient represents a URL to the Azure Storage share allowing you to manipulate its directories and files.
|
29
25
|
*/
|
30
26
|
export class ShareClient extends StorageClient {
|
27
|
+
/**
|
28
|
+
* The name of the share
|
29
|
+
*/
|
30
|
+
get name() {
|
31
|
+
return this._name;
|
32
|
+
}
|
31
33
|
constructor(urlOrConnectionString, credentialOrPipelineOrShareName,
|
32
34
|
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
33
35
|
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
|
@@ -39,8 +41,7 @@ export class ShareClient extends StorageClient {
|
|
39
41
|
url = urlOrConnectionString;
|
40
42
|
pipeline = credentialOrPipelineOrShareName;
|
41
43
|
}
|
42
|
-
else if (credentialOrPipelineOrShareName instanceof Credential
|
43
|
-
isTokenCredential(credentialOrPipelineOrShareName)) {
|
44
|
+
else if (credentialOrPipelineOrShareName instanceof Credential) {
|
44
45
|
// (url: string, credential?: Credential, options?: StoragePipelineOptions)
|
45
46
|
url = urlOrConnectionString;
|
46
47
|
pipeline = newPipeline(credentialOrPipelineOrShareName, options);
|
@@ -80,14 +81,7 @@ export class ShareClient extends StorageClient {
|
|
80
81
|
}
|
81
82
|
super(url, pipeline);
|
82
83
|
this._name = getShareNameAndPathFromUrl(this.url).shareName;
|
83
|
-
this.
|
84
|
-
this.context = new Share(this.storageClientContext);
|
85
|
-
}
|
86
|
-
/**
|
87
|
-
* The name of the share
|
88
|
-
*/
|
89
|
-
get name() {
|
90
|
-
return this._name;
|
84
|
+
this.context = this.storageClientContext.share;
|
91
85
|
}
|
92
86
|
/**
|
93
87
|
* Creates a new ShareClient object identical to the source but with the specified snapshot timestamp.
|
@@ -97,7 +91,7 @@ export class ShareClient extends StorageClient {
|
|
97
91
|
* @returns A new ShareClient object identical to the source but with the specified snapshot timestamp
|
98
92
|
*/
|
99
93
|
withSnapshot(snapshot) {
|
100
|
-
return new ShareClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline
|
94
|
+
return new ShareClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline);
|
101
95
|
}
|
102
96
|
/**
|
103
97
|
* Creates a new share under the specified account. If the share with
|
@@ -108,20 +102,9 @@ export class ShareClient extends StorageClient {
|
|
108
102
|
* @returns Response data for the Share Create operation.
|
109
103
|
*/
|
110
104
|
async create(options = {}) {
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
}
|
115
|
-
catch (e) {
|
116
|
-
span.setStatus({
|
117
|
-
code: SpanStatusCode.ERROR,
|
118
|
-
message: e.message,
|
119
|
-
});
|
120
|
-
throw e;
|
121
|
-
}
|
122
|
-
finally {
|
123
|
-
span.end();
|
124
|
-
}
|
105
|
+
return tracingClient.withSpan("ShareClient-create", options, async (updatedOptions) => {
|
106
|
+
return assertResponse(await this.context.create(Object.assign(Object.assign({}, updatedOptions), { enabledProtocols: toShareProtocolsString(updatedOptions.protocols) })));
|
107
|
+
});
|
125
108
|
}
|
126
109
|
/**
|
127
110
|
* Creates a new share under the specified account. If the share with
|
@@ -131,29 +114,19 @@ export class ShareClient extends StorageClient {
|
|
131
114
|
* @param options -
|
132
115
|
*/
|
133
116
|
async createIfNotExists(options = {}) {
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
}
|
140
|
-
catch (e) {
|
141
|
-
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ShareAlreadyExists") {
|
142
|
-
span.setStatus({
|
143
|
-
code: SpanStatusCode.ERROR,
|
144
|
-
message: "Expected exception when creating a share only if it doesn't already exist.",
|
145
|
-
});
|
146
|
-
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
117
|
+
return tracingClient.withSpan("ShareClient-createIfNotExists", options, async (updatedOptions) => {
|
118
|
+
var _a, _b;
|
119
|
+
try {
|
120
|
+
const res = await this.create(updatedOptions);
|
121
|
+
return Object.assign({ succeeded: true }, res);
|
147
122
|
}
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
span.end();
|
156
|
-
}
|
123
|
+
catch (e) {
|
124
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ShareAlreadyExists") {
|
125
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
126
|
+
}
|
127
|
+
throw e;
|
128
|
+
}
|
129
|
+
});
|
157
130
|
}
|
158
131
|
/**
|
159
132
|
* Creates a {@link ShareDirectoryClient} object.
|
@@ -164,7 +137,7 @@ export class ShareClient extends StorageClient {
|
|
164
137
|
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
165
138
|
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
|
166
139
|
getDirectoryClient(directoryName) {
|
167
|
-
return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(directoryName)), this.pipeline
|
140
|
+
return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(directoryName)), this.pipeline);
|
168
141
|
}
|
169
142
|
/**
|
170
143
|
* Gets the directory client for the root directory of this share.
|
@@ -186,25 +159,14 @@ export class ShareClient extends StorageClient {
|
|
186
159
|
* @returns Directory creation response data and the corresponding directory client.
|
187
160
|
*/
|
188
161
|
async createDirectory(directoryName, options = {}) {
|
189
|
-
|
190
|
-
try {
|
162
|
+
return tracingClient.withSpan("ShareClient-createDirectory", options, async (updatedOptions) => {
|
191
163
|
const directoryClient = this.getDirectoryClient(directoryName);
|
192
164
|
const directoryCreateResponse = await directoryClient.create(updatedOptions);
|
193
165
|
return {
|
194
166
|
directoryClient,
|
195
167
|
directoryCreateResponse,
|
196
168
|
};
|
197
|
-
}
|
198
|
-
catch (e) {
|
199
|
-
span.setStatus({
|
200
|
-
code: SpanStatusCode.ERROR,
|
201
|
-
message: e.message,
|
202
|
-
});
|
203
|
-
throw e;
|
204
|
-
}
|
205
|
-
finally {
|
206
|
-
span.end();
|
207
|
-
}
|
169
|
+
});
|
208
170
|
}
|
209
171
|
/**
|
210
172
|
* Removes the specified empty sub directory under this share.
|
@@ -216,21 +178,10 @@ export class ShareClient extends StorageClient {
|
|
216
178
|
* @returns Directory deletion response data.
|
217
179
|
*/
|
218
180
|
async deleteDirectory(directoryName, options = {}) {
|
219
|
-
|
220
|
-
try {
|
181
|
+
return tracingClient.withSpan("ShareClient-deleteDirectory", options, async (updatedOptions) => {
|
221
182
|
const directoryClient = this.getDirectoryClient(directoryName);
|
222
|
-
return
|
223
|
-
}
|
224
|
-
catch (e) {
|
225
|
-
span.setStatus({
|
226
|
-
code: SpanStatusCode.ERROR,
|
227
|
-
message: e.message,
|
228
|
-
});
|
229
|
-
throw e;
|
230
|
-
}
|
231
|
-
finally {
|
232
|
-
span.end();
|
233
|
-
}
|
183
|
+
return directoryClient.delete(updatedOptions);
|
184
|
+
});
|
234
185
|
}
|
235
186
|
/**
|
236
187
|
* Creates a new file or replaces a file under the root directory of this share.
|
@@ -243,8 +194,7 @@ export class ShareClient extends StorageClient {
|
|
243
194
|
* @returns File creation response data and the corresponding file client.
|
244
195
|
*/
|
245
196
|
async createFile(fileName, size, options = {}) {
|
246
|
-
|
247
|
-
try {
|
197
|
+
return tracingClient.withSpan("ShareClient-createFile", options, async (updatedOptions) => {
|
248
198
|
const directoryClient = this.rootDirectoryClient;
|
249
199
|
const fileClient = directoryClient.getFileClient(fileName);
|
250
200
|
const fileCreateResponse = await fileClient.create(size, updatedOptions);
|
@@ -252,17 +202,7 @@ export class ShareClient extends StorageClient {
|
|
252
202
|
fileClient,
|
253
203
|
fileCreateResponse,
|
254
204
|
};
|
255
|
-
}
|
256
|
-
catch (e) {
|
257
|
-
span.setStatus({
|
258
|
-
code: SpanStatusCode.ERROR,
|
259
|
-
message: e.message,
|
260
|
-
});
|
261
|
-
throw e;
|
262
|
-
}
|
263
|
-
finally {
|
264
|
-
span.end();
|
265
|
-
}
|
205
|
+
});
|
266
206
|
}
|
267
207
|
/**
|
268
208
|
* Removes a file under the root directory of this share from the storage account.
|
@@ -285,22 +225,11 @@ export class ShareClient extends StorageClient {
|
|
285
225
|
* @returns Promise<FileDeleteResponse> File Delete response data.
|
286
226
|
*/
|
287
227
|
async deleteFile(fileName, options = {}) {
|
288
|
-
|
289
|
-
try {
|
228
|
+
return tracingClient.withSpan("ShareClient-deleteFile", options, async (updatedOptions) => {
|
290
229
|
const directoryClient = this.rootDirectoryClient;
|
291
230
|
const fileClient = directoryClient.getFileClient(fileName);
|
292
|
-
return
|
293
|
-
}
|
294
|
-
catch (e) {
|
295
|
-
span.setStatus({
|
296
|
-
code: SpanStatusCode.ERROR,
|
297
|
-
message: e.message,
|
298
|
-
});
|
299
|
-
throw e;
|
300
|
-
}
|
301
|
-
finally {
|
302
|
-
span.end();
|
303
|
-
}
|
231
|
+
return fileClient.delete(updatedOptions);
|
232
|
+
});
|
304
233
|
}
|
305
234
|
/**
|
306
235
|
* Returns true if the Azrue share resource represented by this client exists; false otherwise.
|
@@ -312,28 +241,18 @@ export class ShareClient extends StorageClient {
|
|
312
241
|
* @param options - options to Exists operation.
|
313
242
|
*/
|
314
243
|
async exists(options = {}) {
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
}
|
320
|
-
catch (e) {
|
321
|
-
if (e.statusCode === 404) {
|
322
|
-
span.setStatus({
|
323
|
-
code: SpanStatusCode.ERROR,
|
324
|
-
message: "Expected exception when checking share existence",
|
325
|
-
});
|
326
|
-
return false;
|
244
|
+
return tracingClient.withSpan("ShareClient-exists", options, async (updatedOptions) => {
|
245
|
+
try {
|
246
|
+
await this.getProperties(updatedOptions);
|
247
|
+
return true;
|
327
248
|
}
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
span.end();
|
336
|
-
}
|
249
|
+
catch (e) {
|
250
|
+
if (e.statusCode === 404) {
|
251
|
+
return false;
|
252
|
+
}
|
253
|
+
throw e;
|
254
|
+
}
|
255
|
+
});
|
337
256
|
}
|
338
257
|
/**
|
339
258
|
* Returns all user-defined metadata and system properties for the specified
|
@@ -348,24 +267,10 @@ export class ShareClient extends StorageClient {
|
|
348
267
|
* @returns Response data for the Share Get Properties operation.
|
349
268
|
*/
|
350
269
|
async getProperties(options = {}) {
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
const protocols = toShareProtocols(res.enabledProtocols);
|
356
|
-
res.protocols = protocols;
|
357
|
-
return res;
|
358
|
-
}
|
359
|
-
catch (e) {
|
360
|
-
span.setStatus({
|
361
|
-
code: SpanStatusCode.ERROR,
|
362
|
-
message: e.message,
|
363
|
-
});
|
364
|
-
throw e;
|
365
|
-
}
|
366
|
-
finally {
|
367
|
-
span.end();
|
368
|
-
}
|
270
|
+
return tracingClient.withSpan("ShareClient-getProperties", options, async (updatedOptions) => {
|
271
|
+
const res = assertResponse(await this.context.getProperties(updatedOptions));
|
272
|
+
return Object.assign(Object.assign({}, res), { protocols: toShareProtocols(res.enabledProtocols) });
|
273
|
+
});
|
369
274
|
}
|
370
275
|
/**
|
371
276
|
* Marks the specified share for deletion. The share and any directories or files
|
@@ -376,20 +281,9 @@ export class ShareClient extends StorageClient {
|
|
376
281
|
* @returns Response data for the Share Delete operation.
|
377
282
|
*/
|
378
283
|
async delete(options = {}) {
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
}
|
383
|
-
catch (e) {
|
384
|
-
span.setStatus({
|
385
|
-
code: SpanStatusCode.ERROR,
|
386
|
-
message: e.message,
|
387
|
-
});
|
388
|
-
throw e;
|
389
|
-
}
|
390
|
-
finally {
|
391
|
-
span.end();
|
392
|
-
}
|
284
|
+
return tracingClient.withSpan("ShareClient-delete", options, async (updatedOptions) => {
|
285
|
+
return assertResponse(await this.context.delete(Object.assign({}, updatedOptions)));
|
286
|
+
});
|
393
287
|
}
|
394
288
|
/**
|
395
289
|
* Marks the specified share for deletion if it exists. The share and any directories or files
|
@@ -399,29 +293,19 @@ export class ShareClient extends StorageClient {
|
|
399
293
|
* @param options -
|
400
294
|
*/
|
401
295
|
async deleteIfExists(options = {}) {
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
}
|
408
|
-
catch (e) {
|
409
|
-
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ShareNotFound") {
|
410
|
-
span.setStatus({
|
411
|
-
code: SpanStatusCode.ERROR,
|
412
|
-
message: "Expected exception when deleting a share only if it exists.",
|
413
|
-
});
|
414
|
-
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
296
|
+
return tracingClient.withSpan("ShareClient-deleteIfExists", options, async (updatedOptions) => {
|
297
|
+
var _a, _b;
|
298
|
+
try {
|
299
|
+
const res = await this.delete(updatedOptions);
|
300
|
+
return Object.assign({ succeeded: true }, res);
|
415
301
|
}
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
span.end();
|
424
|
-
}
|
302
|
+
catch (e) {
|
303
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ShareNotFound") {
|
304
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
305
|
+
}
|
306
|
+
throw e;
|
307
|
+
}
|
308
|
+
});
|
425
309
|
}
|
426
310
|
/**
|
427
311
|
* Sets one or more user-defined name-value pairs for the specified share.
|
@@ -435,20 +319,9 @@ export class ShareClient extends StorageClient {
|
|
435
319
|
* @returns Response data for the Share Set Metadata operation.
|
436
320
|
*/
|
437
321
|
async setMetadata(metadata, options = {}) {
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
}
|
442
|
-
catch (e) {
|
443
|
-
span.setStatus({
|
444
|
-
code: SpanStatusCode.ERROR,
|
445
|
-
message: e.message,
|
446
|
-
});
|
447
|
-
throw e;
|
448
|
-
}
|
449
|
-
finally {
|
450
|
-
span.end();
|
451
|
-
}
|
322
|
+
return tracingClient.withSpan("ShareClient-setMetadata", options, async (updatedOptions) => {
|
323
|
+
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign({}, updatedOptions), { metadata })));
|
324
|
+
});
|
452
325
|
}
|
453
326
|
/**
|
454
327
|
* Gets the permissions for the specified share. The permissions indicate
|
@@ -463,9 +336,8 @@ export class ShareClient extends StorageClient {
|
|
463
336
|
* @returns Response data for the Share Get Access Policy operation.
|
464
337
|
*/
|
465
338
|
async getAccessPolicy(options = {}) {
|
466
|
-
|
467
|
-
|
468
|
-
const response = await this.context.getAccessPolicy(Object.assign(Object.assign({}, options), convertTracingToRequestOptionsBase(updatedOptions)));
|
339
|
+
return tracingClient.withSpan("ShareClient-getAccessPolicy", options, async (updatedOptions) => {
|
340
|
+
const response = assertResponse(await this.context.getAccessPolicy(Object.assign({}, updatedOptions)));
|
469
341
|
const res = {
|
470
342
|
_response: response._response,
|
471
343
|
date: response.date,
|
@@ -494,17 +366,7 @@ export class ShareClient extends StorageClient {
|
|
494
366
|
});
|
495
367
|
}
|
496
368
|
return res;
|
497
|
-
}
|
498
|
-
catch (e) {
|
499
|
-
span.setStatus({
|
500
|
-
code: SpanStatusCode.ERROR,
|
501
|
-
message: e.message,
|
502
|
-
});
|
503
|
-
throw e;
|
504
|
-
}
|
505
|
-
finally {
|
506
|
-
span.end();
|
507
|
-
}
|
369
|
+
});
|
508
370
|
}
|
509
371
|
/**
|
510
372
|
* Sets the permissions for the specified share. The permissions indicate
|
@@ -524,9 +386,8 @@ export class ShareClient extends StorageClient {
|
|
524
386
|
* @returns Response data for the Share Set Access Policy operation.
|
525
387
|
*/
|
526
388
|
async setAccessPolicy(shareAcl, options = {}) {
|
527
|
-
|
528
|
-
|
529
|
-
try {
|
389
|
+
return tracingClient.withSpan("ShareClient-setAccessPolicy", options, async (updatedOptions) => {
|
390
|
+
var _a, _b, _c;
|
530
391
|
const acl = [];
|
531
392
|
for (const identifier of shareAcl || []) {
|
532
393
|
acl.push({
|
@@ -542,18 +403,8 @@ export class ShareClient extends StorageClient {
|
|
542
403
|
id: identifier.id,
|
543
404
|
});
|
544
405
|
}
|
545
|
-
return await this.context.setAccessPolicy(Object.assign(Object.assign(
|
546
|
-
}
|
547
|
-
catch (e) {
|
548
|
-
span.setStatus({
|
549
|
-
code: SpanStatusCode.ERROR,
|
550
|
-
message: e.message,
|
551
|
-
});
|
552
|
-
throw e;
|
553
|
-
}
|
554
|
-
finally {
|
555
|
-
span.end();
|
556
|
-
}
|
406
|
+
return assertResponse(await this.context.setAccessPolicy(Object.assign(Object.assign({}, updatedOptions), { shareAcl: acl })));
|
407
|
+
});
|
557
408
|
}
|
558
409
|
/**
|
559
410
|
* Creates a read-only snapshot of a share.
|
@@ -562,20 +413,9 @@ export class ShareClient extends StorageClient {
|
|
562
413
|
* @returns Response data for the Share Create Snapshot operation.
|
563
414
|
*/
|
564
415
|
async createSnapshot(options = {}) {
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
}
|
569
|
-
catch (e) {
|
570
|
-
span.setStatus({
|
571
|
-
code: SpanStatusCode.ERROR,
|
572
|
-
message: e.message,
|
573
|
-
});
|
574
|
-
throw e;
|
575
|
-
}
|
576
|
-
finally {
|
577
|
-
span.end();
|
578
|
-
}
|
416
|
+
return tracingClient.withSpan("ShareClient-createSnapshot", options, async (updatedOptions) => {
|
417
|
+
return assertResponse(await this.context.createSnapshot(updatedOptions));
|
418
|
+
});
|
579
419
|
}
|
580
420
|
/**
|
581
421
|
* Sets quota for the specified share.
|
@@ -587,20 +427,9 @@ export class ShareClient extends StorageClient {
|
|
587
427
|
* @returns Response data for the Share Get Quota operation.
|
588
428
|
*/
|
589
429
|
async setQuota(quotaInGB, options = {}) {
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
}
|
594
|
-
catch (e) {
|
595
|
-
span.setStatus({
|
596
|
-
code: SpanStatusCode.ERROR,
|
597
|
-
message: e.message,
|
598
|
-
});
|
599
|
-
throw e;
|
600
|
-
}
|
601
|
-
finally {
|
602
|
-
span.end();
|
603
|
-
}
|
430
|
+
return tracingClient.withSpan("ShareClient-setQuota", options, async (updatedOptions) => {
|
431
|
+
return assertResponse(await this.context.setProperties(Object.assign(Object.assign({}, updatedOptions), { quota: quotaInGB })));
|
432
|
+
});
|
604
433
|
}
|
605
434
|
/**
|
606
435
|
* Sets properties of the share.
|
@@ -609,20 +438,9 @@ export class ShareClient extends StorageClient {
|
|
609
438
|
* @returns Response data for the Share Set Properties operation.
|
610
439
|
*/
|
611
440
|
async setProperties(options = {}) {
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
}
|
616
|
-
catch (e) {
|
617
|
-
span.setStatus({
|
618
|
-
code: SpanStatusCode.ERROR,
|
619
|
-
message: e.message,
|
620
|
-
});
|
621
|
-
throw e;
|
622
|
-
}
|
623
|
-
finally {
|
624
|
-
span.end();
|
625
|
-
}
|
441
|
+
return tracingClient.withSpan("ShareClient-setProperties", options, async (updatedOptions) => {
|
442
|
+
return assertResponse(await this.context.setProperties(Object.assign(Object.assign({}, options), { quota: options.quotaInGB, tracingOptions: updatedOptions.tracingOptions })));
|
443
|
+
});
|
626
444
|
}
|
627
445
|
/**
|
628
446
|
* Retrieves statistics related to the share.
|
@@ -631,22 +449,11 @@ export class ShareClient extends StorageClient {
|
|
631
449
|
* @returns Response data for the Share Get Statistics operation.
|
632
450
|
*/
|
633
451
|
async getStatistics(options = {}) {
|
634
|
-
|
635
|
-
|
636
|
-
const response = await this.context.getStatistics(Object.assign(Object.assign({}, options), convertTracingToRequestOptionsBase(updatedOptions)));
|
452
|
+
return tracingClient.withSpan("ShareClient-getStatistics", options, async (updatedOptions) => {
|
453
|
+
const response = assertResponse(await this.context.getStatistics(updatedOptions));
|
637
454
|
const GBBytes = 1024 * 1024 * 1024;
|
638
455
|
return Object.assign(Object.assign({}, response), { shareUsage: Math.ceil(response.shareUsageBytes / GBBytes) });
|
639
|
-
}
|
640
|
-
catch (e) {
|
641
|
-
span.setStatus({
|
642
|
-
code: SpanStatusCode.ERROR,
|
643
|
-
message: e.message,
|
644
|
-
});
|
645
|
-
throw e;
|
646
|
-
}
|
647
|
-
finally {
|
648
|
-
span.end();
|
649
|
-
}
|
456
|
+
});
|
650
457
|
}
|
651
458
|
/**
|
652
459
|
* Creates a file permission (a security descriptor) at the share level.
|
@@ -657,22 +464,11 @@ export class ShareClient extends StorageClient {
|
|
657
464
|
* @param filePermission - File permission described in the SDDL
|
658
465
|
*/
|
659
466
|
async createPermission(filePermission, options = {}) {
|
660
|
-
|
661
|
-
|
662
|
-
return await this.context.createPermission({
|
467
|
+
return tracingClient.withSpan("ShareClient-createPermission", options, async (updatedOptions) => {
|
468
|
+
return assertResponse(await this.context.createPermission({
|
663
469
|
permission: filePermission,
|
664
|
-
},
|
665
|
-
}
|
666
|
-
catch (e) {
|
667
|
-
span.setStatus({
|
668
|
-
code: SpanStatusCode.ERROR,
|
669
|
-
message: e.message,
|
670
|
-
});
|
671
|
-
throw e;
|
672
|
-
}
|
673
|
-
finally {
|
674
|
-
span.end();
|
675
|
-
}
|
470
|
+
}, updatedOptions));
|
471
|
+
});
|
676
472
|
}
|
677
473
|
/**
|
678
474
|
* Gets the Security Descriptor Definition Language (SDDL) for a given file permission key
|
@@ -683,20 +479,9 @@ export class ShareClient extends StorageClient {
|
|
683
479
|
* @param filePermissionKey - File permission key which indicates the security descriptor of the permission.
|
684
480
|
*/
|
685
481
|
async getPermission(filePermissionKey, options = {}) {
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
}
|
690
|
-
catch (e) {
|
691
|
-
span.setStatus({
|
692
|
-
code: SpanStatusCode.ERROR,
|
693
|
-
message: e.message,
|
694
|
-
});
|
695
|
-
throw e;
|
696
|
-
}
|
697
|
-
finally {
|
698
|
-
span.end();
|
699
|
-
}
|
482
|
+
return tracingClient.withSpan("ShareClient-getPermission", options, async (updatedOptions) => {
|
483
|
+
return assertResponse(await this.context.getPermission(filePermissionKey, updatedOptions));
|
484
|
+
});
|
700
485
|
}
|
701
486
|
/**
|
702
487
|
* Only available for ShareClient constructed with a shared key credential.
|
@@ -721,28 +506,6 @@ export class ShareClient extends StorageClient {
|
|
721
506
|
* A ShareDirectoryClient represents a URL to the Azure Storage directory allowing you to manipulate its files and directories.
|
722
507
|
*/
|
723
508
|
export class ShareDirectoryClient extends StorageClient {
|
724
|
-
constructor(url, credentialOrPipeline, options = {}) {
|
725
|
-
let pipeline;
|
726
|
-
if (credentialOrPipeline instanceof Pipeline) {
|
727
|
-
pipeline = credentialOrPipeline;
|
728
|
-
}
|
729
|
-
else if (credentialOrPipeline instanceof Credential ||
|
730
|
-
isTokenCredential(credentialOrPipeline)) {
|
731
|
-
pipeline = newPipeline(credentialOrPipeline, options);
|
732
|
-
}
|
733
|
-
else {
|
734
|
-
// The second parameter is undefined. Use anonymous credential.
|
735
|
-
pipeline = newPipeline(new AnonymousCredential(), options);
|
736
|
-
}
|
737
|
-
super(url, pipeline);
|
738
|
-
({
|
739
|
-
baseName: this._name,
|
740
|
-
shareName: this._shareName,
|
741
|
-
path: this._path,
|
742
|
-
} = getShareNameAndPathFromUrl(this.url));
|
743
|
-
this.shareClientConfig = options;
|
744
|
-
this.context = new Directory(this.storageClientContext);
|
745
|
-
}
|
746
509
|
/**
|
747
510
|
* The share name corresponding to this directory client
|
748
511
|
*/
|
@@ -761,6 +524,29 @@ export class ShareDirectoryClient extends StorageClient {
|
|
761
524
|
get name() {
|
762
525
|
return this._name;
|
763
526
|
}
|
527
|
+
constructor(url, credentialOrPipeline,
|
528
|
+
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
529
|
+
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
|
530
|
+
options = {}) {
|
531
|
+
let pipeline;
|
532
|
+
if (credentialOrPipeline instanceof Pipeline) {
|
533
|
+
pipeline = credentialOrPipeline;
|
534
|
+
}
|
535
|
+
else if (credentialOrPipeline instanceof Credential) {
|
536
|
+
pipeline = newPipeline(credentialOrPipeline, options);
|
537
|
+
}
|
538
|
+
else {
|
539
|
+
// The second parameter is undefined. Use anonymous credential.
|
540
|
+
pipeline = newPipeline(new AnonymousCredential(), options);
|
541
|
+
}
|
542
|
+
super(url, pipeline);
|
543
|
+
({
|
544
|
+
baseName: this._name,
|
545
|
+
shareName: this._shareName,
|
546
|
+
path: this._path,
|
547
|
+
} = getShareNameAndPathFromUrl(this.url));
|
548
|
+
this.context = this.storageClientContext.directory;
|
549
|
+
}
|
764
550
|
/**
|
765
551
|
* Creates a new directory under the specified share or parent directory.
|
766
552
|
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-directory
|
@@ -769,29 +555,18 @@ export class ShareDirectoryClient extends StorageClient {
|
|
769
555
|
* @returns Response data for the Directory operation.
|
770
556
|
*/
|
771
557
|
async create(options = {}) {
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
}
|
785
|
-
catch (e) {
|
786
|
-
span.setStatus({
|
787
|
-
code: SpanStatusCode.ERROR,
|
788
|
-
message: e.message,
|
789
|
-
});
|
790
|
-
throw e;
|
791
|
-
}
|
792
|
-
finally {
|
793
|
-
span.end();
|
794
|
-
}
|
558
|
+
if (!options.fileAttributes) {
|
559
|
+
options = validateAndSetDefaultsForFileAndDirectoryCreateCommonOptions(options);
|
560
|
+
// By default set it as a directory.
|
561
|
+
const attributes = new FileSystemAttributes();
|
562
|
+
attributes.directory = true;
|
563
|
+
options.fileAttributes = attributes;
|
564
|
+
}
|
565
|
+
return tracingClient.withSpan("ShareDirectoryClient-create", options, async (updatedOptions) => {
|
566
|
+
return assertResponse(await this.context.create(updatedOptions.fileAttributes
|
567
|
+
? fileAttributesToString(updatedOptions.fileAttributes)
|
568
|
+
: FileAttributesNone, Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) })));
|
569
|
+
});
|
795
570
|
}
|
796
571
|
/**
|
797
572
|
* Creates a new directory under the specified share or parent directory if it does not already exists.
|
@@ -801,29 +576,19 @@ export class ShareDirectoryClient extends StorageClient {
|
|
801
576
|
* @param options -
|
802
577
|
*/
|
803
578
|
async createIfNotExists(options = {}) {
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
}
|
810
|
-
catch (e) {
|
811
|
-
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceAlreadyExists") {
|
812
|
-
span.setStatus({
|
813
|
-
code: SpanStatusCode.ERROR,
|
814
|
-
message: "Expected exception when creating a directory only if it does not already exist.",
|
815
|
-
});
|
816
|
-
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
579
|
+
return tracingClient.withSpan("ShareDirectoryClient-createIfNotExists", options, async (updatedOptions) => {
|
580
|
+
var _a, _b;
|
581
|
+
try {
|
582
|
+
const res = await this.create(updatedOptions);
|
583
|
+
return Object.assign({ succeeded: true }, res);
|
817
584
|
}
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
span.end();
|
826
|
-
}
|
585
|
+
catch (e) {
|
586
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceAlreadyExists") {
|
587
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
588
|
+
}
|
589
|
+
throw e;
|
590
|
+
}
|
591
|
+
});
|
827
592
|
}
|
828
593
|
/**
|
829
594
|
* Sets properties on the directory.
|
@@ -833,23 +598,12 @@ export class ShareDirectoryClient extends StorageClient {
|
|
833
598
|
* existing values will be preserved.
|
834
599
|
*/
|
835
600
|
async setProperties(properties = {}) {
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
}
|
843
|
-
catch (e) {
|
844
|
-
span.setStatus({
|
845
|
-
code: SpanStatusCode.ERROR,
|
846
|
-
message: e.message,
|
847
|
-
});
|
848
|
-
throw e;
|
849
|
-
}
|
850
|
-
finally {
|
851
|
-
span.end();
|
852
|
-
}
|
601
|
+
properties = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(properties);
|
602
|
+
return tracingClient.withSpan("ShareDirectoryClient-setProperties", properties, async (updatedOptions) => {
|
603
|
+
return assertResponse(await this.context.setProperties(updatedOptions.fileAttributes
|
604
|
+
? fileAttributesToString(updatedOptions.fileAttributes)
|
605
|
+
: FileAttributesPreserve, Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) })));
|
606
|
+
});
|
853
607
|
}
|
854
608
|
/**
|
855
609
|
* Creates a ShareDirectoryClient object for a sub directory.
|
@@ -866,7 +620,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
866
620
|
* ```
|
867
621
|
*/
|
868
622
|
getDirectoryClient(subDirectoryName) {
|
869
|
-
return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(subDirectoryName)), this.pipeline
|
623
|
+
return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(subDirectoryName)), this.pipeline);
|
870
624
|
}
|
871
625
|
/**
|
872
626
|
* Creates a new subdirectory under this directory.
|
@@ -877,25 +631,14 @@ export class ShareDirectoryClient extends StorageClient {
|
|
877
631
|
* @returns Directory create response data and the corresponding DirectoryClient instance.
|
878
632
|
*/
|
879
633
|
async createSubdirectory(directoryName, options = {}) {
|
880
|
-
|
881
|
-
try {
|
634
|
+
return tracingClient.withSpan("ShareDirectoryClient-createSubdirectory", options, async (updatedOptions) => {
|
882
635
|
const directoryClient = this.getDirectoryClient(directoryName);
|
883
636
|
const directoryCreateResponse = await directoryClient.create(updatedOptions);
|
884
637
|
return {
|
885
638
|
directoryClient,
|
886
639
|
directoryCreateResponse,
|
887
640
|
};
|
888
|
-
}
|
889
|
-
catch (e) {
|
890
|
-
span.setStatus({
|
891
|
-
code: SpanStatusCode.ERROR,
|
892
|
-
message: e.message,
|
893
|
-
});
|
894
|
-
throw e;
|
895
|
-
}
|
896
|
-
finally {
|
897
|
-
span.end();
|
898
|
-
}
|
641
|
+
});
|
899
642
|
}
|
900
643
|
/**
|
901
644
|
* Removes the specified empty sub directory under this directory.
|
@@ -907,21 +650,10 @@ export class ShareDirectoryClient extends StorageClient {
|
|
907
650
|
* @returns Directory deletion response data.
|
908
651
|
*/
|
909
652
|
async deleteSubdirectory(directoryName, options = {}) {
|
910
|
-
|
911
|
-
try {
|
653
|
+
return tracingClient.withSpan("ShareDirectoryClient-deleteSubdirectory", options, async (updatedOptions) => {
|
912
654
|
const directoryClient = this.getDirectoryClient(directoryName);
|
913
|
-
return
|
914
|
-
}
|
915
|
-
catch (e) {
|
916
|
-
span.setStatus({
|
917
|
-
code: SpanStatusCode.ERROR,
|
918
|
-
message: e.message,
|
919
|
-
});
|
920
|
-
throw e;
|
921
|
-
}
|
922
|
-
finally {
|
923
|
-
span.end();
|
924
|
-
}
|
655
|
+
return directoryClient.delete(updatedOptions);
|
656
|
+
});
|
925
657
|
}
|
926
658
|
/**
|
927
659
|
* Creates a new file or replaces a file under this directory. Note it only initializes the file with no content.
|
@@ -933,25 +665,14 @@ export class ShareDirectoryClient extends StorageClient {
|
|
933
665
|
* @returns File creation response data and the corresponding file client.
|
934
666
|
*/
|
935
667
|
async createFile(fileName, size, options = {}) {
|
936
|
-
|
937
|
-
try {
|
668
|
+
return tracingClient.withSpan("ShareDirectoryClient-createFile", options, async (updatedOptions) => {
|
938
669
|
const fileClient = this.getFileClient(fileName);
|
939
670
|
const fileCreateResponse = await fileClient.create(size, updatedOptions);
|
940
671
|
return {
|
941
672
|
fileClient,
|
942
673
|
fileCreateResponse,
|
943
674
|
};
|
944
|
-
}
|
945
|
-
catch (e) {
|
946
|
-
span.setStatus({
|
947
|
-
code: SpanStatusCode.ERROR,
|
948
|
-
message: e.message,
|
949
|
-
});
|
950
|
-
throw e;
|
951
|
-
}
|
952
|
-
finally {
|
953
|
-
span.end();
|
954
|
-
}
|
675
|
+
});
|
955
676
|
}
|
956
677
|
/**
|
957
678
|
* Removes the specified file under this directory from the storage account.
|
@@ -972,21 +693,10 @@ export class ShareDirectoryClient extends StorageClient {
|
|
972
693
|
* @returns File deletion response data.
|
973
694
|
*/
|
974
695
|
async deleteFile(fileName, options = {}) {
|
975
|
-
|
976
|
-
try {
|
696
|
+
return tracingClient.withSpan("ShareDirectoryClient-deleteFile", options, async (updatedOptions) => {
|
977
697
|
const fileClient = this.getFileClient(fileName);
|
978
|
-
return
|
979
|
-
}
|
980
|
-
catch (e) {
|
981
|
-
span.setStatus({
|
982
|
-
code: SpanStatusCode.ERROR,
|
983
|
-
message: e.message,
|
984
|
-
});
|
985
|
-
throw e;
|
986
|
-
}
|
987
|
-
finally {
|
988
|
-
span.end();
|
989
|
-
}
|
698
|
+
return fileClient.delete(updatedOptions);
|
699
|
+
});
|
990
700
|
}
|
991
701
|
/**
|
992
702
|
* Creates a {@link ShareFileClient} object.
|
@@ -1011,7 +721,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1011
721
|
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
1012
722
|
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
|
1013
723
|
getFileClient(fileName) {
|
1014
|
-
return new ShareFileClient(appendToURLPath(this.url, EscapePath(fileName)), this.pipeline
|
724
|
+
return new ShareFileClient(appendToURLPath(this.url, EscapePath(fileName)), this.pipeline);
|
1015
725
|
}
|
1016
726
|
/**
|
1017
727
|
* Returns true if the specified directory exists; false otherwise.
|
@@ -1023,31 +733,18 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1023
733
|
* @param options - options to Exists operation.
|
1024
734
|
*/
|
1025
735
|
async exists(options = {}) {
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
tracingOptions: Object.assign(Object.assign({}, options.tracingOptions), convertTracingToRequestOptionsBase(updatedOptions)),
|
1031
|
-
});
|
1032
|
-
return true;
|
1033
|
-
}
|
1034
|
-
catch (e) {
|
1035
|
-
if (e.statusCode === 404) {
|
1036
|
-
span.setStatus({
|
1037
|
-
code: SpanStatusCode.ERROR,
|
1038
|
-
message: "Expected exception when checking directory existence",
|
1039
|
-
});
|
1040
|
-
return false;
|
736
|
+
return tracingClient.withSpan("ShareDirectoryClient-exists", options, async (updatedOptions) => {
|
737
|
+
try {
|
738
|
+
await this.getProperties(updatedOptions);
|
739
|
+
return true;
|
1041
740
|
}
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
span.end();
|
1050
|
-
}
|
741
|
+
catch (e) {
|
742
|
+
if (e.statusCode === 404) {
|
743
|
+
return false;
|
744
|
+
}
|
745
|
+
throw e;
|
746
|
+
}
|
747
|
+
});
|
1051
748
|
}
|
1052
749
|
/**
|
1053
750
|
* Returns all system properties for the specified directory, and can also be used to check the
|
@@ -1059,20 +756,9 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1059
756
|
* @returns Response data for the Directory Get Properties operation.
|
1060
757
|
*/
|
1061
758
|
async getProperties(options = {}) {
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
}
|
1066
|
-
catch (e) {
|
1067
|
-
span.setStatus({
|
1068
|
-
code: SpanStatusCode.ERROR,
|
1069
|
-
message: e.message,
|
1070
|
-
});
|
1071
|
-
throw e;
|
1072
|
-
}
|
1073
|
-
finally {
|
1074
|
-
span.end();
|
1075
|
-
}
|
759
|
+
return tracingClient.withSpan("ShareDirectoryClient-getProperties", options, async (updatedOptions) => {
|
760
|
+
return assertResponse(await this.context.getProperties(updatedOptions));
|
761
|
+
});
|
1076
762
|
}
|
1077
763
|
/**
|
1078
764
|
* Removes the specified empty directory. Note that the directory must be empty before it can be
|
@@ -1083,20 +769,9 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1083
769
|
* @returns Response data for the Directory Delete operation.
|
1084
770
|
*/
|
1085
771
|
async delete(options = {}) {
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
}
|
1090
|
-
catch (e) {
|
1091
|
-
span.setStatus({
|
1092
|
-
code: SpanStatusCode.ERROR,
|
1093
|
-
message: e.message,
|
1094
|
-
});
|
1095
|
-
throw e;
|
1096
|
-
}
|
1097
|
-
finally {
|
1098
|
-
span.end();
|
1099
|
-
}
|
772
|
+
return tracingClient.withSpan("ShareDirectoryClient-delete", options, async (updatedOptions) => {
|
773
|
+
return assertResponse(await this.context.delete(updatedOptions));
|
774
|
+
});
|
1100
775
|
}
|
1101
776
|
/**
|
1102
777
|
* Removes the specified empty directory if it exists. Note that the directory must be empty before it can be
|
@@ -1106,30 +781,20 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1106
781
|
* @param options -
|
1107
782
|
*/
|
1108
783
|
async deleteIfExists(options = {}) {
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
}
|
1115
|
-
catch (e) {
|
1116
|
-
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceNotFound" ||
|
1117
|
-
((_b = e.details) === null || _b === void 0 ? void 0 : _b.errorCode) === "ParentNotFound") {
|
1118
|
-
span.setStatus({
|
1119
|
-
code: SpanStatusCode.ERROR,
|
1120
|
-
message: "Expected exception when deleting a directory only if it exists.",
|
1121
|
-
});
|
1122
|
-
return Object.assign(Object.assign({ succeeded: false }, (_c = e.response) === null || _c === void 0 ? void 0 : _c.parsedHeaders), { _response: e.response });
|
784
|
+
return tracingClient.withSpan("ShareDirectoryClient-deleteIfExists", options, async (updatedOptions) => {
|
785
|
+
var _a, _b, _c;
|
786
|
+
try {
|
787
|
+
const res = await this.delete(updatedOptions);
|
788
|
+
return Object.assign({ succeeded: true }, res);
|
1123
789
|
}
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
}
|
790
|
+
catch (e) {
|
791
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceNotFound" ||
|
792
|
+
((_b = e.details) === null || _b === void 0 ? void 0 : _b.errorCode) === "ParentNotFound") {
|
793
|
+
return Object.assign(Object.assign({ succeeded: false }, (_c = e.response) === null || _c === void 0 ? void 0 : _c.parsedHeaders), { _response: e.response });
|
794
|
+
}
|
795
|
+
throw e;
|
796
|
+
}
|
797
|
+
});
|
1133
798
|
}
|
1134
799
|
/**
|
1135
800
|
* Updates user defined metadata for the specified directory.
|
@@ -1140,20 +805,9 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1140
805
|
* @returns Response data for the Directory Set Metadata operation.
|
1141
806
|
*/
|
1142
807
|
async setMetadata(metadata, options = {}) {
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
}
|
1147
|
-
catch (e) {
|
1148
|
-
span.setStatus({
|
1149
|
-
code: SpanStatusCode.ERROR,
|
1150
|
-
message: e.message,
|
1151
|
-
});
|
1152
|
-
throw e;
|
1153
|
-
}
|
1154
|
-
finally {
|
1155
|
-
span.end();
|
1156
|
-
}
|
808
|
+
return tracingClient.withSpan("ShareDirectoryClient-setMetadata", options, async (updatedOptions) => {
|
809
|
+
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign({}, updatedOptions), { metadata })));
|
810
|
+
});
|
1157
811
|
}
|
1158
812
|
/**
|
1159
813
|
* Returns an AsyncIterableIterator for {@link DirectoryListFilesAndDirectoriesSegmentResponse} objects
|
@@ -1187,26 +841,33 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1187
841
|
*/
|
1188
842
|
listFilesAndDirectoriesItems(options = {}) {
|
1189
843
|
return __asyncGenerator(this, arguments, function* listFilesAndDirectoriesItems_1() {
|
1190
|
-
var e_1,
|
844
|
+
var _a, e_1, _b, _c;
|
1191
845
|
if (options.prefix === "") {
|
1192
846
|
options.prefix = undefined;
|
1193
847
|
}
|
1194
848
|
let marker;
|
1195
849
|
try {
|
1196
|
-
for (var
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
850
|
+
for (var _d = true, _e = __asyncValues(this.iterateFilesAndDirectoriesSegments(marker, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
851
|
+
_c = _f.value;
|
852
|
+
_d = false;
|
853
|
+
try {
|
854
|
+
const listFilesAndDirectoriesResponse = _c;
|
855
|
+
for (const file of listFilesAndDirectoriesResponse.segment.fileItems) {
|
856
|
+
yield yield __await(Object.assign({ kind: "file" }, file));
|
857
|
+
}
|
858
|
+
for (const directory of listFilesAndDirectoriesResponse.segment.directoryItems) {
|
859
|
+
yield yield __await(Object.assign({ kind: "directory" }, directory));
|
860
|
+
}
|
1200
861
|
}
|
1201
|
-
|
1202
|
-
|
862
|
+
finally {
|
863
|
+
_d = true;
|
1203
864
|
}
|
1204
865
|
}
|
1205
866
|
}
|
1206
867
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
1207
868
|
finally {
|
1208
869
|
try {
|
1209
|
-
if (
|
870
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
1210
871
|
}
|
1211
872
|
finally { if (e_1) throw e_1.error; }
|
1212
873
|
}
|
@@ -1353,25 +1014,12 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1353
1014
|
* @returns Response data for the Directory List Files and Directories operation.
|
1354
1015
|
*/
|
1355
1016
|
async listFilesAndDirectoriesSegment(marker, options = {}) {
|
1356
|
-
const { span, updatedOptions } = createSpan("ShareDirectoryClient-listFilesAndDirectoriesSegment", options);
|
1357
1017
|
if (options.prefix === "") {
|
1358
1018
|
options.prefix = undefined;
|
1359
1019
|
}
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
return wrappedResponse;
|
1364
|
-
}
|
1365
|
-
catch (e) {
|
1366
|
-
span.setStatus({
|
1367
|
-
code: SpanStatusCode.ERROR,
|
1368
|
-
message: e.message,
|
1369
|
-
});
|
1370
|
-
throw e;
|
1371
|
-
}
|
1372
|
-
finally {
|
1373
|
-
span.end();
|
1374
|
-
}
|
1020
|
+
return tracingClient.withSpan("ShareDirectoryClient-listFilesAndDirectoriesSegment", options, async (updatedOptions) => {
|
1021
|
+
return assertResponse(await this.context.listFilesAndDirectoriesSegment(Object.assign(Object.assign({}, updatedOptions), { marker })));
|
1022
|
+
});
|
1375
1023
|
}
|
1376
1024
|
/**
|
1377
1025
|
* Returns an AsyncIterableIterator for {@link DirectoryListHandlesResponse}
|
@@ -1402,22 +1050,29 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1402
1050
|
*/
|
1403
1051
|
listHandleItems(options = {}) {
|
1404
1052
|
return __asyncGenerator(this, arguments, function* listHandleItems_1() {
|
1405
|
-
var e_2,
|
1053
|
+
var _a, e_2, _b, _c;
|
1406
1054
|
let marker;
|
1407
1055
|
try {
|
1408
|
-
for (var
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1056
|
+
for (var _d = true, _e = __asyncValues(this.iterateHandleSegments(marker, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
1057
|
+
_c = _f.value;
|
1058
|
+
_d = false;
|
1059
|
+
try {
|
1060
|
+
const listHandlesResponse = _c;
|
1061
|
+
if (listHandlesResponse.handleList) {
|
1062
|
+
for (const handle of listHandlesResponse.handleList) {
|
1063
|
+
yield yield __await(handle);
|
1064
|
+
}
|
1413
1065
|
}
|
1414
1066
|
}
|
1067
|
+
finally {
|
1068
|
+
_d = true;
|
1069
|
+
}
|
1415
1070
|
}
|
1416
1071
|
}
|
1417
1072
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
1418
1073
|
finally {
|
1419
1074
|
try {
|
1420
|
-
if (
|
1075
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
1421
1076
|
}
|
1422
1077
|
finally { if (e_2) throw e_2.error; }
|
1423
1078
|
}
|
@@ -1535,28 +1190,16 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1535
1190
|
* @param options -
|
1536
1191
|
*/
|
1537
1192
|
async listHandlesSegment(marker, options = {}) {
|
1538
|
-
|
1539
|
-
try {
|
1193
|
+
return tracingClient.withSpan("ShareDirectoryClient-listHandlesSegment", options, async (updatedOptions) => {
|
1540
1194
|
marker = marker === "" ? undefined : marker;
|
1541
|
-
const response = await this.context.listHandles(Object.assign(Object.assign(
|
1195
|
+
const response = assertResponse(await this.context.listHandles(Object.assign(Object.assign({}, updatedOptions), { marker })));
|
1542
1196
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
1543
1197
|
// response.handleList is an empty string
|
1544
1198
|
if (response.handleList === "") {
|
1545
1199
|
response.handleList = undefined;
|
1546
1200
|
}
|
1547
|
-
|
1548
|
-
|
1549
|
-
}
|
1550
|
-
catch (e) {
|
1551
|
-
span.setStatus({
|
1552
|
-
code: SpanStatusCode.ERROR,
|
1553
|
-
message: e.message,
|
1554
|
-
});
|
1555
|
-
throw e;
|
1556
|
-
}
|
1557
|
-
finally {
|
1558
|
-
span.end();
|
1559
|
-
}
|
1201
|
+
return response;
|
1202
|
+
});
|
1560
1203
|
}
|
1561
1204
|
/**
|
1562
1205
|
* Force close all handles for a directory.
|
@@ -1570,25 +1213,14 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1570
1213
|
* @param options -
|
1571
1214
|
*/
|
1572
1215
|
async forceCloseHandlesSegment(marker, options = {}) {
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
}
|
1582
|
-
catch (e) {
|
1583
|
-
span.setStatus({
|
1584
|
-
code: SpanStatusCode.ERROR,
|
1585
|
-
message: e.message,
|
1586
|
-
});
|
1587
|
-
throw e;
|
1588
|
-
}
|
1589
|
-
finally {
|
1590
|
-
span.end();
|
1591
|
-
}
|
1216
|
+
return tracingClient.withSpan("ShareDirectoryClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
|
1217
|
+
var _a, _b;
|
1218
|
+
if (marker === "") {
|
1219
|
+
marker = undefined;
|
1220
|
+
}
|
1221
|
+
const rawResponse = assertResponse(await this.context.forceCloseHandles("*", Object.assign(Object.assign({}, updatedOptions), { marker })));
|
1222
|
+
return Object.assign(Object.assign({}, rawResponse), { closedHandlesCount: (_a = rawResponse.numberOfHandlesClosed) !== null && _a !== void 0 ? _a : 0, closeFailureCount: (_b = rawResponse.numberOfHandlesFailedToClose) !== null && _b !== void 0 ? _b : 0 });
|
1223
|
+
});
|
1592
1224
|
}
|
1593
1225
|
/**
|
1594
1226
|
* Force close all handles for a directory.
|
@@ -1597,8 +1229,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1597
1229
|
* @param options -
|
1598
1230
|
*/
|
1599
1231
|
async forceCloseAllHandles(options = {}) {
|
1600
|
-
|
1601
|
-
try {
|
1232
|
+
return tracingClient.withSpan("ShareDirectoryClient-forceCloseAllHandles", options, async (updatedOptions) => {
|
1602
1233
|
let handlesClosed = 0;
|
1603
1234
|
let numberOfHandlesFailedToClose = 0;
|
1604
1235
|
let marker = "";
|
@@ -1612,18 +1243,11 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1612
1243
|
numberOfHandlesFailedToClose += response.closeFailureCount;
|
1613
1244
|
}
|
1614
1245
|
} while (marker);
|
1615
|
-
return {
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
message: e.message,
|
1621
|
-
});
|
1622
|
-
throw e;
|
1623
|
-
}
|
1624
|
-
finally {
|
1625
|
-
span.end();
|
1626
|
-
}
|
1246
|
+
return {
|
1247
|
+
closedHandlesCount: handlesClosed,
|
1248
|
+
closeFailureCount: numberOfHandlesFailedToClose,
|
1249
|
+
};
|
1250
|
+
});
|
1627
1251
|
}
|
1628
1252
|
/**
|
1629
1253
|
* Force close a specific handle for a directory.
|
@@ -1636,27 +1260,16 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1636
1260
|
* @param options -
|
1637
1261
|
*/
|
1638
1262
|
async forceCloseHandle(handleId, options = {}) {
|
1639
|
-
|
1640
|
-
try {
|
1263
|
+
return tracingClient.withSpan("ShareDirectoryClient-forceCloseHandle", options, async (updatedOptions) => {
|
1641
1264
|
if (handleId === "*") {
|
1642
1265
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
1643
1266
|
}
|
1644
|
-
const rawResponse = await this.context.forceCloseHandles(handleId,
|
1267
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, updatedOptions);
|
1645
1268
|
const response = rawResponse;
|
1646
1269
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
1647
1270
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
1648
1271
|
return response;
|
1649
|
-
}
|
1650
|
-
catch (e) {
|
1651
|
-
span.setStatus({
|
1652
|
-
code: SpanStatusCode.ERROR,
|
1653
|
-
message: e.message,
|
1654
|
-
});
|
1655
|
-
throw e;
|
1656
|
-
}
|
1657
|
-
finally {
|
1658
|
-
span.end();
|
1659
|
-
}
|
1272
|
+
});
|
1660
1273
|
}
|
1661
1274
|
/**
|
1662
1275
|
* Renames a directory.
|
@@ -1676,7 +1289,6 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1676
1289
|
* ```
|
1677
1290
|
*/
|
1678
1291
|
async rename(destinationPath, options = {}) {
|
1679
|
-
const { span, updatedOptions } = createSpan("ShareDirectoryClient-rename", options);
|
1680
1292
|
const split = destinationPath.split("?");
|
1681
1293
|
let destinationUrl;
|
1682
1294
|
if (split.length === 2) {
|
@@ -1693,9 +1305,9 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1693
1305
|
else {
|
1694
1306
|
throw new RangeError("Destination path should not contain more than one query string");
|
1695
1307
|
}
|
1696
|
-
const destDirectory = new ShareDirectoryClient(destinationUrl, this.pipeline
|
1697
|
-
|
1698
|
-
const response = await destDirectory.context.rename(this.url, Object.assign(Object.assign(
|
1308
|
+
const destDirectory = new ShareDirectoryClient(destinationUrl, this.pipeline);
|
1309
|
+
return tracingClient.withSpan("ShareDirectoryClient-rename", options, async (updatedOptions) => {
|
1310
|
+
const response = assertResponse(await destDirectory.context.rename(this.url, Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
1699
1311
|
? {
|
1700
1312
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
1701
1313
|
}
|
@@ -1703,28 +1315,36 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1703
1315
|
? {
|
1704
1316
|
destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
|
1705
1317
|
}
|
1706
|
-
: undefined })
|
1318
|
+
: undefined })));
|
1707
1319
|
return {
|
1708
1320
|
destinationDirectoryClient: destDirectory,
|
1709
1321
|
directoryRenameResponse: response,
|
1710
1322
|
};
|
1711
|
-
}
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1323
|
+
});
|
1324
|
+
}
|
1325
|
+
}
|
1326
|
+
/**
|
1327
|
+
* A ShareFileClient represents a URL to an Azure Storage file.
|
1328
|
+
*/
|
1329
|
+
export class ShareFileClient extends StorageClient {
|
1330
|
+
/**
|
1331
|
+
* The share name corresponding to this file client
|
1332
|
+
*/
|
1333
|
+
get shareName() {
|
1334
|
+
return this._shareName;
|
1335
|
+
}
|
1336
|
+
/**
|
1337
|
+
* The full path of the file
|
1338
|
+
*/
|
1339
|
+
get path() {
|
1340
|
+
return this._path;
|
1341
|
+
}
|
1342
|
+
/**
|
1343
|
+
* The name of the file
|
1344
|
+
*/
|
1345
|
+
get name() {
|
1346
|
+
return this._name;
|
1722
1347
|
}
|
1723
|
-
}
|
1724
|
-
/**
|
1725
|
-
* A ShareFileClient represents a URL to an Azure Storage file.
|
1726
|
-
*/
|
1727
|
-
export class ShareFileClient extends StorageClient {
|
1728
1348
|
constructor(url, credentialOrPipeline,
|
1729
1349
|
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
1730
1350
|
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
|
@@ -1733,8 +1353,7 @@ export class ShareFileClient extends StorageClient {
|
|
1733
1353
|
if (credentialOrPipeline instanceof Pipeline) {
|
1734
1354
|
pipeline = credentialOrPipeline;
|
1735
1355
|
}
|
1736
|
-
else if (credentialOrPipeline instanceof Credential
|
1737
|
-
isTokenCredential(credentialOrPipeline)) {
|
1356
|
+
else if (credentialOrPipeline instanceof Credential) {
|
1738
1357
|
pipeline = newPipeline(credentialOrPipeline, options);
|
1739
1358
|
}
|
1740
1359
|
else {
|
@@ -1747,26 +1366,7 @@ export class ShareFileClient extends StorageClient {
|
|
1747
1366
|
shareName: this._shareName,
|
1748
1367
|
path: this._path,
|
1749
1368
|
} = getShareNameAndPathFromUrl(this.url));
|
1750
|
-
this.
|
1751
|
-
this.context = new File(this.storageClientContext);
|
1752
|
-
}
|
1753
|
-
/**
|
1754
|
-
* The share name corresponding to this file client
|
1755
|
-
*/
|
1756
|
-
get shareName() {
|
1757
|
-
return this._shareName;
|
1758
|
-
}
|
1759
|
-
/**
|
1760
|
-
* The full path of the file
|
1761
|
-
*/
|
1762
|
-
get path() {
|
1763
|
-
return this._path;
|
1764
|
-
}
|
1765
|
-
/**
|
1766
|
-
* The name of the file
|
1767
|
-
*/
|
1768
|
-
get name() {
|
1769
|
-
return this._name;
|
1369
|
+
this.context = this.storageClientContext.file;
|
1770
1370
|
}
|
1771
1371
|
/**
|
1772
1372
|
* Creates a new ShareFileClient object identical to the source but with the specified share snapshot timestamp.
|
@@ -1776,7 +1376,7 @@ export class ShareFileClient extends StorageClient {
|
|
1776
1376
|
* @returns A new ShareFileClient object identical to the source but with the specified share snapshot timestamp.
|
1777
1377
|
*/
|
1778
1378
|
withShareSnapshot(shareSnapshot) {
|
1779
|
-
return new ShareFileClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, shareSnapshot.length === 0 ? undefined : shareSnapshot), this.pipeline
|
1379
|
+
return new ShareFileClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, shareSnapshot.length === 0 ? undefined : shareSnapshot), this.pipeline);
|
1780
1380
|
}
|
1781
1381
|
/**
|
1782
1382
|
* Creates a new file or replaces a file. Note it only initializes the file with no content.
|
@@ -1801,27 +1401,16 @@ export class ShareFileClient extends StorageClient {
|
|
1801
1401
|
* ```
|
1802
1402
|
*/
|
1803
1403
|
async create(size, options = {}) {
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
}
|
1815
|
-
catch (e) {
|
1816
|
-
span.setStatus({
|
1817
|
-
code: SpanStatusCode.ERROR,
|
1818
|
-
message: e.message,
|
1819
|
-
});
|
1820
|
-
throw e;
|
1821
|
-
}
|
1822
|
-
finally {
|
1823
|
-
span.end();
|
1824
|
-
}
|
1404
|
+
if (size < 0 || size > FILE_MAX_SIZE_BYTES) {
|
1405
|
+
throw new RangeError(`File size must >= 0 and < ${FILE_MAX_SIZE_BYTES}.`);
|
1406
|
+
}
|
1407
|
+
options = validateAndSetDefaultsForFileAndDirectoryCreateCommonOptions(options);
|
1408
|
+
options.fileHttpHeaders = options.fileHttpHeaders || {};
|
1409
|
+
return tracingClient.withSpan("ShareFileClient-create", options, async (updatedOptions) => {
|
1410
|
+
return assertResponse(await this.context.create(size, updatedOptions.fileAttributes
|
1411
|
+
? fileAttributesToString(updatedOptions.fileAttributes)
|
1412
|
+
: FileAttributesNone, Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) })));
|
1413
|
+
});
|
1825
1414
|
}
|
1826
1415
|
/**
|
1827
1416
|
* Reads or downloads a file from the system, including its metadata and properties.
|
@@ -1885,15 +1474,14 @@ export class ShareFileClient extends StorageClient {
|
|
1885
1474
|
* ```
|
1886
1475
|
*/
|
1887
1476
|
async download(offset = 0, count, options = {}) {
|
1888
|
-
|
1889
|
-
|
1890
|
-
if (options.rangeGetContentMD5 && offset === 0 && count === undefined) {
|
1477
|
+
return tracingClient.withSpan("ShareFileClient-download", options, async (updatedOptions) => {
|
1478
|
+
if (updatedOptions.rangeGetContentMD5 && offset === 0 && count === undefined) {
|
1891
1479
|
throw new RangeError(`rangeGetContentMD5 only works with partial data downloading`);
|
1892
1480
|
}
|
1893
1481
|
const downloadFullFile = offset === 0 && !count;
|
1894
|
-
const res = await this.context.download(Object.assign(Object.assign({
|
1895
|
-
onDownloadProgress: isNode ? undefined :
|
1896
|
-
}, range: downloadFullFile ? undefined : rangeToString({ offset, count })
|
1482
|
+
const res = assertResponse(await this.context.download(Object.assign(Object.assign({}, updatedOptions), { requestOptions: {
|
1483
|
+
onDownloadProgress: isNode ? undefined : updatedOptions.onProgress, // for Node.js, progress is reported by RetriableReadableStream
|
1484
|
+
}, range: downloadFullFile ? undefined : rangeToString({ offset, count }) })));
|
1897
1485
|
// Return browser response immediately
|
1898
1486
|
if (!isNode) {
|
1899
1487
|
return res;
|
@@ -1903,9 +1491,9 @@ export class ShareFileClient extends StorageClient {
|
|
1903
1491
|
// bundlers may try to bundle following code and "FileReadResponse.ts".
|
1904
1492
|
// In this case, "FileDownloadResponse.browser.ts" will be used as a shim of "FileDownloadResponse.ts"
|
1905
1493
|
// The config is in package.json "browser" field
|
1906
|
-
if (
|
1494
|
+
if (updatedOptions.maxRetryRequests === undefined || updatedOptions.maxRetryRequests < 0) {
|
1907
1495
|
// TODO: Default value or make it a required parameter?
|
1908
|
-
|
1496
|
+
updatedOptions.maxRetryRequests = DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS;
|
1909
1497
|
}
|
1910
1498
|
if (res.contentLength === undefined) {
|
1911
1499
|
throw new RangeError(`File download response doesn't contain valid content length header`);
|
@@ -1923,27 +1511,16 @@ export class ShareFileClient extends StorageClient {
|
|
1923
1511
|
// chunkDownloadOptions.range
|
1924
1512
|
// }, options: ${JSON.stringify(chunkDownloadOptions)}`
|
1925
1513
|
// );
|
1926
|
-
const downloadRes = await this.context.download(Object.assign(Object.assign({
|
1514
|
+
const downloadRes = await this.context.download(Object.assign(Object.assign({}, updatedOptions), updatedDownloadOptions));
|
1927
1515
|
if (!(downloadRes.etag === res.etag)) {
|
1928
1516
|
throw new Error("File has been modified concurrently");
|
1929
1517
|
}
|
1930
1518
|
return downloadRes.readableStreamBody;
|
1931
1519
|
}, offset, res.contentLength, {
|
1932
|
-
|
1933
|
-
|
1934
|
-
onProgress: options.onProgress,
|
1935
|
-
});
|
1936
|
-
}
|
1937
|
-
catch (e) {
|
1938
|
-
span.setStatus({
|
1939
|
-
code: SpanStatusCode.ERROR,
|
1940
|
-
message: e.message,
|
1520
|
+
maxRetryRequests: updatedOptions.maxRetryRequests,
|
1521
|
+
onProgress: updatedOptions.onProgress,
|
1941
1522
|
});
|
1942
|
-
|
1943
|
-
}
|
1944
|
-
finally {
|
1945
|
-
span.end();
|
1946
|
-
}
|
1523
|
+
});
|
1947
1524
|
}
|
1948
1525
|
/**
|
1949
1526
|
* Returns true if the specified file exists; false otherwise.
|
@@ -1955,31 +1532,18 @@ export class ShareFileClient extends StorageClient {
|
|
1955
1532
|
* @param options - options to Exists operation.
|
1956
1533
|
*/
|
1957
1534
|
async exists(options = {}) {
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
|
1962
|
-
tracingOptions: Object.assign(Object.assign({}, options.tracingOptions), convertTracingToRequestOptionsBase(updatedOptions)),
|
1963
|
-
});
|
1964
|
-
return true;
|
1965
|
-
}
|
1966
|
-
catch (e) {
|
1967
|
-
if (e.statusCode === 404) {
|
1968
|
-
span.setStatus({
|
1969
|
-
code: SpanStatusCode.ERROR,
|
1970
|
-
message: "Expected exception when checking file existence",
|
1971
|
-
});
|
1972
|
-
return false;
|
1535
|
+
return tracingClient.withSpan("ShareFileClient-exists", options, async (updatedOptions) => {
|
1536
|
+
try {
|
1537
|
+
await this.getProperties(updatedOptions);
|
1538
|
+
return true;
|
1973
1539
|
}
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
span.end();
|
1982
|
-
}
|
1540
|
+
catch (e) {
|
1541
|
+
if (e.statusCode === 404) {
|
1542
|
+
return false;
|
1543
|
+
}
|
1544
|
+
throw e;
|
1545
|
+
}
|
1546
|
+
});
|
1983
1547
|
}
|
1984
1548
|
/**
|
1985
1549
|
* Returns all user-defined metadata, standard HTTP properties, and system properties
|
@@ -1990,20 +1554,9 @@ export class ShareFileClient extends StorageClient {
|
|
1990
1554
|
* @returns Response data for the File Get Properties operation.
|
1991
1555
|
*/
|
1992
1556
|
async getProperties(options = {}) {
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
}
|
1997
|
-
catch (e) {
|
1998
|
-
span.setStatus({
|
1999
|
-
code: SpanStatusCode.ERROR,
|
2000
|
-
message: e.message,
|
2001
|
-
});
|
2002
|
-
throw e;
|
2003
|
-
}
|
2004
|
-
finally {
|
2005
|
-
span.end();
|
2006
|
-
}
|
1557
|
+
return tracingClient.withSpan("ShareFileClient-getProperties", options, async (updatedOptions) => {
|
1558
|
+
return assertResponse(await this.context.getProperties(updatedOptions));
|
1559
|
+
});
|
2007
1560
|
}
|
2008
1561
|
/**
|
2009
1562
|
* Sets properties on the file.
|
@@ -2015,24 +1568,13 @@ export class ShareFileClient extends StorageClient {
|
|
2015
1568
|
* existing values will be preserved.
|
2016
1569
|
*/
|
2017
1570
|
async setProperties(properties = {}) {
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
2025
|
-
}
|
2026
|
-
catch (e) {
|
2027
|
-
span.setStatus({
|
2028
|
-
code: SpanStatusCode.ERROR,
|
2029
|
-
message: e.message,
|
2030
|
-
});
|
2031
|
-
throw e;
|
2032
|
-
}
|
2033
|
-
finally {
|
2034
|
-
span.end();
|
2035
|
-
}
|
1571
|
+
properties = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(properties);
|
1572
|
+
properties.fileHttpHeaders = properties.fileHttpHeaders || {};
|
1573
|
+
return tracingClient.withSpan("ShareFileClient-setProperties", properties, async (updatedOptions) => {
|
1574
|
+
return assertResponse(await this.context.setHttpHeaders(updatedOptions.fileAttributes
|
1575
|
+
? fileAttributesToString(updatedOptions.fileAttributes)
|
1576
|
+
: FileAttributesPreserve, Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) })));
|
1577
|
+
});
|
2036
1578
|
}
|
2037
1579
|
/**
|
2038
1580
|
* Removes the file from the storage account.
|
@@ -2052,20 +1594,9 @@ export class ShareFileClient extends StorageClient {
|
|
2052
1594
|
* @returns Response data for the File Delete operation.
|
2053
1595
|
*/
|
2054
1596
|
async delete(options = {}) {
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
}
|
2059
|
-
catch (e) {
|
2060
|
-
span.setStatus({
|
2061
|
-
code: SpanStatusCode.ERROR,
|
2062
|
-
message: e.message,
|
2063
|
-
});
|
2064
|
-
throw e;
|
2065
|
-
}
|
2066
|
-
finally {
|
2067
|
-
span.end();
|
2068
|
-
}
|
1597
|
+
return tracingClient.withSpan("ShareFileClient-delete", options, async (updatedOptions) => {
|
1598
|
+
return assertResponse(await this.context.delete(updatedOptions));
|
1599
|
+
});
|
2069
1600
|
}
|
2070
1601
|
/**
|
2071
1602
|
* Removes the file from the storage account if it exists.
|
@@ -2084,30 +1615,20 @@ export class ShareFileClient extends StorageClient {
|
|
2084
1615
|
* @param options -
|
2085
1616
|
*/
|
2086
1617
|
async deleteIfExists(options = {}) {
|
2087
|
-
|
2088
|
-
|
2089
|
-
|
2090
|
-
|
2091
|
-
|
2092
|
-
}
|
2093
|
-
catch (e) {
|
2094
|
-
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceNotFound" ||
|
2095
|
-
((_b = e.details) === null || _b === void 0 ? void 0 : _b.errorCode) === "ParentNotFound") {
|
2096
|
-
span.setStatus({
|
2097
|
-
code: SpanStatusCode.ERROR,
|
2098
|
-
message: "Expected exception when deleting a file only if it exists.",
|
2099
|
-
});
|
2100
|
-
return Object.assign(Object.assign({ succeeded: false }, (_c = e.response) === null || _c === void 0 ? void 0 : _c.parsedHeaders), { _response: e.response });
|
1618
|
+
return tracingClient.withSpan("ShareFileClient-deleteIfExists", options, async (updatedOptions) => {
|
1619
|
+
var _a, _b, _c;
|
1620
|
+
try {
|
1621
|
+
const res = await this.delete(updatedOptions);
|
1622
|
+
return Object.assign({ succeeded: true }, res);
|
2101
1623
|
}
|
2102
|
-
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
2106
|
-
|
2107
|
-
|
2108
|
-
|
2109
|
-
|
2110
|
-
}
|
1624
|
+
catch (e) {
|
1625
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceNotFound" ||
|
1626
|
+
((_b = e.details) === null || _b === void 0 ? void 0 : _b.errorCode) === "ParentNotFound") {
|
1627
|
+
return Object.assign(Object.assign({ succeeded: false }, (_c = e.response) === null || _c === void 0 ? void 0 : _c.parsedHeaders), { _response: e.response });
|
1628
|
+
}
|
1629
|
+
throw e;
|
1630
|
+
}
|
1631
|
+
});
|
2111
1632
|
}
|
2112
1633
|
/**
|
2113
1634
|
* Sets HTTP headers on the file.
|
@@ -2122,24 +1643,13 @@ export class ShareFileClient extends StorageClient {
|
|
2122
1643
|
* @returns Response data for the File Set HTTP Headers operation.
|
2123
1644
|
*/
|
2124
1645
|
async setHttpHeaders(fileHttpHeaders = {}, options = {}) {
|
2125
|
-
|
2126
|
-
|
2127
|
-
|
2128
|
-
|
2129
|
-
|
2130
|
-
|
2131
|
-
|
2132
|
-
}
|
2133
|
-
catch (e) {
|
2134
|
-
span.setStatus({
|
2135
|
-
code: SpanStatusCode.ERROR,
|
2136
|
-
message: e.message,
|
2137
|
-
});
|
2138
|
-
throw e;
|
2139
|
-
}
|
2140
|
-
finally {
|
2141
|
-
span.end();
|
2142
|
-
}
|
1646
|
+
// FileAttributes, filePermission, createTime, lastWriteTime will all be preserved
|
1647
|
+
options = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(options);
|
1648
|
+
return tracingClient.withSpan("ShareFileClient-setHTTPHeaders", options, async (updatedOptions) => {
|
1649
|
+
return assertResponse(await this.context.setHttpHeaders(updatedOptions.fileAttributes
|
1650
|
+
? fileAttributesToString(updatedOptions.fileAttributes)
|
1651
|
+
: FileAttributesPreserve, Object.assign(Object.assign({}, updatedOptions), { fileHttpHeaders, fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime), fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime) })));
|
1652
|
+
});
|
2143
1653
|
}
|
2144
1654
|
/**
|
2145
1655
|
* Resize file.
|
@@ -2153,25 +1663,14 @@ export class ShareFileClient extends StorageClient {
|
|
2153
1663
|
* @returns Response data for the File Set HTTP Headers operation.
|
2154
1664
|
*/
|
2155
1665
|
async resize(length, options = {}) {
|
2156
|
-
|
2157
|
-
|
2158
|
-
if (length < 0) {
|
2159
|
-
throw new RangeError(`Size cannot less than 0 when resizing file.`);
|
2160
|
-
}
|
2161
|
-
// FileAttributes, filePermission, createTime, lastWriteTime will all be preserved.
|
2162
|
-
options = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(options);
|
2163
|
-
return await this.context.setHttpHeaders(fileAttributesToString(options.fileAttributes), Object.assign(Object.assign({ abortSignal: options.abortSignal, fileContentLength: length, filePermission: options.filePermission, filePermissionKey: options.filePermissionKey, leaseAccessConditions: options.leaseAccessConditions, fileChangeOn: fileChangeTimeToString(options.changeTime), fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime) }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
|
2164
|
-
}
|
2165
|
-
catch (e) {
|
2166
|
-
span.setStatus({
|
2167
|
-
code: SpanStatusCode.ERROR,
|
2168
|
-
message: e.message,
|
2169
|
-
});
|
2170
|
-
throw e;
|
2171
|
-
}
|
2172
|
-
finally {
|
2173
|
-
span.end();
|
1666
|
+
if (length < 0) {
|
1667
|
+
throw new RangeError(`Size cannot less than 0 when resizing file.`);
|
2174
1668
|
}
|
1669
|
+
// FileAttributes, filePermission, createTime, lastWriteTime will all be preserved.
|
1670
|
+
options = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(options);
|
1671
|
+
return tracingClient.withSpan("ShareFileClient-resize", options, async (updatedOptions) => {
|
1672
|
+
return assertResponse(await this.context.setHttpHeaders(fileAttributesToString(updatedOptions.fileAttributes), Object.assign(Object.assign({}, updatedOptions), { fileContentLength: length, fileChangeOn: fileChangeTimeToString(options.changeTime), fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime) })));
|
1673
|
+
});
|
2175
1674
|
}
|
2176
1675
|
/**
|
2177
1676
|
* Updates user-defined metadata for the specified file.
|
@@ -2185,20 +1684,9 @@ export class ShareFileClient extends StorageClient {
|
|
2185
1684
|
* @returns Response data for the File Set Metadata operation.
|
2186
1685
|
*/
|
2187
1686
|
async setMetadata(metadata = {}, options = {}) {
|
2188
|
-
|
2189
|
-
|
2190
|
-
|
2191
|
-
}
|
2192
|
-
catch (e) {
|
2193
|
-
span.setStatus({
|
2194
|
-
code: SpanStatusCode.ERROR,
|
2195
|
-
message: e.message,
|
2196
|
-
});
|
2197
|
-
throw e;
|
2198
|
-
}
|
2199
|
-
finally {
|
2200
|
-
span.end();
|
2201
|
-
}
|
1687
|
+
return tracingClient.withSpan("ShareFileClient-setMetadata", options, async (updatedOptions) => {
|
1688
|
+
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign({}, updatedOptions), { metadata })));
|
1689
|
+
});
|
2202
1690
|
}
|
2203
1691
|
/**
|
2204
1692
|
* Upload a range of bytes to a file. This operation can only be called on an existing file.
|
@@ -2228,8 +1716,7 @@ export class ShareFileClient extends StorageClient {
|
|
2228
1716
|
* ```
|
2229
1717
|
*/
|
2230
1718
|
async uploadRange(body, offset, contentLength, options = {}) {
|
2231
|
-
|
2232
|
-
try {
|
1719
|
+
return tracingClient.withSpan("ShareFileClient-uploadRange", options, async (updatedOptions) => {
|
2233
1720
|
if (offset < 0) {
|
2234
1721
|
throw new RangeError(`offset must be >= 0`);
|
2235
1722
|
}
|
@@ -2239,20 +1726,10 @@ export class ShareFileClient extends StorageClient {
|
|
2239
1726
|
if (contentLength > FILE_RANGE_MAX_SIZE_BYTES) {
|
2240
1727
|
throw new RangeError(`offset must be < ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
2241
1728
|
}
|
2242
|
-
return await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "update", contentLength, Object.assign(Object.assign(
|
2243
|
-
onUploadProgress:
|
2244
|
-
}, body
|
2245
|
-
}
|
2246
|
-
catch (e) {
|
2247
|
-
span.setStatus({
|
2248
|
-
code: SpanStatusCode.ERROR,
|
2249
|
-
message: e.message,
|
2250
|
-
});
|
2251
|
-
throw e;
|
2252
|
-
}
|
2253
|
-
finally {
|
2254
|
-
span.end();
|
2255
|
-
}
|
1729
|
+
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "update", contentLength, Object.assign(Object.assign({}, updatedOptions), { requestOptions: {
|
1730
|
+
onUploadProgress: updatedOptions.onProgress,
|
1731
|
+
}, body })));
|
1732
|
+
});
|
2256
1733
|
}
|
2257
1734
|
/**
|
2258
1735
|
* Upload a range of bytes to a file where the contents are read from a another file's URL.
|
@@ -2265,26 +1742,15 @@ export class ShareFileClient extends StorageClient {
|
|
2265
1742
|
* @param options - Options to configure File - Upload Range from URL operation.
|
2266
1743
|
*/
|
2267
1744
|
async uploadRangeFromURL(sourceURL, sourceOffset, destOffset, count, options = {}) {
|
2268
|
-
|
2269
|
-
try {
|
1745
|
+
return tracingClient.withSpan("ShareFileClient-uploadRangeFromURL", options, async (updatedOptions) => {
|
2270
1746
|
if (sourceOffset < 0 || destOffset < 0) {
|
2271
1747
|
throw new RangeError(`sourceOffset and destOffset must be >= 0`);
|
2272
1748
|
}
|
2273
1749
|
if (count <= 0 || count > FILE_RANGE_MAX_SIZE_BYTES) {
|
2274
1750
|
throw new RangeError(`count must be > 0 and <= ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
2275
1751
|
}
|
2276
|
-
return await this.context.uploadRangeFromURL(rangeToString({ offset: destOffset, count }), sourceURL, 0, Object.assign(Object.assign(
|
2277
|
-
}
|
2278
|
-
catch (e) {
|
2279
|
-
span.setStatus({
|
2280
|
-
code: SpanStatusCode.ERROR,
|
2281
|
-
message: e.message,
|
2282
|
-
});
|
2283
|
-
throw e;
|
2284
|
-
}
|
2285
|
-
finally {
|
2286
|
-
span.end();
|
2287
|
-
}
|
1752
|
+
return assertResponse(await this.context.uploadRangeFromURL(rangeToString({ offset: destOffset, count }), sourceURL, 0, Object.assign(Object.assign({}, updatedOptions), { sourceRange: rangeToString({ offset: sourceOffset, count }), sourceModifiedAccessConditions: updatedOptions.sourceConditions, copySourceAuthorization: httpAuthorizationToString(updatedOptions.sourceAuthorization) })));
|
1753
|
+
});
|
2288
1754
|
}
|
2289
1755
|
/**
|
2290
1756
|
* Clears the specified range and
|
@@ -2295,23 +1761,12 @@ export class ShareFileClient extends StorageClient {
|
|
2295
1761
|
* @param options - Options to File Clear Range operation.
|
2296
1762
|
*/
|
2297
1763
|
async clearRange(offset, contentLength, options = {}) {
|
2298
|
-
|
2299
|
-
try {
|
1764
|
+
return tracingClient.withSpan("ShareFileClient-clearRange", options, async (updatedOptions) => {
|
2300
1765
|
if (offset < 0 || contentLength <= 0) {
|
2301
1766
|
throw new RangeError(`offset must >= 0 and contentLength must be > 0`);
|
2302
1767
|
}
|
2303
|
-
return await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "clear", 0,
|
2304
|
-
}
|
2305
|
-
catch (e) {
|
2306
|
-
span.setStatus({
|
2307
|
-
code: SpanStatusCode.ERROR,
|
2308
|
-
message: e.message,
|
2309
|
-
});
|
2310
|
-
throw e;
|
2311
|
-
}
|
2312
|
-
finally {
|
2313
|
-
span.end();
|
2314
|
-
}
|
1768
|
+
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "clear", 0, updatedOptions));
|
1769
|
+
});
|
2315
1770
|
}
|
2316
1771
|
/**
|
2317
1772
|
* Returns the list of valid ranges for a file.
|
@@ -2319,25 +1774,14 @@ export class ShareFileClient extends StorageClient {
|
|
2319
1774
|
* @param options - Options to File Get range List operation.
|
2320
1775
|
*/
|
2321
1776
|
async getRangeList(options = {}) {
|
2322
|
-
|
2323
|
-
|
2324
|
-
const originalResponse = await this.context.getRangeList(Object.assign(Object.assign({ abortSignal: options.abortSignal, range: options.range ? rangeToString(options.range) : undefined, leaseAccessConditions: options.leaseAccessConditions }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
|
1777
|
+
return tracingClient.withSpan("ShareFileClient-getRangeList", options, async (updatedOptions) => {
|
1778
|
+
const originalResponse = assertResponse(await this.context.getRangeList(Object.assign(Object.assign({}, updatedOptions), { range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined })));
|
2325
1779
|
// Only returns ranges, ignoring clearRanges.
|
2326
1780
|
const parsedBody = originalResponse._response.parsedBody.ranges
|
2327
1781
|
? originalResponse._response.parsedBody.ranges
|
2328
1782
|
: [];
|
2329
1783
|
return Object.assign(Object.assign({}, originalResponse), { _response: Object.assign(Object.assign({}, originalResponse._response), { parsedBody }), rangeList: originalResponse.ranges ? originalResponse.ranges : [] });
|
2330
|
-
}
|
2331
|
-
catch (e) {
|
2332
|
-
span.setStatus({
|
2333
|
-
code: SpanStatusCode.ERROR,
|
2334
|
-
message: e.message,
|
2335
|
-
});
|
2336
|
-
throw e;
|
2337
|
-
}
|
2338
|
-
finally {
|
2339
|
-
span.end();
|
2340
|
-
}
|
1784
|
+
});
|
2341
1785
|
}
|
2342
1786
|
/**
|
2343
1787
|
* Returns the list of ranges that differ between a previous share snapshot and this file.
|
@@ -2346,20 +1790,9 @@ export class ShareFileClient extends StorageClient {
|
|
2346
1790
|
* @param options -
|
2347
1791
|
*/
|
2348
1792
|
async getRangeListDiff(prevShareSnapshot, options = {}) {
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
}
|
2353
|
-
catch (e) {
|
2354
|
-
span.setStatus({
|
2355
|
-
code: SpanStatusCode.ERROR,
|
2356
|
-
message: e.message,
|
2357
|
-
});
|
2358
|
-
throw e;
|
2359
|
-
}
|
2360
|
-
finally {
|
2361
|
-
span.end();
|
2362
|
-
}
|
1793
|
+
return tracingClient.withSpan("ShareFileClient-getRangeListDiff", options, async (updatedOptions) => {
|
1794
|
+
return assertResponse(await this.context.getRangeList(Object.assign(Object.assign({}, updatedOptions), { prevsharesnapshot: prevShareSnapshot, range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined })));
|
1795
|
+
});
|
2363
1796
|
}
|
2364
1797
|
/**
|
2365
1798
|
* Copies a blob or file to a destination file within the storage account.
|
@@ -2374,20 +1807,9 @@ export class ShareFileClient extends StorageClient {
|
|
2374
1807
|
* @param options - Options to File Start Copy operation.
|
2375
1808
|
*/
|
2376
1809
|
async startCopyFromURL(copySource, options = {}) {
|
2377
|
-
|
2378
|
-
|
2379
|
-
|
2380
|
-
}
|
2381
|
-
catch (e) {
|
2382
|
-
span.setStatus({
|
2383
|
-
code: SpanStatusCode.ERROR,
|
2384
|
-
message: e.message,
|
2385
|
-
});
|
2386
|
-
throw e;
|
2387
|
-
}
|
2388
|
-
finally {
|
2389
|
-
span.end();
|
2390
|
-
}
|
1810
|
+
return tracingClient.withSpan("ShareFileClient-startCopyFromURL", options, async (updatedOptions) => {
|
1811
|
+
return assertResponse(await this.context.startCopy(copySource, updatedOptions));
|
1812
|
+
});
|
2391
1813
|
}
|
2392
1814
|
/**
|
2393
1815
|
* Aborts a pending Copy File operation, and leaves a destination file with zero length and full
|
@@ -2398,20 +1820,9 @@ export class ShareFileClient extends StorageClient {
|
|
2398
1820
|
* @param options - Options to File Abort Copy From URL operation.
|
2399
1821
|
*/
|
2400
1822
|
async abortCopyFromURL(copyId, options = {}) {
|
2401
|
-
|
2402
|
-
|
2403
|
-
|
2404
|
-
}
|
2405
|
-
catch (e) {
|
2406
|
-
span.setStatus({
|
2407
|
-
code: SpanStatusCode.ERROR,
|
2408
|
-
message: e.message,
|
2409
|
-
});
|
2410
|
-
throw e;
|
2411
|
-
}
|
2412
|
-
finally {
|
2413
|
-
span.end();
|
2414
|
-
}
|
1823
|
+
return tracingClient.withSpan("ShareFileClient-abortCopyFromURL", options, async (updatedOptions) => {
|
1824
|
+
return assertResponse(await this.context.abortCopy(copyId, updatedOptions));
|
1825
|
+
});
|
2415
1826
|
}
|
2416
1827
|
// High Level functions
|
2417
1828
|
/**
|
@@ -2421,8 +1832,7 @@ export class ShareFileClient extends StorageClient {
|
|
2421
1832
|
* @param options -
|
2422
1833
|
*/
|
2423
1834
|
async uploadData(data, options = {}) {
|
2424
|
-
|
2425
|
-
try {
|
1835
|
+
return tracingClient.withSpan("ShareFileClient-uploadData", options, async (updatedOptions) => {
|
2426
1836
|
if (isNode) {
|
2427
1837
|
let buffer;
|
2428
1838
|
if (data instanceof Buffer) {
|
@@ -2441,17 +1851,7 @@ export class ShareFileClient extends StorageClient {
|
|
2441
1851
|
const browserBlob = new Blob([data]);
|
2442
1852
|
return this.uploadSeekableInternal((offset, size) => browserBlob.slice(offset, offset + size), browserBlob.size, updatedOptions);
|
2443
1853
|
}
|
2444
|
-
}
|
2445
|
-
catch (e) {
|
2446
|
-
span.setStatus({
|
2447
|
-
code: SpanStatusCode.ERROR,
|
2448
|
-
message: e.message,
|
2449
|
-
});
|
2450
|
-
throw e;
|
2451
|
-
}
|
2452
|
-
finally {
|
2453
|
-
span.end();
|
2454
|
-
}
|
1854
|
+
});
|
2455
1855
|
}
|
2456
1856
|
/**
|
2457
1857
|
* ONLY AVAILABLE IN BROWSERS.
|
@@ -2464,20 +1864,9 @@ export class ShareFileClient extends StorageClient {
|
|
2464
1864
|
* @param options -
|
2465
1865
|
*/
|
2466
1866
|
async uploadSeekableBlob(blobFactory, size, options = {}) {
|
2467
|
-
|
2468
|
-
try {
|
1867
|
+
return tracingClient.withSpan("ShareFileClient-UploadSeekableBlob", options, async (updatedOptions) => {
|
2469
1868
|
return this.uploadSeekableInternal(blobFactory, size, updatedOptions);
|
2470
|
-
}
|
2471
|
-
catch (e) {
|
2472
|
-
span.setStatus({
|
2473
|
-
code: SpanStatusCode.ERROR,
|
2474
|
-
message: e.message,
|
2475
|
-
});
|
2476
|
-
throw e;
|
2477
|
-
}
|
2478
|
-
finally {
|
2479
|
-
span.end();
|
2480
|
-
}
|
1869
|
+
});
|
2481
1870
|
}
|
2482
1871
|
/**
|
2483
1872
|
* ONLY AVAILABLE IN NODE.JS RUNTIME.
|
@@ -2489,27 +1878,16 @@ export class ShareFileClient extends StorageClient {
|
|
2489
1878
|
* @param options -
|
2490
1879
|
*/
|
2491
1880
|
async uploadFile(filePath, options = {}) {
|
2492
|
-
|
2493
|
-
try {
|
1881
|
+
return tracingClient.withSpan("ShareFileClient-uploadFile", options, async (updatedOptions) => {
|
2494
1882
|
const size = (await fsStat(filePath)).size;
|
2495
|
-
return
|
1883
|
+
return this.uploadSeekableInternal((offset, count) => {
|
2496
1884
|
return () => fsCreateReadStream(filePath, {
|
2497
1885
|
autoClose: true,
|
2498
1886
|
end: count ? offset + count - 1 : Infinity,
|
2499
1887
|
start: offset,
|
2500
1888
|
});
|
2501
1889
|
}, size, updatedOptions);
|
2502
|
-
}
|
2503
|
-
catch (e) {
|
2504
|
-
span.setStatus({
|
2505
|
-
code: SpanStatusCode.ERROR,
|
2506
|
-
message: e.message,
|
2507
|
-
});
|
2508
|
-
throw e;
|
2509
|
-
}
|
2510
|
-
finally {
|
2511
|
-
span.end();
|
2512
|
-
}
|
1890
|
+
});
|
2513
1891
|
}
|
2514
1892
|
/**
|
2515
1893
|
* ONLY AVAILABLE IN NODE.JS RUNTIME.
|
@@ -2525,22 +1903,11 @@ export class ShareFileClient extends StorageClient {
|
|
2525
1903
|
* @param options -
|
2526
1904
|
*/
|
2527
1905
|
async uploadResetableStream(streamFactory, size, options = {}) {
|
2528
|
-
|
2529
|
-
|
2530
|
-
return await this.uploadSeekableInternal((offset, count) => {
|
1906
|
+
return tracingClient.withSpan("ShareFileClient-uploadResetableStream", options, async (updatedOptions) => {
|
1907
|
+
return this.uploadSeekableInternal((offset, count) => {
|
2531
1908
|
return () => streamFactory(offset, count);
|
2532
1909
|
}, size, updatedOptions);
|
2533
|
-
}
|
2534
|
-
catch (e) {
|
2535
|
-
span.setStatus({
|
2536
|
-
code: SpanStatusCode.ERROR,
|
2537
|
-
message: e.message,
|
2538
|
-
});
|
2539
|
-
throw e;
|
2540
|
-
}
|
2541
|
-
finally {
|
2542
|
-
span.end();
|
2543
|
-
}
|
1910
|
+
});
|
2544
1911
|
}
|
2545
1912
|
/**
|
2546
1913
|
*
|
@@ -2550,8 +1917,7 @@ export class ShareFileClient extends StorageClient {
|
|
2550
1917
|
* @param options -
|
2551
1918
|
*/
|
2552
1919
|
async uploadSeekableInternal(bodyFactory, size, options = {}) {
|
2553
|
-
|
2554
|
-
try {
|
1920
|
+
return tracingClient.withSpan("ShareFileClient-uploadSeekableInternal", options, async (updatedOptions) => {
|
2555
1921
|
if (!options.rangeSize) {
|
2556
1922
|
options.rangeSize = FILE_RANGE_MAX_SIZE_BYTES;
|
2557
1923
|
}
|
@@ -2595,18 +1961,8 @@ export class ShareFileClient extends StorageClient {
|
|
2595
1961
|
}
|
2596
1962
|
});
|
2597
1963
|
}
|
2598
|
-
return
|
2599
|
-
}
|
2600
|
-
catch (e) {
|
2601
|
-
span.setStatus({
|
2602
|
-
code: SpanStatusCode.ERROR,
|
2603
|
-
message: e.message,
|
2604
|
-
});
|
2605
|
-
throw e;
|
2606
|
-
}
|
2607
|
-
finally {
|
2608
|
-
span.end();
|
2609
|
-
}
|
1964
|
+
return batch.do();
|
1965
|
+
});
|
2610
1966
|
}
|
2611
1967
|
async downloadToBuffer(bufferOrOffset, offsetOrCount, countOrOptions, optOptions = {}) {
|
2612
1968
|
let buffer = undefined;
|
@@ -2623,8 +1979,7 @@ export class ShareFileClient extends StorageClient {
|
|
2623
1979
|
count = typeof offsetOrCount === "number" ? offsetOrCount : 0;
|
2624
1980
|
options = countOrOptions || {};
|
2625
1981
|
}
|
2626
|
-
|
2627
|
-
try {
|
1982
|
+
return tracingClient.withSpan("ShareFileClient-downloadToBuffer", options, async (updatedOptions) => {
|
2628
1983
|
if (!options.rangeSize) {
|
2629
1984
|
options.rangeSize = FILE_RANGE_MAX_SIZE_BYTES;
|
2630
1985
|
}
|
@@ -2696,17 +2051,7 @@ export class ShareFileClient extends StorageClient {
|
|
2696
2051
|
}
|
2697
2052
|
await batch.do();
|
2698
2053
|
return buffer;
|
2699
|
-
}
|
2700
|
-
catch (e) {
|
2701
|
-
span.setStatus({
|
2702
|
-
code: SpanStatusCode.ERROR,
|
2703
|
-
message: e.message,
|
2704
|
-
});
|
2705
|
-
throw e;
|
2706
|
-
}
|
2707
|
-
finally {
|
2708
|
-
span.end();
|
2709
|
-
}
|
2054
|
+
});
|
2710
2055
|
}
|
2711
2056
|
/**
|
2712
2057
|
* ONLY AVAILABLE IN NODE.JS RUNTIME.
|
@@ -2730,8 +2075,7 @@ export class ShareFileClient extends StorageClient {
|
|
2730
2075
|
* @param options -
|
2731
2076
|
*/
|
2732
2077
|
async uploadStream(stream, size, bufferSize, maxBuffers, options = {}) {
|
2733
|
-
|
2734
|
-
try {
|
2078
|
+
return tracingClient.withSpan("ShareFileClient-uploadStream", options, async (updatedOptions) => {
|
2735
2079
|
if (!options.fileHttpHeaders) {
|
2736
2080
|
options.fileHttpHeaders = {};
|
2737
2081
|
}
|
@@ -2771,18 +2115,8 @@ export class ShareFileClient extends StorageClient {
|
|
2771
2115
|
// this situation, outgoing handlers are blocked.
|
2772
2116
|
// Outgoing queue shouldn't be empty.
|
2773
2117
|
Math.ceil((maxBuffers / 4) * 3));
|
2774
|
-
return
|
2775
|
-
}
|
2776
|
-
catch (e) {
|
2777
|
-
span.setStatus({
|
2778
|
-
code: SpanStatusCode.ERROR,
|
2779
|
-
message: e.message,
|
2780
|
-
});
|
2781
|
-
throw e;
|
2782
|
-
}
|
2783
|
-
finally {
|
2784
|
-
span.end();
|
2785
|
-
}
|
2118
|
+
return scheduler.do();
|
2119
|
+
});
|
2786
2120
|
}
|
2787
2121
|
/**
|
2788
2122
|
* ONLY AVAILABLE IN NODE.JS RUNTIME.
|
@@ -2801,8 +2135,7 @@ export class ShareFileClient extends StorageClient {
|
|
2801
2135
|
* at the specified path.
|
2802
2136
|
*/
|
2803
2137
|
async downloadToFile(filePath, offset = 0, count, options = {}) {
|
2804
|
-
|
2805
|
-
try {
|
2138
|
+
return tracingClient.withSpan("ShareFileClient-downloadToFile", options, async (updatedOptions) => {
|
2806
2139
|
const response = await this.download(offset, count, updatedOptions);
|
2807
2140
|
if (response.readableStreamBody) {
|
2808
2141
|
await readStreamToLocalFile(response.readableStreamBody, filePath);
|
@@ -2810,17 +2143,7 @@ export class ShareFileClient extends StorageClient {
|
|
2810
2143
|
// The stream is no longer accessible so setting it to undefined.
|
2811
2144
|
response.fileDownloadStream = undefined;
|
2812
2145
|
return response;
|
2813
|
-
}
|
2814
|
-
catch (e) {
|
2815
|
-
span.setStatus({
|
2816
|
-
code: SpanStatusCode.ERROR,
|
2817
|
-
message: e.message,
|
2818
|
-
});
|
2819
|
-
throw e;
|
2820
|
-
}
|
2821
|
-
finally {
|
2822
|
-
span.end();
|
2823
|
-
}
|
2146
|
+
});
|
2824
2147
|
}
|
2825
2148
|
/**
|
2826
2149
|
* Lists handles for a file.
|
@@ -2834,28 +2157,16 @@ export class ShareFileClient extends StorageClient {
|
|
2834
2157
|
* @param options -
|
2835
2158
|
*/
|
2836
2159
|
async listHandlesSegment(marker, options = {}) {
|
2837
|
-
|
2838
|
-
try {
|
2160
|
+
return tracingClient.withSpan("ShareFileClient-listHandlesSegment", options, async (updatedOptions) => {
|
2839
2161
|
marker = marker === "" ? undefined : marker;
|
2840
|
-
const response = await this.context.listHandles(Object.assign(Object.assign(
|
2162
|
+
const response = assertResponse(await this.context.listHandles(Object.assign(Object.assign({}, updatedOptions), { marker })));
|
2841
2163
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
2842
2164
|
// response.handleList is an empty string
|
2843
2165
|
if (response.handleList === "") {
|
2844
2166
|
response.handleList = undefined;
|
2845
2167
|
}
|
2846
|
-
|
2847
|
-
|
2848
|
-
}
|
2849
|
-
catch (e) {
|
2850
|
-
span.setStatus({
|
2851
|
-
code: SpanStatusCode.ERROR,
|
2852
|
-
message: e.message,
|
2853
|
-
});
|
2854
|
-
throw e;
|
2855
|
-
}
|
2856
|
-
finally {
|
2857
|
-
span.end();
|
2858
|
-
}
|
2168
|
+
return response;
|
2169
|
+
});
|
2859
2170
|
}
|
2860
2171
|
/**
|
2861
2172
|
* Returns an AsyncIterableIterator for FileListHandlesResponse
|
@@ -2886,22 +2197,29 @@ export class ShareFileClient extends StorageClient {
|
|
2886
2197
|
*/
|
2887
2198
|
listHandleItems(options = {}) {
|
2888
2199
|
return __asyncGenerator(this, arguments, function* listHandleItems_2() {
|
2889
|
-
var e_3,
|
2200
|
+
var _a, e_3, _b, _c;
|
2890
2201
|
let marker;
|
2891
2202
|
try {
|
2892
|
-
for (var
|
2893
|
-
|
2894
|
-
|
2895
|
-
|
2896
|
-
|
2203
|
+
for (var _d = true, _e = __asyncValues(this.iterateHandleSegments(marker, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
2204
|
+
_c = _f.value;
|
2205
|
+
_d = false;
|
2206
|
+
try {
|
2207
|
+
const listHandlesResponse = _c;
|
2208
|
+
if (listHandlesResponse.handleList) {
|
2209
|
+
for (const handle of listHandlesResponse.handleList) {
|
2210
|
+
yield yield __await(handle);
|
2211
|
+
}
|
2897
2212
|
}
|
2898
2213
|
}
|
2214
|
+
finally {
|
2215
|
+
_d = true;
|
2216
|
+
}
|
2899
2217
|
}
|
2900
2218
|
}
|
2901
2219
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
2902
2220
|
finally {
|
2903
2221
|
try {
|
2904
|
-
if (
|
2222
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
2905
2223
|
}
|
2906
2224
|
finally { if (e_3) throw e_3.error; }
|
2907
2225
|
}
|
@@ -2953,25 +2271,14 @@ export class ShareFileClient extends StorageClient {
|
|
2953
2271
|
* @param options - Options to force close handles operation.
|
2954
2272
|
*/
|
2955
2273
|
async forceCloseHandlesSegment(marker, options = {}) {
|
2956
|
-
|
2957
|
-
try {
|
2274
|
+
return tracingClient.withSpan("ShareFileClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
|
2958
2275
|
marker = marker === "" ? undefined : marker;
|
2959
|
-
const rawResponse = await this.context.forceCloseHandles("*", Object.assign(Object.assign({
|
2276
|
+
const rawResponse = await this.context.forceCloseHandles("*", Object.assign(Object.assign({}, updatedOptions), { marker }));
|
2960
2277
|
const response = rawResponse;
|
2961
2278
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
2962
2279
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
2963
2280
|
return response;
|
2964
|
-
}
|
2965
|
-
catch (e) {
|
2966
|
-
span.setStatus({
|
2967
|
-
code: SpanStatusCode.ERROR,
|
2968
|
-
message: e.message,
|
2969
|
-
});
|
2970
|
-
throw e;
|
2971
|
-
}
|
2972
|
-
finally {
|
2973
|
-
span.end();
|
2974
|
-
}
|
2281
|
+
});
|
2975
2282
|
}
|
2976
2283
|
/**
|
2977
2284
|
* Force close all handles for a file.
|
@@ -2980,8 +2287,7 @@ export class ShareFileClient extends StorageClient {
|
|
2980
2287
|
* @param options - Options to force close handles operation.
|
2981
2288
|
*/
|
2982
2289
|
async forceCloseAllHandles(options = {}) {
|
2983
|
-
|
2984
|
-
try {
|
2290
|
+
return tracingClient.withSpan("ShareFileClient-forceCloseAllHandles", options, async (updatedOptions) => {
|
2985
2291
|
let handlesClosed = 0;
|
2986
2292
|
let numberOfHandlesFailedToClose = 0;
|
2987
2293
|
let marker = "";
|
@@ -2999,17 +2305,7 @@ export class ShareFileClient extends StorageClient {
|
|
2999
2305
|
closedHandlesCount: handlesClosed,
|
3000
2306
|
closeFailureCount: numberOfHandlesFailedToClose,
|
3001
2307
|
};
|
3002
|
-
}
|
3003
|
-
catch (e) {
|
3004
|
-
span.setStatus({
|
3005
|
-
code: SpanStatusCode.ERROR,
|
3006
|
-
message: e.message,
|
3007
|
-
});
|
3008
|
-
throw e;
|
3009
|
-
}
|
3010
|
-
finally {
|
3011
|
-
span.end();
|
3012
|
-
}
|
2308
|
+
});
|
3013
2309
|
}
|
3014
2310
|
/**
|
3015
2311
|
* Force close a specific handle for a file.
|
@@ -3020,27 +2316,16 @@ export class ShareFileClient extends StorageClient {
|
|
3020
2316
|
* @param FileForceCloseHandlesOptions - Options to force close handles operation.
|
3021
2317
|
*/
|
3022
2318
|
async forceCloseHandle(handleId, options = {}) {
|
3023
|
-
|
3024
|
-
try {
|
2319
|
+
return tracingClient.withSpan("ShareFileClient-forceCloseHandle", options, async (updatedOptions) => {
|
3025
2320
|
if (handleId === "*") {
|
3026
2321
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
3027
2322
|
}
|
3028
|
-
const rawResponse = await this.context.forceCloseHandles(handleId,
|
2323
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, updatedOptions);
|
3029
2324
|
const response = rawResponse;
|
3030
2325
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
3031
2326
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
3032
2327
|
return response;
|
3033
|
-
}
|
3034
|
-
catch (e) {
|
3035
|
-
span.setStatus({
|
3036
|
-
code: SpanStatusCode.ERROR,
|
3037
|
-
message: e.message,
|
3038
|
-
});
|
3039
|
-
throw e;
|
3040
|
-
}
|
3041
|
-
finally {
|
3042
|
-
span.end();
|
3043
|
-
}
|
2328
|
+
});
|
3044
2329
|
}
|
3045
2330
|
/**
|
3046
2331
|
* Get a {@link ShareLeaseClient} that manages leases on the file.
|
@@ -3087,7 +2372,6 @@ export class ShareFileClient extends StorageClient {
|
|
3087
2372
|
* ```
|
3088
2373
|
*/
|
3089
2374
|
async rename(destinationPath, options = {}) {
|
3090
|
-
const { span, updatedOptions } = createSpan("ShareFileClient-rename", options);
|
3091
2375
|
const split = destinationPath.split("?");
|
3092
2376
|
let destinationUrl;
|
3093
2377
|
if (split.length === 2) {
|
@@ -3104,9 +2388,9 @@ export class ShareFileClient extends StorageClient {
|
|
3104
2388
|
else {
|
3105
2389
|
throw new RangeError("Destination path should not contain more than one query string");
|
3106
2390
|
}
|
3107
|
-
const destFile = new ShareFileClient(destinationUrl, this.pipeline
|
3108
|
-
|
3109
|
-
const response = await destFile.context.rename(this.url, Object.assign(Object.assign(
|
2391
|
+
const destFile = new ShareFileClient(destinationUrl, this.pipeline);
|
2392
|
+
return tracingClient.withSpan("ShareFileClient-rename", options, async (updatedOptions) => {
|
2393
|
+
const response = assertResponse(await destFile.context.rename(this.url, Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
3110
2394
|
? {
|
3111
2395
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
3112
2396
|
}
|
@@ -3118,22 +2402,12 @@ export class ShareFileClient extends StorageClient {
|
|
3118
2402
|
? {
|
3119
2403
|
fileContentType: options.contentType,
|
3120
2404
|
}
|
3121
|
-
: undefined })
|
2405
|
+
: undefined })));
|
3122
2406
|
return {
|
3123
2407
|
destinationFileClient: destFile,
|
3124
2408
|
fileRenameResponse: response,
|
3125
2409
|
};
|
3126
|
-
}
|
3127
|
-
catch (e) {
|
3128
|
-
span.setStatus({
|
3129
|
-
code: SpanStatusCode.ERROR,
|
3130
|
-
message: e.message,
|
3131
|
-
});
|
3132
|
-
throw e;
|
3133
|
-
}
|
3134
|
-
finally {
|
3135
|
-
span.end();
|
3136
|
-
}
|
2410
|
+
});
|
3137
2411
|
}
|
3138
2412
|
}
|
3139
2413
|
/**
|
@@ -3143,27 +2417,6 @@ export class ShareFileClient extends StorageClient {
|
|
3143
2417
|
* @see https://docs.microsoft.com/rest/api/storageservices/lease-share
|
3144
2418
|
*/
|
3145
2419
|
export class ShareLeaseClient {
|
3146
|
-
/**
|
3147
|
-
* Creates an instance of ShareLeaseClient.
|
3148
|
-
* @param client - The client to make the lease operation requests.
|
3149
|
-
* @param leaseId - Initial proposed lease id.
|
3150
|
-
*/
|
3151
|
-
constructor(client, leaseId) {
|
3152
|
-
const clientContext = new StorageClientContext(client.url, Object.assign({ version: SERVICE_VERSION }, client.pipeline.toServiceClientOptions()));
|
3153
|
-
if (client instanceof ShareClient) {
|
3154
|
-
this.isShare = true;
|
3155
|
-
this.fileOrShare = new Share(clientContext);
|
3156
|
-
}
|
3157
|
-
else {
|
3158
|
-
this.isShare = false;
|
3159
|
-
this.fileOrShare = new File(clientContext);
|
3160
|
-
}
|
3161
|
-
this._url = client.url;
|
3162
|
-
if (!leaseId) {
|
3163
|
-
leaseId = generateUuid();
|
3164
|
-
}
|
3165
|
-
this._leaseId = leaseId;
|
3166
|
-
}
|
3167
2420
|
/**
|
3168
2421
|
* Gets the lease Id.
|
3169
2422
|
*
|
@@ -3180,6 +2433,25 @@ export class ShareLeaseClient {
|
|
3180
2433
|
get url() {
|
3181
2434
|
return this._url;
|
3182
2435
|
}
|
2436
|
+
/**
|
2437
|
+
* Creates an instance of ShareLeaseClient.
|
2438
|
+
* @param client - The client to make the lease operation requests.
|
2439
|
+
* @param leaseId - Initial proposed lease id.
|
2440
|
+
*/
|
2441
|
+
constructor(client, leaseId) {
|
2442
|
+
const clientContext = client["storageClientContext"];
|
2443
|
+
if (client instanceof ShareClient) {
|
2444
|
+
this.fileOrShare = clientContext.share;
|
2445
|
+
}
|
2446
|
+
else {
|
2447
|
+
this.fileOrShare = clientContext.file;
|
2448
|
+
}
|
2449
|
+
this._url = client.url;
|
2450
|
+
if (!leaseId) {
|
2451
|
+
leaseId = generateUuid();
|
2452
|
+
}
|
2453
|
+
this._leaseId = leaseId;
|
2454
|
+
}
|
3183
2455
|
/**
|
3184
2456
|
* Establishes and manages a lock on a file, share or share snapshot for write and delete operations.
|
3185
2457
|
*
|
@@ -3188,20 +2460,9 @@ export class ShareLeaseClient {
|
|
3188
2460
|
* @returns Response data for acquire lease operation.
|
3189
2461
|
*/
|
3190
2462
|
async acquireLease(duration = -1, options = {}) {
|
3191
|
-
|
3192
|
-
|
3193
|
-
|
3194
|
-
}
|
3195
|
-
catch (e) {
|
3196
|
-
span.setStatus({
|
3197
|
-
code: SpanStatusCode.ERROR,
|
3198
|
-
message: e.message,
|
3199
|
-
});
|
3200
|
-
throw e;
|
3201
|
-
}
|
3202
|
-
finally {
|
3203
|
-
span.end();
|
3204
|
-
}
|
2463
|
+
return tracingClient.withSpan("ShareLeaseClient-acquireLease", options, async (updatedOptions) => {
|
2464
|
+
return assertResponse(await this.fileOrShare.acquireLease(Object.assign(Object.assign({}, updatedOptions), { duration, proposedLeaseId: this._leaseId })));
|
2465
|
+
});
|
3205
2466
|
}
|
3206
2467
|
/**
|
3207
2468
|
* To change the ID of an existing lease.
|
@@ -3211,22 +2472,11 @@ export class ShareLeaseClient {
|
|
3211
2472
|
* @returns Response data for change lease operation.
|
3212
2473
|
*/
|
3213
2474
|
async changeLease(proposedLeaseId, options = {}) {
|
3214
|
-
|
3215
|
-
|
3216
|
-
const response = await this.fileOrShare.changeLease(this._leaseId, Object.assign({ proposedLeaseId, abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)));
|
2475
|
+
return tracingClient.withSpan("ShareLeaseClient-changeLease", options, async (updatedOptions) => {
|
2476
|
+
const response = assertResponse(await this.fileOrShare.changeLease(this._leaseId, Object.assign(Object.assign({}, updatedOptions), { proposedLeaseId })));
|
3217
2477
|
this._leaseId = proposedLeaseId;
|
3218
2478
|
return response;
|
3219
|
-
}
|
3220
|
-
catch (e) {
|
3221
|
-
span.setStatus({
|
3222
|
-
code: SpanStatusCode.ERROR,
|
3223
|
-
message: e.message,
|
3224
|
-
});
|
3225
|
-
throw e;
|
3226
|
-
}
|
3227
|
-
finally {
|
3228
|
-
span.end();
|
3229
|
-
}
|
2479
|
+
});
|
3230
2480
|
}
|
3231
2481
|
/**
|
3232
2482
|
* To free the lease if it is no longer needed so that another client may
|
@@ -3236,20 +2486,9 @@ export class ShareLeaseClient {
|
|
3236
2486
|
* @returns Response data for release lease operation.
|
3237
2487
|
*/
|
3238
2488
|
async releaseLease(options = {}) {
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
}
|
3243
|
-
catch (e) {
|
3244
|
-
span.setStatus({
|
3245
|
-
code: SpanStatusCode.ERROR,
|
3246
|
-
message: e.message,
|
3247
|
-
});
|
3248
|
-
throw e;
|
3249
|
-
}
|
3250
|
-
finally {
|
3251
|
-
span.end();
|
3252
|
-
}
|
2489
|
+
return tracingClient.withSpan("ShareLeaseClient-releaseLease", options, async (updatedOptions) => {
|
2490
|
+
return assertResponse(await this.fileOrShare.releaseLease(this._leaseId, updatedOptions));
|
2491
|
+
});
|
3253
2492
|
}
|
3254
2493
|
/**
|
3255
2494
|
* To force end the lease.
|
@@ -3258,20 +2497,9 @@ export class ShareLeaseClient {
|
|
3258
2497
|
* @returns Response data for break lease operation.
|
3259
2498
|
*/
|
3260
2499
|
async breakLease(options = {}) {
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
}
|
3265
|
-
catch (e) {
|
3266
|
-
span.setStatus({
|
3267
|
-
code: SpanStatusCode.ERROR,
|
3268
|
-
message: e.message,
|
3269
|
-
});
|
3270
|
-
throw e;
|
3271
|
-
}
|
3272
|
-
finally {
|
3273
|
-
span.end();
|
3274
|
-
}
|
2500
|
+
return tracingClient.withSpan("ShareLeaseClient-breakLease", options, async (updatedOptions) => {
|
2501
|
+
return assertResponse(await this.fileOrShare.breakLease(updatedOptions));
|
2502
|
+
});
|
3275
2503
|
}
|
3276
2504
|
/**
|
3277
2505
|
* To renew the lease. Only available for lease on share or share snapshot.
|
@@ -3282,23 +2510,18 @@ export class ShareLeaseClient {
|
|
3282
2510
|
* @returns Response data for renew lease operation.
|
3283
2511
|
*/
|
3284
2512
|
async renewLease(options = {}) {
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3288
|
-
|
3289
|
-
|
3290
|
-
|
3291
|
-
}
|
3292
|
-
catch (e) {
|
3293
|
-
span.setStatus({
|
3294
|
-
code: SpanStatusCode.ERROR,
|
3295
|
-
message: e.message,
|
3296
|
-
});
|
3297
|
-
throw e;
|
3298
|
-
}
|
3299
|
-
finally {
|
3300
|
-
span.end();
|
3301
|
-
}
|
2513
|
+
return tracingClient.withSpan("ShareLeaseClient-renewLease", options, async (updatedOptions) => {
|
2514
|
+
if (isFile(this.fileOrShare)) {
|
2515
|
+
throw new RangeError("The renewLease operation is not available for lease on file.");
|
2516
|
+
}
|
2517
|
+
return assertResponse(await this.fileOrShare.renewLease(this._leaseId, updatedOptions));
|
2518
|
+
});
|
3302
2519
|
}
|
3303
2520
|
}
|
2521
|
+
/**
|
2522
|
+
* @internal
|
2523
|
+
*/
|
2524
|
+
function isFile(fileOrShare) {
|
2525
|
+
return "renewLease" in fileOrShare;
|
2526
|
+
}
|
3304
2527
|
//# sourceMappingURL=Clients.js.map
|