Refined File service. (#1629)

This commit is contained in:
Kan Tang 2021-02-09 10:57:55 +08:00 committed by GitHub
parent b3497f8c16
commit 19ea155f45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 324 additions and 414 deletions

View File

@ -20,6 +20,18 @@
- Added `RequestId` in `ForceCloseShareDirectoryHandleResult`.
- Removed `TransactionalContentHash` from `ClearShareFileRangeResult`.
- Changed API signature of `ShareFileClient::UploadRangeFromUri`.
- Renamed `ForceCloseAllHandles` to `ForceCloseAllHandlesSinglePage` and all related structs.
- Made all `ContinuationToken` in return types nullable.
- Renamed `ShareFileHttpHeaders` to `FileHttpHeaders`.
- Renamed `ShareGetPropertiesResult::AccessTierChangeTime` to `AccessTierChangedOn`.
- Renamed `ShareGetStatisticsResult::ShareUsageBytes` to `ShareUsageInBytes`.
- Renamed `ShareGetPermissionResult::Permission` to `FilePermission`.
- Grouped all file SMB properties into a struct and refined the APIs that return these properties.
- Renamed `numberOfHandlesClosed` to `NumberOfHandlesClosed` and `numberOfHandlesFailedToClose` to `NumberOfHandlesFailedToClose`.
- Renamed `FileGetRangeListResult::FileContentLength` to `FileSize`.
- Renamed `StorageServiceProperties` to `FileServiceProperties`.
- Removed `LeaseTime` in results returned by lease operations. Also removed `LeaseId` in `ShareBreakLeaseResult`.
## 12.0.0-beta.7 (2021-02-04)

View File

@ -5,6 +5,7 @@
#pragma once
#include "azure/storage/files/shares/dll_import_export.hpp"
#include "azure/storage/files/shares/share_file_attributes.hpp"
#include <functional>
#include <iostream>
@ -29,7 +30,7 @@
namespace Azure { namespace Storage { namespace Files { namespace Shares {
namespace Models {
struct ShareFileHttpHeaders
struct FileHttpHeaders
{
std::string CacheControl;
std::string ContentDisposition;
@ -39,6 +40,45 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Storage::ContentHash ContentHash;
};
struct FileSmbProperties
{
/**
* @brief Permission key of the directory or file.
*/
Azure::Core::Nullable<std::string> PermissionKey;
/**
* @brief If specified, the provided file attributes shall be set. Default value:
* FileAttribute::Archive for file and FileAttribute::Directory for directory.
* FileAttribute::None can also be specified as default.
*/
FileAttributes Attributes;
/**
* @brief Creation time for the file/directory.
*/
Azure::Core::Nullable<Core::DateTime> CreatedOn;
/**
* @brief Last write time for the file/directory.
*/
Azure::Core::Nullable<Core::DateTime> LastWrittenOn;
/**
* @brief Changed time for the file/directory.
*/
Azure::Core::Nullable<Core::DateTime> ChangedOn;
/**
* @brief The fileId of the file.
*/
std::string FileId;
/**
* @brief The parentId of the file
*/
std::string ParentFileId;
};
// Specifies the access tier of the share.
class ShareAccessTier {
public:
@ -246,7 +286,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Azure::Core::Nullable<Core::DateTime> DeletedOn;
int32_t RemainingRetentionDays = int32_t();
Azure::Core::Nullable<ShareAccessTier> AccessTier; // The access tier of the share.
Azure::Core::Nullable<Core::DateTime> AccessTierChangeTime;
Azure::Core::Nullable<Core::DateTime> AccessTierChangedOn;
Azure::Core::Nullable<std::string> AccessTierTransitionState;
LeaseStatusType LeaseStatus;
LeaseStateType LeaseState;
@ -328,7 +368,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
// Stats for the share.
struct ShareStats
{
int64_t ShareUsageBytes
int64_t ShareUsageInBytes
= int64_t(); // The approximate size of the data stored in bytes. Note that this value may
// not include all recently created or recently resized files.
};
@ -341,7 +381,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
};
// Storage service properties.
struct StorageServiceProperties
struct FileServiceProperties
{
Metrics HourMetrics; // A summary of request statistics grouped by API in hourly aggregates
// for files.
@ -355,7 +395,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
struct SharePermission
{
std::string
Permission; // The permission in the Security Descriptor Definition Language (SDDL).
FilePermission; // The permission in the Security Descriptor Definition Language (SDDL).
};
// Describes what lease action to take.
@ -541,17 +581,19 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
constexpr static const char* HeaderLeaseDuration = "x-ms-lease-duration";
constexpr static const char* HeaderLeaseState = "x-ms-lease-state";
constexpr static const char* HeaderLeaseStatus = "x-ms-lease-status";
constexpr static const char* HeaderAccessTierChangeTime = "x-ms-access-tier-change-time";
constexpr static const char* HeaderAccessTierChangedOn = "x-ms-access-tier-change-time";
constexpr static const char* HeaderAccessTierTransitionState
= "x-ms-access-tier-transition-state";
constexpr static const char* HeaderLeaseTime = "x-ms-lease-time";
constexpr static const char* HeaderClientRequestId = "x-ms-client-request-id";
constexpr static const char* HeaderAction = "x-ms-lease-action";
constexpr static const char* HeaderSnapshot = "x-ms-snapshot";
constexpr static const char* HeaderRequestIsServerEncrypted = "x-ms-request-server-encrypted";
constexpr static const char* HeaderFileChangedOn = "x-ms-file-change-time";
constexpr static const char* HeaderAttributes = "x-ms-file-attributes";
constexpr static const char* HeaderCreatedOn = "x-ms-file-creation-time";
constexpr static const char* HeaderLastWrittenOn = "x-ms-file-last-write-time";
constexpr static const char* HeaderChangedOn = "x-ms-file-change-time";
constexpr static const char* HeaderFileId = "x-ms-file-id";
constexpr static const char* HeaderFileParentId = "x-ms-file-parent-id";
constexpr static const char* HeaderParentFileId = "x-ms-file-parent-id";
constexpr static const char* HeaderIsServerEncrypted = "x-ms-server-encrypted";
constexpr static const char* HeaderContentType = "content-type";
constexpr static const char* HeaderContinuationToken = "x-ms-marker";
@ -571,7 +613,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
constexpr static const char* HeaderCopyId = "x-ms-copy-id";
constexpr static const char* HeaderCopyProgress = "x-ms-copy-progress";
constexpr static const char* HeaderCopyStatus = "x-ms-copy-status";
constexpr static const char* HeaderFileType = "x-ms-type";
constexpr static const char* HeaderXMsRange = "x-ms-range";
constexpr static const char* HeaderFileRangeWrite = "x-ms-write";
constexpr static const char* HeaderFileRangeWriteTypeDefault = "update";
@ -594,14 +635,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::string Prefix;
int32_t PageSizeHint = int32_t();
FilesAndDirectoriesListSinglePage SinglePage;
std::string ContinuationToken;
Azure::Core::Nullable<std::string> ContinuationToken;
};
// An enumeration of handles.
struct ListHandlesResponse
{
std::vector<HandleItem> HandleList;
std::string ContinuationToken;
Azure::Core::Nullable<std::string> ContinuationToken;
};
// An enumeration of shares.
@ -611,7 +652,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::string Prefix;
int32_t PageSizeHint = int32_t();
std::vector<ShareItem> Items;
std::string ContinuationToken;
Azure::Core::Nullable<std::string> ContinuationToken;
};
struct ServiceSetPropertiesResult
@ -634,7 +675,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::string Prefix;
int32_t PageSizeHint = int32_t();
std::vector<ShareItem> Items;
std::string ContinuationToken;
Azure::Core::Nullable<std::string> ContinuationToken;
std::string RequestId;
};
@ -660,7 +701,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Azure::Core::Nullable<LeaseStateType> LeaseState;
Azure::Core::Nullable<LeaseStatusType> LeaseStatus;
Azure::Core::Nullable<ShareAccessTier> AccessTier;
Azure::Core::Nullable<Core::DateTime> AccessTierChangeTime;
Azure::Core::Nullable<Core::DateTime> AccessTierChangedOn;
Azure::Core::Nullable<std::string> AccessTierTransitionState;
};
@ -673,7 +714,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
Core::ETag ETag;
Core::DateTime LastModified;
Azure::Core::Nullable<int32_t> LeaseTime;
std::string LeaseId;
std::string RequestId;
};
@ -682,7 +722,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
Core::ETag ETag;
Core::DateTime LastModified;
Azure::Core::Nullable<int32_t> LeaseTime;
std::string RequestId;
};
@ -690,7 +729,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
Core::ETag ETag;
Core::DateTime LastModified;
Azure::Core::Nullable<int32_t> LeaseTime;
std::string LeaseId;
std::string RequestId;
};
@ -699,7 +737,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
Core::ETag ETag;
Core::DateTime LastModified;
Azure::Core::Nullable<int32_t> LeaseTime;
std::string LeaseId;
std::string RequestId;
};
@ -708,8 +745,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
Core::ETag ETag;
Core::DateTime LastModified;
int32_t LeaseTime = int32_t();
Azure::Core::Nullable<std::string> LeaseId;
std::string RequestId;
};
@ -729,7 +764,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
struct ShareGetPermissionResult
{
std::string Permission;
std::string FilePermission;
std::string RequestId;
};
@ -764,7 +799,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
struct ShareGetStatisticsResult
{
int64_t ShareUsageBytes = int64_t();
int64_t ShareUsageInBytes = int64_t();
Core::ETag ETag;
Core::DateTime LastModified;
std::string RequestId;
@ -783,13 +818,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Core::DateTime LastModified;
std::string RequestId;
bool IsServerEncrypted = bool();
std::string FilePermissionKey;
std::string FileAttributes;
Core::DateTime FileCreatedOn;
Core::DateTime FileLastWrittenOn;
Core::DateTime FileChangedOn;
std::string FileId;
std::string FileParentId;
FileSmbProperties SmbProperties;
};
struct DirectoryGetPropertiesResult
@ -799,13 +828,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Core::DateTime LastModified;
std::string RequestId;
bool IsServerEncrypted = bool();
std::string FileAttributes;
Core::DateTime FileCreatedOn;
Core::DateTime FileLastWrittenOn;
Core::DateTime FileChangedOn;
std::string FilePermissionKey;
std::string FileId;
std::string FileParentId;
FileSmbProperties SmbProperties;
};
struct DirectoryDeleteResult
@ -819,13 +842,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::string RequestId;
Core::DateTime LastModified;
bool IsServerEncrypted = bool();
std::string FilePermissionKey;
std::string FileAttributes;
Core::DateTime FileCreatedOn;
Core::DateTime FileLastWrittenOn;
Core::DateTime FileChangedOn;
std::string FileId;
std::string FileParentId;
FileSmbProperties SmbProperties;
};
struct DirectorySetMetadataResult
@ -844,16 +861,16 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::string Prefix;
int32_t PageSizeHint = int32_t();
FilesAndDirectoriesListSinglePage SinglePage;
std::string ContinuationToken;
ShareFileHttpHeaders HttpHeaders;
Azure::Core::Nullable<std::string> ContinuationToken;
FileHttpHeaders HttpHeaders;
std::string RequestId;
};
struct DirectoryListHandlesResult
{
std::vector<HandleItem> HandleList;
std::string ContinuationToken;
ShareFileHttpHeaders HttpHeaders;
Azure::Core::Nullable<std::string> ContinuationToken;
FileHttpHeaders HttpHeaders;
std::string RequestId;
};
@ -861,8 +878,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
std::string RequestId;
Azure::Core::Nullable<std::string> ContinuationToken;
int32_t numberOfHandlesClosed = int32_t();
int32_t numberOfHandlesFailedToClose = int32_t();
int32_t NumberOfHandlesClosed = int32_t();
int32_t NumberOfHandlesFailedToClose = int32_t();
};
struct FileCreateResult
@ -871,13 +888,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Core::DateTime LastModified;
std::string RequestId;
bool IsServerEncrypted = bool();
std::string FilePermissionKey;
std::string FileAttributes;
Core::DateTime FileCreatedOn;
Core::DateTime FileLastWrittenOn;
Core::DateTime FileChangedOn;
std::string FileId;
std::string FileParentId;
FileSmbProperties SmbProperties;
};
struct FileDownloadResult
@ -885,7 +896,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::unique_ptr<Azure::Core::Http::BodyStream> BodyStream;
Core::DateTime LastModified;
Storage::Metadata Metadata;
ShareFileHttpHeaders HttpHeaders;
FileHttpHeaders HttpHeaders;
Azure::Core::Http::Range ContentRange;
int64_t FileSize;
Core::ETag ETag;
@ -899,13 +910,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Azure::Core::Nullable<std::string> CopySource;
Azure::Core::Nullable<CopyStatusType> CopyStatus;
bool IsServerEncrypted = bool();
std::string FileAttributes;
Core::DateTime FileCreatedOn;
Core::DateTime FileLastWrittenOn;
Core::DateTime FileChangedOn;
std::string FilePermissionKey;
std::string FileId;
std::string FileParentId;
FileSmbProperties SmbProperties;
Azure::Core::Nullable<LeaseDurationType> LeaseDuration;
Azure::Core::Nullable<LeaseStateType> LeaseState;
Azure::Core::Nullable<LeaseStatusType> LeaseStatus;
@ -915,9 +920,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
Core::DateTime LastModified;
Storage::Metadata Metadata;
std::string FileType;
int64_t ContentLength = int64_t();
ShareFileHttpHeaders HttpHeaders;
int64_t FileSize = int64_t();
FileHttpHeaders HttpHeaders;
Core::ETag ETag;
std::string RequestId;
Azure::Core::Nullable<Core::DateTime> CopyCompletedOn;
@ -927,13 +931,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Azure::Core::Nullable<std::string> CopySource;
Azure::Core::Nullable<CopyStatusType> CopyStatus;
bool IsServerEncrypted = bool();
std::string FileAttributes;
Core::DateTime FileCreatedOn;
Core::DateTime FileLastWrittenOn;
Core::DateTime FileChangedOn;
std::string FilePermissionKey;
std::string FileId;
std::string FileParentId;
FileSmbProperties SmbProperties;
Azure::Core::Nullable<LeaseDurationType> LeaseDuration;
Azure::Core::Nullable<LeaseStateType> LeaseState;
Azure::Core::Nullable<LeaseStatusType> LeaseStatus;
@ -950,13 +948,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Core::DateTime LastModified;
std::string RequestId;
bool IsServerEncrypted = bool();
std::string FilePermissionKey;
std::string FileAttributes;
Core::DateTime FileCreatedOn;
Core::DateTime FileLastWrittenOn;
Core::DateTime FileChangedOn;
std::string FileId;
std::string FileParentId;
FileSmbProperties SmbProperties;
};
struct FileSetMetadataResult
@ -1021,7 +1013,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::vector<Core::Http::Range> ClearRanges;
Core::DateTime LastModified;
Core::ETag ETag;
int64_t FileContentLength = int64_t();
int64_t FileSize = int64_t();
std::string RequestId;
};
@ -1042,8 +1034,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
struct FileListHandlesResult
{
std::vector<HandleItem> HandleList;
std::string ContinuationToken;
ShareFileHttpHeaders HttpHeaders;
Azure::Core::Nullable<std::string> ContinuationToken;
FileHttpHeaders HttpHeaders;
std::string RequestId;
};
@ -1051,8 +1043,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
std::string RequestId;
Azure::Core::Nullable<std::string> ContinuationToken;
int32_t numberOfHandlesClosed = int32_t();
int32_t numberOfHandlesFailedToClose = int32_t();
int32_t NumberOfHandlesClosed = int32_t();
int32_t NumberOfHandlesFailedToClose = int32_t();
};
class ShareRestClient {
@ -1116,7 +1108,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
public:
struct SetPropertiesOptions
{
StorageServiceProperties ServiceProperties;
FileServiceProperties ServiceProperties;
Azure::Core::Nullable<int32_t> Timeout;
std::string ApiVersionParameter = Details::DefaultServiceApiVersion;
};
@ -1131,7 +1123,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::string xml_body;
{
Storage::Details::XmlWriter writer;
StorageServicePropertiesToXml(writer, setPropertiesOptions.ServiceProperties);
FileServicePropertiesToXml(writer, setPropertiesOptions.ServiceProperties);
writer.Write(Storage::Details::XmlNode{Storage::Details::XmlNodeType::End});
xml_body = writer.GetDocument();
}
@ -1371,9 +1363,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
writer.Write(Storage::Details::XmlNode{Storage::Details::XmlNodeType::EndTag});
}
static void StorageServicePropertiesToXml(
static void FileServicePropertiesToXml(
Storage::Details::XmlWriter& writer,
const StorageServiceProperties& object)
const FileServiceProperties& object)
{
writer.Write(Storage::Details::XmlNode{
Storage::Details::XmlNodeType::StartTag, "StorageServiceProperties"});
@ -1414,8 +1406,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
reinterpret_cast<const char*>(bodyBuffer.data()), bodyBuffer.size());
ServiceGetPropertiesResult result = bodyBuffer.empty()
? ServiceGetPropertiesResult()
: ServiceGetPropertiesResultFromStorageServiceProperties(
StorageServicePropertiesFromXml(reader));
: ServiceGetPropertiesResultFromFileServiceProperties(
FileServicePropertiesFromXml(reader));
result.RequestId = response.GetHeaders().at(Details::HeaderRequestId);
return Azure::Core::Response<ServiceGetPropertiesResult>(
std::move(result), std::move(responsePtr));
@ -1812,10 +1804,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
return result;
}
static StorageServiceProperties StorageServicePropertiesFromXml(
static FileServiceProperties FileServicePropertiesFromXml(
Storage::Details::XmlReader& reader)
{
auto result = StorageServiceProperties();
auto result = FileServiceProperties();
enum class XmlTagName
{
Cors,
@ -1913,8 +1905,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
return result;
}
static ServiceGetPropertiesResult ServiceGetPropertiesResultFromStorageServiceProperties(
StorageServiceProperties object)
static ServiceGetPropertiesResult ServiceGetPropertiesResultFromFileServiceProperties(
FileServiceProperties object)
{
ServiceGetPropertiesResult result;
result.HourMetrics = std::move(object.HourMetrics);
@ -2238,7 +2230,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else if (path.size() == 1 && path[0] == XmlTagName::AccessTierChangeTime)
{
result.AccessTierChangeTime
result.AccessTierChangedOn
= Core::DateTime::Parse(node.Value, Core::DateTime::DateFormat::Rfc1123);
}
else if (path.size() == 1 && path[0] == XmlTagName::AccessTierTransitionState)
@ -3305,11 +3297,11 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
result.AccessTier = ShareAccessTier(response.GetHeaders().at("x-ms-access-tier"));
}
if (response.GetHeaders().find(Details::HeaderAccessTierChangeTime)
if (response.GetHeaders().find(Details::HeaderAccessTierChangedOn)
!= response.GetHeaders().end())
{
result.AccessTierChangeTime = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderAccessTierChangeTime),
result.AccessTierChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderAccessTierChangedOn),
Core::DateTime::DateFormat::Rfc1123);
}
if (response.GetHeaders().find(Details::HeaderAccessTierTransitionState)
@ -3361,10 +3353,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
result.LastModified = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderLastModified),
Core::DateTime::DateFormat::Rfc1123);
if (response.GetHeaders().find(Details::HeaderLeaseTime) != response.GetHeaders().end())
{
result.LeaseTime = std::stoi(response.GetHeaders().at(Details::HeaderLeaseTime));
}
result.LeaseId = response.GetHeaders().at(Details::HeaderLeaseId);
result.RequestId = response.GetHeaders().at(Details::HeaderRequestId);
return Azure::Core::Response<ShareAcquireLeaseResult>(
@ -3390,10 +3378,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
result.LastModified = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderLastModified),
Core::DateTime::DateFormat::Rfc1123);
if (response.GetHeaders().find(Details::HeaderLeaseTime) != response.GetHeaders().end())
{
result.LeaseTime = std::stoi(response.GetHeaders().at(Details::HeaderLeaseTime));
}
result.RequestId = response.GetHeaders().at(Details::HeaderRequestId);
return Azure::Core::Response<ShareReleaseLeaseResult>(
std::move(result), std::move(responsePtr));
@ -3418,10 +3402,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
result.LastModified = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderLastModified),
Core::DateTime::DateFormat::Rfc1123);
if (response.GetHeaders().find(Details::HeaderLeaseTime) != response.GetHeaders().end())
{
result.LeaseTime = std::stoi(response.GetHeaders().at(Details::HeaderLeaseTime));
}
result.LeaseId = response.GetHeaders().at(Details::HeaderLeaseId);
result.RequestId = response.GetHeaders().at(Details::HeaderRequestId);
return Azure::Core::Response<ShareChangeLeaseResult>(
@ -3447,10 +3427,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
result.LastModified = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderLastModified),
Core::DateTime::DateFormat::Rfc1123);
if (response.GetHeaders().find(Details::HeaderLeaseTime) != response.GetHeaders().end())
{
result.LeaseTime = std::stoi(response.GetHeaders().at(Details::HeaderLeaseTime));
}
result.LeaseId = response.GetHeaders().at(Details::HeaderLeaseId);
result.RequestId = response.GetHeaders().at(Details::HeaderRequestId);
return Azure::Core::Response<ShareRenewLeaseResult>(
@ -3476,14 +3452,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
result.LastModified = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderLastModified),
Core::DateTime::DateFormat::Rfc1123);
if (response.GetHeaders().find(Details::HeaderLeaseTime) != response.GetHeaders().end())
{
result.LeaseTime = std::stoi(response.GetHeaders().at(Details::HeaderLeaseTime));
}
if (response.GetHeaders().find(Details::HeaderLeaseId) != response.GetHeaders().end())
{
result.LeaseId = response.GetHeaders().at(Details::HeaderLeaseId);
}
result.RequestId = response.GetHeaders().at(Details::HeaderRequestId);
return Azure::Core::Response<ShareBreakLeaseResult>(
std::move(result), std::move(responsePtr));
@ -3545,7 +3513,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Azure::Core::Internal::Json::json& node,
const SharePermission& object)
{
node["permission"] = object.Permission;
node["permission"] = object.FilePermission;
}
static Azure::Core::Response<ShareGetPermissionResult> GetPermissionParseResult(
@ -3576,7 +3544,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const Azure::Core::Internal::Json::json& node)
{
SharePermission result;
result.Permission = node["permission"].get<std::string>();
result.FilePermission = node["permission"].get<std::string>();
return result;
}
@ -3584,7 +3552,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
SharePermission object)
{
ShareGetPermissionResult result;
result.Permission = std::move(object.Permission);
result.FilePermission = std::move(object.FilePermission);
return result;
}
@ -4024,7 +3992,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
if (path.size() == 2 && path[0] == XmlTagName::ShareStats
&& path[1] == XmlTagName::ShareUsageBytes)
{
result.ShareUsageBytes = std::stoll(node.Value);
result.ShareUsageInBytes = std::stoll(node.Value);
}
}
}
@ -4034,7 +4002,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
static ShareGetStatisticsResult ShareGetStatisticsResultFromShareStats(ShareStats object)
{
ShareGetStatisticsResult result;
result.ShareUsageBytes = object.ShareUsageBytes;
result.ShareUsageInBytes = object.ShareUsageInBytes;
return result;
}
@ -4437,19 +4405,22 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
result.RequestId = response.GetHeaders().at(Details::HeaderRequestId);
result.IsServerEncrypted
= response.GetHeaders().at(Details::HeaderRequestIsServerEncrypted) == "true";
result.FilePermissionKey = response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.FileAttributes = response.GetHeaders().at(Details::HeaderFileAttributes);
result.FileCreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileCreatedOn),
result.SmbProperties.PermissionKey
= response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.SmbProperties.Attributes
= FileAttributes(response.GetHeaders().at(Details::HeaderAttributes));
result.SmbProperties.CreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderCreatedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileLastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileLastWrittenOn),
result.SmbProperties.LastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderLastWrittenOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileChangedOn),
result.SmbProperties.ChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderChangedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.FileParentId = response.GetHeaders().at(Details::HeaderFileParentId);
result.SmbProperties.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.SmbProperties.ParentFileId
= response.GetHeaders().at(Details::HeaderParentFileId);
return Azure::Core::Response<DirectoryCreateResult>(
std::move(result), std::move(responsePtr));
}
@ -4484,19 +4455,22 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
result.RequestId = response.GetHeaders().at(Details::HeaderRequestId);
result.IsServerEncrypted
= response.GetHeaders().at(Details::HeaderIsServerEncrypted) == "true";
result.FileAttributes = response.GetHeaders().at(Details::HeaderFileAttributes);
result.FileCreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileCreatedOn),
result.SmbProperties.Attributes
= FileAttributes(response.GetHeaders().at(Details::HeaderAttributes));
result.SmbProperties.CreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderCreatedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileLastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileLastWrittenOn),
result.SmbProperties.LastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderLastWrittenOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileChangedOn),
result.SmbProperties.ChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderChangedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FilePermissionKey = response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.FileParentId = response.GetHeaders().at(Details::HeaderFileParentId);
result.SmbProperties.PermissionKey
= response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.SmbProperties.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.SmbProperties.ParentFileId
= response.GetHeaders().at(Details::HeaderParentFileId);
return Azure::Core::Response<DirectoryGetPropertiesResult>(
std::move(result), std::move(responsePtr));
}
@ -4543,19 +4517,22 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Core::DateTime::DateFormat::Rfc1123);
result.IsServerEncrypted
= response.GetHeaders().at(Details::HeaderRequestIsServerEncrypted) == "true";
result.FilePermissionKey = response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.FileAttributes = response.GetHeaders().at(Details::HeaderFileAttributes);
result.FileCreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileCreatedOn),
result.SmbProperties.PermissionKey
= response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.SmbProperties.Attributes
= FileAttributes(response.GetHeaders().at(Details::HeaderAttributes));
result.SmbProperties.CreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderCreatedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileLastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileLastWrittenOn),
result.SmbProperties.LastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderLastWrittenOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileChangedOn),
result.SmbProperties.ChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderChangedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.FileParentId = response.GetHeaders().at(Details::HeaderFileParentId);
result.SmbProperties.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.SmbProperties.ParentFileId
= response.GetHeaders().at(Details::HeaderParentFileId);
return Azure::Core::Response<DirectorySetPropertiesResult>(
std::move(result), std::move(responsePtr));
}
@ -5218,9 +5195,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
result.ContinuationToken = response.GetHeaders().at(Details::HeaderContinuationToken);
}
result.numberOfHandlesClosed
result.NumberOfHandlesClosed
= std::stoi(response.GetHeaders().at(Details::HeaderNumberOfHandlesClosed));
result.numberOfHandlesFailedToClose
result.NumberOfHandlesFailedToClose
= std::stoi(response.GetHeaders().at(Details::HeaderNumberOfHandlesFailedToClose));
return Azure::Core::Response<DirectoryForceCloseHandlesResult>(
std::move(result), std::move(responsePtr));
@ -6114,19 +6091,22 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
result.RequestId = response.GetHeaders().at(Details::HeaderRequestId);
result.IsServerEncrypted
= response.GetHeaders().at(Details::HeaderRequestIsServerEncrypted) == "true";
result.FilePermissionKey = response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.FileAttributes = response.GetHeaders().at(Details::HeaderFileAttributes);
result.FileCreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileCreatedOn),
result.SmbProperties.PermissionKey
= response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.SmbProperties.Attributes
= FileAttributes(response.GetHeaders().at(Details::HeaderAttributes));
result.SmbProperties.CreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderCreatedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileLastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileLastWrittenOn),
result.SmbProperties.LastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderLastWrittenOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileChangedOn),
result.SmbProperties.ChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderChangedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.FileParentId = response.GetHeaders().at(Details::HeaderFileParentId);
result.SmbProperties.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.SmbProperties.ParentFileId
= response.GetHeaders().at(Details::HeaderParentFileId);
return Azure::Core::Response<FileCreateResult>(
std::move(result), std::move(responsePtr));
}
@ -6268,19 +6248,22 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
result.IsServerEncrypted
= response.GetHeaders().at(Details::HeaderIsServerEncrypted) == "true";
}
result.FileAttributes = response.GetHeaders().at(Details::HeaderFileAttributes);
result.FileCreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileCreatedOn),
result.SmbProperties.Attributes
= FileAttributes(response.GetHeaders().at(Details::HeaderAttributes));
result.SmbProperties.CreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderCreatedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileLastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileLastWrittenOn),
result.SmbProperties.LastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderLastWrittenOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileChangedOn),
result.SmbProperties.ChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderChangedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FilePermissionKey = response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.FileParentId = response.GetHeaders().at(Details::HeaderFileParentId);
result.SmbProperties.PermissionKey
= response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.SmbProperties.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.SmbProperties.ParentFileId
= response.GetHeaders().at(Details::HeaderParentFileId);
if (response.GetHeaders().find(Details::HeaderLeaseDuration)
!= response.GetHeaders().end())
{
@ -6428,19 +6411,22 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
result.IsServerEncrypted
= response.GetHeaders().at(Details::HeaderIsServerEncrypted) == "true";
}
result.FileAttributes = response.GetHeaders().at(Details::HeaderFileAttributes);
result.FileCreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileCreatedOn),
result.SmbProperties.Attributes
= FileAttributes(response.GetHeaders().at(Details::HeaderAttributes));
result.SmbProperties.CreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderCreatedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileLastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileLastWrittenOn),
result.SmbProperties.LastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderLastWrittenOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileChangedOn),
result.SmbProperties.ChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderChangedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FilePermissionKey = response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.FileParentId = response.GetHeaders().at(Details::HeaderFileParentId);
result.SmbProperties.PermissionKey
= response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.SmbProperties.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.SmbProperties.ParentFileId
= response.GetHeaders().at(Details::HeaderParentFileId);
if (response.GetHeaders().find(Details::HeaderLeaseDuration)
!= response.GetHeaders().end())
{
@ -6489,9 +6475,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
result.Metadata.emplace(i->first.substr(10), i->second);
}
result.FileType = response.GetHeaders().at(Details::HeaderFileType);
result.ContentLength
= std::stoll(response.GetHeaders().at(Details::HeaderContentLength));
result.FileSize = std::stoll(response.GetHeaders().at(Details::HeaderContentLength));
if (response.GetHeaders().find(Details::HeaderContentType)
!= response.GetHeaders().end())
{
@ -6569,19 +6553,22 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
result.IsServerEncrypted
= response.GetHeaders().at(Details::HeaderIsServerEncrypted) == "true";
}
result.FileAttributes = response.GetHeaders().at(Details::HeaderFileAttributes);
result.FileCreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileCreatedOn),
result.SmbProperties.Attributes
= FileAttributes(response.GetHeaders().at(Details::HeaderAttributes));
result.SmbProperties.CreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderCreatedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileLastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileLastWrittenOn),
result.SmbProperties.LastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderLastWrittenOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileChangedOn),
result.SmbProperties.ChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderChangedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FilePermissionKey = response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.FileParentId = response.GetHeaders().at(Details::HeaderFileParentId);
result.SmbProperties.PermissionKey
= response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.SmbProperties.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.SmbProperties.ParentFileId
= response.GetHeaders().at(Details::HeaderParentFileId);
if (response.GetHeaders().find(Details::HeaderLeaseDuration)
!= response.GetHeaders().end())
{
@ -6646,19 +6633,22 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
result.RequestId = response.GetHeaders().at(Details::HeaderRequestId);
result.IsServerEncrypted
= response.GetHeaders().at(Details::HeaderRequestIsServerEncrypted) == "true";
result.FilePermissionKey = response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.FileAttributes = response.GetHeaders().at(Details::HeaderFileAttributes);
result.FileCreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileCreatedOn),
result.SmbProperties.PermissionKey
= response.GetHeaders().at(Details::HeaderFilePermissionKey);
result.SmbProperties.Attributes
= FileAttributes(response.GetHeaders().at(Details::HeaderAttributes));
result.SmbProperties.CreatedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderCreatedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileLastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileLastWrittenOn),
result.SmbProperties.LastWrittenOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderLastWrittenOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderFileChangedOn),
result.SmbProperties.ChangedOn = Core::DateTime::Parse(
response.GetHeaders().at(Details::HeaderChangedOn),
Core::DateTime::DateFormat::Rfc3339);
result.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.FileParentId = response.GetHeaders().at(Details::HeaderFileParentId);
result.SmbProperties.FileId = response.GetHeaders().at(Details::HeaderFileId);
result.SmbProperties.ParentFileId
= response.GetHeaders().at(Details::HeaderParentFileId);
return Azure::Core::Response<FileSetHttpHeadersResult>(
std::move(result), std::move(responsePtr));
}
@ -6878,8 +6868,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
response.GetHeaders().at(Details::HeaderLastModified),
Core::DateTime::DateFormat::Rfc1123);
result.ETag = Core::ETag(response.GetHeaders().at(Details::HeaderETag));
result.FileContentLength
= std::stoll(response.GetHeaders().at(Details::HeaderXMsContentLength));
result.FileSize = std::stoll(response.GetHeaders().at(Details::HeaderXMsContentLength));
result.RequestId = response.GetHeaders().at(Details::HeaderRequestId);
return Azure::Core::Response<FileGetRangeListResult>(
std::move(result), std::move(responsePtr));
@ -7262,9 +7251,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
result.ContinuationToken = response.GetHeaders().at(Details::HeaderContinuationToken);
}
result.numberOfHandlesClosed
result.NumberOfHandlesClosed
= std::stoi(response.GetHeaders().at(Details::HeaderNumberOfHandlesClosed));
result.numberOfHandlesFailedToClose
result.NumberOfHandlesFailedToClose
= std::stoi(response.GetHeaders().at(Details::HeaderNumberOfHandlesFailedToClose));
return Azure::Core::Response<FileForceCloseHandlesResult>(
std::move(result), std::move(responsePtr));

