Skip to content

Commit

Permalink
Stg87 protocol layer (Azure#4374)
Browse files Browse the repository at this point in the history
* storage stg87 protocol layer
  • Loading branch information
microzchang committed Apr 4, 2023
1 parent 02bb09a commit 8808372
Show file tree
Hide file tree
Showing 6 changed files with 436 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
Nullable<std::string> EncryptionScope;
Nullable<std::string> CreatedOn;
Nullable<std::string> ExpiresOn;
Nullable<std::string> EncryptionContext;
std::string ETag;
};
/**
Expand Down Expand Up @@ -412,6 +413,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
Nullable<int64_t> LeaseDuration;
Nullable<std::string> ExpiryOptions;
Nullable<std::string> ExpiresOn;
Nullable<std::string> EncryptionContext;
};
static Response<Models::CreatePathResult> Create(
Core::Http::_internal::HttpPipeline& pipeline,
Expand Down
8 changes: 8 additions & 0 deletions sdk/storage/azure-storage-files-datalake/src/rest_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
{
vectorElement2.ExpiresOn = var0["expiryTime"].get<std::string>();
}
if (var0.count("EncryptionContext") != 0)
{
vectorElement2.EncryptionContext = var0["EncryptionContext"].get<std::string>();
}
if (var0.count("etag") != 0)
{
vectorElement2.ETag = var0["etag"].get<std::string>();
Expand Down Expand Up @@ -297,6 +301,10 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
{
request.SetHeader("x-ms-expiry-time", options.ExpiresOn.Value());
}
if (options.EncryptionContext.HasValue() && !options.EncryptionContext.Value().empty())
{
request.SetHeader("x-ms-encryption-context", options.EncryptionContext.Value());
}
auto pRawResponse = pipeline.Send(request, context);
auto httpStatusCode = pRawResponse->GetStatusCode();
if (httpStatusCode != Core::Http::HttpStatusCode::Created)
Expand Down
1 change: 1 addition & 0 deletions sdk/storage/azure-storage-files-datalake/swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ directive:
$.Path.properties["contentLength"]["x-ms-client-name"] = "FileSize";
$.Path.properties["isDirectory"]["x-ms-client-default"] = false;
$.Path.properties["EncryptionScope"]["x-nullable"] = true;
$.Path.properties["EncryptionContext"]["x-nullable"] = true;
$.Path.properties["creationTime"] = {"type": "string", "x-ms-client-name": "CreatedOn", "x-nullable": true};
$.Path.properties["expiryTime"] = {"type": "string", "x-ms-client-name": "ExpiresOn", "x-nullable": true};
$.Path.properties["etag"] = {"type": "string", "x-ms-format": "string", "x-ms-client-default": "", "x-ms-client-name": "ETag"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
/**
* The version used for the operations to Azure storage services.
*/
constexpr static const char* ApiVersion = "2021-12-02";
constexpr static const char* ApiVersion = "2022-11-02";
} // namespace _detail
namespace Models {
/**
Expand Down Expand Up @@ -627,6 +627,21 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
*/
DateTime LastModified;
};
/**
* @brief Valid value is backup.
*/
class ShareTokenIntent final {
public:
ShareTokenIntent() = default;
explicit ShareTokenIntent(std::string value) : m_value(std::move(value)) {}
bool operator==(const ShareTokenIntent& other) const { return m_value == other.m_value; }
bool operator!=(const ShareTokenIntent& other) const { return !(*this == other); }
const std::string& ToString() const { return m_value; }
AZ_STORAGE_FILES_SHARES_DLLEXPORT const static ShareTokenIntent Backup;

private:
std::string m_value;
};
/**
* @brief Response type for #Azure::Storage::Files::Shares::ShareClient::CreatePermission.
*/
Expand Down Expand Up @@ -1942,6 +1957,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
struct CreateSharePermissionOptions final
{
Models::_detail::SharePermission SharePermission;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::CreateSharePermissionResult> CreatePermission(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -1951,6 +1967,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
struct GetSharePermissionOptions final
{
std::string FilePermissionKey;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::SharePermission> GetPermission(
Core::Http::_internal::HttpPipeline& pipeline,
Expand Down Expand Up @@ -2012,13 +2029,15 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
public:
struct CreateDirectoryOptions final
{
Nullable<bool> AllowTrailingDot;
std::map<std::string, std::string> Metadata;
Nullable<std::string> FilePermission;
Nullable<std::string> FilePermissionKey;
std::string FileAttributes;
Nullable<std::string> FileCreationTime;
Nullable<std::string> FileLastWriteTime;
Nullable<std::string> FileChangeTime;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::CreateDirectoryResult> Create(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2027,7 +2046,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const Core::Context& context);
struct GetDirectoryPropertiesOptions final
{
Nullable<bool> AllowTrailingDot;
Nullable<std::string> Sharesnapshot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::DirectoryProperties> GetProperties(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2036,6 +2057,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const Core::Context& context);
struct DeleteDirectoryOptions final
{
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::DeleteDirectoryResult> Delete(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2050,6 +2073,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> FileCreationTime;
Nullable<std::string> FileLastWriteTime;
Nullable<std::string> FileChangeTime;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::SetDirectoryPropertiesResult> SetProperties(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2059,6 +2084,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
struct SetDirectoryMetadataOptions final
{
std::map<std::string, std::string> Metadata;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::SetDirectoryMetadataResult> SetMetadata(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2073,6 +2100,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<int32_t> MaxResults;
Nullable<Models::ListFilesIncludeFlags> Include;
Nullable<bool> IncludeExtendedInfo;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::ListFilesAndDirectoriesSegmentResponse>
ListFilesAndDirectoriesSegment(
Expand All @@ -2086,6 +2115,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<int32_t> MaxResults;
Nullable<std::string> Sharesnapshot;
Nullable<bool> Recursive;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::ListHandlesResponse> ListHandles(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2098,6 +2129,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> Sharesnapshot;
std::string HandleId;
Nullable<bool> Recursive;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::ForceCloseDirectoryHandlesResult> ForceCloseHandles(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2118,6 +2151,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> FilePermission;
Nullable<std::string> FilePermissionKey;
std::map<std::string, std::string> Metadata;
Nullable<bool> AllowTrailingDot;
Nullable<bool> AllowSourceTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::RenameDirectoryResult> Rename(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2129,6 +2165,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
public:
struct CreateFileOptions final
{
Nullable<bool> AllowTrailingDot;
int64_t FileContentLength = int64_t();
Nullable<std::string> FileContentType;
Nullable<std::string> FileContentEncoding;
Expand All @@ -2144,6 +2181,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> FileLastWriteTime;
Nullable<std::string> FileChangeTime;
Nullable<std::string> LeaseId;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::CreateFileResult> Create(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2152,9 +2190,11 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const Core::Context& context);
struct DownloadFileOptions final
{
Nullable<bool> AllowTrailingDot;
Nullable<std::string> Range;
Nullable<bool> RangeGetContentMD5;
Nullable<std::string> LeaseId;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::DownloadFileResult> Download(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2163,8 +2203,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const Core::Context& context);
struct GetFilePropertiesOptions final
{
Nullable<bool> AllowTrailingDot;
Nullable<std::string> Sharesnapshot;
Nullable<std::string> LeaseId;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::FileProperties> GetProperties(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2173,7 +2215,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const Core::Context& context);
struct DeleteFileOptions final
{
Nullable<bool> AllowTrailingDot;
Nullable<std::string> LeaseId;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::DeleteFileResult> Delete(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2196,6 +2240,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> FileLastWriteTime;
Nullable<std::string> FileChangeTime;
Nullable<std::string> LeaseId;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::SetFilePropertiesResult> SetHttpHeaders(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2206,6 +2252,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
std::map<std::string, std::string> Metadata;
Nullable<std::string> LeaseId;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::SetFileMetadataResult> SetMetadata(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2216,6 +2264,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
Nullable<int32_t> Duration;
Nullable<std::string> ProposedLeaseId;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::AcquireFileLeaseResult> AcquireLease(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2225,6 +2275,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
struct ReleaseFileLeaseOptions final
{
std::string LeaseId;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::ReleaseFileLeaseResult> ReleaseLease(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2235,6 +2287,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
std::string LeaseId;
Nullable<std::string> ProposedLeaseId;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::ChangeFileLeaseResult> ChangeLease(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2244,6 +2298,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
struct BreakFileLeaseOptions final
{
Nullable<std::string> LeaseId;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::BreakFileLeaseResult> BreakLease(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2257,6 +2313,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::vector<uint8_t>> ContentMD5;
Nullable<std::string> LeaseId;
Nullable<Models::FileLastWrittenMode> FileLastWrittenMode;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::UploadFileRangeResult> UploadRange(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2275,6 +2333,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> LeaseId;
Nullable<std::string> CopySourceAuthorization;
Nullable<Models::FileLastWrittenMode> FileLastWrittenMode;
Nullable<bool> AllowTrailingDot;
Nullable<bool> AllowSourceTrailingDot;
};
static Response<Models::UploadFileRangeFromUriResult> UploadRangeFromUri(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2287,6 +2347,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> Prevsharesnapshot;
Nullable<std::string> Range;
Nullable<std::string> LeaseId;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::GetFileRangeListResult> GetRangeList(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2307,6 +2369,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> FileChangeTime;
Nullable<bool> SetArchiveAttribute;
Nullable<std::string> LeaseId;
Nullable<bool> AllowTrailingDot;
Nullable<bool> AllowSourceTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::StartFileCopyResult> StartCopy(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2317,6 +2382,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
std::string CopyId;
Nullable<std::string> LeaseId;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::AbortFileCopyResult> AbortCopy(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2328,6 +2395,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> Marker;
Nullable<int32_t> MaxResults;
Nullable<std::string> Sharesnapshot;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::ListHandlesResponse> ListHandles(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2339,6 +2408,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> Marker;
Nullable<std::string> Sharesnapshot;
std::string HandleId;
Nullable<bool> AllowTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::ForceFileCloseHandlesResult> ForceCloseHandles(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -2360,6 +2431,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> FilePermissionKey;
std::map<std::string, std::string> Metadata;
Nullable<std::string> FileContentType;
Nullable<bool> AllowTrailingDot;
Nullable<bool> AllowSourceTrailingDot;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::RenameFileResult> Rename(
Core::Http::_internal::HttpPipeline& pipeline,
Expand Down
Loading

0 comments on commit 8808372

Please sign in to comment.