Skip to content

Commit 5375070

Browse files
authored
Storeage/STG95 Files Binary ACE (#5824)
* feature code * update test case to playback only * update records * fix cspell * update record * fix cspell * fix cspell * fix comments * Remove copy opreation rest code.
1 parent 6ced010 commit 5375070

11 files changed

Lines changed: 378 additions & 4 deletions

File tree

.vscode/cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@
225225
"Schulze",
226226
"scus",
227227
"SDDL",
228+
"Sddl",
229+
"sddl",
228230
"sdpath",
229231
"serializers",
230232
"Seriot",

sdk/storage/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "cpp",
44
"TagPrefix": "cpp/storage",
5-
"Tag": "cpp/storage_f113099cfb"
5+
"Tag": "cpp/storage_3a6c7a0852"
66
}

sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/rest_client.hpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,33 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
796796
*/
797797
DateTime LastModified;
798798
};
799+
/**
800+
* @brief Optional. Available for version 2023-06-01 and later. Specifies the format in which
801+
* the permission is returned. Acceptable values are SDDL or binary. If
802+
* x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is
803+
* returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the
804+
* permission is returned as a base64 string representing the binary encoding of the permission.
805+
*/
806+
class FilePermissionFormat final {
807+
public:
808+
/** Constructs a new FilePermissionFormat instance */
809+
FilePermissionFormat() = default;
810+
/** Constructs a new FilePermissionFormat from a string. */
811+
explicit FilePermissionFormat(std::string value) : m_value(std::move(value)) {}
812+
/** Compares with another FilePermissionFormat. */
813+
bool operator==(const FilePermissionFormat& other) const { return m_value == other.m_value; }
814+
/** Compares with another FilePermissionFormat. */
815+
bool operator!=(const FilePermissionFormat& other) const { return !(*this == other); }
816+
/** Converts the value to a string. */
817+
const std::string& ToString() const { return m_value; }
818+
/** Constant value of type FilePermissionFormat: Sddl */
819+
AZ_STORAGE_FILES_SHARES_DLLEXPORT const static FilePermissionFormat Sddl;
820+
/** Constant value of type FilePermissionFormat: Binary */
821+
AZ_STORAGE_FILES_SHARES_DLLEXPORT const static FilePermissionFormat Binary;
822+
823+
private:
824+
std::string m_value;
825+
};
799826
/**
800827
* @brief Response type for #Azure::Storage::Files::Shares::ShareClient::CreatePermission.
801828
*/
@@ -816,6 +843,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
816843
* The permission in the Security Descriptor Definition Language (SDDL).
817844
*/
818845
std::string Permission;
846+
Nullable<FilePermissionFormat> Format;
819847
};
820848
} // namespace _detail
821849
/**
@@ -2243,6 +2271,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
22432271
struct GetSharePermissionOptions final
22442272
{
22452273
std::string FilePermissionKey;
2274+
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
22462275
Nullable<Models::ShareTokenIntent> FileRequestIntent;
22472276
};
22482277
static Response<Models::_detail::SharePermission> GetPermission(
@@ -2353,6 +2382,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
23532382
struct SetDirectoryPropertiesOptions final
23542383
{
23552384
Nullable<std::string> FilePermission;
2385+
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
23562386
Nullable<std::string> FilePermissionKey;
23572387
std::string FileAttributes;
23582388
Nullable<std::string> FileCreationTime;
@@ -2434,6 +2464,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
24342464
Nullable<std::string> FileLastWriteTime;
24352465
Nullable<std::string> FileChangeTime;
24362466
Nullable<std::string> FilePermission;
2467+
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
24372468
Nullable<std::string> FilePermissionKey;
24382469
std::map<std::string, std::string> Metadata;
24392470
Nullable<bool> AllowTrailingDot;
@@ -2460,6 +2491,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
24602491
Nullable<std::string> FileContentDisposition;
24612492
std::map<std::string, std::string> Metadata;
24622493
Nullable<std::string> FilePermission;
2494+
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
24632495
Nullable<std::string> FilePermissionKey;
24642496
std::string FileAttributes;
24652497
Nullable<std::string> FileCreationTime;
@@ -2519,6 +2551,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
25192551
Nullable<std::vector<uint8_t>> FileContentMD5;
25202552
Nullable<std::string> FileContentDisposition;
25212553
Nullable<std::string> FilePermission;
2554+
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
25222555
Nullable<std::string> FilePermissionKey;
25232556
std::string FileAttributes;
25242557
Nullable<std::string> FileCreationTime;
@@ -2715,6 +2748,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
27152748
Nullable<std::string> FileLastWriteTime;
27162749
Nullable<std::string> FileChangeTime;
27172750
Nullable<std::string> FilePermission;
2751+
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
27182752
Nullable<std::string> FilePermissionKey;
27192753
std::map<std::string, std::string> Metadata;
27202754
Nullable<std::string> FileContentType;

sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,27 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
311311
*/
312312
struct CreateSharePermissionOptions final
313313
{
314+
/**
315+
* Optional. Available for version 2024-11-04 and later. Specifies
316+
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
317+
* explicitly set to SDDL format, the permission will be
318+
* returned in SDDL format.
319+
*/
320+
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
314321
};
315322