View File

@ -200,13 +200,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
/**
* @brief Closes all handles opened on a directory at the service.
* @param options Optional parameters to close all this directory's open handles.
* @return Azure::Core::Response<Models::ForceCloseAllShareDirectoryHandlesResult> containing
* the information of the closed handles
* @return Azure::Core::Response<Models::ForceCloseAllShareDirectoryHandlesSinglePageResult>
* containing the information of the closed handles
* @remark This operation may return a marker showing that the operation can be continued.
*/
Azure::Core::Response<Models::ForceCloseAllShareDirectoryHandlesResult> ForceCloseAllHandles(
const ForceCloseAllShareDirectoryHandlesOptions& options
= ForceCloseAllShareDirectoryHandlesOptions()) const;
Azure::Core::Response<Models::ForceCloseAllShareDirectoryHandlesSinglePageResult>
ForceCloseAllHandlesSinglePage(
const ForceCloseAllShareDirectoryHandlesSinglePageOptions& options
= ForceCloseAllShareDirectoryHandlesSinglePageOptions()) const;
private:
Azure::Core::Http::Url m_shareDirectoryUrl;

View File

@ -217,7 +217,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
* of the file returned from the server.
*/
Azure::Core::Response<Models::SetShareFilePropertiesResult> SetProperties(
const Models::ShareFileHttpHeaders& httpHeaders,
const Models::FileHttpHeaders& httpHeaders,
const Models::FileSmbProperties& smbProperties,
const SetShareFilePropertiesOptions& options = SetShareFilePropertiesOptions()) const;
@ -289,13 +289,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
/**
* @brief Closes all handles opened on a file at the service.
* @param options Optional parameters to close all this file's open handles.
* @return Azure::Core::Response<Models::ForceCloseAllShareFileHandlesResult> containing the
* information of the closed handles
* @return Azure::Core::Response<Models::ForceCloseAllShareFileHandlesSinglePageResult>
* containing the information of the closed handles
* @remark This operation may return a marker showing that the operation can be continued.
*/
Azure::Core::Response<Models::ForceCloseAllShareFileHandlesResult> ForceCloseAllHandles(
const ForceCloseAllShareFileHandlesOptions& options
= ForceCloseAllShareFileHandlesOptions()) const;
Azure::Core::Response<Models::ForceCloseAllShareFileHandlesSinglePageResult>
ForceCloseAllHandlesSinglePage(
const ForceCloseAllShareFileHandlesSinglePageOptions& options
= ForceCloseAllShareFileHandlesSinglePageOptions()) const;
/**
* @brief Upload a range from the source URI to this file's specific range.

View File

@ -414,7 +414,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Azure::Core::Context Context;
};
struct ForceCloseAllShareDirectoryHandlesOptions
struct ForceCloseAllShareDirectoryHandlesSinglePageOptions
{
/**
* @brief Context for cancelling long running operations.
@ -457,7 +457,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
/**
* @brief Specifies the HttpHeaders of the file.
*/
Models::ShareFileHttpHeaders HttpHeaders;
Models::FileHttpHeaders HttpHeaders;
/**
* @brief A name-value pair to associate with a file storage object.
@ -730,7 +730,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Azure::Core::Context Context;
};
struct ForceCloseAllShareFileHandlesOptions
struct ForceCloseAllShareFileHandlesSinglePageOptions
{
/**
* @brief Context for cancelling long running operations.
@ -795,7 +795,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
/**
* @brief The standard HTTP header system properties to set.
*/
Models::ShareFileHttpHeaders HttpHeaders;
Models::FileHttpHeaders HttpHeaders;
/**
* @brief Name-value pairs associated with the file as metadata.

View File

@ -5,7 +5,6 @@
#include "azure/storage/files/shares/protocol/share_rest_client.hpp"
#include "azure/storage/files/shares/share_constants.hpp"
#include "azure/storage/files/shares/share_file_attributes.hpp"
namespace Azure { namespace Storage { namespace Files { namespace Shares { namespace Models {
@ -13,7 +12,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { names
using ListSharesSinglePageResult = Details::ServiceListSharesSinglePageResult;
using SetServicePropertiesResult = Details::ServiceSetPropertiesResult;
using GetServicePropertiesResult = StorageServiceProperties;
using GetServicePropertiesResult = FileServiceProperties;
// ShareClient models:
struct CreateShareResult
@ -45,54 +44,16 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { names
using ChangeShareLeaseResult = Details::ShareChangeLeaseResult;
// DirectoryClient models:
struct FileSmbProperties
{
/**
* @brief Permission key of the directory or file.
*/
Azure::Core::Nullable<std::string> PermissionKey;
/**
* @brief If specified, the provided file attributes shall be set. Default value:
* FileAttribute::Archive for file and FileAttribute::Directory for directory.
* FileAttribute::None can also be specified as default.
*/
FileAttributes Attributes;
/**
* @brief Creation time for the file/directory.
*/
Azure::Core::Nullable<Core::DateTime> CreatedOn;
/**
* @brief Last write time for the file/directory.
*/
Azure::Core::Nullable<Core::DateTime> LastWrittenOn;
/**
* @brief Changed time for the file/directory.
*/
Azure::Core::Nullable<Core::DateTime> ChangedOn;
/**
* @brief The fileId of the file.
*/
std::string FileId;
/**
* @brief The parentId of the file
*/
std::string ParentFileId;
};
struct CreateShareDirectoryResult
{
bool Created = true;
Azure::Core::ETag ETag;
Core::ETag ETag;
Core::DateTime LastModified;
std::string RequestId;
bool IsServerEncrypted = bool();
FileSmbProperties SmbProperties;
std::string RequestId;
std::string ParentFileId;
bool Created = false;
};
struct DeleteShareDirectoryResult
@ -104,7 +65,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { names
using GetShareDirectoryPropertiesResult = Details::DirectoryGetPropertiesResult;
using SetShareDirectoryPropertiesResult = Details::DirectorySetPropertiesResult;
using SetShareDirectoryMetadataResult = Details::DirectorySetMetadataResult;
using ForceCloseAllShareDirectoryHandlesResult = Details::DirectoryForceCloseHandlesResult;
using ForceCloseAllShareDirectoryHandlesSinglePageResult
= Details::DirectoryForceCloseHandlesResult;
struct ForceCloseShareDirectoryHandleResult
{
@ -119,7 +81,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { names
std::string DirectoryPath;
std::string Prefix;
int32_t PageSizeHint = int32_t();
std::string ContinuationToken;
Azure::Core::Nullable<std::string> ContinuationToken;
std::vector<DirectoryItem> DirectoryItems;
std::vector<FileItem> FileItems;
std::string RequestId;
@ -128,7 +90,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { names
struct ListShareDirectoryHandlesSinglePageResult
{
std::vector<HandleItem> Handles;
std::string ContinuationToken;
Azure::Core::Nullable<std::string> ContinuationToken;
std::string RequestId;
};
@ -173,33 +135,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { names
Azure::Core::Http::Range ContentRange;
int64_t FileSize = 0;
Azure::Core::Nullable<Storage::ContentHash> TransactionalContentHash;
ShareFileHttpHeaders HttpHeaders;
FileHttpHeaders HttpHeaders;
DownloadShareFileDetails Details;
std::string RequestId;
};
using StartCopyShareFileResult = Details::FileStartCopyResult;
using AbortCopyShareFileResult = Details::FileAbortCopyResult;
struct GetShareFilePropertiesResult
{
Core::DateTime LastModified;
Storage::Metadata Metadata;
int64_t FileSize = int64_t();
ShareFileHttpHeaders HttpHeaders;
Core::ETag ETag;
std::string RequestId;
Azure::Core::Nullable<Core::DateTime> CopyCompletedOn;
Azure::Core::Nullable<std::string> CopyStatusDescription;
Azure::Core::Nullable<std::string> CopyId;
Azure::Core::Nullable<std::string> CopyProgress;
Azure::Core::Nullable<std::string> CopySource;
Azure::Core::Nullable<CopyStatusType> CopyStatus;
bool IsServerEncrypted = bool();
FileSmbProperties SmbProperties;
Azure::Core::Nullable<LeaseDurationType> LeaseDuration;
Azure::Core::Nullable<LeaseStateType> LeaseState;
Azure::Core::Nullable<LeaseStatusType> LeaseStatus;
};
using GetShareFilePropertiesResult = Details::FileGetPropertiesResult;
using SetShareFilePropertiesResult = Details::FileSetHttpHeadersResult;
using ResizeFileResult = Details::FileSetHttpHeadersResult;
using SetShareFileMetadataResult = Details::FileSetMetadataResult;
@ -214,13 +157,13 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { names
using UploadFileRangeFromUriResult = Details::FileUploadRangeFromUrlResult;
using GetShareFileRangeListResult = Details::FileGetRangeListResult;
using ListShareFileHandlesSinglePageResult = ListShareDirectoryHandlesSinglePageResult;
using ForceCloseAllShareFileHandlesResult = Details::FileForceCloseHandlesResult;
using ForceCloseAllShareFileHandlesSinglePageResult = Details::FileForceCloseHandlesResult;
struct DownloadShareFileToResult
{
int64_t FileSize = 0;
Azure::Core::Http::Range ContentRange;
ShareFileHttpHeaders HttpHeaders;
FileHttpHeaders HttpHeaders;
DownloadShareFileDetails Details;
};

View File

@ -84,7 +84,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
* when setting the service properties.
*/
Azure::Core::Response<Models::SetServicePropertiesResult> SetProperties(
Models::StorageServiceProperties properties,
Models::FileServiceProperties properties,
const SetServicePropertiesOptions& options = SetServicePropertiesOptions()) const;
/**

View File

@ -254,7 +254,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const CreateSharePermissionOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::Share::CreatePermissionOptions();
protocolLayerOptions.Permission.Permission = permission;
protocolLayerOptions.Permission.FilePermission = permission;
return Details::ShareRestClient::Share::CreatePermission(
m_shareUrl, *m_pipeline, options.Context, protocolLayerOptions);
}

View File

@ -170,16 +170,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Models::CreateShareDirectoryResult ret;
ret.Created = true;
ret.ETag = std::move(result->ETag);
ret.SmbProperties.Attributes = Models::FileAttributes(result->FileAttributes);
ret.SmbProperties.CreatedOn = std::move(result->FileCreatedOn);
ret.SmbProperties.LastWrittenOn = std::move(result->FileLastWrittenOn);
ret.SmbProperties.PermissionKey = std::move(result->FilePermissionKey);
ret.SmbProperties.ChangedOn = std::move(result->FileChangedOn);
ret.SmbProperties.FileId = std::move(result->FileId);
ret.SmbProperties.ParentFileId = std::move(result->FileParentId);
ret.IsServerEncrypted = result->IsServerEncrypted;
ret.LastModified = std::move(result->LastModified);
ret.RequestId = std::move(result->RequestId);
ret.SmbProperties = std::move(result->SmbProperties);
return Azure::Core::Response<Models::CreateShareDirectoryResult>(
std::move(ret), result.ExtractRawResponse());
@ -360,9 +354,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::move(ret), result.ExtractRawResponse());
}
Azure::Core::Response<Models::ForceCloseAllShareDirectoryHandlesResult>
ShareDirectoryClient::ForceCloseAllHandles(
const ForceCloseAllShareDirectoryHandlesOptions& options) const
Azure::Core::Response<Models::ForceCloseAllShareDirectoryHandlesSinglePageResult>
ShareDirectoryClient::ForceCloseAllHandlesSinglePage(
const ForceCloseAllShareDirectoryHandlesSinglePageOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::Directory::ForceCloseHandlesOptions();
protocolLayerOptions.HandleId = FileAllHandles;

View File

@ -188,13 +188,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Models::CreateShareFileResult ret;
ret.Created = true;
ret.ETag = std::move(result->ETag);
ret.SmbProperties.Attributes = Models::FileAttributes(result->FileAttributes);
ret.SmbProperties.CreatedOn = std::move(result->FileCreatedOn);
ret.SmbProperties.LastWrittenOn = std::move(result->FileLastWrittenOn);
ret.SmbProperties.PermissionKey = std::move(result->FilePermissionKey);
ret.SmbProperties.ChangedOn = std::move(result->FileChangedOn);
ret.SmbProperties.FileId = std::move(result->FileId);
ret.SmbProperties.ParentFileId = std::move(result->FileParentId);
ret.SmbProperties = std::move(result->SmbProperties);
ret.IsServerEncrypted = result->IsServerEncrypted;
ret.LastModified = std::move(result->LastModified);
ret.RequestId = std::move(result->RequestId);
@ -324,13 +318,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
ret.Details.CopySource = std::move(downloadResponse->CopySource);
ret.Details.CopyStatus = std::move(downloadResponse->CopyStatus);
ret.Details.IsServerEncrypted = downloadResponse->IsServerEncrypted;
ret.Details.SmbProperties.Attributes = Models::FileAttributes(downloadResponse->FileAttributes);
ret.Details.SmbProperties.CreatedOn = std::move(downloadResponse->FileCreatedOn);
ret.Details.SmbProperties.LastWrittenOn = std::move(downloadResponse->FileLastWrittenOn);
ret.Details.SmbProperties.ChangedOn = std::move(downloadResponse->FileChangedOn);
ret.Details.SmbProperties.PermissionKey = std::move(downloadResponse->FilePermissionKey);
ret.Details.SmbProperties.FileId = std::move(downloadResponse->FileId);
ret.Details.SmbProperties.ParentFileId = std::move(downloadResponse->FileParentId);
ret.Details.SmbProperties = std::move(downloadResponse->SmbProperties);
ret.Details.LeaseDuration = std::move(downloadResponse->LeaseDuration);
ret.Details.LeaseState = std::move(downloadResponse->LeaseState);
ret.Details.LeaseStatus = std::move(downloadResponse->LeaseStatus);
@ -414,37 +402,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
auto protocolLayerOptions = Details::ShareRestClient::File::GetPropertiesOptions();
protocolLayerOptions.LeaseIdOptional = options.AccessConditions.LeaseId;
auto result = Details::ShareRestClient::File::GetProperties(
return Details::ShareRestClient::File::GetProperties(
m_shareFileUrl, *m_pipeline, options.Context, protocolLayerOptions);
Models::GetShareFilePropertiesResult ret;
ret.FileSize = result->ContentLength;
ret.HttpHeaders = std::move(result->HttpHeaders);
ret.LastModified = std::move(result->LastModified);
ret.Metadata = std::move(result->Metadata);
ret.ETag = std::move(result->ETag);
ret.CopyCompletedOn = std::move(result->CopyCompletedOn);
ret.CopyStatusDescription = std::move(result->CopyStatusDescription);
ret.CopyId = std::move(result->CopyId);
ret.CopyProgress = std::move(result->CopyProgress);
ret.CopySource = std::move(result->CopySource);
ret.CopyStatus = std::move(result->CopyStatus);
ret.IsServerEncrypted = result->IsServerEncrypted;
ret.SmbProperties.Attributes = Models::FileAttributes(result->FileAttributes);
ret.SmbProperties.CreatedOn = std::move(result->FileCreatedOn);
ret.SmbProperties.LastWrittenOn = std::move(result->FileLastWrittenOn);
ret.SmbProperties.ChangedOn = std::move(result->FileChangedOn);
ret.SmbProperties.PermissionKey = std::move(result->FilePermissionKey);
ret.SmbProperties.FileId = std::move(result->FileId);
ret.SmbProperties.ParentFileId = std::move(result->FileParentId);
ret.LeaseDuration = std::move(result->LeaseDuration);
ret.LeaseState = std::move(result->LeaseState);
ret.LeaseStatus = std::move(result->LeaseStatus);
return Azure::Core::Response<Models::GetShareFilePropertiesResult>(
std::move(ret), result.ExtractRawResponse());
}
Azure::Core::Response<Models::SetShareFilePropertiesResult> ShareFileClient::SetProperties(
const Models::ShareFileHttpHeaders& httpHeaders,
const Models::FileHttpHeaders& httpHeaders,
const Models::FileSmbProperties& smbProperties,
const SetShareFilePropertiesOptions& options) const
{
@ -626,8 +589,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Models::ForceCloseShareFileHandleResult(), result.ExtractRawResponse());
}
Azure::Core::Response<Models::ForceCloseAllShareFileHandlesResult>
ShareFileClient::ForceCloseAllHandles(const ForceCloseAllShareFileHandlesOptions& options) const
Azure::Core::Response<Models::ForceCloseAllShareFileHandlesSinglePageResult>
ShareFileClient::ForceCloseAllHandlesSinglePage(
const ForceCloseAllShareFileHandlesSinglePageOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::File::ForceCloseHandlesOptions();
protocolLayerOptions.HandleId = FileAllHandles;

View File

@ -208,7 +208,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Models::BreakShareLeaseResult ret;
ret.ETag = std::move(response->ETag);
ret.LastModified = std::move(response->LastModified);
ret.LeaseTime = 0; // File lease always have immediate breaks.
return Azure::Core::Response<Models::BreakShareLeaseResult>(
std::move(ret), response.ExtractRawResponse());
@ -226,7 +225,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Models::BreakShareLeaseResult ret;
ret.ETag = std::move(response->ETag);
ret.LastModified = std::move(response->LastModified);
ret.LeaseTime = response->LeaseTime;
return Azure::Core::Response<Models::BreakShareLeaseResult>(
std::move(ret), response.ExtractRawResponse());

View File

@ -105,7 +105,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
Azure::Core::Response<Models::SetServicePropertiesResult> ShareServiceClient::SetProperties(
Models::StorageServiceProperties properties,
Models::FileServiceProperties properties,
const SetServicePropertiesOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::Service::SetPropertiesOptions();
@ -120,12 +120,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
auto protocolLayerOptions = Details::ShareRestClient::Service::GetPropertiesOptions();
auto result = Details::ShareRestClient::Service::GetProperties(
m_serviceUrl, *m_pipeline, options.Context, protocolLayerOptions);
Models::StorageServiceProperties ret;
Models::FileServiceProperties ret;
ret.Cors = std::move(result->Cors);
ret.HourMetrics = std::move(result->HourMetrics);
ret.MinuteMetrics = std::move(result->MinuteMetrics);
ret.Protocol = std::move(result->Protocol);
return Azure::Core::Response<Models::StorageServiceProperties>(
return Azure::Core::Response<Models::FileServiceProperties>(
std::move(ret), result.ExtractRawResponse());
}

View File

@ -42,10 +42,10 @@ namespace Azure { namespace Storage { namespace Test {
m_shareClient->Delete(deleteOptions);
}
Files::Shares::Models::ShareFileHttpHeaders FileShareClientTest::GetInterestingHttpHeaders()
Files::Shares::Models::FileHttpHeaders FileShareClientTest::GetInterestingHttpHeaders()
{
static Files::Shares::Models::ShareFileHttpHeaders result = []() {
Files::Shares::Models::ShareFileHttpHeaders ret;
static Files::Shares::Models::FileHttpHeaders result = []() {
Files::Shares::Models::FileHttpHeaders ret;
ret.CacheControl = std::string("no-cache");
ret.ContentDisposition = std::string("attachment");
ret.ContentEncoding = std::string("deflate");
@ -229,7 +229,7 @@ namespace Azure { namespace Storage { namespace Test {
EXPECT_FALSE(ret->FilePermissionKey.empty());
auto ret2 = m_shareClient->GetPermission(ret->FilePermissionKey);
EXPECT_EQ(expectedPermission, ret2->Permission);
EXPECT_EQ(expectedPermission, ret2->FilePermission);
}
// TEST_F(FileShareClientTest, Lease)
@ -385,7 +385,7 @@ namespace Azure { namespace Storage { namespace Test {
Files::Shares::Models::ShareAccessTier::TransactionOptimized,
properties.AccessTier.GetValue());
EXPECT_FALSE(properties.AccessTierTransitionState.HasValue());
EXPECT_EQ(properties.LastModified, properties.AccessTierChangeTime.GetValue());
EXPECT_EQ(properties.LastModified, properties.AccessTierChangedOn.GetValue());
shareClients.emplace(std::move(shareName), std::move(shareClient));
}
{
@ -398,7 +398,7 @@ namespace Azure { namespace Storage { namespace Test {
EXPECT_NO_THROW(properties = *shareClient.GetProperties());
EXPECT_EQ(Files::Shares::Models::ShareAccessTier::Hot, properties.AccessTier.GetValue());
EXPECT_FALSE(properties.AccessTierTransitionState.HasValue());
EXPECT_EQ(properties.LastModified, properties.AccessTierChangeTime.GetValue());
EXPECT_EQ(properties.LastModified, properties.AccessTierChangedOn.GetValue());
shareClients.emplace(std::move(shareName), std::move(shareClient));
}
{
@ -411,7 +411,7 @@ namespace Azure { namespace Storage { namespace Test {
EXPECT_NO_THROW(properties = *shareClient.GetProperties());
EXPECT_EQ(Files::Shares::Models::ShareAccessTier::Cool, properties.AccessTier.GetValue());
EXPECT_FALSE(properties.AccessTierTransitionState.HasValue());
EXPECT_EQ(properties.LastModified, properties.AccessTierChangeTime.GetValue());
EXPECT_EQ(properties.LastModified, properties.AccessTierChangedOn.GetValue());
shareClients.emplace(std::move(shareName), std::move(shareClient));
}
@ -438,7 +438,7 @@ namespace Azure { namespace Storage { namespace Test {
{
EXPECT_EQ(Files::Shares::Models::ShareAccessTier::Hot, properties.AccessTier.GetValue());
}
EXPECT_EQ(properties.LastModified, properties.AccessTierChangeTime.GetValue());
EXPECT_EQ(properties.LastModified, properties.AccessTierChangedOn.GetValue());
}
// List shares works.
@ -457,11 +457,11 @@ namespace Azure { namespace Storage { namespace Test {
EXPECT_EQ(shareItem.Details.AccessTier.GetValue(), properties.AccessTier.GetValue());
EXPECT_EQ(
true,
shareItem.Details.AccessTierChangeTime.HasValue()
&& properties.AccessTierChangeTime.HasValue());
shareItem.Details.AccessTierChangedOn.HasValue()
&& properties.AccessTierChangedOn.HasValue());
EXPECT_EQ(
shareItem.Details.AccessTierChangeTime.GetValue(),
properties.AccessTierChangeTime.GetValue());
shareItem.Details.AccessTierChangedOn.GetValue(),
properties.AccessTierChangedOn.GetValue());
EXPECT_EQ(
false,
shareItem.Details.AccessTierTransitionState.HasValue()
@ -479,7 +479,7 @@ namespace Azure { namespace Storage { namespace Test {
EXPECT_NO_THROW(properties = *shareClient.GetProperties());
EXPECT_EQ(Files::Shares::Models::ShareAccessTier::Premium, properties.AccessTier.GetValue());
EXPECT_FALSE(properties.AccessTierTransitionState.HasValue());
EXPECT_FALSE(properties.AccessTierChangeTime.HasValue());
EXPECT_FALSE(properties.AccessTierChangedOn.HasValue());
Files::Shares::ListSharesSinglePageOptions listOptions;
listOptions.Prefix = shareName;
@ -492,7 +492,7 @@ namespace Azure { namespace Storage { namespace Test {
Files::Shares::Models::ShareAccessTier::Premium,
shareItems[0].Details.AccessTier.GetValue());
EXPECT_FALSE(shareItems[0].Details.AccessTierTransitionState.HasValue());
EXPECT_FALSE(shareItems[0].Details.AccessTierChangeTime.HasValue());
EXPECT_FALSE(shareItems[0].Details.AccessTierChangedOn.HasValue());
auto setPropertiesOptions = Files::Shares::SetSharePropertiesOptions();
setPropertiesOptions.AccessTier = Files::Shares::Models::ShareAccessTier::Hot;
@ -505,6 +505,6 @@ namespace Azure { namespace Storage { namespace Test {
EXPECT_NO_THROW(shareClient.SetProperties(setPropertiesOptions));
EXPECT_EQ(Files::Shares::Models::ShareAccessTier::Premium, properties.AccessTier.GetValue());
EXPECT_FALSE(properties.AccessTierTransitionState.HasValue());
EXPECT_FALSE(properties.AccessTierChangeTime.HasValue());
EXPECT_FALSE(properties.AccessTierChangedOn.HasValue());
}
}}} // namespace Azure::Storage::Test

View File

@ -12,7 +12,7 @@ namespace Azure { namespace Storage { namespace Test {
static void SetUpTestSuite();
static void TearDownTestSuite();
static Files::Shares::Models::ShareFileHttpHeaders GetInterestingHttpHeaders();
static Files::Shares::Models::FileHttpHeaders GetInterestingHttpHeaders();
static std::shared_ptr<Files::Shares::ShareClient> m_shareClient;
static std::string m_shareName;

View File

@ -27,11 +27,10 @@ namespace Azure { namespace Storage { namespace Test {
void FileShareDirectoryClientTest::TearDownTestSuite() { m_shareClient->Delete(); }
Files::Shares::Models::ShareFileHttpHeaders
FileShareDirectoryClientTest::GetInterestingHttpHeaders()
Files::Shares::Models::FileHttpHeaders FileShareDirectoryClientTest::GetInterestingHttpHeaders()
{
static Files::Shares::Models::ShareFileHttpHeaders result = []() {
Files::Shares::Models::ShareFileHttpHeaders ret;
static Files::Shares::Models::FileHttpHeaders result = []() {
Files::Shares::Models::FileHttpHeaders ret;
ret.CacheControl = std::string("no-cache");
ret.ContentDisposition = std::string("attachment");
ret.ContentEncoding = std::string("deflate");
@ -51,7 +50,6 @@ namespace Azure { namespace Storage { namespace Test {
{
std::vector<Files::Shares::Models::DirectoryItem> directoryResult;
std::vector<Files::Shares::Models::FileItem> fileResult;
std::string continuation;
Files::Shares::ListFilesAndDirectoriesSinglePageOptions options;
if (!prefix.empty())
{
@ -65,9 +63,8 @@ namespace Azure { namespace Storage { namespace Test {
directoryResult.insert(
directoryResult.end(), response->DirectoryItems.begin(), response->DirectoryItems.end());
fileResult.insert(fileResult.end(), response->FileItems.begin(), response->FileItems.end());
continuation = response->ContinuationToken;
options.ContinuationToken = continuation;
} while (!continuation.empty());
options.ContinuationToken = response->ContinuationToken;
} while (options.ContinuationToken.HasValue());
return std::make_pair<
std::vector<Files::Shares::Models::FileItem>,
std::vector<Files::Shares::Models::DirectoryItem>>(
@ -210,17 +207,17 @@ namespace Azure { namespace Storage { namespace Test {
EXPECT_NO_THROW(client1.Create(options1));
EXPECT_NO_THROW(client2.Create(options2));
auto result1 = client1.GetProperties()->FilePermissionKey;
auto result2 = client2.GetProperties()->FilePermissionKey;
EXPECT_EQ(result1, result2);
auto result1 = client1.GetProperties()->SmbProperties.PermissionKey;
auto result2 = client2.GetProperties()->SmbProperties.PermissionKey;
EXPECT_EQ(result1.GetValue(), result2.GetValue());
auto client3
= m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString());
Files::Shares::CreateShareDirectoryOptions options3;
options3.SmbProperties.PermissionKey = result1;
EXPECT_NO_THROW(client3.Create(options3));
auto result3 = client3.GetProperties()->FilePermissionKey;
EXPECT_EQ(result1, result3);
auto result3 = client3.GetProperties()->SmbProperties.PermissionKey;
EXPECT_EQ(result1.GetValue(), result3.GetValue());
}
{
@ -244,9 +241,9 @@ namespace Azure { namespace Storage { namespace Test {
options2.FilePermission = permission;
EXPECT_NO_THROW(client1.SetProperties(properties, options1));
EXPECT_NO_THROW(client2.SetProperties(properties, options2));
auto result1 = client1.GetProperties()->FilePermissionKey;
auto result2 = client2.GetProperties()->FilePermissionKey;
EXPECT_EQ(result1, result2);
auto result1 = client1.GetProperties()->SmbProperties.PermissionKey;
auto result2 = client2.GetProperties()->SmbProperties.PermissionKey;
EXPECT_EQ(result1.GetValue(), result2.GetValue());
auto client3
= m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString());
@ -255,7 +252,7 @@ namespace Azure { namespace Storage { namespace Test {
std::string permissionKey;
EXPECT_NO_THROW(
permissionKey = client3.Create(options3)->SmbProperties.PermissionKey.GetValue());
auto result3 = client3.GetProperties()->FilePermissionKey;
auto result3 = client3.GetProperties()->SmbProperties.PermissionKey.GetValue();
EXPECT_EQ(permissionKey, result3);
}
}
@ -267,7 +264,8 @@ namespace Azure { namespace Storage { namespace Test {
| Files::Shares::Models::FileAttributes::NotContentIndexed;
properties.CreatedOn = std::chrono::system_clock::now();
properties.LastWrittenOn = std::chrono::system_clock::now();
properties.PermissionKey = m_fileShareDirectoryClient->GetProperties()->FilePermissionKey;
properties.PermissionKey
= m_fileShareDirectoryClient->GetProperties()->SmbProperties.PermissionKey;
{
// Create directory with SmbProperties works
auto client1
@ -283,9 +281,15 @@ namespace Azure { namespace Storage { namespace Test {
EXPECT_NO_THROW(client2.Create(options2));
auto directoryProperties1 = client1.GetProperties();
auto directoryProperties2 = client2.GetProperties();
EXPECT_EQ(directoryProperties2->FileCreatedOn, directoryProperties1->FileCreatedOn);
EXPECT_EQ(directoryProperties2->FileLastWrittenOn, directoryProperties1->FileLastWrittenOn);
EXPECT_EQ(directoryProperties2->FileAttributes, directoryProperties1->FileAttributes);
EXPECT_EQ(
directoryProperties2->SmbProperties.CreatedOn.GetValue(),
directoryProperties1->SmbProperties.CreatedOn.GetValue());
EXPECT_EQ(
directoryProperties2->SmbProperties.LastWrittenOn.GetValue(),
directoryProperties1->SmbProperties.LastWrittenOn.GetValue());
EXPECT_EQ(
directoryProperties2->SmbProperties.Attributes,
directoryProperties1->SmbProperties.Attributes);
}
{
@ -301,9 +305,15 @@ namespace Azure { namespace Storage { namespace Test {
EXPECT_NO_THROW(client2.SetProperties(properties));
auto directoryProperties1 = client1.GetProperties();
auto directoryProperties2 = client2.GetProperties();
EXPECT_EQ(directoryProperties2->FileCreatedOn, directoryProperties1->FileCreatedOn);
EXPECT_EQ(directoryProperties2->FileLastWrittenOn, directoryProperties1->FileLastWrittenOn);
EXPECT_EQ(directoryProperties2->FileAttributes, directoryProperties1->FileAttributes);
EXPECT_EQ(
directoryProperties2->SmbProperties.CreatedOn.GetValue(),
directoryProperties1->SmbProperties.CreatedOn.GetValue());
EXPECT_EQ(
directoryProperties2->SmbProperties.LastWrittenOn.GetValue(),
directoryProperties1->SmbProperties.LastWrittenOn.GetValue());
EXPECT_EQ(
directoryProperties2->SmbProperties.Attributes,
directoryProperties1->SmbProperties.Attributes);
}
}
@ -426,7 +436,7 @@ namespace Azure { namespace Storage { namespace Test {
{
auto result = m_fileShareDirectoryClient->ListHandlesSinglePage();
EXPECT_TRUE(result->Handles.empty());
EXPECT_TRUE(result->ContinuationToken.empty());
EXPECT_NO_THROW(m_fileShareDirectoryClient->ForceCloseAllHandles());
EXPECT_FALSE(result->ContinuationToken.HasValue());
EXPECT_NO_THROW(m_fileShareDirectoryClient->ForceCloseAllHandlesSinglePage());
}
}}} // namespace Azure::Storage::Test

View File

@ -20,7 +20,7 @@ namespace Azure { namespace Storage { namespace Test {
const std::string& directoryPath = std::string(),
const std::string& prefix = std::string());
static Files::Shares::Models::ShareFileHttpHeaders GetInterestingHttpHeaders();
static Files::Shares::Models::FileHttpHeaders GetInterestingHttpHeaders();
static std::shared_ptr<Files::Shares::ShareDirectoryClient> m_fileShareDirectoryClient;
static std::string m_directoryName;

View File

@ -261,8 +261,8 @@ namespace Azure { namespace Storage { namespace Test {
{
auto result = m_fileClient->ListHandlesSinglePage();
EXPECT_TRUE(result->Handles.empty());
EXPECT_TRUE(result->ContinuationToken.empty());
EXPECT_NO_THROW(m_fileClient->ForceCloseAllHandles());
EXPECT_FALSE(result->ContinuationToken.HasValue());
EXPECT_NO_THROW(m_fileClient->ForceCloseAllHandlesSinglePage());
}
TEST_F(FileShareFileClientTest, LeaseRelated)

View File

@ -191,7 +191,7 @@ namespace Azure { namespace Storage { namespace Test {
// response headers override
{
Files::Shares::Models::ShareFileHttpHeaders headers;
Files::Shares::Models::FileHttpHeaders headers;
headers.ContentType = "application/x-binary";
headers.ContentLanguage = "en-US";
headers.ContentDisposition = "attachment";

View File

@ -67,7 +67,6 @@ namespace Azure { namespace Storage { namespace Test {
const std::string& prefix)
{
std::vector<Files::Shares::Models::ShareItem> result;
std::string continuation;
Files::Shares::ListSharesSinglePageOptions options;
if (!prefix.empty())
{
@ -77,9 +76,8 @@ namespace Azure { namespace Storage { namespace Test {
{
auto response = m_fileShareServiceClient->ListSharesSinglePage(options);
result.insert(result.end(), response->Items.begin(), response->Items.end());
continuation = response->ContinuationToken;
options.ContinuationToken = continuation;
} while (!continuation.empty());
options.ContinuationToken = response->ContinuationToken;
} while (options.ContinuationToken.HasValue());
return result;
}