Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocol layer for data lake STG82 #3927

Merged
merged 3 commits into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <cstdint>
#include <string>
#include <type_traits>
#include <vector>

#include <azure/core/context.hpp>
Expand All @@ -26,7 +27,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
/**
* The version used for the operations to Azure storage services.
*/
constexpr static const char* ApiVersion = "2020-02-10";
constexpr static const char* ApiVersion = "2021-06-08";
} // namespace _detail
namespace Models {
namespace _detail {
Expand Down Expand Up @@ -92,6 +93,12 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
std::string Owner;
std::string Group;
std::string Permissions;
/**
* The name of the encryption scope under which the blob is encrypted.
*/
Nullable<std::string> EncryptionScope;
std::string CreatedOn;
microzchang marked this conversation as resolved.
Show resolved Hide resolved
microzchang marked this conversation as resolved.
Show resolved Hide resolved
Nullable<std::string> ExpiresOn;
microzchang marked this conversation as resolved.
Show resolved Hide resolved
std::string ETag;
};
namespace _detail {
Expand All @@ -113,6 +120,127 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
Nullable<std::string> ContinuationToken;
};
} // namespace _detail
struct BlobPrefix final
microzchang marked this conversation as resolved.
Show resolved Hide resolved
{
std::string Name;
};
/**
* @brief Properties of a blob.
*/
struct BlobPropertiesInternal final
{
Nullable<DateTime> CreationTime;
DateTime LastModified;
ETag Etag;
/**
* Size in bytes.
*/
Nullable<int64_t> ContentLength;
Nullable<std::string> ContentType;
Nullable<std::string> ContentEncoding;
Nullable<std::string> ContentLanguage;
Nullable<std::vector<uint8_t>> ContentMD5;
Nullable<std::string> ContentDisposition;
Nullable<std::string> CacheControl;
Nullable<int64_t> BlobSequenceNumber;
Nullable<std::string> CopyId;
Nullable<std::string> CopySource;
Nullable<std::string> CopyProgress;
Nullable<DateTime> CopyCompletionTime;
Nullable<std::string> CopyStatusDescription;
Nullable<bool> ServerEncrypted;
Nullable<bool> IncrementalCopy;
Nullable<std::string> DestinationSnapshot;
Nullable<DateTime> DeletedTime;
Nullable<int32_t> RemainingRetentionDays;
Nullable<bool> AccessTierInferred;
Nullable<std::string> CustomerProvidedKeySha256;
/**
* The name of the encryption scope under which the blob is encrypted.
*/
Nullable<std::string> EncryptionScope;
Nullable<DateTime> AccessTierChangeTime;
Nullable<int32_t> TagCount;
Nullable<DateTime> ExpiresOn;
Nullable<bool> IsSealed;
Nullable<DateTime> LastAccessedOn;
Nullable<DateTime> DeleteTime;
};
/**
* @brief An Azure Storage blob.
*/
struct BlobItemInternal final
{
std::string Name;
bool Deleted = bool();
std::string Snapshot;
Nullable<std::string> VersionId;
Nullable<bool> IsCurrentVersion;
/**
* Properties of a blob.
*/
BlobPropertiesInternal Properties;
Nullable<std::string> DeletionId;
};
struct BlobHierarchyListSegment final
{
/**
* Array of BlobPrefix.
*/
std::vector<BlobPrefix> BlobPrefixes;
/**
* Array of BlobItemInternal.
*/
std::vector<BlobItemInternal> BlobItems;
};
/**
* @brief Include this parameter to specify one or more datasets to include in the response.
*/
enum class ListBlobsIncludeFlags
{
None = 0,
Copy = 1,
Deleted = 2,
Metadata = 4,
Snapshots = 8,
Uncommittedblobs = 16,
Versions = 32,
Tags = 64,
};
inline ListBlobsIncludeFlags operator|(ListBlobsIncludeFlags lhs, ListBlobsIncludeFlags rhs)
{
using type = std::underlying_type_t<ListBlobsIncludeFlags>;
return static_cast<ListBlobsIncludeFlags>(static_cast<type>(lhs) | static_cast<type>(rhs));
}
inline ListBlobsIncludeFlags& operator|=(ListBlobsIncludeFlags& lhs, ListBlobsIncludeFlags rhs)
{
lhs = lhs | rhs;
return lhs;
}
inline ListBlobsIncludeFlags operator&(ListBlobsIncludeFlags lhs, ListBlobsIncludeFlags rhs)
{
using type = std::underlying_type_t<ListBlobsIncludeFlags>;
return static_cast<ListBlobsIncludeFlags>(static_cast<type>(lhs) & static_cast<type>(rhs));
}
inline ListBlobsIncludeFlags& operator&=(ListBlobsIncludeFlags& lhs, ListBlobsIncludeFlags rhs)
{
lhs = lhs & rhs;
return lhs;
}
/**
* @brief An enumeration of blobs.
*/
struct ListBlobsHierarchySegmentResponse final
{
std::string ServiceEndpoint;
std::string ContainerName;
Nullable<std::string> Prefix;
Nullable<std::string> Marker;
Nullable<int32_t> MaxResults;
Nullable<std::string> Delimiter;
BlobHierarchyListSegment Segment;
Nullable<std::string> NextMarker;
};
/**
* @brief Required only for Create File and Create Directory. The value must be "file" or
* "directory".
Expand All @@ -127,6 +255,24 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathResourceType Directory;
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathResourceType File;

private:
std::string m_value;
};
/**
* @brief Required. Indicates mode of the expiry time.
*/
class PathExpiryOptions final {
microzchang marked this conversation as resolved.
Show resolved Hide resolved
public:
PathExpiryOptions() = default;
explicit PathExpiryOptions(std::string value) : m_value(std::move(value)) {}
bool operator==(const PathExpiryOptions& other) const { return m_value == other.m_value; }
bool operator!=(const PathExpiryOptions& other) const { return !(*this == other); }
const std::string& ToString() const { return m_value; }
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathExpiryOptions NeverExpire;
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathExpiryOptions RelativeToCreation;
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathExpiryOptions RelativeToNow;
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathExpiryOptions Absolute;

private:
std::string m_value;
};
Expand All @@ -152,6 +298,16 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
* The size of the resource in bytes.
*/
Nullable<int64_t> FileSize;
/**
* The value of this header is set to true if the contents of the request are successfully
* encrypted using the specified algorithm, and false otherwise.
*/
Nullable<bool> IsServerEncrypted;
/**
* The SHA-256 hash of the encryption key used to encrypt the blob. This header is only
* returned when the blob was encrypted with a customer-provided key.
*/
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
};
/**
* @brief Response type for #Azure::Storage::Files::DataLake::PathClient::Delete.
Expand Down Expand Up @@ -220,6 +376,19 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
*/
Nullable<std::string> ContinuationToken;
};
} // namespace _detail
/**
* @brief Response type for #Azure::Storage::Files::DataLake::PathClient::Undelete.
*/
struct UndeletePathResult final
{
/**
* The type of the resource. The value may be "file" or "directory". If not set, the value
* is "file".
*/
std::string ResourceType;
Jinming-Hu marked this conversation as resolved.
Show resolved Hide resolved
};
namespace _detail {
/**
* @brief Response type for
* #Azure::Storage::Files::DataLake::PathClient::GetAccessControlList.
Expand Down Expand Up @@ -267,6 +436,16 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
* The size of the resource in bytes.
*/
int64_t FileSize = int64_t();
/**
* The value of this header is set to true if the contents of the request are successfully
* encrypted using the specified algorithm, and false otherwise.
*/
Nullable<bool> IsServerEncrypted;
/**
* The SHA-256 hash of the encryption key used to encrypt the blob. This header is only
* returned when the blob was encrypted with a customer-provided key.
*/
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
};
/**
* @brief Response type for #Azure::Storage::Files::DataLake::FileClient::Append.
Expand All @@ -282,7 +461,12 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
* The value of this header is set to true if the contents of the request are successfully
* encrypted using the specified algorithm, and false otherwise.
*/
bool IsServerEncrypted = bool();
Nullable<bool> IsServerEncrypted;
/**
* The SHA-256 hash of the encryption key used to encrypt the blob. This header is only
* returned when the blob was encrypted with a customer-provided key.
*/
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
};
} // namespace Models
namespace _detail {
Expand All @@ -303,6 +487,19 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
const Core::Url& url,
const ListFileSystemPathsOptions& options,
const Core::Context& context);
struct ListFileSystemBlobHierarchySegmentOptions final
{
Nullable<std::string> Prefix;
Nullable<std::string> Delimiter;
Nullable<std::string> Marker;
Nullable<int32_t> MaxResults;
Nullable<Models::ListBlobsIncludeFlags> Include;
};
static Response<Models::ListBlobsHierarchySegmentResponse> ListBlobHierarchySegment(
Core::Http::_internal::HttpPipeline& pipeline,
const Core::Url& url,
const ListFileSystemBlobHierarchySegmentOptions& options,
const Core::Context& context);
};
class PathClient final {
public:
Expand Down Expand Up @@ -332,6 +529,15 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
ETag SourceIfNoneMatch;
Nullable<DateTime> SourceIfModifiedSince;
Nullable<DateTime> SourceIfUnmodifiedSince;
Nullable<std::string> EncryptionKey;
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
Nullable<std::string> Owner;
Nullable<std::string> Group;
Nullable<std::string> Acl;
Nullable<std::string> ProposedLeaseId;
Nullable<int64_t> LeaseDuration;
Nullable<Models::PathExpiryOptions> ExpiryOptions;
Nullable<std::string> ExpiresOn;
};
static Response<Models::CreatePathResult> Create(
Core::Http::_internal::HttpPipeline& pipeline,
Expand Down Expand Up @@ -386,6 +592,15 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
const Core::Url& url,
const SetPathAccessControlListRecursiveOptions& options,
const Core::Context& context);
struct UndeletePathOptions final
{
Nullable<std::string> UndeleteSource;
};
static Response<Models::UndeletePathResult> Undelete(
Core::Http::_internal::HttpPipeline& pipeline,
const Core::Url& url,
const UndeletePathOptions& options,
const Core::Context& context);
struct GetPathAccessControlListOptions final
{
Nullable<bool> Upn;
Expand Down Expand Up @@ -419,6 +634,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
ETag IfNoneMatch;
Nullable<DateTime> IfModifiedSince;
Nullable<DateTime> IfUnmodifiedSince;
Nullable<std::string> EncryptionKey;
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
};
static Response<Models::FlushFileResult> Flush(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -431,6 +648,9 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
Nullable<std::vector<uint8_t>> TransactionalContentHash;
Nullable<std::vector<uint8_t>> TransactionalContentCrc64;
Nullable<std::string> LeaseId;
Nullable<std::string> EncryptionKey;
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
Nullable<bool> Flush;
};
static Response<Models::AppendFileResult> Append(
Core::Http::_internal::HttpPipeline& pipeline,
Expand Down
Loading