File/datalake service doxygen comments and detail struct name refine. (#2207)

# Pull Request Checklist

Please leverage this checklist as a reminder to address commonly occurring feedback when submitting a pull request to make sure your PR can be reviewed quickly:

See the detailed list in the [contributing guide](https://github.com/Azure/azure-sdk-for-cpp/blob/master/CONTRIBUTING.md#pull-requests).

- [x] [C++ Guidelines](https://azure.github.io/azure-sdk/cpp_introduction.html)
- [x] Doxygen docs
- [x] Unit tests
- [x] No unwanted commits/changes
- [x] Descriptive title/description
  - [] PR is single purpose
  - [x] Related issue listed
- [x] Comments in source
- [x] No typos
- [x] Update changelog
- [x] Not work-in-progress
- [x] External references or docs updated
- [x] Self review of PR done
- [x] Any breaking changes?
This commit is contained in:
Kan Tang 2021-05-07 15:47:35 +08:00 committed by GitHub
parent 3c04ad93a1
commit 941b67178e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 2613 additions and 642 deletions

View File

@ -23,64 +23,172 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
using UserDelegationKey = Blobs::Models::UserDelegationKey;
/**
* @brief The detailed information of a file system.
*/
struct FileSystemItemDetails
{
/**
* An HTTP entity tag associated with the file system.
*/
Azure::ETag ETag;
/**
* The data and time the file system was last modified.
*/
Azure::DateTime LastModified;
/**
* The Metadata of the file system.
*/
Storage::Metadata Metadata;
/**
* The public access type of the file system.
*/
PublicAccessType AccessType = PublicAccessType::None;
/**
* A boolean that indicates if the file system has immutability policy.
*/
bool HasImmutabilityPolicy = false;
/**
* A boolean that indicates if the file system has legal hold.
*/
bool HasLegalHold = false;
/**
* The duration of the lease on the file system if it has one.
*/
Azure::Nullable<Models::LeaseDuration> LeaseDuration;
/**
* The lease state of the file system.
*/
Models::LeaseState LeaseState = Models::LeaseState::Available;
/**
* The lease status of the file system.
*/
Models::LeaseStatus LeaseStatus = Models::LeaseStatus::Unlocked;
}; // struct FileSystemItemDetails
/**
* @brief The file system item returned when listing the file systems.
*/
struct FileSystemItem
{
/**
* The name of the file system.
*/
std::string Name;
/**
* The detailed information of the file system.
*/
FileSystemItemDetails Details;
}; // struct BlobContainerItem
// FileSystemClient models:
/**
* @brief The access policy of a file system.
*/
struct FileSystemAccessPolicy
{
/**
* The public access type of the file system.
*/
PublicAccessType AccessType = PublicAccessType::None;
/**
* The signed identifiers of the file system.
*/
std::vector<SignedIdentifier> SignedIdentifiers;
}; // struct DataLakeFileSystemAccessPolciy
using SetFileSystemAccessPolicyResult = Blobs::Models::SetBlobContainerAccessPolicyResult;
/**
* @brief The properties of a file system.
*/
struct FileSystemProperties
{
/**
* An HTTP entity tag associated with the file system.
*/
Azure::ETag ETag;
/**
* The data and time the file system was last modified.
*/
DateTime LastModified;
/**
* The Metadata of the file system.
*/
Storage::Metadata Metadata;
};
/**
* @brief The information returned when creating the file system.
*/
struct CreateFileSystemResult
{
/**
* If the object is created.
*/
bool Created = true;
/**
* An HTTP entity tag associated with the file system.
*/
Azure::ETag ETag;
/**
* The data and time the file system was last modified.
*/
DateTime LastModified;
};
/**
* @brief The information returned when deleting the file system.
*/
struct DeleteFileSystemResult
{
/**
* If the object is deleted.
*/
bool Deleted = true;
};
/**
* @brief The information returned when setting the filesystem's metadata
*/
struct SetFileSystemMetadataResult
{
/**
* An HTTP entity tag associated with the file system.
*/
Azure::ETag ETag;
/**
* The data and time the file system was last modified.
*/
DateTime LastModified;
};
// PathClient models:
/**
* @brief The information returned when deleting the path.
*/
struct DeletePathResult
{
/**
* If the object is deleted.
*/
bool Deleted = true;
};
@ -92,11 +200,29 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
using RehydratePriority = Blobs::Models::RehydratePriority;
using ArchiveStatus = Blobs::Models::ArchiveStatus;
/**
* @brief An access control object.
*/
struct Acl
{
/**
* The scope of the ACL.
*/
std::string Scope;
/**
* The type of the ACL.
*/
std::string Type;
/**
* The id of the ACL.
*/
std::string Id;
/**
* The permissions of the ACL.
*/
std::string Permissions;
/**
@ -128,118 +254,405 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
static std::string SerializeAcls(const std::vector<Acl>& aclsArray);
};
/**
* @brief The properties of the path.
*/
struct PathProperties
{
/**
* An HTTP entity tag associated with the path.
*/
Azure::ETag ETag;
/**
* The data and time the path was last modified.
*/
DateTime LastModified;
/**
* The date and time at which the path was created.
*/
DateTime CreatedOn;
/**
* The size of the file.
*/
int64_t FileSize = 0;
/**
* The metadata of the path.
*/
Storage::Metadata Metadata;
/**
* The duration of the lease on the path.
*/
Azure::Nullable<Models::LeaseDuration> LeaseDuration;
/**
* The state of the lease on the path.
*/
Azure::Nullable<Models::LeaseState> LeaseState;
/**
* The status of the lease on the path.
*/
Azure::Nullable<Models::LeaseStatus> LeaseStatus;
/**
* The common http headers of the path.
*/
PathHttpHeaders HttpHeaders;
/**
* A boolean indicates if the server is encrypted.
*/
Azure::Nullable<bool> IsServerEncrypted;
/**
* The encryption key's SHA256.
*/
Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
/**
* The copy ID of the path, if the path is created from a copy operation.
*/
Azure::Nullable<std::string> CopyId;
/**
* The copy source of the path, if the path is created from a copy operation.
*/
Azure::Nullable<std::string> CopySource;
/**
* The copy status of the path, if the path is created from a copy operation.
*/
Azure::Nullable<Blobs::Models::CopyStatus> CopyStatus;
/**
* The copy progress of the path, if the path is created from a copy operation.
*/
Azure::Nullable<std::string> CopyProgress;
/**
* The copy completion time of the path, if the path is created from a copy operation.
*/
Azure::Nullable<DateTime> CopyCompletedOn;
/**
* The expiry time of the path.
*/
Azure::Nullable<DateTime> ExpiresOn;
/**
* The time this path is last accessed on.
*/
Azure::Nullable<DateTime> LastAccessedOn;
/**
* A boolean indicates if the path is a directory.
*/
bool IsDirectory = false;
/**
* The archive status of the path.
*/
Azure::Nullable<Models::ArchiveStatus> ArchiveStatus;
/**
* The rehydrate priority of the path.
*/
Azure::Nullable<Models::RehydratePriority> RehydratePriority;
/**
* The copy status's description of the path, if the path is created from a copy operation.
*/
Azure::Nullable<std::string> CopyStatusDescription;
/**
* A boolean indicates if the path has been incremental copied.
*/
Azure::Nullable<bool> IsIncrementalCopy;
/**
* The incremental copy destination snapshot of the path.
*/
Azure::Nullable<std::string> IncrementalCopyDestinationSnapshot;
/**
* The version ID of the path.
*/
Azure::Nullable<std::string> VersionId;
/**
* A boolean indicates if the path is in its current version.
*/
Azure::Nullable<bool> IsCurrentVersion;
};
/**
* @brief The access control list of a path.
*/
struct PathAccessControlList
{
/**
* The owner of the path.
*/
std::string Owner;
/**
* The group of the path.
*/
std::string Group;
/**
* The permission of the path.
*/
std::string Permissions;
/**
* The acls of the path.
*/
std::vector<Acl> Acls;
};
/**
* @brief The information returned when setting the path's Http headers.
*/
struct SetPathHttpHeadersResult
{
/**
* An HTTP entity tag associated with the path.
*/
Azure::ETag ETag;
/**
* The data and time the path was last modified.
*/
DateTime LastModified;
};
/**
* @brief The information returned when setting the path's metadata.
*/
struct SetPathMetadataResult
{
/**
* An HTTP entity tag associated with the path.
*/
Azure::ETag ETag;
/**
* The data and time the path was last modified.
*/
DateTime LastModified;
};
/**
* @brief The information returned when creating a path.
*/
struct CreatePathResult
{
/**
* A boolean indicates if the path is created.
*/
bool Created = true;
/**
* An HTTP entity tag associated with the path.
*/
Azure::ETag ETag;
/**
* The data and time the path was last modified.
*/
DateTime LastModified;
/**
* The size of the file.
*/
Azure::Nullable<int64_t> FileSize;
};
using SetPathAccessControlListResult = _detail::PathSetAccessControlResult;
using SetPathPermissionsResult = _detail::PathSetAccessControlResult;
using SetPathPermissionsResult = SetPathAccessControlListResult;
// FileClient models:
using UploadFileFromResult = Blobs::Models::UploadBlockBlobResult;
using AppendFileResult = _detail::PathAppendDataResult;
using FlushFileResult = _detail::PathFlushDataResult;
using ScheduleFileDeletionResult = Blobs::Models::SetBlobExpiryResult;
using CopyStatus = Blobs::Models::CopyStatus;
/**
* @brief The detailed information returned when downloading a file.
*/
struct DownloadFileDetails
{
/**
* An HTTP entity tag associated with the file.
*/
Azure::ETag ETag;
/**
* The data and time the file was last modified.
*/
DateTime LastModified;
/**
* The lease duration of the file.
*/
Azure::Nullable<Models::LeaseDuration> LeaseDuration;
/**
* The lease state of the file.
*/
Models::LeaseState LeaseState;
/**
* The lease status of the file.
*/
Models::LeaseStatus LeaseStatus;
/**
* The common Http headers of the file.
*/
PathHttpHeaders HttpHeaders;
/**
* The metadata of the file.
*/
Storage::Metadata Metadata;
/**
* The time this file is created on.
*/
DateTime CreatedOn;
/**
* The time this file expires on.
*/
Azure::Nullable<DateTime> ExpiresOn;
/**
* The time this file is last accessed on.
*/
Azure::Nullable<DateTime> LastAccessedOn;
/**
* The copy ID of the file, if the file is created from a copy operation.
*/
Azure::Nullable<std::string> CopyId;
/**
* The copy source of the file, if the file is created from a copy operation.
*/
Azure::Nullable<std::string> CopySource;
/**
* The copy status of the file, if the file is created from a copy operation.
*/
Azure::Nullable<Models::CopyStatus> CopyStatus;
/**
* The copy status's description of the file, if the file is created from a copy operation.
*/
Azure::Nullable<std::string> CopyStatusDescription;
/**
* The copy progress of the file, if the file is created from a copy operation.
*/
Azure::Nullable<std::string> CopyProgress;
/**
* The copy completed time of the file, if the file is created from a copy operation.
*/
Azure::Nullable<Azure::DateTime> CopyCompletedOn;
/**
* The version ID of the file.
*/
Azure::Nullable<std::string> VersionId;
/**
* If the file is in its current version.
*/
Azure::Nullable<bool> IsCurrentVersion;
/**
* A boolean indicates if the service is encrypted.
*/
bool IsServerEncrypted = false;
/**
* The encryption key's SHA256.
*/
Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
/**
* The encryption scope.
*/
Azure::Nullable<std::string> EncryptionScope;
};
/**
* @brief The content and information returned when downloading a file.
*/
struct DownloadFileResult
{
/**
* The body of the downloaded result.
*/
std::unique_ptr<Azure::Core::IO::BodyStream> Body;
/**
* The size of the file.
*/
int64_t FileSize = int64_t();
/**
* The range of the downloaded content.
*/
Azure::Core::Http::HttpRange ContentRange;
/**
* The transactional hash of the downloaded content.
*/
Azure::Nullable<Storage::ContentHash> TransactionalContentHash;
/**
* The detailed information of the downloaded file.
*/
DownloadFileDetails Details;
};
/**
* @brief The information returned when deleting a file.
*/
struct DeleteFileResult
{
/**
* A boolean indicates if the file is deleted.
*/
bool Deleted = true;
};
/**
* @brief The information returned when downloading a file to a specific destination.
*/
struct DownloadFileToResult
{
/**
* The size of the file.
*/
int64_t FileSize = int64_t();
/**
* The range of the downloaded content.
*/
Azure::Core::Http::HttpRange ContentRange;
/**
* The detailed information of the downloaded file.
*/
DownloadFileDetails Details;
};

View File

@ -28,35 +28,112 @@
namespace Azure { namespace Storage { namespace Files { namespace DataLake {
namespace Models {
/**
* @brief The common HTTP headers.
*/
struct PathHttpHeaders
{
/**
* The cache control of the content.
*/
std::string CacheControl;
/**
* The disposition of the content.
*/
std::string ContentDisposition;
/**
* The encoding of the content.
*/
std::string ContentEncoding;
/**
* The language of the content.
*/
std::string ContentLanguage;
/**
* The type of the content.
*/
std::string ContentType;
/**
* The hash of the content.
*/
Storage::ContentHash ContentHash;
};
/**
* @brief The failed entries when setting the Acl.
*/
struct AclFailedEntry
{
/**
* The name of the failed entry.
*/
std::string Name;
/**
* The type of the failure.
*/
std::string Type;
/**
* The error message of the failure.
*/
std::string ErrorMessage;
};
struct PathItem
{
/**
* The name of the path item.
*/
std::string Name;
/**
* A boolean that indicates if the path is a directory.
*/
bool IsDirectory = bool();
/**
* The data and time the file or directory was last modified. Write operations on the file or
* directory update the last modified time.
*/
DateTime LastModified;
/**
* An HTTP entity tag associated with the file or directory.
*/
std::string ETag;
/**
* The size of the file.
*/
int64_t FileSize = int64_t();
/**
* The owner of the file.
*/
std::string Owner;
/**
* The group of the file.
*/
std::string Group;
/**
* The permission of the file.
*/
std::string Permissions;
};
/**
* @brief The public access type of a file system.
*/
class PublicAccessType {
public:
PublicAccessType() = default;
@ -73,7 +150,10 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
std::string m_value;
}; // extensible enum PublicAccessType
// Required only for Create File and Create Directory. The value must be "file" or "directory".
/**
* @brief Required only for Create File and Create Directory. The value must be "file" or
* "directory".
*/
class PathResourceType {
public:
PathResourceType() = default;
@ -89,7 +169,10 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
std::string m_value;
}; // extensible enum PathResourceType
// When a resource is leased, specifies whether the lease is of infinite or fixed duration.
/**
* @brief When a resource is leased, specifies whether the lease is of infinite or fixed
* duration.
*/
class LeaseDuration {
public:
LeaseDuration() = default;
@ -105,7 +188,9 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
std::string m_value;
}; // extensible enum LeaseDuration
// Lease state of the resource.
/**
* @brief Lease state of the resource.
*/
class LeaseState {
public:
LeaseState() = default;
@ -124,7 +209,9 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
std::string m_value;
}; // extensible enum LeaseState
// The lease status of the resource.
/**
* @brief The lease status of the resource.
*/
class LeaseStatus {
public:
LeaseStatus() = default;
@ -140,6 +227,65 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
std::string m_value;
}; // extensible enum LeaseStatus
/**
* @brief The serialized return result for operation: SetPathAccessControlList
*/
struct SetPathAccessControlListResult
{
/**
* An HTTP entity tag associated with the file or directory.
*/
Azure::ETag ETag;
/**
* The data and time the file or directory was last modified. Write operations on the file or
* directory update the last modified time.
*/
DateTime LastModified;
};
/**
* @brief The serialized return result for operation: FlushFile
*/
struct FlushFileResult
{
/**
* An HTTP entity tag associated with the file or directory.
*/
Azure::ETag ETag;
/**
* The data and time the file or directory was last modified. Write operations on the file or
* directory update the last modified time.
*/
DateTime LastModified;
/**
* The size of the resource in bytes.
*/
int64_t ContentLength = int64_t();
};
/**
* @brief The serialized return result for operation: AppendFile
*/
struct AppendFileResult
{
/**
* If the blob has an MD5 hash and this operation is to read the full blob, this response
* header is returned so that the client can check for message content integrity.
*/
Azure::Nullable<Storage::ContentHash> TransactionalContentHash;
/**
* A boolean that indicates if the server is encrypted.
*/
bool IsServerEncrypted = bool();
};
} // namespace Models
namespace _detail {
using namespace Models;
@ -206,28 +352,29 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
constexpr static const char* HeaderLeaseStatus = "x-ms-lease-status";
constexpr static const char* HeaderRequestIsServerEncrypted = "x-ms-request-server-encrypted";
// The value must be "filesystem" for all filesystem operations.
class FileSystemResourceType {
/**
* @brief The value must be "filesystem" for all filesystem operations.
*/
class FileSystemResource {
public:
FileSystemResourceType() = default;
explicit FileSystemResourceType(std::string value) : m_value(std::move(value)) {}
bool operator==(const FileSystemResourceType& other) const
{
return m_value == other.m_value;
}
bool operator!=(const FileSystemResourceType& other) const { return !(*this == other); }
FileSystemResource() = default;
explicit FileSystemResource(std::string value) : m_value(std::move(value)) {}
bool operator==(const FileSystemResource& other) const { return m_value == other.m_value; }
bool operator!=(const FileSystemResource& other) const { return !(*this == other); }
const std::string& ToString() const { return m_value; }
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static FileSystemResourceType Filesystem;
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static FileSystemResource Filesystem;
private:
std::string m_value;
}; // extensible enum FileSystemResourceType
}; // extensible enum FileSystemResource
// Mode "set" sets POSIX access control rights on files and directories, "modify" modifies one
// or more POSIX access control rights that pre-exist on files and directories, "remove"
// removes one or more POSIX access control rights that were present earlier on files and
// directories
/**
* @brief Mode "set" sets POSIX access control rights on files and directories, "modify"
* modifies one or more POSIX access control rights that pre-exist on files and directories,
* "remove" removes one or more POSIX access control rights that were present earlier on files
* and directories
*/
class PathSetAccessControlRecursiveMode {
public:
PathSetAccessControlRecursiveMode() = default;
@ -253,19 +400,27 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
struct SetAccessControlRecursiveResponse
{
int32_t NumberOfSuccessfulDirectories = int32_t();
int32_t NumberOfSuccessfulFiles = int32_t();
int32_t NumberOfFailures = int32_t();
std::vector<AclFailedEntry> FailedEntries;
};
/**
* @brief The items returned when listing paths.
*/
struct PathList
{
std::vector<PathItem> Items;
};
// Optional. Valid only when namespace is enabled. This parameter determines the behavior of the
// rename operation. The value must be "legacy" or "posix", and the default value will be
// "posix".
/**
* @brief Optional. Valid only when namespace is enabled. This parameter determines the behavior
* of the rename operation. The value must be "legacy" or "posix", and the default value will be
* "posix".
*/
class PathRenameMode {
public:
PathRenameMode() = default;
@ -281,10 +436,12 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
std::string m_value;
}; // extensible enum PathRenameMode
// Optional. If the value is "getStatus" only the system defined properties for the path are
// returned. If the value is "getAccessControl" the access control list is returned in the
// response headers (Hierarchical Namespace must be enabled for the account), otherwise the
// properties are returned.
/**
* @brief Optional. If the value is "getStatus" only the system defined properties for the path
* are returned. If the value is "getAccessControl" the access control list is returned in the
* response headers (Hierarchical Namespace must be enabled for the account), otherwise the
* properties are returned.
*/
class PathGetPropertiesAction {
public:
PathGetPropertiesAction() = default;
@ -306,42 +463,125 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
struct FileSystemListPathsResult
{
std::vector<PathItem> Items;
/**
* If the number of paths to be listed exceeds the maxResults limit, a continuation token is
* returned in this response header. When a continuation token is returned in the response,
* it must be specified in a subsequent invocation of the list operation to continue listing
* the paths.
*/
Azure::Nullable<std::string> ContinuationToken;
};
struct PathCreateResult
{
/**
* An HTTP entity tag associated with the file or directory.
*/
Azure::ETag ETag;
/**
* The data and time the file or directory was last modified. Write operations on the file or
* directory update the last modified time.
*/
Azure::Nullable<DateTime> LastModified;
/**
* The size of the resource in bytes.
*/
Azure::Nullable<int64_t> ContentLength;
};
struct PathGetPropertiesResult
{
/**
* Indicates that the service supports requests for partial file content.
*/
Azure::Nullable<std::string> AcceptRanges;
/**
* The Http Headers of the object.
*/
PathHttpHeaders HttpHeaders;
/**
* An HTTP entity tag associated with the file or directory.
*/
Azure::ETag ETag;
/**
* The data and time the file or directory was last modified. Write operations on the file or
* directory update the last modified time.
*/
DateTime LastModified;
/**
* The type of the resource. The value may be "file" or "directory". If not set, the value
* is "file".
*/
Azure::Nullable<std::string> ResourceType;
/**
* The user-defined properties associated with the file or directory, in the format of a
* comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value is a
* base64 encoded string. Note that the string may only contain ASCII characters in the
* ISO-8859-1 character set.
*/
Azure::Nullable<std::string> Properties;
/**
* The owner of the file or directory. Included in the response if Hierarchical Namespace is
* enabled for the account.
*/
Azure::Nullable<std::string> Owner;
/**
* The owning group of the file or directory. Included in the response if Hierarchical
* Namespace is enabled for the account.
*/
Azure::Nullable<std::string> Group;
/**
* The POSIX access permissions for the file owner, the file owning group, and others.
* Included in the response if Hierarchical Namespace is enabled for the account.
*/
Azure::Nullable<std::string> Permissions;
/**
* The POSIX access control list for the file or directory. Included in the response only if
* the action is "getAccessControl" and Hierarchical Namespace is enabled for the account.
*/
Azure::Nullable<std::string> Acl;
/**
* When a resource is leased, specifies whether the lease is of infinite or fixed duration.
*/
Azure::Nullable<Models::LeaseDuration> LeaseDuration;
/**
* Lease state of the resource.
*/
Azure::Nullable<Models::LeaseState> LeaseState;
/**
* The lease status of the resource.
*/
Azure::Nullable<Models::LeaseStatus> LeaseStatus;
};
struct PathDeleteResult
{
Azure::Nullable<std::string> ContinuationToken;
};
struct PathSetAccessControlResult
{
Azure::ETag ETag;
DateTime LastModified;
/**
* When deleting a directory, the number of paths that are deleted with each invocation is
* limited. If the number of paths to be deleted exceeds this limit, a continuation token is
* returned in this response header. When a continuation token is returned in the response,
* it must be specified in a subsequent invocation of the delete operation to continue
* deleting the directory.
*/
Azure::Nullable<std::string> ContinuationToken;
};
struct PathSetAccessControlRecursiveResult
@ -350,29 +590,25 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
int32_t NumberOfSuccessfulFiles = int32_t();
int32_t NumberOfFailures = int32_t();
std::vector<AclFailedEntry> FailedEntries;
/**
* When performing setAccessControlRecursive on a directory, the number of paths that are
* processed with each invocation is limited. If the number of paths to be processed exceeds
* this limit, a continuation token is returned in this response header. When a continuation
* token is returned in the response, it must be specified in a subsequent invocation of the
* setAccessControlRecursive operation to continue the setAccessControlRecursive operation on
* the directory.
*/
Azure::Nullable<std::string> ContinuationToken;
};
struct PathFlushDataResult
{
Azure::ETag ETag;
DateTime LastModified;
int64_t ContentLength = int64_t();
};
struct PathAppendDataResult
{
Azure::Nullable<Storage::ContentHash> TransactionalContentHash;
bool IsServerEncrypted = bool();
};
class DataLakeRestClient {
public:
class FileSystem {
public:
struct ListPathsOptions
{
FileSystemResourceType Resource;
FileSystemResource Resource;
Azure::Nullable<int32_t> Timeout;
std::string ApiVersionParameter = _detail::DefaultServiceApiVersion;
Azure::Nullable<std::string> ContinuationToken;
@ -811,7 +1047,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
std::string ApiVersionParameter = _detail::DefaultServiceApiVersion;
};
static Azure::Response<PathSetAccessControlResult> SetAccessControl(
static Azure::Response<Models::SetPathAccessControlListResult> SetAccessControl(
const Azure::Core::Url& url,
Azure::Core::Http::_internal::HttpPipeline& pipeline,
Azure::Core::Context context,
@ -955,7 +1191,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
std::string ApiVersionParameter = _detail::DefaultServiceApiVersion;
};
static Azure::Response<PathFlushDataResult> FlushData(
static Azure::Response<Models::FlushFileResult> FlushData(
const Azure::Core::Url& url,
Azure::Core::Http::_internal::HttpPipeline& pipeline,
Azure::Core::Context context,
@ -1065,7 +1301,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
std::string ApiVersionParameter = _detail::DefaultServiceApiVersion;
};
static Azure::Response<PathAppendDataResult> AppendData(
static Azure::Response<Models::AppendFileResult> AppendData(
const Azure::Core::Url& url,
Azure::Core::IO::BodyStream& bodyStream,
Azure::Core::Http::_internal::HttpPipeline& pipeline,
@ -1280,7 +1516,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
}
}
static Azure::Response<PathSetAccessControlResult> SetAccessControlParseResult(
static Azure::Response<Models::SetPathAccessControlListResult> SetAccessControlParseResult(
Azure::Core::Context context,
std::unique_ptr<Azure::Core::Http::RawResponse> responsePtr)
{
@ -1288,7 +1524,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
if (response.GetStatusCode() == Azure::Core::Http::HttpStatusCode::Ok)
{
// Set directory access control response.
PathSetAccessControlResult result;
Models::SetPathAccessControlListResult result;
if (response.GetHeaders().find(_detail::HeaderETag) != response.GetHeaders().end())
{
result.ETag = Azure::ETag(response.GetHeaders().at(_detail::HeaderETag));
@ -1300,7 +1536,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
response.GetHeaders().at(_detail::HeaderLastModified),
DateTime::DateFormat::Rfc1123);
}
return Azure::Response<PathSetAccessControlResult>(
return Azure::Response<Models::SetPathAccessControlListResult>(
std::move(result), std::move(responsePtr));
}
else
@ -1375,7 +1611,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
return result;
}
static Azure::Response<PathFlushDataResult> FlushDataParseResult(
static Azure::Response<Models::FlushFileResult> FlushDataParseResult(
Azure::Core::Context context,
std::unique_ptr<Azure::Core::Http::RawResponse> responsePtr)
{
@ -1383,7 +1619,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
if (response.GetStatusCode() == Azure::Core::Http::HttpStatusCode::Ok)
{
// The data was flushed (written) to the file successfully.
PathFlushDataResult result;
Models::FlushFileResult result;
if (response.GetHeaders().find(_detail::HeaderETag) != response.GetHeaders().end())
{
result.ETag = Azure::ETag(response.GetHeaders().at(_detail::HeaderETag));
@ -1401,7 +1637,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
result.ContentLength
= std::stoll(response.GetHeaders().at(_detail::HeaderContentLength));
}
return Azure::Response<PathFlushDataResult>(std::move(result), std::move(responsePtr));
return Azure::Response<Models::FlushFileResult>(
std::move(result), std::move(responsePtr));
}
else
{
@ -1410,7 +1647,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
}
}
static Azure::Response<PathAppendDataResult> AppendDataParseResult(
static Azure::Response<Models::AppendFileResult> AppendDataParseResult(
Azure::Core::Context context,
std::unique_ptr<Azure::Core::Http::RawResponse> responsePtr)
{
@ -1418,7 +1655,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
if (response.GetStatusCode() == Azure::Core::Http::HttpStatusCode::Accepted)
{
// Append data to file control response.
PathAppendDataResult result;
Models::AppendFileResult result;
if (response.GetHeaders().find(_detail::HeaderContentHashMd5)
!= response.GetHeaders().end())
{
@ -1434,7 +1671,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
}
result.IsServerEncrypted
= response.GetHeaders().at(_detail::HeaderRequestIsServerEncrypted) == "true";
return Azure::Response<PathAppendDataResult>(std::move(result), std::move(responsePtr));
return Azure::Response<Models::AppendFileResult>(
std::move(result), std::move(responsePtr));
}
else
{

View File

@ -203,7 +203,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
const Azure::Core::Context& context) const
{
_detail::DataLakeRestClient::FileSystem::ListPathsOptions protocolLayerOptions;
protocolLayerOptions.Resource = _detail::FileSystemResourceType::Filesystem;
protocolLayerOptions.Resource = _detail::FileSystemResource::Filesystem;
protocolLayerOptions.Upn = options.UserPrincipalName;
protocolLayerOptions.MaxResults = options.PageSizeHint;

View File

@ -269,7 +269,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
const Azure::Core::Context& context) const
{
_detail::DataLakeRestClient::FileSystem::ListPathsOptions protocolLayerOptions;
protocolLayerOptions.Resource = _detail::FileSystemResourceType::Filesystem;
protocolLayerOptions.Resource = _detail::FileSystemResource::Filesystem;
protocolLayerOptions.Upn = options.UserPrincipalName;
protocolLayerOptions.MaxResults = options.PageSizeHint;
protocolLayerOptions.RecursiveRequired = recursive;

View File

@ -33,7 +33,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
const PathGetPropertiesAction PathGetPropertiesAction::GetAccessControl("getAccessControl");
const PathGetPropertiesAction PathGetPropertiesAction::GetStatus("getStatus");
const FileSystemResourceType FileSystemResourceType::Filesystem("filesystem");
const FileSystemResource FileSystemResource::Filesystem("filesystem");
const PathSetAccessControlRecursiveMode PathSetAccessControlRecursiveMode::Set("set");
const PathSetAccessControlRecursiveMode PathSetAccessControlRecursiveMode::Modify("modify");

View File

@ -10,6 +10,7 @@
- Renamed `HasMorePages()` in paged response to `HasPage()`.
- `ShareLeaseClient::Change()` updates internal lease id.
- `ShareItem::ShareMetadata` was renamed to `ShareItem::Metadata`.
## 12.0.0-beta.10 (2021-04-16)

View File

@ -18,133 +18,187 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
namespace Models {
// ServiceClient models:
using SetServicePropertiesResult = _detail::ServiceSetPropertiesResult;
// ShareClient models:
struct CreateShareResult
{
bool Created = true;
Azure::ETag ETag;
DateTime LastModified;
};
struct DeleteShareResult
{
bool Deleted = true;
};
using CreateShareSnapshotResult = _detail::ShareCreateSnapshotResult;
using ShareProperties = _detail::ShareGetPropertiesResult;
using SetSharePropertiesResult = _detail::ShareSetPropertiesResult;
using SetShareMetadataResult = _detail::ShareSetMetadataResult;
using ShareAccessPolicy = _detail::ShareGetAccessPolicyResult;
using SetShareAccessPolicyResult = _detail::ShareSetAccessPolicyResult;
using ShareStatistics = _detail::ShareGetStatisticsResult;
using CreateSharePermissionResult = _detail::ShareCreatePermissionResult;
using AcquireLeaseResult = _detail::ShareAcquireLeaseResult;
using RenewLeaseResult = _detail::ShareRenewLeaseResult;
using ReleaseLeaseResult = _detail::ShareReleaseLeaseResult;
using BreakLeaseResult = _detail::ShareBreakLeaseResult;
using ChangeLeaseResult = _detail::ShareChangeLeaseResult;
// DirectoryClient models:
struct CreateDirectoryResult
{
Azure::ETag ETag;
DateTime LastModified;
bool IsServerEncrypted = bool();
FileSmbProperties SmbProperties;
std::string ParentFileId;
bool Created = false;
};
struct DeleteDirectoryResult
{
bool Deleted = true;
};
using DirectoryProperties = _detail::DirectoryGetPropertiesResult;
using SetDirectoryPropertiesResult = _detail::DirectorySetPropertiesResult;
using SetDirectoryMetadataResult = _detail::DirectorySetMetadataResult;
/**
* @brief The information returned when forcing the directory handles to close.
*/
struct ForceCloseDirectoryHandleResult
{
};
// FileClient models:
struct CreateFileResult
{
bool Created = true;
Azure::ETag ETag;
DateTime LastModified;
bool IsServerEncrypted = bool();
FileSmbProperties SmbProperties;
};
struct DeleteFileResult
{
bool Deleted = true;
};
/**
* @brief The detailed information returned when downloading a file.
*/
struct DownloadFileDetails
{
DateTime LastModified;
Storage::Metadata Metadata;
/**
* An HTTP entity tag associated with the file.
*/
Azure::ETag ETag;
/**
* The data and time the file was last modified.
*/
DateTime LastModified;
/**
* The metadata of the file.
*/
Storage::Metadata Metadata;
/**
* The copy completed time of the file, if the file is created from a copy operation.
*/
Nullable<DateTime> CopyCompletedOn;
/**
* The copy status's description of the file, if the file is created from a copy operation.
*/
Nullable<std::string> CopyStatusDescription;
/**
* The copy ID of the file, if the file is created from a copy operation.
*/
Nullable<std::string> CopyId;
/**
* The copy progress of the file, if the file is created from a copy operation.
*/
Nullable<std::string> CopyProgress;
/**
* The copy source of the file, if the file is created from a copy operation.
*/
Nullable<std::string> CopySource;
/**
* The copy status of the file, if the file is created from a copy operation.
*/
Nullable<Models::CopyStatus> CopyStatus;
/**
* A boolean indicates if the service is encrypted.
*/
bool IsServerEncrypted = bool();
/**
* The SMB related properties of the file or directory.
*/
FileSmbProperties SmbProperties;
/**
* When a file is leased, specifies whether the lease is of infinite or fixed duration.
*/
Nullable<Models::LeaseDuration> LeaseDuration;
/**
* Lease state of the file.
*/
Nullable<Models::LeaseState> LeaseState;
/**
* The current lease status of the file.
*/
Nullable<Models::LeaseStatus> LeaseStatus;
};
/**
* @brief The content and information returned when downloading a file.
*/
struct DownloadFileResult
{
/**
* The body of the downloaded result.
*/
std::unique_ptr<Azure::Core::IO::BodyStream> BodyStream;
/**
* The range of the downloaded content.
*/
Azure::Core::Http::HttpRange ContentRange;
/**
* The size of the file.
*/
int64_t FileSize = 0;
/**
* The transactional hash of the downloaded content.
*/
Nullable<Storage::ContentHash> TransactionalContentHash;
/**
* The common Http headers of the file.
*/
FileHttpHeaders HttpHeaders;
/**
* The detailed information of the downloaded file.
*/
DownloadFileDetails Details;
};
using AbortFileCopyResult = _detail::FileAbortCopyResult;
using FileProperties = _detail::FileGetPropertiesResult;
using SetFilePropertiesResult = _detail::FileSetHttpHeadersResult;
using ResizeFileResult = _detail::FileSetHttpHeadersResult;
using SetFileMetadataResult = _detail::FileSetMetadataResult;
using UploadFileRangeResult = _detail::FileUploadRangeResult;
/**
* @brief The information returned when clearing a range in the file.
*/
struct ClearFileRangeResult
{
/**
* An HTTP entity tag associated with the file.
*/
Azure::ETag ETag;
/**
* The data and time the file was last modified.
*/
DateTime LastModified;
/**
* A boolean indicates if the service is encrypted.
*/
bool IsServerEncrypted = bool();
};
using UploadFileRangeFromUriResult = _detail::FileUploadRangeFromUrlResult;
using GetFileRangeListResult = _detail::FileGetRangeListResult;
/**
* @brief The information returned when downloading a file to a destination.
*/
struct DownloadFileToResult
{
/**
* The size of the file.
*/
int64_t FileSize = 0;
/**
* The range of the downloaded content.
*/
Azure::Core::Http::HttpRange ContentRange;
/**
* The common Http headers of the file.
*/
FileHttpHeaders HttpHeaders;
/**
* The detailed information of the downloaded file.
*/
DownloadFileDetails Details;
};
/**
* @brief The information returned when forcing a file handle to close.
*/
struct ForceCloseFileHandleResult
{
};
/**
* @brief The information returned when uploading a file from a source.
*/
struct UploadFileFromResult
{
/**
* A boolean indicates if the service is encrypted.
*/
bool IsServerEncrypted = false;
};

View File

@ -486,7 +486,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const Azure::Core::Context& context) const
{
auto protocolLayerOptions = _detail::ShareRestClient::File::UploadRangeOptions();
protocolLayerOptions.XMsWrite = _detail::FileRangeWriteType::Update;
protocolLayerOptions.XMsWrite = _detail::FileRangeWrite::Update;
protocolLayerOptions.ContentLength = content.Length();
protocolLayerOptions.XMsRange = std::string("bytes=") + std::to_string(offset)
+ std::string("-") + std::to_string(offset + content.Length() - 1);
@ -508,7 +508,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const Azure::Core::Context& context) const
{
auto protocolLayerOptions = _detail::ShareRestClient::File::UploadRangeOptions();
protocolLayerOptions.XMsWrite = _detail::FileRangeWriteType::Clear;
protocolLayerOptions.XMsWrite = _detail::FileRangeWrite::Clear;
protocolLayerOptions.ContentLength = 0;
protocolLayerOptions.XMsRange = std::string("bytes=") + std::to_string(offset)
+ std::string("-") + std::to_string(offset + length - 1);
@ -1116,7 +1116,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
= options.SourceAccessCondition.IfNoneMatchContentHash;
protocolLayerOptions.SourceRange = std::string("bytes=") + std::to_string(sourceRange.Offset)
+ std::string("-") + std::to_string(sourceRange.Offset + sourceRange.Length.Value() - 1);
protocolLayerOptions.XMsWrite = _detail::FileRangeWriteFromUrlType::Update;
protocolLayerOptions.XMsWrite = _detail::FileRangeWriteFromUrl::Update;
return _detail::ShareRestClient::File::UploadRangeFromUrl(
m_shareFileUrl, *m_pipeline, context, protocolLayerOptions);

View File

@ -35,10 +35,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
} // namespace Models
namespace _detail {
const FileRangeWriteType FileRangeWriteType::Update("update");
const FileRangeWriteType FileRangeWriteType::Clear("clear");
const FileRangeWrite FileRangeWrite::Update("update");
const FileRangeWrite FileRangeWrite::Clear("clear");
const FileRangeWriteFromUrlType FileRangeWriteFromUrlType::Update("update");
const FileRangeWriteFromUrl FileRangeWriteFromUrl::Update("update");
const LeaseAction LeaseAction::Acquire("acquire");
const LeaseAction LeaseAction::Release("release");