Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
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
2 changes: 2 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@
"Schulze",
"scus",
"SDDL",
"Sddl",
"sddl",
"sdpath",
"serializers",
"Seriot",
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "cpp",
"TagPrefix": "cpp/storage",
"Tag": "cpp/storage_f113099cfb"
"Tag": "cpp/storage_3a6c7a0852"
}
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,33 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
*/
DateTime LastModified;
};
/**
* @brief Optional. Available for version 2023-06-01 and later. Specifies the format in which
* the permission is returned. Acceptable values are SDDL or binary. If
* x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is
* returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the
* permission is returned as a base64 string representing the binary encoding of the permission.
*/
class FilePermissionFormat final {
public:
/** Constructs a new FilePermissionFormat instance */
FilePermissionFormat() = default;
/** Constructs a new FilePermissionFormat from a string. */
explicit FilePermissionFormat(std::string value) : m_value(std::move(value)) {}
/** Compares with another FilePermissionFormat. */
bool operator==(const FilePermissionFormat& other) const { return m_value == other.m_value; }
/** Compares with another FilePermissionFormat. */
bool operator!=(const FilePermissionFormat& other) const { return !(*this == other); }
/** Converts the value to a string. */
const std::string& ToString() const { return m_value; }
/** Constant value of type FilePermissionFormat: Sddl */
AZ_STORAGE_FILES_SHARES_DLLEXPORT const static FilePermissionFormat Sddl;
/** Constant value of type FilePermissionFormat: Binary */
AZ_STORAGE_FILES_SHARES_DLLEXPORT const static FilePermissionFormat Binary;

private:
std::string m_value;
};
/**
* @brief Response type for #Azure::Storage::Files::Shares::ShareClient::CreatePermission.
*/
Expand All @@ -816,6 +843,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
* The permission in the Security Descriptor Definition Language (SDDL).
*/
std::string Permission;
Nullable<FilePermissionFormat> Format;
};
} // namespace _detail
/**
Expand Down Expand Up @@ -2243,6 +2271,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
struct GetSharePermissionOptions final
{
std::string FilePermissionKey;
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
Nullable<Models::ShareTokenIntent> FileRequestIntent;
};
static Response<Models::_detail::SharePermission> GetPermission(
Expand Down Expand Up @@ -2353,6 +2382,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
struct SetDirectoryPropertiesOptions final
{
Nullable<std::string> FilePermission;
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
Nullable<std::string> FilePermissionKey;
std::string FileAttributes;
Nullable<std::string> FileCreationTime;
Expand Down Expand Up @@ -2434,6 +2464,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> FileLastWriteTime;
Nullable<std::string> FileChangeTime;
Nullable<std::string> FilePermission;
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
Nullable<std::string> FilePermissionKey;
std::map<std::string, std::string> Metadata;
Nullable<bool> AllowTrailingDot;
Expand All @@ -2460,6 +2491,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> FileContentDisposition;
std::map<std::string, std::string> Metadata;
Nullable<std::string> FilePermission;
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
Nullable<std::string> FilePermissionKey;
std::string FileAttributes;
Nullable<std::string> FileCreationTime;
Expand Down Expand Up @@ -2519,6 +2551,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::vector<uint8_t>> FileContentMD5;
Nullable<std::string> FileContentDisposition;
Nullable<std::string> FilePermission;
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
Nullable<std::string> FilePermissionKey;
std::string FileAttributes;
Nullable<std::string> FileCreationTime;
Expand Down Expand Up @@ -2647,6 +2680,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::map<std::string, std::string> Metadata;
std::string CopySource;
Nullable<std::string> FilePermission;
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
Nullable<std::string> FilePermissionKey;
Nullable<Models::PermissionCopyMode> FilePermissionCopyMode;
Nullable<bool> IgnoreReadOnly;
Expand Down Expand Up @@ -2715,6 +2749,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Nullable<std::string> FileLastWriteTime;
Nullable<std::string> FileChangeTime;
Nullable<std::string> FilePermission;
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
Nullable<std::string> FilePermissionKey;
std::map<std::string, std::string> Metadata;
Nullable<std::string> FileContentType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,27 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
*/
struct CreateSharePermissionOptions final
{
/**
* Optional. Available for version 2024-11-04 and later. Specifies
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
* explicitly set to SDDL format, the permission will be
* returned in SDDL format.
*/
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
};