316323
/**
317324
* @brief Optional parameters for #Azure::Storage::Files::Shares::ShareClient::GetPermission.
318325
*/
319326
struct GetSharePermissionOptions final
320327
{
328+
/**
329+
* Optional. Available for version 2024-11-04 and later. Specifies
330+
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
331+
* explicitly set to SDDL format, the permission will be
332+
* returned in SDDL format.
333+
*/
334+
Nullable<Models::FilePermissionFormat> FilePermissionFormat;
321335
};
322336

323337
/**
@@ -387,6 +401,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
387401
*/
388402
Azure::Nullable<std::string> FilePermission;
389403

404+
/**
405+
* Optional. Available for version 2024-11-04 and later. Specifies
406+
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
407+
* explicitly set to SDDL format, the permission will be
408+
* returned in SDDL format.
409+
*/
410+
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;
411+
390412
/**
391413
* A name-value pair to associate with a file storage object.
392414
*/
@@ -443,6 +465,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
443465
*/
444466
Azure::Nullable<std::string> FilePermission;
445467

468+
/**
469+
* Optional. Available for version 2024-11-04 and later. Specifies
470+
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
471+
* explicitly set to SDDL format, the permission will be
472+
* returned in SDDL format.
473+
*/
474+
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;
475+
446476
/**
447477
* A name-value pair to associate with a file storage object.
448478
*/
@@ -477,6 +507,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
477507
* group and dacl.
478508
*/
479509
Azure::Nullable<std::string> FilePermission;
510+
511+
/**
512+
* Optional. Available for version 2024-11-04 and later. Specifies
513+
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
514+
* explicitly set to SDDL format format, the permission will be
515+
* returned in SDDL format.
516+
*/
517+
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;
480518
};
481519

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

