Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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: 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_490fe1b8ae"
}
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 @@ -242,6 +242,23 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const GetSharePermissionOptions& options = GetSharePermissionOptions(),
const Azure::Core::Context& context = Azure::Core::Context()) const;

/**
* @brief Gets the permission of the share using the specific key.
* @param permissionKey The permission key of a permission.
* @param filePermissionFormat Optional. Available for version 2024-11-04 and later. Specifies
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
* explicityly set to SSDL format, the permission will be
* returned in SSDL format.
* @param options Optional parameters to get share's permission.
* @param context Context for cancelling long running operations.
* @return Azure::Response<std::string> containing the permission string with specified key.
*/
Azure::Response<Models::ShareFilePermission> GetPermission(
Comment thread
microzchang marked this conversation as resolved.
Outdated
const std::string& permissionKey,
const Nullable<Models::FilePermissionFormat> filePermissionFormat,
Comment thread
microzchang marked this conversation as resolved.
Outdated
const GetSharePermissionOptions& options = GetSharePermissionOptions(),
const Azure::Core::Context& context = Azure::Core::Context()) const;

private:
Azure::Core::Url m_shareUrl;
std::shared_ptr<Azure::Core::Http::_internal::HttpPipeline> m_pipeline;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,13 @@ 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
* explicityly set to SDDL format, the permission will be
* returned in SSDL format.
*/
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
};

/**
Expand Down Expand Up @@ -387,6 +394,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
* explicityly set to SDDL format, the permission will be
* returned in SSDL format.
*/
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;

/**
* A name-value pair to associate with a file storage object.
*/
Expand Down Expand Up @@ -443,6 +458,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
* explicityly set to SDDL format, the permission will be
* returned in SSDL format.
*/
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;

/**
* A name-value pair to associate with a file storage object.
*/
Expand Down Expand Up @@ -477,6 +500,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
* explicityly set to SDDL format format, the permission will be
* returned in SSDL format.
*/
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;
};

/**
Expand Down Expand Up @@ -590,10 +621,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
* explicityly set to SDDL format format, the permission will be
* returned in SSDL format.
*/
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;

/**
* SMB properties to set for the file.
*/
Expand Down Expand Up @@ -722,10 +762,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
* explicityly set to SDDL format format, the permission will be
* returned in SSDL format.
*/
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;

/**
* Specify this to resize a file to the specified value.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,23 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
*/
Azure::Nullable<ShareFileHandleAccessRights> AccessRights;
};

/**
* @brief A permission at the share level.
*/
struct ShareFilePermission final
{
/**
* The permission in the Security Descriptor Definition Language (SDDL) or base64 encoded
* binary format.
*/
std::string Permission;

/**
* Format of Permission.
*/
Nullable<FilePermissionFormat> PermissionFormat;
};
} // namespace Models

/**
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
Loading