From 485b526a26855b857c30a54515f86c1f9d118cf1 Mon Sep 17 00:00:00 2001 From: JinmingHu Date: Tue, 17 Nov 2020 14:35:27 +0800 Subject: [PATCH] unify blob client options (#989) * unify blob client options * Unified client options is datalake/files and adapt blob breaking change. Co-authored-by: Tank Tang --- .../azure/storage/blobs/blob_batch_client.hpp | 8 +- .../storage/blobs/blob_container_client.hpp | 16 +- .../inc/azure/storage/blobs/blob_options.hpp | 162 ++++-------------- .../storage/blobs/blob_service_client.hpp | 10 +- .../src/blob_batch_client.cpp | 10 +- .../src/blob_container_client.cpp | 8 +- .../src/blob_service_client.cpp | 11 +- .../test/blob_container_client_test.cpp | 4 +- .../datalake/datalake_directory_client.hpp | 8 +- .../files/datalake/datalake_file_client.hpp | 8 +- .../datalake/datalake_file_system_client.hpp | 8 +- .../files/datalake/datalake_options.hpp | 66 ++----- .../files/datalake/datalake_path_client.hpp | 8 +- .../datalake/datalake_service_client.hpp | 8 +- .../src/datalake_directory_client.cpp | 8 +- .../src/datalake_file_client.cpp | 8 +- .../src/datalake_file_system_client.cpp | 13 +- .../src/datalake_path_client.cpp | 10 +- .../src/datalake_service_client.cpp | 13 +- .../files/shares/share_directory_client.hpp | 8 +- .../files/shares/share_file_client.hpp | 8 +- .../storage/files/shares/share_options.hpp | 63 +------ .../files/shares/share_service_client.hpp | 8 +- .../src/share_directory_client.cpp | 8 +- .../src/share_file_client.cpp | 8 +- .../src/share_service_client.cpp | 8 +- 26 files changed, 159 insertions(+), 339 deletions(-) diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_batch_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_batch_client.hpp index c8c21fb29..30a8813d2 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_batch_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_batch_client.hpp @@ -96,7 +96,7 @@ namespace Azure { namespace Storage { namespace Blobs { */ static BlobBatchClient CreateFromConnectionString( const std::string& connectionString, - const BlobBatchClientOptions& options = BlobBatchClientOptions()); + const BlobClientOptions& options = BlobClientOptions()); /** * @brief Initialize a new instance of BlobBatchClient. @@ -109,7 +109,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit BlobBatchClient( const std::string& serviceUri, std::shared_ptr credential, - const BlobBatchClientOptions& options = BlobBatchClientOptions()); + const BlobClientOptions& options = BlobClientOptions()); /** * @brief Initialize a new instance of BlobBatchClient. @@ -122,7 +122,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit BlobBatchClient( const std::string& serviceUri, std::shared_ptr credential, - const BlobBatchClientOptions& options = BlobBatchClientOptions()); + const BlobClientOptions& options = BlobClientOptions()); /** * @brief Initialize a new instance of BlobBatchClient. @@ -134,7 +134,7 @@ namespace Azure { namespace Storage { namespace Blobs { */ explicit BlobBatchClient( const std::string& serviceUri, - const BlobBatchClientOptions& options = BlobBatchClientOptions()); + const BlobClientOptions& options = BlobClientOptions()); /** * @brief Creates a new BlobBatch to collect sub-operations that can be submitted diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_container_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_container_client.hpp index dba21552e..a9cd0ba1f 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_container_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_container_client.hpp @@ -34,7 +34,7 @@ namespace Azure { namespace Storage { namespace Blobs { static BlobContainerClient CreateFromConnectionString( const std::string& connectionString, const std::string& containerName, - const BlobContainerClientOptions& options = BlobContainerClientOptions()); + const BlobClientOptions& options = BlobClientOptions()); /** * @brief Initialize a new instance of BlobContainerClient. @@ -50,7 +50,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit BlobContainerClient( const std::string& containerUri, std::shared_ptr credential, - const BlobContainerClientOptions& options = BlobContainerClientOptions()); + const BlobClientOptions& options = BlobClientOptions()); /** * @brief Initialize a new instance of BlobContainerClient. @@ -65,7 +65,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit BlobContainerClient( const std::string& containerUri, std::shared_ptr credential, - const BlobContainerClientOptions& options = BlobContainerClientOptions()); + const BlobClientOptions& options = BlobClientOptions()); /** * @brief Initialize a new instance of BlobContainerClient. @@ -79,7 +79,7 @@ namespace Azure { namespace Storage { namespace Blobs { */ explicit BlobContainerClient( const std::string& containerUri, - const BlobContainerClientOptions& options = BlobContainerClientOptions()); + const BlobClientOptions& options = BlobClientOptions()); /** * @brief Create a new BlobClient object by appending blobName to the end of uri. The @@ -313,8 +313,12 @@ namespace Azure { namespace Storage { namespace Blobs { private: explicit BlobContainerClient( Azure::Core::Http::Url containerUri, - std::shared_ptr pipeline) - : m_containerUrl(std::move(containerUri)), m_pipeline(std::move(pipeline)) + std::shared_ptr pipeline, + Azure::Core::Nullable customerProvidedKey, + Azure::Core::Nullable encryptionScope) + : m_containerUrl(std::move(containerUri)), m_pipeline(std::move(pipeline)), + m_customerProvidedKey(std::move(customerProvidedKey)), + m_encryptionScope(std::move(encryptionScope)) { } diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_options.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_options.hpp index 99a3a57ee..df805105b 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_options.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_options.hpp @@ -86,9 +86,31 @@ namespace Azure { namespace Storage { namespace Blobs { }; /** - * @brief Service client options used to initalize BlobServiceClient. + * @brief Wrapper for an encryption key to be used with client provided key server-side + * encryption. */ - struct BlobServiceClientOptions + struct EncryptionKey + { + /** + * @brief Base64 encoded string of the AES256 encryption key. + */ + std::string Key; + + /** + * @brief Base64 encoded string of the AES256 encryption key's SHA256 hash. + */ + std::string KeyHash; + + /** + * @brief The algorithm for Azure Blob Storage to encrypt with. + */ + Models::EncryptionAlgorithmType Algorithm; + }; + + /** + * @brief Client options used to initalize all kinds of blob clients. + */ + struct BlobClientOptions { /** * @brief Transport pipeline policies for authentication, additional HTTP headers, etc., that @@ -102,6 +124,16 @@ namespace Azure { namespace Storage { namespace Blobs { */ std::vector> PerRetryPolicies; + /** + * @brief Holds the customer provided key used when making requests. + */ + Azure::Core::Nullable CustomerProvidedKey; + + /** + * @brief Holds the encryption scope used when making requests. + */ + Azure::Core::Nullable EncryptionScope; + /** * @brief Specify the number of retries and other retry-related options. */ @@ -229,66 +261,6 @@ namespace Azure { namespace Storage { namespace Blobs { Azure::Core::Nullable MaxResults; }; - /** - * @brief Wrapper for an encryption key to be used with client provided key server-side - * encryption. - */ - struct EncryptionKey - { - /** - * @brief Base64 encoded string of the AES256 encryption key. - */ - std::string Key; - - /** - * @brief Base64 encoded string of the AES256 encryption key's SHA256 hash. - */ - std::string KeyHash; - - /** - * @brief The algorithm for Azure Blob Storage to encrypt with. - */ - Models::EncryptionAlgorithmType Algorithm; - }; - - /** - * @brief Container client options used to initalize BlobContainerClient. - */ - struct BlobContainerClientOptions - { - /** - * @brief Transport pipeline policies for authentication, additional HTTP headers, etc., that - * are applied to every request. - */ - std::vector> PerOperationPolicies; - - /** - * @brief Transport pipeline policies for authentication, additional HTTP headers, etc., that - * are applied to every retrial. - */ - std::vector> PerRetryPolicies; - - /** - * @brief Holds the customer provided key used when making requests. - */ - Azure::Core::Nullable CustomerProvidedKey; - - /** - * @brief Holds the encryption scope used when making requests. - */ - Azure::Core::Nullable EncryptionScope; - - /** - * @brief Specify the number of retries and other retry-related options. - */ - StorageRetryWithSecondaryOptions RetryOptions; - - /** - * @brief Customized HTTP client. We're going to use the default one if this is empty. - */ - Azure::Core::Http::TransportPolicyOptions TransportPolicyOptions; - }; - /** * @brief Optional parameters for BlobContainerClient::Create. */ @@ -526,44 +498,6 @@ namespace Azure { namespace Storage { namespace Blobs { Azure::Core::Nullable BreakPeriod; }; - /** - * @brief Blob client options used to initalize BlobClient. - */ - struct BlobClientOptions - { - /** - * @brief Transport pipeline policies for authentication, additional HTTP headers, etc., that - * are applied to every request. - */ - std::vector> PerOperationPolicies; - - /** - * @brief Transport pipeline policies for authentication, additional HTTP headers, etc., that - * are applied to every retrial. - */ - std::vector> PerRetryPolicies; - - /** - * @brief Holds the customer provided key used when making requests. - */ - Azure::Core::Nullable CustomerProvidedKey; - - /** - * @brief Holds the encryption scope used when making requests. - */ - Azure::Core::Nullable EncryptionScope; - - /** - * @brief Specify the number of retries and other retry-related options. - */ - StorageRetryWithSecondaryOptions RetryOptions; - - /** - * @brief Customized HTTP client. We're going to use the default one if this is empty. - */ - Azure::Core::Http::TransportPolicyOptions TransportPolicyOptions; - }; - /** * @brief Optional parameters for BlobClient::GetProperties. */ @@ -1429,34 +1363,6 @@ namespace Azure { namespace Storage { namespace Blobs { BlobAccessConditions AccessConditions; }; - /** - * @brief Batch client options used to initalize BlobBatchClient. - */ - struct BlobBatchClientOptions - { - /** - * @brief Transport pipeline policies for authentication, additional HTTP headers, etc., that - * are applied to every request. - */ - std::vector> PerOperationPolicies; - - /** - * @brief Transport pipeline policies for authentication, additional HTTP headers, etc., that - * are applied to every retrial. - */ - std::vector> PerRetryPolicies; - - /** - * @brief Specify the number of retries and other retry-related options. - */ - StorageRetryWithSecondaryOptions RetryOptions; - - /** - * @brief Customized HTTP client. We're going to use the default one if this is empty. - */ - Azure::Core::Http::TransportPolicyOptions TransportPolicyOptions; - }; - /** * @brief Optional parameters for BlobBatchClient::SubmitBatch. */ diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_service_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_service_client.hpp index 1499324b1..695fc2a69 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_service_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_service_client.hpp @@ -31,7 +31,7 @@ namespace Azure { namespace Storage { namespace Blobs { */ static BlobServiceClient CreateFromConnectionString( const std::string& connectionString, - const BlobServiceClientOptions& options = BlobServiceClientOptions()); + const BlobClientOptions& options = BlobClientOptions()); /** * @brief Initialize a new instance of BlobServiceClient. @@ -44,7 +44,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit BlobServiceClient( const std::string& serviceUri, std::shared_ptr credential, - const BlobServiceClientOptions& options = BlobServiceClientOptions()); + const BlobClientOptions& options = BlobClientOptions()); /** * @brief Initialize a new instance of BlobServiceClient. @@ -57,7 +57,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit BlobServiceClient( const std::string& serviceUri, std::shared_ptr credential, - const BlobServiceClientOptions& options = BlobServiceClientOptions()); + const BlobClientOptions& options = BlobClientOptions()); /** * @brief Initialize a new instance of BlobServiceClient. @@ -69,7 +69,7 @@ namespace Azure { namespace Storage { namespace Blobs { */ explicit BlobServiceClient( const std::string& serviceUri, - const BlobServiceClientOptions& options = BlobServiceClientOptions()); + const BlobClientOptions& options = BlobClientOptions()); /** * @brief Creates a new BlobContainerClient object with the same uri as this BlobServiceClient. @@ -182,6 +182,8 @@ namespace Azure { namespace Storage { namespace Blobs { protected: Azure::Core::Http::Url m_serviceUrl; std::shared_ptr m_pipeline; + Azure::Core::Nullable m_customerProvidedKey; + Azure::Core::Nullable m_encryptionScope; private: friend class BlobBatchClient; diff --git a/sdk/storage/azure-storage-blobs/src/blob_batch_client.cpp b/sdk/storage/azure-storage-blobs/src/blob_batch_client.cpp index 2c76b7e1c..c94f89a98 100644 --- a/sdk/storage/azure-storage-blobs/src/blob_batch_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/blob_batch_client.cpp @@ -67,7 +67,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobBatchClient BlobBatchClient::CreateFromConnectionString( const std::string& connectionString, - const BlobBatchClientOptions& options) + const BlobClientOptions& options) { auto parsedConnectionString = Storage::Details::ParseConnectionString(connectionString); auto serviceUri = std::move(parsedConnectionString.BlobServiceUri); @@ -86,7 +86,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobBatchClient::BlobBatchClient( const std::string& serviceUri, std::shared_ptr credential, - const BlobBatchClientOptions& options) + const BlobClientOptions& options) : m_serviceUrl(serviceUri) { std::vector> policies; @@ -127,7 +127,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobBatchClient::BlobBatchClient( const std::string& serviceUri, std::shared_ptr credential, - const BlobBatchClientOptions& options) + const BlobClientOptions& options) : m_serviceUrl(serviceUri) { std::vector> policies; @@ -167,9 +167,7 @@ namespace Azure { namespace Storage { namespace Blobs { m_subRequestPipeline = std::make_shared(policies); } - BlobBatchClient::BlobBatchClient( - const std::string& serviceUri, - const BlobBatchClientOptions& options) + BlobBatchClient::BlobBatchClient(const std::string& serviceUri, const BlobClientOptions& options) : m_serviceUrl(serviceUri) { std::vector> policies; diff --git a/sdk/storage/azure-storage-blobs/src/blob_container_client.cpp b/sdk/storage/azure-storage-blobs/src/blob_container_client.cpp index 3793e1345..449121601 100644 --- a/sdk/storage/azure-storage-blobs/src/blob_container_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/blob_container_client.cpp @@ -19,7 +19,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobContainerClient BlobContainerClient::CreateFromConnectionString( const std::string& connectionString, const std::string& containerName, - const BlobContainerClientOptions& options) + const BlobClientOptions& options) { auto parsedConnectionString = Storage::Details::ParseConnectionString(connectionString); auto containerUri = std::move(parsedConnectionString.BlobServiceUri); @@ -39,7 +39,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobContainerClient::BlobContainerClient( const std::string& containerUri, std::shared_ptr credential, - const BlobContainerClientOptions& options) + const BlobClientOptions& options) : BlobContainerClient(containerUri, options) { std::vector> policies; @@ -65,7 +65,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobContainerClient::BlobContainerClient( const std::string& containerUri, std::shared_ptr credential, - const BlobContainerClientOptions& options) + const BlobClientOptions& options) : BlobContainerClient(containerUri, options) { std::vector> policies; @@ -91,7 +91,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobContainerClient::BlobContainerClient( const std::string& containerUri, - const BlobContainerClientOptions& options) + const BlobClientOptions& options) : m_containerUrl(containerUri), m_customerProvidedKey(options.CustomerProvidedKey), m_encryptionScope(options.EncryptionScope) { diff --git a/sdk/storage/azure-storage-blobs/src/blob_service_client.cpp b/sdk/storage/azure-storage-blobs/src/blob_service_client.cpp index 93fe99a02..c53902696 100644 --- a/sdk/storage/azure-storage-blobs/src/blob_service_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/blob_service_client.cpp @@ -15,7 +15,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobServiceClient BlobServiceClient::CreateFromConnectionString( const std::string& connectionString, - const BlobServiceClientOptions& options) + const BlobClientOptions& options) { auto parsedConnectionString = Storage::Details::ParseConnectionString(connectionString); auto serviceUri = std::move(parsedConnectionString.BlobServiceUri); @@ -34,7 +34,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobServiceClient::BlobServiceClient( const std::string& serviceUri, std::shared_ptr credential, - const BlobServiceClientOptions& options) + const BlobClientOptions& options) : m_serviceUrl(serviceUri) { std::vector> policies; @@ -60,7 +60,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobServiceClient::BlobServiceClient( const std::string& serviceUri, std::shared_ptr credential, - const BlobServiceClientOptions& options) + const BlobClientOptions& options) : m_serviceUrl(serviceUri) { std::vector> policies; @@ -86,7 +86,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobServiceClient::BlobServiceClient( const std::string& serviceUri, - const BlobServiceClientOptions& options) + const BlobClientOptions& options) : m_serviceUrl(serviceUri) { std::vector> policies; @@ -113,7 +113,8 @@ namespace Azure { namespace Storage { namespace Blobs { { auto containerUri = m_serviceUrl; containerUri.AppendPath(Storage::Details::UrlEncodePath(containerName)); - return BlobContainerClient(std::move(containerUri), m_pipeline); + return BlobContainerClient( + std::move(containerUri), m_pipeline, m_customerProvidedKey, m_encryptionScope); } Azure::Core::Response diff --git a/sdk/storage/azure-storage-blobs/test/blob_container_client_test.cpp b/sdk/storage/azure-storage-blobs/test/blob_container_client_test.cpp index ad2f892ab..f6072f85f 100644 --- a/sdk/storage/azure-storage-blobs/test/blob_container_client_test.cpp +++ b/sdk/storage/azure-storage-blobs/test/blob_container_client_test.cpp @@ -441,7 +441,7 @@ namespace Azure { namespace Storage { namespace Test { { std::string containerName = LowercaseRandomString(); std::string blobName = RandomString(); - Blobs::BlobContainerClientOptions options; + Blobs::BlobClientOptions options; options.EncryptionScope = c_TestEncryptionScope; auto containerClient = Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString( StandardStorageConnectionString(), containerName, options); @@ -508,7 +508,7 @@ namespace Azure { namespace Storage { namespace Test { return key; }; - Blobs::BlobContainerClientOptions options; + Blobs::BlobClientOptions options; options.CustomerProvidedKey = getRandomCustomerProvidedKey(); auto containerClient = Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString( StandardStorageConnectionString(), m_containerName, options); diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_directory_client.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_directory_client.hpp index 1040be4de..763edac69 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_directory_client.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_directory_client.hpp @@ -31,7 +31,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { const std::string& connectionString, const std::string& fileSystemName, const std::string& directoryPath, - const DirectoryClientOptions& options = DirectoryClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Shared key authentication client. @@ -42,7 +42,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit DirectoryClient( const std::string& directoryUri, std::shared_ptr credential, - const DirectoryClientOptions& options = DirectoryClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Bearer token authentication client. @@ -53,7 +53,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit DirectoryClient( const std::string& directoryUri, std::shared_ptr credential, - const DirectoryClientOptions& options = DirectoryClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Anonymous/SAS/customized pipeline auth. @@ -62,7 +62,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { */ explicit DirectoryClient( const std::string& directoryUri, - const DirectoryClientOptions& options = DirectoryClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Create a FileClient from current DirectoryClient diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_client.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_client.hpp index 2c2bb6a7c..88fba4139 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_client.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_client.hpp @@ -32,7 +32,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { const std::string& connectionString, const std::string& fileSystemName, const std::string& filePath, - const FileClientOptions& options = FileClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Shared key authentication client. @@ -43,7 +43,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit FileClient( const std::string& fileUri, std::shared_ptr credential, - const FileClientOptions& options = FileClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Bearer token authentication client. @@ -54,7 +54,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit FileClient( const std::string& fileUri, std::shared_ptr credential, - const FileClientOptions& options = FileClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Anonymous/SAS/customized pipeline auth. @@ -63,7 +63,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { */ explicit FileClient( const std::string& fileUri, - const FileClientOptions& options = FileClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Gets the file's primary uri endpoint. This is the endpoint used for blob diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_system_client.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_system_client.hpp index 954204b04..c14f10e31 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_system_client.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_system_client.hpp @@ -34,7 +34,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { static FileSystemClient CreateFromConnectionString( const std::string& connectionString, const std::string& fileSystemName, - const FileSystemClientOptions& options = FileSystemClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Shared key authentication client. @@ -45,7 +45,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit FileSystemClient( const std::string& fileSystemUri, std::shared_ptr credential, - const FileSystemClientOptions& options = FileSystemClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Bearer token authentication client. @@ -56,7 +56,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit FileSystemClient( const std::string& fileSystemUri, std::shared_ptr credential, - const FileSystemClientOptions& options = FileSystemClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Anonymous/SAS/customized pipeline auth. @@ -65,7 +65,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { */ explicit FileSystemClient( const std::string& fileSystemUri, - const FileSystemClientOptions& options = FileSystemClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Create a PathClient from current FileSystemClient diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_options.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_options.hpp index 72760cab6..cbc80ad6e 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_options.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_options.hpp @@ -19,11 +19,21 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { using GetUserDelegationKeyOptions = Blobs::GetUserDelegationKeyOptions; /** - * @brief Service client options used to initalize ServiceClient. + * @brief Client options used to initalize DataLakeServiceClient, FileSystemClient, PathClient, + * FileClient and DirectoryClient. */ - struct DataLakeServiceClientOptions + struct DataLakeClientOptions { + /** + * @brief Transport pipeline policies for authentication, additional HTTP headers, etc., that + * are applied to every request. + */ std::vector> PerOperationPolicies; + + /** + * @brief Transport pipeline policies for authentication, additional HTTP headers, etc., that + * are applied to every retrial. + */ std::vector> PerRetryPolicies; /** @@ -37,58 +47,6 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { Azure::Core::Http::TransportPolicyOptions TransportPolicyOptions; }; - /** - * @brief File system client options used to initalize FileSystemClient. - */ - struct FileSystemClientOptions - { - std::vector> PerOperationPolicies; - std::vector> PerRetryPolicies; - - /** - * @brief Specify the number of retries and other retry-related options. - */ - StorageRetryWithSecondaryOptions RetryOptions; - - /** - * @brief Customized HTTP client. We're going to use the default one if this is empty. - */ - Azure::Core::Http::TransportPolicyOptions TransportPolicyOptions; - }; - - /** - * @brief Path client options used to initalize PathClient. - */ - struct PathClientOptions - { - std::vector> PerOperationPolicies; - std::vector> PerRetryPolicies; - - /** - * @brief Specify the number of retries and other retry-related options. - */ - StorageRetryWithSecondaryOptions RetryOptions; - - /** - * @brief Customized HTTP client. We're going to use the default one if this is empty. - */ - Azure::Core::Http::TransportPolicyOptions TransportPolicyOptions; - }; - - /** - * @brief File client options used to initalize FileClient. - */ - struct FileClientOptions : public PathClientOptions - { - }; - - /** - * @brief Directory client options used to initalize DirectoryClient. - */ - struct DirectoryClientOptions : public PathClientOptions - { - }; - /** * @brief Specifies access conditions for a file system. */ diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_path_client.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_path_client.hpp index 76703423d..46c6b1ae5 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_path_client.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_path_client.hpp @@ -32,7 +32,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { const std::string& connectionString, const std::string& fileSystemName, const std::string& path, - const PathClientOptions& options = PathClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Shared key authentication client. @@ -43,7 +43,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit PathClient( const std::string& pathUri, std::shared_ptr credential, - const PathClientOptions& options = PathClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Bearer token authentication client. @@ -54,7 +54,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit PathClient( const std::string& pathUri, std::shared_ptr credential, - const PathClientOptions& options = PathClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Anonymous/SAS/customized pipeline auth. @@ -63,7 +63,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { */ explicit PathClient( const std::string& pathUri, - const PathClientOptions& options = PathClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Gets the path's primary uri endpoint. This is the endpoint used for blob diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_service_client.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_service_client.hpp index 3bae5d24d..644a79952 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_service_client.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_service_client.hpp @@ -29,7 +29,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { */ static DataLakeServiceClient CreateFromConnectionString( const std::string& connectionString, - const DataLakeServiceClientOptions& options = DataLakeServiceClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Shared key authentication client. @@ -40,7 +40,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit DataLakeServiceClient( const std::string& serviceUri, std::shared_ptr credential, - const DataLakeServiceClientOptions& options = DataLakeServiceClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Bearer token authentication client. @@ -51,7 +51,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit DataLakeServiceClient( const std::string& serviceUri, std::shared_ptr credential, - const DataLakeServiceClientOptions& options = DataLakeServiceClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Anonymous/SAS/customized pipeline auth. @@ -60,7 +60,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { */ explicit DataLakeServiceClient( const std::string& serviceUri, - const DataLakeServiceClientOptions& options = DataLakeServiceClientOptions()); + const DataLakeClientOptions& options = DataLakeClientOptions()); /** * @brief Create a FileSystemClient from current DataLakeServiceClient diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_directory_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_directory_client.cpp index 41860b8d5..5b9a63da4 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_directory_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_directory_client.cpp @@ -24,7 +24,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { const std::string& connectionString, const std::string& fileSystemName, const std::string& path, - const DirectoryClientOptions& options) + const DataLakeClientOptions& options) { auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString); auto directoryUri = std::move(parsedConnectionString.DataLakeServiceUri); @@ -45,7 +45,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { DirectoryClient::DirectoryClient( const std::string& directoryUri, std::shared_ptr credential, - const DirectoryClientOptions& options) + const DataLakeClientOptions& options) : PathClient(directoryUri, credential, options) { std::vector> policies; @@ -75,7 +75,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { DirectoryClient::DirectoryClient( const std::string& directoryUri, std::shared_ptr credential, - const DirectoryClientOptions& options) + const DataLakeClientOptions& options) : PathClient(directoryUri, credential, options) { std::vector> policies; @@ -104,7 +104,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { DirectoryClient::DirectoryClient( const std::string& directoryUri, - const DirectoryClientOptions& options) + const DataLakeClientOptions& options) : PathClient(directoryUri, options) { std::vector> policies; diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_file_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_file_client.cpp index ec7e4980f..3fa84cecf 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_file_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_file_client.cpp @@ -102,7 +102,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { const std::string& connectionString, const std::string& fileSystemName, const std::string& filePath, - const FileClientOptions& options) + const DataLakeClientOptions& options) { auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString); auto fileUri = std::move(parsedConnectionString.DataLakeServiceUri); @@ -122,7 +122,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { FileClient::FileClient( const std::string& fileUri, std::shared_ptr credential, - const FileClientOptions& options) + const DataLakeClientOptions& options) : PathClient(fileUri, credential, options), m_blockBlobClient(m_blobClient.GetBlockBlobClient()) { @@ -153,7 +153,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { FileClient::FileClient( const std::string& fileUri, std::shared_ptr credential, - const FileClientOptions& options) + const DataLakeClientOptions& options) : PathClient(fileUri, credential, options), m_blockBlobClient(m_blobClient.GetBlockBlobClient()) { @@ -182,7 +182,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { m_pipeline = std::make_shared(policies); } - FileClient::FileClient(const std::string& fileUri, const FileClientOptions& options) + FileClient::FileClient(const std::string& fileUri, const DataLakeClientOptions& options) : PathClient(fileUri, options), m_blockBlobClient(m_blobClient.GetBlockBlobClient()) { std::vector> policies; diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_file_system_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_file_system_client.cpp index 09324d4bd..26dbfc8b1 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_file_system_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_file_system_client.cpp @@ -20,10 +20,9 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { namespace { - Blobs::BlobContainerClientOptions GetBlobContainerClientOptions( - const FileSystemClientOptions& options) + Blobs::BlobClientOptions GetBlobContainerClientOptions(const DataLakeClientOptions& options) { - Blobs::BlobContainerClientOptions blobOptions; + Blobs::BlobClientOptions blobOptions; for (const auto& p : options.PerOperationPolicies) { blobOptions.PerOperationPolicies.emplace_back(p->Clone()); @@ -42,7 +41,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { FileSystemClient FileSystemClient::CreateFromConnectionString( const std::string& connectionString, const std::string& fileSystemName, - const FileSystemClientOptions& options) + const DataLakeClientOptions& options) { auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString); auto fileSystemUri = std::move(parsedConnectionString.DataLakeServiceUri); @@ -62,7 +61,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { FileSystemClient::FileSystemClient( const std::string& fileSystemUri, std::shared_ptr credential, - const FileSystemClientOptions& options) + const DataLakeClientOptions& options) : m_dfsUri(Details::GetDfsUriFromUri(fileSystemUri)), m_blobContainerClient( Details::GetBlobUriFromUri(fileSystemUri), @@ -97,7 +96,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { FileSystemClient::FileSystemClient( const std::string& fileSystemUri, std::shared_ptr credential, - const FileSystemClientOptions& options) + const DataLakeClientOptions& options) : m_dfsUri(Details::GetDfsUriFromUri(fileSystemUri)), m_blobContainerClient( Details::GetBlobUriFromUri(fileSystemUri), @@ -131,7 +130,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { FileSystemClient::FileSystemClient( const std::string& fileSystemUri, - const FileSystemClientOptions& options) + const DataLakeClientOptions& options) : m_dfsUri(Details::GetDfsUriFromUri(fileSystemUri)), m_blobContainerClient( Details::GetBlobUriFromUri(fileSystemUri), diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_path_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_path_client.cpp index 55f592a9a..95c7b2da2 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_path_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_path_client.cpp @@ -19,7 +19,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { namespace { - Blobs::BlobClientOptions GetBlobClientOptions(const PathClientOptions& options) + Blobs::BlobClientOptions GetBlobClientOptions(const DataLakeClientOptions& options) { Blobs::BlobClientOptions blobOptions; for (const auto& p : options.PerOperationPolicies) @@ -86,7 +86,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { const std::string& connectionString, const std::string& fileSystemName, const std::string& path, - const PathClientOptions& options) + const DataLakeClientOptions& options) { auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString); auto pathUri = std::move(parsedConnectionString.DataLakeServiceUri); @@ -106,7 +106,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { PathClient::PathClient( const std::string& pathUri, std::shared_ptr credential, - const PathClientOptions& options) + const DataLakeClientOptions& options) : m_dfsUri(Details::GetDfsUriFromUri(pathUri)), m_blobClient(Details::GetBlobUriFromUri(pathUri), credential, GetBlobClientOptions(options)) { @@ -137,7 +137,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { PathClient::PathClient( const std::string& pathUri, std::shared_ptr credential, - const PathClientOptions& options) + const DataLakeClientOptions& options) : m_dfsUri(Details::GetDfsUriFromUri(pathUri)), m_blobClient(Details::GetBlobUriFromUri(pathUri), credential, GetBlobClientOptions(options)) { @@ -166,7 +166,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { m_pipeline = std::make_shared(policies); } - PathClient::PathClient(const std::string& pathUri, const PathClientOptions& options) + PathClient::PathClient(const std::string& pathUri, const DataLakeClientOptions& options) : m_dfsUri(Details::GetDfsUriFromUri(pathUri)), m_blobClient(Details::GetBlobUriFromUri(pathUri), GetBlobClientOptions(options)) { diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_service_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_service_client.cpp index 6e220f1ee..806868b0e 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_service_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_service_client.cpp @@ -18,10 +18,9 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { namespace { - Blobs::BlobServiceClientOptions GetBlobServiceClientOptions( - const DataLakeServiceClientOptions& options) + Blobs::BlobClientOptions GetBlobServiceClientOptions(const DataLakeClientOptions& options) { - Blobs::BlobServiceClientOptions blobOptions; + Blobs::BlobClientOptions blobOptions; for (const auto& p : options.PerOperationPolicies) { blobOptions.PerOperationPolicies.emplace_back(p->Clone()); @@ -54,7 +53,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { DataLakeServiceClient DataLakeServiceClient::CreateFromConnectionString( const std::string& connectionString, - const DataLakeServiceClientOptions& options) + const DataLakeClientOptions& options) { auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString); auto serviceUri = std::move(parsedConnectionString.DataLakeServiceUri); @@ -73,7 +72,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { DataLakeServiceClient::DataLakeServiceClient( const std::string& serviceUri, std::shared_ptr credential, - const DataLakeServiceClientOptions& options) + const DataLakeClientOptions& options) : m_dfsUri(Details::GetDfsUriFromUri(serviceUri)), m_blobServiceClient( Details::GetBlobUriFromUri(serviceUri), credential, @@ -105,7 +104,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { DataLakeServiceClient::DataLakeServiceClient( const std::string& serviceUri, std::shared_ptr credential, - const DataLakeServiceClientOptions& options) + const DataLakeClientOptions& options) : m_dfsUri(Details::GetDfsUriFromUri(serviceUri)), m_blobServiceClient( Details::GetBlobUriFromUri(serviceUri), credential, @@ -137,7 +136,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { DataLakeServiceClient::DataLakeServiceClient( const std::string& serviceUri, - const DataLakeServiceClientOptions& options) + const DataLakeClientOptions& options) : m_dfsUri(Details::GetDfsUriFromUri(serviceUri)), m_blobServiceClient( Details::GetBlobUriFromUri(serviceUri), GetBlobServiceClientOptions(options)) diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_directory_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_directory_client.hpp index d502158e7..5201a997d 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_directory_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_directory_client.hpp @@ -34,7 +34,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { const std::string& connectionString, const std::string& shareName, const std::string& directoryPath, - const DirectoryClientOptions& options = DirectoryClientOptions()); + const ShareClientOptions& options = ShareClientOptions()); /** * @brief Initialize a new instance of DirectoryClient using shared key authentication. @@ -45,7 +45,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { explicit DirectoryClient( const std::string& shareDirectoryUri, std::shared_ptr credential, - const DirectoryClientOptions& options = DirectoryClientOptions()); + const ShareClientOptions& options = ShareClientOptions()); /** * @brief Initialize a new instance of DirectoryClient using token authentication. @@ -56,7 +56,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { explicit DirectoryClient( const std::string& shareDirectoryUri, std::shared_ptr credential, - const DirectoryClientOptions& options = DirectoryClientOptions()); + const ShareClientOptions& options = ShareClientOptions()); /** * @brief Initialize a new instance of DirectoryClient using anonymous access or shared access @@ -66,7 +66,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ explicit DirectoryClient( const std::string& shareDirectoryUri, - const DirectoryClientOptions& options = DirectoryClientOptions()); + const ShareClientOptions& options = ShareClientOptions()); /** * @brief Gets the directory's primary uri endpoint. diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp index b891bf1ca..5f12b83b7 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp @@ -33,7 +33,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { const std::string& connectionString, const std::string& shareName, const std::string& filePath, - const FileClientOptions& options = FileClientOptions()); + const ShareClientOptions& options = ShareClientOptions()); /** * @brief Initialize a new instance of FileClient using shared key authentication. @@ -44,7 +44,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { explicit FileClient( const std::string& shareFileUri, std::shared_ptr credential, - const FileClientOptions& options = FileClientOptions()); + const ShareClientOptions& options = ShareClientOptions()); /** * @brief Initialize a new instance of FileClient using token authentication. @@ -55,7 +55,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { explicit FileClient( const std::string& shareFileUri, std::shared_ptr credential, - const FileClientOptions& options = FileClientOptions()); + const ShareClientOptions& options = ShareClientOptions()); /** * @brief Initialize a new instance of FileClient using anonymous access or shared access @@ -65,7 +65,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ explicit FileClient( const std::string& shareFileUri, - const FileClientOptions& options = FileClientOptions()); + const ShareClientOptions& options = ShareClientOptions()); /** * @brief Gets the file's primary uri endpoint. diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp index 00316e40f..913f132b4 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp @@ -17,68 +17,21 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { /** - * @brief Service client options used to initalize ServiceClient. - */ - struct ShareServiceClientOptions - { - std::vector> PerOperationPolicies; - std::vector> PerRetryPolicies; - - /** - * @brief Specify the number of retries and other retry-related options. - */ - StorageRetryOptions RetryOptions; - - /** - * @brief Customized HTTP client. We're going to use the default one if this is empty. - */ - Azure::Core::Http::TransportPolicyOptions TransportPolicyOptions; - }; - - /** - * @brief Share client options used to initalize ShareClient. + * @brief Client options used to initalize ShareServiceClient, ShareClient, ShareFileClient and + * ShareDirectoryClient. */ struct ShareClientOptions { + /** + * @brief Transport pipeline policies for authentication, additional HTTP headers, etc., that + * are applied to every request. + */ std::vector> PerOperationPolicies; - std::vector> PerRetryPolicies; /** - * @brief Specify the number of retries and other retry-related options. + * @brief Transport pipeline policies for authentication, additional HTTP headers, etc., that + * are applied to every retrial. */ - StorageRetryOptions RetryOptions; - - /** - * @brief Customized HTTP client. We're going to use the default one if this is empty. - */ - Azure::Core::Http::TransportPolicyOptions TransportPolicyOptions; - }; - - /** - * @brief Directory client options used to initalize DirectoryClient. - */ - struct DirectoryClientOptions - { - std::vector> PerOperationPolicies; - std::vector> PerRetryPolicies; - - /** - * @brief Specify the number of retries and other retry-related options. - */ - StorageRetryOptions RetryOptions; - - /** - * @brief Customized HTTP client. We're going to use the default one if this is empty. - */ - Azure::Core::Http::TransportPolicyOptions TransportPolicyOptions; - }; - - /** - * @brief File client options used to initalize FileClient. - */ - struct FileClientOptions - { - std::vector> PerOperationPolicies; std::vector> PerRetryPolicies; /** diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_service_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_service_client.hpp index c1b4ea65b..649f82e63 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_service_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_service_client.hpp @@ -29,7 +29,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ static ShareServiceClient CreateFromConnectionString( const std::string& connectionString, - const ShareServiceClientOptions& options = ShareServiceClientOptions()); + const ShareClientOptions& options = ShareClientOptions()); /** * @brief Initialize a new instance of ShareServiceClient using shared key authentication. @@ -40,7 +40,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { explicit ShareServiceClient( const std::string& serviceUri, std::shared_ptr credential, - const ShareServiceClientOptions& options = ShareServiceClientOptions()); + const ShareClientOptions& options = ShareClientOptions()); /** * @brief Initialize a new instance of ShareServiceClient using token authentication. @@ -51,7 +51,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { explicit ShareServiceClient( const std::string& serviceUri, std::shared_ptr credential, - const ShareServiceClientOptions& options = ShareServiceClientOptions()); + const ShareClientOptions& options = ShareClientOptions()); /** * @brief Initialize a new instance of ShareServiceClient using anonymous access or shared @@ -61,7 +61,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ explicit ShareServiceClient( const std::string& serviceUri, - const ShareServiceClientOptions& options = ShareServiceClientOptions()); + const ShareClientOptions& options = ShareClientOptions()); /** * @brief Create a ShareClient from current ShareServiceClient diff --git a/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp index dc5a1bdb0..6be6d041c 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp @@ -20,7 +20,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { const std::string& connectionString, const std::string& shareName, const std::string& directoryPath, - const DirectoryClientOptions& options) + const ShareClientOptions& options) { auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString); auto directoryUri = std::move(parsedConnectionString.FileServiceUri); @@ -41,7 +41,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { DirectoryClient::DirectoryClient( const std::string& shareDirectoryUri, std::shared_ptr credential, - const DirectoryClientOptions& options) + const ShareClientOptions& options) : m_shareDirectoryUri(shareDirectoryUri) { std::vector> policies; @@ -67,7 +67,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { DirectoryClient::DirectoryClient( const std::string& shareDirectoryUri, std::shared_ptr credential, - const DirectoryClientOptions& options) + const ShareClientOptions& options) : m_shareDirectoryUri(shareDirectoryUri) { std::vector> policies; @@ -93,7 +93,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { DirectoryClient::DirectoryClient( const std::string& shareDirectoryUri, - const DirectoryClientOptions& options) + const ShareClientOptions& options) : m_shareDirectoryUri(shareDirectoryUri) { std::vector> policies; diff --git a/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp index f86c1a492..ffbb636cd 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp @@ -23,7 +23,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { const std::string& connectionString, const std::string& shareName, const std::string& filePath, - const FileClientOptions& options) + const ShareClientOptions& options) { auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString); auto fileUri = std::move(parsedConnectionString.FileServiceUri); @@ -43,7 +43,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { FileClient::FileClient( const std::string& shareFileUri, std::shared_ptr credential, - const FileClientOptions& options) + const ShareClientOptions& options) : m_shareFileUri(shareFileUri) { @@ -70,7 +70,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { FileClient::FileClient( const std::string& shareFileUri, std::shared_ptr credential, - const FileClientOptions& options) + const ShareClientOptions& options) : m_shareFileUri(shareFileUri) { std::vector> policies; @@ -94,7 +94,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { m_pipeline = std::make_shared(policies); } - FileClient::FileClient(const std::string& shareFileUri, const FileClientOptions& options) + FileClient::FileClient(const std::string& shareFileUri, const ShareClientOptions& options) : m_shareFileUri(shareFileUri) { std::vector> policies; diff --git a/sdk/storage/azure-storage-files-shares/src/share_service_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_service_client.cpp index bd0bf4484..2680eafeb 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_service_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_service_client.cpp @@ -17,7 +17,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { ShareServiceClient ShareServiceClient::CreateFromConnectionString( const std::string& connectionString, - const ShareServiceClientOptions& options) + const ShareClientOptions& options) { auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString); auto serviceUri = std::move(parsedConnectionString.FileServiceUri); @@ -36,7 +36,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { ShareServiceClient::ShareServiceClient( const std::string& serviceUri, std::shared_ptr credential, - const ShareServiceClientOptions& options) + const ShareClientOptions& options) : m_serviceUri(serviceUri) { std::vector> policies; @@ -62,7 +62,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { ShareServiceClient::ShareServiceClient( const std::string& serviceUri, std::shared_ptr credential, - const ShareServiceClientOptions& options) + const ShareClientOptions& options) : m_serviceUri(serviceUri) { std::vector> policies; @@ -88,7 +88,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { ShareServiceClient::ShareServiceClient( const std::string& serviceUri, - const ShareServiceClientOptions& options) + const ShareClientOptions& options) : m_serviceUri(serviceUri) { std::vector> policies;