/**
* @brief Optional parameters for #Azure::Storage::Files::Shares::ShareClient::GetPermission.
*/
struct GetSharePermissionOptions final
{
/**
* Optional. Available for version 2024-11-04 and later. Specifies
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
* explicitly set to SDDL format, the permission will be
* returned in SDDL format.
*/
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
};

/**
Expand Down Expand Up @@ -387,6 +401,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
*/
Azure::Nullable<std::string> FilePermission;

/**
* Optional. Available for version 2024-11-04 and later. Specifies
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
* explicitly set to SDDL format, the permission will be
* returned in SDDL format.
*/
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;

/**
* A name-value pair to associate with a file storage object.
*/
Expand Down Expand Up @@ -443,6 +465,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
*/
Azure::Nullable<std::string> FilePermission;

/**
* Optional. Available for version 2024-11-04 and later. Specifies
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
* explicitly set to SDDL format, the permission will be
* returned in SDDL format.
*/
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;

/**
* A name-value pair to associate with a file storage object.
*/
Expand Down Expand Up @@ -477,6 +507,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
* group and dacl.
*/
Azure::Nullable<std::string> FilePermission;

/**
* Optional. Available for version 2024-11-04 and later. Specifies
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
* explicitly set to SDDL format format, the permission will be
* returned in SDDL format.
*/
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;
};

/**
Expand Down Expand Up @@ -590,10 +628,19 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
/**
* This permission is the security descriptor for the file specified in the Security
* Descriptor Definition Language (SDDL). If not specified, 'inherit' is used.
* Descriptor Definition Language (SDDL) or base64 encoded
* binary format. If not specified, 'inherit' is used.
*/
Azure::Nullable<std::string> Permission;

/**
* Optional. Available for version 2024-11-04 and later. Specifies
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
* explicitly set to SDDL format format, the permission will be
* returned in SDDL format.
*/
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;

/**
* SMB properties to set for the file.
*/
Expand Down Expand Up @@ -722,10 +769,19 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
/**
* This permission is the security descriptor for the file specified in the Security
* Descriptor Definition Language (SDDL). If not specified, 'inherit' is used.
* Descriptor Definition Language (SDDL) or base64 encoded
* binary format. If not specified, 'inherit' is used.
*/
Azure::Nullable<std::string> Permission;

/**
* Optional. Available for version 2024-11-04 and later. Specifies
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
* explicitly set to SDDL format format, the permission will be
* returned in SDDL format.
*/
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;

