Resolve review comments from Core team. (#946)
This commit is contained in:
parent
8e46bbaacd
commit
927542cc6e
@ -126,7 +126,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
|
||||
/**
|
||||
* @brief Deletes the directory.
|
||||
* @param Recursive If "true", all paths beneath the directory will be deleted. If "false" and
|
||||
* @param recursive If "true", all paths beneath the directory will be deleted. If "false" and
|
||||
* the directory is non-empty, an error occurs.
|
||||
* @param options Optional parameters to delete the directory the path points to.
|
||||
* @return Azure::Core::Response<DeleteDirectoryResult> containing the information returned when
|
||||
@ -134,7 +134,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
* @remark This request is sent to dfs endpoint.
|
||||
*/
|
||||
Azure::Core::Response<DeleteDirectoryResult> Delete(
|
||||
bool Recursive,
|
||||
bool recursive,
|
||||
const DeleteDirectoryOptions& options = DeleteDirectoryOptions()) const;
|
||||
|
||||
/**
|
||||
|
||||
@ -174,6 +174,6 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
m_pipeline(std::move(pipeline))
|
||||
{
|
||||
}
|
||||
friend class ServiceClient;
|
||||
friend class DataLakeServiceClient;
|
||||
};
|
||||
}}}} // namespace Azure::Storage::Files::DataLake
|
||||
|
||||
@ -21,7 +21,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
/**
|
||||
* @brief Service client options used to initalize ServiceClient.
|
||||
*/
|
||||
struct ServiceClientOptions
|
||||
struct DataLakeServiceClientOptions
|
||||
{
|
||||
std::vector<std::unique_ptr<Azure::Core::Http::HttpPolicy>> PerOperationPolicies;
|
||||
std::vector<std::unique_ptr<Azure::Core::Http::HttpPolicy>> PerRetryPolicies;
|
||||
|
||||
@ -19,17 +19,17 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
|
||||
class FileSystemClient;
|
||||
|
||||
class ServiceClient {
|
||||
class DataLakeServiceClient {
|
||||
public:
|
||||
/**
|
||||
* @brief Create from connection string
|
||||
* @param connectionString Azure Storage connection string.
|
||||
* @param options Optional parameters used to initialize the client.
|
||||
* @return ServiceClient
|
||||
* @return DataLakeServiceClient
|
||||
*/
|
||||
static ServiceClient CreateFromConnectionString(
|
||||
static DataLakeServiceClient CreateFromConnectionString(
|
||||
const std::string& connectionString,
|
||||
const ServiceClientOptions& options = ServiceClientOptions());
|
||||
const DataLakeServiceClientOptions& options = DataLakeServiceClientOptions());
|
||||
|
||||
/**
|
||||
* @brief Shared key authentication client.
|
||||
@ -37,10 +37,10 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
* @param credential The shared key credential used to initialize the client.
|
||||
* @param options Optional parameters used to initialize the client.
|
||||
*/
|
||||
explicit ServiceClient(
|
||||
explicit DataLakeServiceClient(
|
||||
const std::string& serviceUri,
|
||||
std::shared_ptr<SharedKeyCredential> credential,
|
||||
const ServiceClientOptions& options = ServiceClientOptions());
|
||||
const DataLakeServiceClientOptions& options = DataLakeServiceClientOptions());
|
||||
|
||||
/**
|
||||
* @brief Bearer token authentication client.
|
||||
@ -48,22 +48,22 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
* @param credential The client secret credential used to initialize the client.
|
||||
* @param options Optional parameters used to initialize the client.
|
||||
*/
|
||||
explicit ServiceClient(
|
||||
explicit DataLakeServiceClient(
|
||||
const std::string& serviceUri,
|
||||
std::shared_ptr<Identity::ClientSecretCredential> credential,
|
||||
const ServiceClientOptions& options = ServiceClientOptions());
|
||||
const DataLakeServiceClientOptions& options = DataLakeServiceClientOptions());
|
||||
|
||||
/**
|
||||
* @brief Anonymous/SAS/customized pipeline auth.
|
||||
* @param serviceUri The service URI this client's request targets.
|
||||
* @param options Optional parameters used to initialize the client.
|
||||
*/
|
||||
explicit ServiceClient(
|
||||
explicit DataLakeServiceClient(
|
||||
const std::string& serviceUri,
|
||||
const ServiceClientOptions& options = ServiceClientOptions());
|
||||
const DataLakeServiceClientOptions& options = DataLakeServiceClientOptions());
|
||||
|
||||
/**
|
||||
* @brief Create a FileSystemClient from current ServiceClient
|
||||
* @brief Create a FileSystemClient from current DataLakeServiceClient
|
||||
* @param fileSystemName The name of the file system.
|
||||
* @return FileSystemClient
|
||||
*/
|
||||
|
||||
@ -2411,7 +2411,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
const AppendDataOptions& appendDataOptions)
|
||||
{
|
||||
Azure::Core::Http::Request request(
|
||||
Azure::Core::Http::HttpMethod::Patch, std::move(url), &bodyStream);
|
||||
Azure::Core::Http::HttpMethod::Patch, url, &bodyStream);
|
||||
request.GetUrl().AppendQueryParameter(Details::c_QueryAction, "append");
|
||||
if (appendDataOptions.Position.HasValue())
|
||||
{
|
||||
|
||||
@ -19,7 +19,7 @@ void DataLakeGettingStarted()
|
||||
|
||||
// Initializing a ServiceClient that can then initialize the FileSystemClient or list file
|
||||
// systems.
|
||||
auto serviceClient = ServiceClient::CreateFromConnectionString(GetConnectionString());
|
||||
auto serviceClient = DataLakeServiceClient::CreateFromConnectionString(GetConnectionString());
|
||||
// Initializing a FileSystemClient that can then initialize the PathClient, FileClient,
|
||||
// DirectoryClient.
|
||||
auto fileSystemClient
|
||||
|
||||
@ -184,7 +184,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
}
|
||||
|
||||
Azure::Core::Response<DeleteDirectoryResult> DirectoryClient::Delete(
|
||||
bool Recursive,
|
||||
bool recursive,
|
||||
const DeleteDirectoryOptions& options) const
|
||||
{
|
||||
Details::DataLakeRestClient::Path::DeleteOptions protocolLayerOptions;
|
||||
@ -194,7 +194,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.RecursiveOptional = Recursive;
|
||||
protocolLayerOptions.RecursiveOptional = recursive;
|
||||
return Details::DataLakeRestClient::Path::Delete(
|
||||
m_dfsUri, *m_pipeline, options.Context, protocolLayerOptions);
|
||||
}
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
|
||||
namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
namespace {
|
||||
Blobs::BlobServiceClientOptions GetBlobServiceClientOptions(const ServiceClientOptions& options)
|
||||
Blobs::BlobServiceClientOptions GetBlobServiceClientOptions(
|
||||
const DataLakeServiceClientOptions& options)
|
||||
{
|
||||
Blobs::BlobServiceClientOptions blobOptions;
|
||||
for (const auto& p : options.PerOperationPolicies)
|
||||
@ -51,28 +52,28 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
ServiceClient ServiceClient::CreateFromConnectionString(
|
||||
DataLakeServiceClient DataLakeServiceClient::CreateFromConnectionString(
|
||||
const std::string& connectionString,
|
||||
const ServiceClientOptions& options)
|
||||
const DataLakeServiceClientOptions& options)
|
||||
{
|
||||
auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString);
|
||||
auto serviceUri = std::move(parsedConnectionString.DataLakeServiceUri);
|
||||
|
||||
if (parsedConnectionString.KeyCredential)
|
||||
{
|
||||
return ServiceClient(
|
||||
return DataLakeServiceClient(
|
||||
serviceUri.GetAbsoluteUrl(), parsedConnectionString.KeyCredential, options);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ServiceClient(serviceUri.GetAbsoluteUrl(), options);
|
||||
return DataLakeServiceClient(serviceUri.GetAbsoluteUrl(), options);
|
||||
}
|
||||
}
|
||||
|
||||
ServiceClient::ServiceClient(
|
||||
DataLakeServiceClient::DataLakeServiceClient(
|
||||
const std::string& serviceUri,
|
||||
std::shared_ptr<SharedKeyCredential> credential,
|
||||
const ServiceClientOptions& options)
|
||||
const DataLakeServiceClientOptions& options)
|
||||
: m_dfsUri(Details::GetDfsUriFromUri(serviceUri)), m_blobServiceClient(
|
||||
Details::GetBlobUriFromUri(serviceUri),
|
||||
credential,
|
||||
@ -100,10 +101,10 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
|
||||
}
|
||||
|
||||
ServiceClient::ServiceClient(
|
||||
DataLakeServiceClient::DataLakeServiceClient(
|
||||
const std::string& serviceUri,
|
||||
std::shared_ptr<Identity::ClientSecretCredential> credential,
|
||||
const ServiceClientOptions& options)
|
||||
const DataLakeServiceClientOptions& options)
|
||||
: m_dfsUri(Details::GetDfsUriFromUri(serviceUri)), m_blobServiceClient(
|
||||
Details::GetBlobUriFromUri(serviceUri),
|
||||
credential,
|
||||
@ -132,7 +133,9 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
|
||||
}
|
||||
|
||||
ServiceClient::ServiceClient(const std::string& serviceUri, const ServiceClientOptions& options)
|
||||
DataLakeServiceClient::DataLakeServiceClient(
|
||||
const std::string& serviceUri,
|
||||
const DataLakeServiceClientOptions& options)
|
||||
: m_dfsUri(Details::GetDfsUriFromUri(serviceUri)), m_blobServiceClient(
|
||||
Details::GetBlobUriFromUri(serviceUri),
|
||||
GetBlobServiceClientOptions(options))
|
||||
@ -158,7 +161,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
|
||||
}
|
||||
|
||||
FileSystemClient ServiceClient::GetFileSystemClient(const std::string& fileSystemName) const
|
||||
FileSystemClient DataLakeServiceClient::GetFileSystemClient(
|
||||
const std::string& fileSystemName) const
|
||||
{
|
||||
auto builder = m_dfsUri;
|
||||
builder.AppendPath(Storage::Details::UrlEncodePath(fileSystemName));
|
||||
@ -166,8 +170,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
builder, m_blobServiceClient.GetBlobContainerClient(fileSystemName), m_pipeline);
|
||||
}
|
||||
|
||||
Azure::Core::Response<ListFileSystemsSegmentResult> ServiceClient::ListFileSystemsSegement(
|
||||
const ListFileSystemsSegmentOptions& options) const
|
||||
Azure::Core::Response<ListFileSystemsSegmentResult>
|
||||
DataLakeServiceClient::ListFileSystemsSegement(const ListFileSystemsSegmentOptions& options) const
|
||||
{
|
||||
Blobs::ListContainersSegmentOptions blobOptions;
|
||||
blobOptions.Context = options.Context;
|
||||
|
||||
@ -33,8 +33,8 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
|
||||
auto keyCredential = Details::ParseConnectionString(AdlsGen2ConnectionString()).KeyCredential;
|
||||
auto accountName = keyCredential->AccountName;
|
||||
auto serviceClient0
|
||||
= Files::DataLake::ServiceClient::CreateFromConnectionString(AdlsGen2ConnectionString());
|
||||
auto serviceClient0 = Files::DataLake::DataLakeServiceClient::CreateFromConnectionString(
|
||||
AdlsGen2ConnectionString());
|
||||
auto filesystemClient0 = serviceClient0.GetFileSystemClient(m_fileSystemName);
|
||||
auto containerClinet0 = Blobs::BlobContainerClient::CreateFromConnectionString(
|
||||
AdlsGen2ConnectionString(), m_fileSystemName);
|
||||
@ -50,7 +50,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
auto directory2Uri = directory2Client0.GetDfsUri();
|
||||
auto fileUri = fileClient0.GetUri();
|
||||
|
||||
auto serviceClient1 = Files::DataLake::ServiceClient(
|
||||
auto serviceClient1 = Files::DataLake::DataLakeServiceClient(
|
||||
serviceUri,
|
||||
std::make_shared<Azure::Identity::ClientSecretCredential>(
|
||||
AadTenantId(), AadClientId(), AadClientSecret()));
|
||||
|
||||
@ -9,7 +9,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
|
||||
const size_t c_FILE_SYSTEM_TEST_SIZE = 5;
|
||||
|
||||
std::shared_ptr<Files::DataLake::ServiceClient>
|
||||
std::shared_ptr<Files::DataLake::DataLakeServiceClient>
|
||||
DataLakeServiceClientTest::m_dataLakeServiceClient;
|
||||
std::vector<std::string> DataLakeServiceClientTest::m_fileSystemNameSetA;
|
||||
std::vector<std::string> DataLakeServiceClientTest::m_fileSystemNameSetB;
|
||||
@ -18,8 +18,9 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
|
||||
void DataLakeServiceClientTest::SetUpTestSuite()
|
||||
{
|
||||
m_dataLakeServiceClient = std::make_shared<Files::DataLake::ServiceClient>(
|
||||
Files::DataLake::ServiceClient::CreateFromConnectionString(AdlsGen2ConnectionString()));
|
||||
m_dataLakeServiceClient = std::make_shared<Files::DataLake::DataLakeServiceClient>(
|
||||
Files::DataLake::DataLakeServiceClient::CreateFromConnectionString(
|
||||
AdlsGen2ConnectionString()));
|
||||
m_fileSystemPrefixA = LowercaseRandomString(10);
|
||||
m_fileSystemPrefixB = LowercaseRandomString(10);
|
||||
m_fileSystemNameSetA.clear();
|
||||
|
||||
@ -14,7 +14,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
static std::vector<Files::DataLake::FileSystem> ListAllFileSystems(
|
||||
const std::string& prefix = std::string());
|
||||
|
||||
static std::shared_ptr<Files::DataLake::ServiceClient> m_dataLakeServiceClient;
|
||||
static std::shared_ptr<Files::DataLake::DataLakeServiceClient> m_dataLakeServiceClient;
|
||||
static std::vector<std::string> m_fileSystemNameSetA;
|
||||
static std::string m_fileSystemPrefixA;
|
||||
static std::vector<std::string> m_fileSystemNameSetB;
|
||||
|
||||
@ -342,7 +342,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
{
|
||||
std::string LastModified;
|
||||
std::string Etag;
|
||||
int32_t Quota = int32_t();
|
||||
int64_t Quota = int64_t();
|
||||
Azure::Core::Nullable<int32_t> ProvisionedIops;
|
||||
Azure::Core::Nullable<int32_t> ProvisionedIngressMBps;
|
||||
Azure::Core::Nullable<int32_t> ProvisionedEgressMBps;
|
||||
@ -537,7 +537,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
std::map<std::string, std::string> Metadata;
|
||||
std::string ETag;
|
||||
std::string LastModified;
|
||||
int32_t Quota = int32_t();
|
||||
int64_t Quota = int64_t();
|
||||
Azure::Core::Nullable<int32_t> ProvisionedIops;
|
||||
Azure::Core::Nullable<int32_t> ProvisionedIngressMBps;
|
||||
Azure::Core::Nullable<int32_t> ProvisionedEgressMBps;
|
||||
@ -2341,7 +2341,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
else if (path.size() == 1 && path[0] == XmlTagName::c_Quota)
|
||||
{
|
||||
result.Quota = std::stoi(node.Value);
|
||||
result.Quota = std::stoll(node.Value);
|
||||
}
|
||||
else if (path.size() == 1 && path[0] == XmlTagName::c_RemainingRetentionDays)
|
||||
{
|
||||
@ -2626,7 +2626,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
// Timeouts for File Service Operations.</a>
|
||||
std::map<std::string, std::string>
|
||||
Metadata; // A name-value pair to associate with a file storage object.
|
||||
Azure::Core::Nullable<int32_t>
|
||||
Azure::Core::Nullable<int64_t>
|
||||
ShareQuota; // Specifies the maximum size of the share, in gigabytes.
|
||||
std::string ApiVersionParameter
|
||||
= Details::c_DefaultServiceApiVersion; // Specifies the version of the operation to
|
||||
@ -3241,7 +3241,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
std::string ApiVersionParameter
|
||||
= Details::c_DefaultServiceApiVersion; // Specifies the version of the operation to
|
||||
// use for this request.
|
||||
Azure::Core::Nullable<int32_t>
|
||||
Azure::Core::Nullable<int64_t>
|
||||
ShareQuota; // Specifies the maximum size of the share, in gigabytes.
|
||||
Azure::Core::Nullable<std::string>
|
||||
LeaseIdOptional; // If specified, the operation only succeeds if the resource's lease
|
||||
@ -3565,7 +3565,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
result.ETag = response.GetHeaders().at(Details::c_HeaderETag);
|
||||
result.LastModified = response.GetHeaders().at(Details::c_HeaderLastModified);
|
||||
result.Quota = std::stoi(response.GetHeaders().at(Details::c_HeaderQuota));
|
||||
result.Quota = std::stoll(response.GetHeaders().at(Details::c_HeaderQuota));
|
||||
if (response.GetHeaders().find(Details::c_HeaderProvisionedIops)
|
||||
!= response.GetHeaders().end())
|
||||
{
|
||||
|
||||
@ -143,7 +143,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
* version and modified time of a share.
|
||||
*/
|
||||
Azure::Core::Response<SetShareQuotaResult> SetQuota(
|
||||
int32_t quota,
|
||||
int32_t quotaInGiB,
|
||||
const SetShareQuotaOptions& options = SetShareQuotaOptions()) const;
|
||||
|
||||
/**
|
||||
@ -287,6 +287,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
: m_shareUri(std::move(shareUri)), m_pipeline(std::move(pipeline))
|
||||
{
|
||||
}
|
||||
friend class ServiceClient;
|
||||
friend class ShareServiceClient;
|
||||
};
|
||||
}}}} // namespace Azure::Storage::Files::Shares
|
||||
|
||||
@ -19,7 +19,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
/**
|
||||
* @brief Service client options used to initalize ServiceClient.
|
||||
*/
|
||||
struct ServiceClientOptions
|
||||
struct ShareServiceClientOptions
|
||||
{
|
||||
std::vector<std::unique_ptr<Azure::Core::Http::HttpPolicy>> PerOperationPolicies;
|
||||
std::vector<std::unique_ptr<Azure::Core::Http::HttpPolicy>> PerRetryPolicies;
|
||||
@ -137,7 +137,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
/**
|
||||
* @brief Specifies the maximum size of the share, in gigabytes.
|
||||
*/
|
||||
Azure::Core::Nullable<int32_t> ShareQuota;
|
||||
Azure::Core::Nullable<int64_t> ShareQuotaInGiB;
|
||||
};
|
||||
|
||||
struct DeleteShareOptions
|
||||
|
||||
@ -18,53 +18,53 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
|
||||
class ShareClient;
|
||||
|
||||
class ServiceClient {
|
||||
class ShareServiceClient {
|
||||
public:
|
||||
/**
|
||||
* @brief Create A ServiceClient from connection string to manage the service related
|
||||
* @brief Create A ShareServiceClient from connection string to manage the service related
|
||||
* attributes.
|
||||
* @param connectionString Azure Storage connection string.
|
||||
* @param options Optional parameters used to initialize the client.
|
||||
* @return ServiceClient
|
||||
* @return ShareServiceClient
|
||||
*/
|
||||
static ServiceClient CreateFromConnectionString(
|
||||
static ShareServiceClient CreateFromConnectionString(
|
||||
const std::string& connectionString,
|
||||
const ServiceClientOptions& options = ServiceClientOptions());
|
||||
const ShareServiceClientOptions& options = ShareServiceClientOptions());
|
||||
|
||||
/**
|
||||
* @brief Initialize a new instance of ServiceClient using shared key authentication.
|
||||
* @brief Initialize a new instance of ShareServiceClient using shared key authentication.
|
||||
* @param serviceUri The service URI this client's request targets.
|
||||
* @param credential The shared key credential used to initialize the client.
|
||||
* @param options Optional parameters used to initialize the client.
|
||||
*/
|
||||
explicit ServiceClient(
|
||||
explicit ShareServiceClient(
|
||||
const std::string& serviceUri,
|
||||
std::shared_ptr<SharedKeyCredential> credential,
|
||||
const ServiceClientOptions& options = ServiceClientOptions());
|
||||
const ShareServiceClientOptions& options = ShareServiceClientOptions());
|
||||
|
||||
/**
|
||||
* @brief Initialize a new instance of ServiceClient using token authentication.
|
||||
* @brief Initialize a new instance of ShareServiceClient using token authentication.
|
||||
* @param serviceUri The service URI this client's request targets.
|
||||
* @param credential The client secret credential used to initialize the client.
|
||||
* @param options Optional parameters used to initialize the client.
|
||||
*/
|
||||
explicit ServiceClient(
|
||||
explicit ShareServiceClient(
|
||||
const std::string& serviceUri,
|
||||
std::shared_ptr<Identity::ClientSecretCredential> credential,
|
||||
const ServiceClientOptions& options = ServiceClientOptions());
|
||||
const ShareServiceClientOptions& options = ShareServiceClientOptions());
|
||||
|
||||
/**
|
||||
* @brief Initialize a new instance of ServiceClient using anonymous access or shared access
|
||||
* signature.
|
||||
* @brief Initialize a new instance of ShareServiceClient using anonymous access or shared
|
||||
* access signature.
|
||||
* @param serviceUri The service URI this client's request targets.
|
||||
* @param options Optional parameters used to initialize the client.
|
||||
*/
|
||||
explicit ServiceClient(
|
||||
explicit ShareServiceClient(
|
||||
const std::string& serviceUri,
|
||||
const ServiceClientOptions& options = ServiceClientOptions());
|
||||
const ShareServiceClientOptions& options = ShareServiceClientOptions());
|
||||
|
||||
/**
|
||||
* @brief Create a ShareClient from current ServiceClient
|
||||
* @brief Create a ShareClient from current ShareServiceClient
|
||||
* @param shareName The name of the file share.
|
||||
* @return ShareClient A share client that can be used to manage a share resource.
|
||||
*/
|
||||
|
||||
@ -144,7 +144,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
{
|
||||
auto protocolLayerOptions = Details::ShareRestClient::Share::CreateOptions();
|
||||
protocolLayerOptions.Metadata = options.Metadata;
|
||||
protocolLayerOptions.ShareQuota = options.ShareQuota;
|
||||
protocolLayerOptions.ShareQuota = options.ShareQuotaInGiB;
|
||||
return Details::ShareRestClient::Share::Create(
|
||||
m_shareUri, *m_pipeline, options.Context, protocolLayerOptions);
|
||||
}
|
||||
@ -179,11 +179,11 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
|
||||
Azure::Core::Response<SetShareQuotaResult> ShareClient::SetQuota(
|
||||
int32_t quota,
|
||||
int32_t quotaInGiB,
|
||||
const SetShareQuotaOptions& options) const
|
||||
{
|
||||
auto protocolLayerOptions = Details::ShareRestClient::Share::SetQuotaOptions();
|
||||
protocolLayerOptions.ShareQuota = quota;
|
||||
protocolLayerOptions.ShareQuota = quotaInGiB;
|
||||
return Details::ShareRestClient::Share::SetQuota(
|
||||
m_shareUri, *m_pipeline, options.Context, protocolLayerOptions);
|
||||
}
|
||||
|
||||
@ -15,28 +15,28 @@
|
||||
#include "azure/storage/files/shares/version.hpp"
|
||||
|
||||
namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
ServiceClient ServiceClient::CreateFromConnectionString(
|
||||
ShareServiceClient ShareServiceClient::CreateFromConnectionString(
|
||||
const std::string& connectionString,
|
||||
const ServiceClientOptions& options)
|
||||
const ShareServiceClientOptions& options)
|
||||
{
|
||||
auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString);
|
||||
auto serviceUri = std::move(parsedConnectionString.FileServiceUri);
|
||||
|
||||
if (parsedConnectionString.KeyCredential)
|
||||
{
|
||||
return ServiceClient(
|
||||
return ShareServiceClient(
|
||||
serviceUri.GetAbsoluteUrl(), parsedConnectionString.KeyCredential, options);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ServiceClient(serviceUri.GetAbsoluteUrl(), options);
|
||||
return ShareServiceClient(serviceUri.GetAbsoluteUrl(), options);
|
||||
}
|
||||
}
|
||||
|
||||
ServiceClient::ServiceClient(
|
||||
ShareServiceClient::ShareServiceClient(
|
||||
const std::string& serviceUri,
|
||||
std::shared_ptr<SharedKeyCredential> credential,
|
||||
const ServiceClientOptions& options)
|
||||
const ShareServiceClientOptions& options)
|
||||
: m_serviceUri(serviceUri)
|
||||
{
|
||||
std::vector<std::unique_ptr<Azure::Core::Http::HttpPolicy>> policies;
|
||||
@ -58,10 +58,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
|
||||
}
|
||||
|
||||
ServiceClient::ServiceClient(
|
||||
ShareServiceClient::ShareServiceClient(
|
||||
const std::string& serviceUri,
|
||||
std::shared_ptr<Identity::ClientSecretCredential> credential,
|
||||
const ServiceClientOptions& options)
|
||||
const ShareServiceClientOptions& options)
|
||||
: m_serviceUri(serviceUri)
|
||||
{
|
||||
std::vector<std::unique_ptr<Azure::Core::Http::HttpPolicy>> policies;
|
||||
@ -84,7 +84,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
|
||||
}
|
||||
|
||||
ServiceClient::ServiceClient(const std::string& serviceUri, const ServiceClientOptions& options)
|
||||
ShareServiceClient::ShareServiceClient(
|
||||
const std::string& serviceUri,
|
||||
const ShareServiceClientOptions& options)
|
||||
: m_serviceUri(serviceUri)
|
||||
{
|
||||
std::vector<std::unique_ptr<Azure::Core::Http::HttpPolicy>> policies;
|
||||
@ -105,14 +107,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
|
||||
}
|
||||
|
||||
ShareClient ServiceClient::GetShareClient(const std::string& shareName) const
|
||||
ShareClient ShareServiceClient::GetShareClient(const std::string& shareName) const
|
||||
{
|
||||
auto builder = m_serviceUri;
|
||||
builder.AppendPath(Storage::Details::UrlEncodePath(shareName));
|
||||
return ShareClient(builder, m_pipeline);
|
||||
}
|
||||
|
||||
Azure::Core::Response<ListSharesSegmentResult> ServiceClient::ListSharesSegment(
|
||||
Azure::Core::Response<ListSharesSegmentResult> ShareServiceClient::ListSharesSegment(
|
||||
const ListSharesSegmentOptions& options) const
|
||||
{
|
||||
auto protocolLayerOptions = Details::ShareRestClient::Service::ListSharesSegmentOptions();
|
||||
@ -124,7 +126,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
m_serviceUri, *m_pipeline, options.Context, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<SetServicePropertiesResult> ServiceClient::SetProperties(
|
||||
Azure::Core::Response<SetServicePropertiesResult> ShareServiceClient::SetProperties(
|
||||
StorageServiceProperties properties,
|
||||
const SetServicePropertiesOptions& options) const
|
||||
{
|
||||
@ -134,7 +136,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
m_serviceUri, *m_pipeline, options.Context, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<GetServicePropertiesResult> ServiceClient::GetProperties(
|
||||
Azure::Core::Response<GetServicePropertiesResult> ShareServiceClient::GetProperties(
|
||||
const GetServicePropertiesOptions& options) const
|
||||
{
|
||||
auto protocolLayerOptions = Details::ShareRestClient::Service::GetPropertiesOptions();
|
||||
|
||||
@ -130,8 +130,8 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
AdlsGen2ConnectionString(), LowercaseRandomString());
|
||||
Files::Shares::CreateShareOptions options1;
|
||||
Files::Shares::CreateShareOptions options2;
|
||||
options1.ShareQuota = quota32GB;
|
||||
options2.ShareQuota = quota64GB;
|
||||
options1.ShareQuotaInGiB = quota32GB;
|
||||
options2.ShareQuotaInGiB = quota64GB;
|
||||
|
||||
EXPECT_NO_THROW(client1.Create(options1));
|
||||
EXPECT_NO_THROW(client2.Create(options2));
|
||||
|
||||
@ -26,7 +26,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
auto keyCredential
|
||||
= Details::ParseConnectionString(StandardStorageConnectionString()).KeyCredential;
|
||||
auto accountName = keyCredential->AccountName;
|
||||
auto fileServiceClient0 = Files::Shares::ServiceClient::CreateFromConnectionString(
|
||||
auto fileServiceClient0 = Files::Shares::ShareServiceClient::CreateFromConnectionString(
|
||||
StandardStorageConnectionString());
|
||||
auto shareClient0 = fileServiceClient0.GetShareClient(m_shareName);
|
||||
auto fileClient0 = shareClient0.GetFileClient(fileName);
|
||||
|
||||
@ -20,7 +20,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
|
||||
const size_t c_SHARE_TEST_SIZE = 5;
|
||||
|
||||
std::shared_ptr<Files::Shares::ServiceClient>
|
||||
std::shared_ptr<Files::Shares::ShareServiceClient>
|
||||
FileShareServiceClientTest::m_fileShareServiceClient;
|
||||
std::vector<std::string> FileShareServiceClientTest::m_shareNameSetA;
|
||||
std::vector<std::string> FileShareServiceClientTest::m_shareNameSetB;
|
||||
@ -29,8 +29,8 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
|
||||
void FileShareServiceClientTest::SetUpTestSuite()
|
||||
{
|
||||
m_fileShareServiceClient = std::make_shared<Files::Shares::ServiceClient>(
|
||||
Files::Shares::ServiceClient::CreateFromConnectionString(
|
||||
m_fileShareServiceClient = std::make_shared<Files::Shares::ShareServiceClient>(
|
||||
Files::Shares::ShareServiceClient::CreateFromConnectionString(
|
||||
StandardStorageConnectionString()));
|
||||
m_sharePrefixA = LowercaseRandomString(10);
|
||||
m_sharePrefixB = LowercaseRandomString(10);
|
||||
@ -246,8 +246,9 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
|
||||
TEST_F(FileShareServiceClientTest, DISABLED_SetPremiumFileProperties)
|
||||
{
|
||||
auto premiumFileShareServiceClient = std::make_shared<Files::Shares::ServiceClient>(
|
||||
Files::Shares::ServiceClient::CreateFromConnectionString(PremiumFileConnectionString()));
|
||||
auto premiumFileShareServiceClient = std::make_shared<Files::Shares::ShareServiceClient>(
|
||||
Files::Shares::ShareServiceClient::CreateFromConnectionString(
|
||||
PremiumFileConnectionString()));
|
||||
auto properties = *premiumFileShareServiceClient->GetProperties();
|
||||
auto originalProperties = properties;
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
static std::vector<Files::Shares::ShareItem> ListAllShares(
|
||||
const std::string& prefix = std::string());
|
||||
|
||||
static std::shared_ptr<Files::Shares::ServiceClient> m_fileShareServiceClient;
|
||||
static std::shared_ptr<Files::Shares::ShareServiceClient> m_fileShareServiceClient;
|
||||
static std::vector<std::string> m_shareNameSetA;
|
||||
static std::string m_sharePrefixA;
|
||||
static std::vector<std::string> m_shareNameSetB;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user