636+
/**
637+
* Optional. Available for version 2024-11-04 and later. Specifies
638+
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
639+
* explicitly set to SDDL format format, the permission will be
640+
* returned in SDDL format.
641+
*/
642+
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;
643+
597644
/**
598645
* SMB properties to set for the file.
599646
*/
@@ -722,10 +769,19 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
722769
{
723770
/**
724771
* This permission is the security descriptor for the file specified in the Security
725-
* Descriptor Definition Language (SDDL). If not specified, 'inherit' is used.
772+
* Descriptor Definition Language (SDDL) or base64 encoded
773+
* binary format. If not specified, 'inherit' is used.
726774
*/
727775
Azure::Nullable<std::string> Permission;
728776

777+
/**
778+
* Optional. Available for version 2024-11-04 and later. Specifies
779+
* the format in which the permission is returned.If filePermissionKeyFormat is unspecified or
780+
* explicitly set to SDDL format format, the permission will be
781+
* returned in SDDL format.
782+
*/
783+
Nullable<Models ::FilePermissionFormat> FilePermissionFormat;
784+
729785
/**
730786
* Specify this to resize a file to the specified value.
731787
*/

sdk/storage/azure-storage-files-shares/src/rest_client.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
106106
const ShareRootSquash ShareRootSquash::RootSquash("RootSquash");
107107
const ShareRootSquash ShareRootSquash::AllSquash("AllSquash");
108108
const DeleteSnapshotsOption DeleteSnapshotsOption::Include("include");
109+
const FilePermissionFormat FilePermissionFormat::Sddl("sddl");
110+
const FilePermissionFormat FilePermissionFormat::Binary("binary");
109111
FileAttributes::FileAttributes(const std::string& value)
110112
{
111113
const std::string delimiter = " | ";
@@ -1443,6 +1445,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
14431445
{
14441446
auto jsonRoot = Core::Json::_internal::json::object();
14451447
jsonRoot["permission"] = options.SharePermission.Permission;
1448+
if (options.SharePermission.Format.HasValue())
1449+
{
1450+
jsonRoot["format"] = options.SharePermission.Format.Value().ToString();
1451+
}
14461452
jsonBody = jsonRoot.dump();
14471453
}
14481454
Core::IO::MemoryBodyStream requestBody(
@@ -1482,6 +1488,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
14821488
{
14831489
request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey);
14841490
}
1491+
if (options.FilePermissionFormat.HasValue()
1492+
&& !options.FilePermissionFormat.Value().ToString().empty())
1493+
{
1494+
request.SetHeader(
1495+
"x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString());
1496+
}
14851497
request.SetHeader("x-ms-version", "2024-11-04");
14861498
if (options.FileRequestIntent.HasValue()
14871499
&& !options.FileRequestIntent.Value().ToString().empty())
@@ -1500,6 +1512,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
15001512
auto jsonRoot
15011513
= Core::Json::_internal::json::parse(responseBody.begin(), responseBody.end());
15021514
response.Permission = jsonRoot["permission"].get<std::string>();
1515+
if (jsonRoot.count("format") != 0)
1516+
{
1517+
response.Format = Models::FilePermissionFormat(jsonRoot["format"].get<std::string>());
1518+
}
15031519
}
15041520
return Response<Models::_detail::SharePermission>(
15051521
std::move(response), std::move(pRawResponse));
@@ -2075,6 +2091,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
20752091
{
20762092
request.SetHeader("x-ms-file-permission", options.FilePermission.Value());
20772093
}
2094+
if (options.FilePermissionFormat.HasValue()
2095+
&& !options.FilePermissionFormat.Value().ToString().empty())
2096+
{
2097+
request.SetHeader(
2098+
"x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString());
2099+
}
20782100
if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty())
20792101
{
20802102
request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value());
@@ -2902,6 +2924,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
29022924
{
29032925
request.SetHeader("x-ms-file-permission", options.FilePermission.Value());
29042926
}
2927+
if (options.FilePermissionFormat.HasValue()
2928+
&& !options.FilePermissionFormat.Value().ToString().empty())
2929+
{
2930+
request.SetHeader(
2931+
"x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString());
2932+
}
29052933
if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty())
29062934
{
29072935
request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value());
@@ -3004,6 +3032,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
30043032
{
30053033
request.SetHeader("x-ms-file-permission", options.FilePermission.Value());
30063034
}
3035+
if (options.FilePermissionFormat.HasValue()
3036+
&& !options.FilePermissionFormat.Value().ToString().empty())
3037+
{
3038+
request.SetHeader(
3039+
"x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString());
3040+
}
30073041
if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty())
30083042
{
30093043
request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value());
@@ -3472,6 +3506,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
34723506
{
34733507
request.SetHeader("x-ms-file-permission", options.FilePermission.Value());
34743508
}
3509+
if (options.FilePermissionFormat.HasValue()
3510+
&& !options.FilePermissionFormat.Value().ToString().empty())
3511+
{
3512+
request.SetHeader(
3513+
"x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString());
3514+
}
34753515
if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty())
34763516
{
34773517
request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value());
@@ -4495,6 +4535,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
44954535
{
44964536
request.SetHeader("x-ms-file-permission", options.FilePermission.Value());
44974537
}
4538+
if (options.FilePermissionFormat.HasValue()
4539+
&& !options.FilePermissionFormat.Value().ToString().empty())
4540+
{
4541+
request.SetHeader(
4542+
"x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString());
4543+
}
44984544
if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty())
44994545
{
45004546
request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value());

sdk/storage/azure-storage-files-shares/src/share_client.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
321321
(void)options;
322322
auto protocolLayerOptions = _detail::ShareClient::CreateSharePermissionOptions();
323323
protocolLayerOptions.SharePermission.Permission = permission;
324+
protocolLayerOptions.SharePermission.Format = options.FilePermissionFormat;
324325
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
325326
return _detail::ShareClient::CreatePermission(
326327
*m_pipeline, m_shareUrl, protocolLayerOptions, context);
@@ -331,10 +332,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
331332
const GetSharePermissionOptions& options,
332333
const Azure::Core::Context& context) const
333334
{
334-
(void)options;
335335
auto protocolLayerOptions = _detail::ShareClient::GetSharePermissionOptions();
336336
protocolLayerOptions.FilePermissionKey = permissionKey;
337337
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
338+
protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat;
338339
auto result = _detail::ShareClient::GetPermission(
339340
*m_pipeline, m_shareUrl, protocolLayerOptions, context);
340341

sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
294294
protocolLayerOptions.AllowSourceTrailingDot = m_allowSourceTrailingDot;
295295
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
296296
protocolLayerOptions.FileContentType = options.ContentType;
297+
protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat;
297298

298299
auto response = _detail::FileClient::Rename(
299300
*m_pipeline, destinationFileUrl, protocolLayerOptions, context);
@@ -356,6 +357,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
356357
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
357358
protocolLayerOptions.AllowSourceTrailingDot = m_allowSourceTrailingDot;
358359
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
360+
protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat;
359361

360362
auto response = _detail::DirectoryClient::Rename(
361363
*m_pipeline, destinationDirectoryUrl, protocolLayerOptions, context);
@@ -466,6 +468,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
466468
}
467469
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
468470
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
471+
protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat;
469472
return _detail::DirectoryClient::SetProperties(
470473
*m_pipeline, m_shareDirectoryUrl, protocolLayerOptions, context);
471474
}

sdk/storage/azure-storage-files-shares/src/share_file_client.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
217217
protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
218218
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
219219
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
220+
protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat;
220221
auto result
221222
= _detail::FileClient::Create(*m_pipeline, m_shareFileUrl, protocolLayerOptions, context);
222223
Models::CreateFileResult ret;
@@ -541,6 +542,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
541542
}
542543
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
543544
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
545+
protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat;
544546

545547
return _detail::FileClient::SetHttpHeaders(
546548
*m_pipeline, m_shareFileUrl, protocolLayerOptions, context);

0 commit comments

Comments
 (0)