/**
* Specify this to resize a file to the specified value.
*/
Expand Down
52 changes: 52 additions & 0 deletions sdk/storage/azure-storage-files-shares/src/rest_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const ShareRootSquash ShareRootSquash::RootSquash("RootSquash");
const ShareRootSquash ShareRootSquash::AllSquash("AllSquash");
const DeleteSnapshotsOption DeleteSnapshotsOption::Include("include");
const FilePermissionFormat FilePermissionFormat::Sddl("sddl");
const FilePermissionFormat FilePermissionFormat::Binary("binary");
FileAttributes::FileAttributes(const std::string& value)
{
const std::string delimiter = " | ";
Expand Down Expand Up @@ -1443,6 +1445,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
auto jsonRoot = Core::Json::_internal::json::object();
jsonRoot["permission"] = options.SharePermission.Permission;
if (options.SharePermission.Format.HasValue())
{
jsonRoot["format"] = options.SharePermission.Format.Value().ToString();
}
jsonBody = jsonRoot.dump();
}
Core::IO::MemoryBodyStream requestBody(
Expand Down Expand Up @@ -1482,6 +1488,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey);
}
if (options.FilePermissionFormat.HasValue()
&& !options.FilePermissionFormat.Value().ToString().empty())
{
request.SetHeader(
"x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString());
}
request.SetHeader("x-ms-version", "2024-11-04");
if (options.FileRequestIntent.HasValue()
&& !options.FileRequestIntent.Value().ToString().empty())
Expand All @@ -1500,6 +1512,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
auto jsonRoot
= Core::Json::_internal::json::parse(responseBody.begin(), responseBody.end());
response.Permission = jsonRoot["permission"].get<std::string>();
if (jsonRoot.count("format") != 0)
{
response.Format = Models::FilePermissionFormat(jsonRoot["format"].get<std::string>());
}
}
return Response<Models::_detail::SharePermission>(
std::move(response), std::move(pRawResponse));
Expand Down Expand Up @@ -2075,6 +2091,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
request.SetHeader("x-ms-file-permission", options.FilePermission.Value());
}
if (options.FilePermissionFormat.HasValue()
&& !options.FilePermissionFormat.Value().ToString().empty())
{
request.SetHeader(
"x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString());
}
if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty())
{
request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value());
Expand Down Expand Up @@ -2902,6 +2924,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
request.SetHeader("x-ms-file-permission", options.FilePermission.Value());
}
if (options.FilePermissionFormat.HasValue()
&& !options.FilePermissionFormat.Value().ToString().empty())
{
request.SetHeader(
"x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString());
}
if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty())
{
request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value());
Expand Down Expand Up @@ -3004,6 +3032,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
request.SetHeader("x-ms-file-permission", options.FilePermission.Value());
}
if (options.FilePermissionFormat.HasValue()
&& !options.FilePermissionFormat.Value().ToString().empty())
{
request.SetHeader(
"x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString());
}
if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty())
{
request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value());
Expand Down Expand Up @@ -3472,6 +3506,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
request.SetHeader("x-ms-file-permission", options.FilePermission.Value());
}
if (options.FilePermissionFormat.HasValue()
&& !options.FilePermissionFormat.Value().ToString().empty())
{
request.SetHeader(
"x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString());
}
if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty())
{
request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value());
Expand Down Expand Up @@ -4073,6 +4113,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
request.SetHeader("x-ms-file-permission", options.FilePermission.Value());
}
if (options.FilePermissionFormat.HasValue()
&& !options.FilePermissionFormat.Value().ToString().empty())
{
request.SetHeader(
"x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString());
}
if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty())
{
request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value());
Expand Down Expand Up @@ -4495,6 +4541,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
request.SetHeader("x-ms-file-permission", options.FilePermission.Value());
}
if (options.FilePermissionFormat.HasValue()
&& !options.FilePermissionFormat.Value().ToString().empty())
{
request.SetHeader(
"x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString());
}
if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty())
{
request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value());
Expand Down
3 changes: 2 additions & 1 deletion sdk/storage/azure-storage-files-shares/src/share_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
(void)options;
auto protocolLayerOptions = _detail::ShareClient::CreateSharePermissionOptions();
protocolLayerOptions.SharePermission.Permission = permission;
protocolLayerOptions.SharePermission.Format = options.FilePermissionFormat;
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
return _detail::ShareClient::CreatePermission(
*m_pipeline, m_shareUrl, protocolLayerOptions, context);
Expand All @@ -331,10 +332,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const GetSharePermissionOptions& options,
const Azure::Core::Context& context) const
{
(void)options;
auto protocolLayerOptions = _detail::ShareClient::GetSharePermissionOptions();
protocolLayerOptions.FilePermissionKey = permissionKey;
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat;
auto result = _detail::ShareClient::GetPermission(
*m_pipeline, m_shareUrl, protocolLayerOptions, context);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
protocolLayerOptions.AllowSourceTrailingDot = m_allowSourceTrailingDot;
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
protocolLayerOptions.FileContentType = options.ContentType;
protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat;

auto response = _detail::FileClient::Rename(
*m_pipeline, destinationFileUrl, protocolLayerOptions, context);
Expand Down Expand Up @@ -356,6 +357,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
protocolLayerOptions.AllowSourceTrailingDot = m_allowSourceTrailingDot;
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat;

auto response = _detail::DirectoryClient::Rename(
*m_pipeline, destinationDirectoryUrl, protocolLayerOptions, context);
Expand Down Expand Up @@ -466,6 +468,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat;
return _detail::DirectoryClient::SetProperties(
*m_pipeline, m_shareDirectoryUrl, protocolLayerOptions, context);
}
Expand Down
Loading