Skip to content

Commit fb8ea79

Browse files
committed
Storage/STG95 Resolve Archboard Review Comments (Azure#5856)
* fix comments * fix comments
1 parent ee36e7b commit fb8ea79

File tree

7 files changed

+377
-709
lines changed

7 files changed

+377
-709
lines changed

sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/rest_client.hpp

Lines changed: 213 additions & 397 deletions
Large diffs are not rendered by default.

sdk/storage/azure-storage-blobs/swagger/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ package-name: azure-storage-blobs
99
namespace: Azure::Storage::Blobs
1010
output-folder: generated
1111
clear-output-folder: true
12-
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.BlobStorage/stable/2021-12-02/blob.json
12+
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.BlobStorage/stable/2024-08-04/blob.json
1313
```
1414
1515
## ModelFour Options

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

Lines changed: 42 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <azure/core/context.hpp>
1010
#include <azure/core/datetime.hpp>
1111
#include <azure/core/etag.hpp>
12+
#include <azure/core/internal/extendable_enumeration.hpp>
1213
#include <azure/core/internal/http/pipeline.hpp>
1314
#include <azure/core/io/body_stream.hpp>
1415
#include <azure/core/nullable.hpp>
@@ -30,47 +31,29 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
3031
} // namespace _detail
3132
namespace Models {
3233
namespace _detail {
33-
class PathRenameMode final {
34+
class PathRenameMode final : public Core::_internal::ExtendableEnumeration<PathRenameMode> {
3435
public:
3536
/** Constructs a new PathRenameMode instance */
3637
PathRenameMode() = default;
3738
/** Constructs a new PathRenameMode from a string. */
38-
explicit PathRenameMode(std::string value) : m_value(std::move(value)) {}
39-
/** Compares with another PathRenameMode. */
40-
bool operator==(const PathRenameMode& other) const { return m_value == other.m_value; }
41-
/** Compares with another PathRenameMode. */
42-
bool operator!=(const PathRenameMode& other) const { return !(*this == other); }
43-
/** Converts the value to a string. */
44-
const std::string& ToString() const { return m_value; }
39+
explicit PathRenameMode(std::string value) : ExtendableEnumeration(std::move(value)) {}
40+
4541
/** Constant value of type PathRenameMode: Legacy */
4642
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathRenameMode Legacy;
4743
/** Constant value of type PathRenameMode: Posix */
4844
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathRenameMode Posix;
49-
50-
private:
51-
std::string m_value;
5245
};
53-
class PathSetAccessControlListRecursiveMode final {
46+
class PathSetAccessControlListRecursiveMode final
47+
: public Core::_internal::ExtendableEnumeration<PathSetAccessControlListRecursiveMode> {
5448
public:
5549
/** Constructs a new PathSetAccessControlListRecursiveMode instance */
5650
PathSetAccessControlListRecursiveMode() = default;
5751
/** Constructs a new PathSetAccessControlListRecursiveMode from a string. */
5852
explicit PathSetAccessControlListRecursiveMode(std::string value)
59-
: m_value(std::move(value))
60-
{
61-
}
62-
/** Compares with another PathSetAccessControlListRecursiveMode. */
63-
bool operator==(const PathSetAccessControlListRecursiveMode& other) const
53+
: ExtendableEnumeration(std::move(value))
6454
{
65-
return m_value == other.m_value;
6655
}
67-
/** Compares with another PathSetAccessControlListRecursiveMode. */
68-
bool operator!=(const PathSetAccessControlListRecursiveMode& other) const
69-
{
70-
return !(*this == other);
71-
}
72-
/** Converts the value to a string. */
73-
const std::string& ToString() const { return m_value; }
56+
7457
/** Constant value of type PathSetAccessControlListRecursiveMode: Set */
7558
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathSetAccessControlListRecursiveMode Set;
7659
/** Constant value of type PathSetAccessControlListRecursiveMode: Modify */
@@ -79,44 +62,33 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
7962
/** Constant value of type PathSetAccessControlListRecursiveMode: Remove */
8063
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathSetAccessControlListRecursiveMode
8164
Remove;
82-
83-
private:
84-
std::string m_value;
8565
};
8666
} // namespace _detail
8767
/**
8868
* @brief Specifies whether data in the file system may be accessed publicly and the level of
8969
* access.
9070
*/
91-
class PublicAccessType final {
71+
class PublicAccessType final : public Core::_internal::ExtendableEnumeration<PublicAccessType> {
9272
public:
9373
/** Constructs a new PublicAccessType instance */
9474
PublicAccessType() = default;
9575
/** Constructs a new PublicAccessType from a string. */
96-
explicit PublicAccessType(std::string value) : m_value(std::move(value)) {}
97-
/** Compares with another PublicAccessType. */
98-
bool operator==(const PublicAccessType& other) const { return m_value == other.m_value; }
99-
/** Compares with another PublicAccessType. */
100-
bool operator!=(const PublicAccessType& other) const { return !(*this == other); }
101-
/** Converts the value to a string. */
102-
const std::string& ToString() const { return m_value; }
76+
explicit PublicAccessType(std::string value) : ExtendableEnumeration(std::move(value)) {}
77+
10378
/** Constant value of type PublicAccessType: None */
10479
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PublicAccessType None;
10580
/** Constant value of type PublicAccessType: FileSystem */
10681
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PublicAccessType FileSystem;
10782
/** Constant value of type PublicAccessType: Path */
10883
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PublicAccessType Path;
109-
110-
private:
111-
std::string m_value;
11284
};
11385
namespace _detail {
11486
struct PathItem final
11587
{
11688
std::string Name;
11789
bool IsDirectory = false;
11890
DateTime LastModified;
119-
int64_t FileSize = int64_t();
91+
std::int64_t FileSize = std::int64_t();
12092
std::string Owner;
12193
std::string Group;
12294
std::string Permissions;
@@ -151,25 +123,17 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
151123
* @brief Required only for Create File and Create Directory. The value must be "file" or
152124
* "directory".
153125
*/
154-
class PathResourceType final {
126+
class PathResourceType final : public Core::_internal::ExtendableEnumeration<PathResourceType> {
155127
public:
156128
/** Constructs a new PathResourceType instance */
157129
PathResourceType() = default;
158130
/** Constructs a new PathResourceType from a string. */
159-
explicit PathResourceType(std::string value) : m_value(std::move(value)) {}
160-
/** Compares with another PathResourceType. */
161-
bool operator==(const PathResourceType& other) const { return m_value == other.m_value; }
162-
/** Compares with another PathResourceType. */
163-
bool operator!=(const PathResourceType& other) const { return !(*this == other); }
164-
/** Converts the value to a string. */
165-
const std::string& ToString() const { return m_value; }
131+
explicit PathResourceType(std::string value) : ExtendableEnumeration(std::move(value)) {}
132+
166133
/** Constant value of type PathResourceType: Directory */
167134
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathResourceType Directory;
168135
/** Constant value of type PathResourceType: File */
169136
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathResourceType File;
170-
171-
private:
172-
std::string m_value;
173137
};
174138
/**
175139
* @brief Response type for #Azure::Storage::Files::DataLake::DataLakePathClient::Create.
@@ -192,7 +156,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
192156
/**
193157
* The size of the resource in bytes.
194158
*/
195-
Nullable<int64_t> FileSize;
159+
Nullable<std::int64_t> FileSize;
196160
/**
197161
* The value of this header is set to true if the contents of the request are successfully
198162
* encrypted using the specified algorithm, and false otherwise.
@@ -202,7 +166,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
202166
* The SHA-256 hash of the encryption key used to encrypt the blob. This header is only
203167
* returned when the blob was encrypted with a customer-provided key.
204168
*/
205-
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
169+
Nullable<std::vector<std::uint8_t>> EncryptionKeySha256;
206170
};
207171
/**
208172
* @brief Response type for #Azure::Storage::Files::DataLake::DataLakePathClient::Delete.
@@ -255,9 +219,9 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
255219
*/
256220
struct SetAccessControlListRecursiveResult final
257221
{
258-
int32_t NumberOfSuccessfulDirectories = int32_t();
259-
int32_t NumberOfSuccessfulFiles = int32_t();
260-
int32_t NumberOfFailures = int32_t();
222+
std::int32_t NumberOfSuccessfulDirectories = std::int32_t();
223+
std::int32_t NumberOfSuccessfulFiles = std::int32_t();
224+
std::int32_t NumberOfFailures = std::int32_t();
261225
/**
262226
* Array of AclFailedEntry.
263227
*/
@@ -317,18 +281,13 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
317281
* lease. If "release" it will release the lease only on flush. If "acquire-release" it will
318282
* acquire & complete the operation & release the lease once operation is done.
319283
*/
320-
class LeaseAction final {
284+
class LeaseAction final : public Core::_internal::ExtendableEnumeration<LeaseAction> {
321285
public:
322286
/** Constructs a new LeaseAction instance */
323287
LeaseAction() = default;
324288
/** Constructs a new LeaseAction from a string. */
325-
explicit LeaseAction(std::string value) : m_value(std::move(value)) {}
326-
/** Compares with another LeaseAction. */
327-
bool operator==(const LeaseAction& other) const { return m_value == other.m_value; }
328-
/** Compares with another LeaseAction. */
329-
bool operator!=(const LeaseAction& other) const { return !(*this == other); }
330-
/** Converts the value to a string. */
331-
const std::string& ToString() const { return m_value; }
289+
explicit LeaseAction(std::string value) : ExtendableEnumeration(std::move(value)) {}
290+
332291
/** Constant value of type LeaseAction: Acquire */
333292
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static LeaseAction Acquire;
334293
/** Constant value of type LeaseAction: AutoRenew */
@@ -337,9 +296,6 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
337296
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static LeaseAction Release;
338297
/** Constant value of type LeaseAction: AcquireRelease */
339298
AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static LeaseAction AcquireRelease;
340-
341-
private:
342-
std::string m_value;
343299
};
344300
/**
345301
* @brief Response type for #Azure::Storage::Files::DataLake::DataLakeFileClient::Flush.
@@ -358,7 +314,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
358314
/**
359315
* The size of the resource in bytes.
360316
*/
361-
int64_t FileSize = int64_t();
317+
std::int64_t FileSize = std::int64_t();
362318
/**
363319
* The value of this header is set to true if the contents of the request are successfully
364320
* encrypted using the specified algorithm, and false otherwise.
@@ -368,7 +324,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
368324
* The SHA-256 hash of the encryption key used to encrypt the blob. This header is only
369325
* returned when the blob was encrypted with a customer-provided key.
370326
*/
371-
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
327+
Nullable<std::vector<std::uint8_t>> EncryptionKeySha256;
372328
/**
373329
* If the lease was auto-renewed with this request.
374330
*/
@@ -393,7 +349,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
393349
* The SHA-256 hash of the encryption key used to encrypt the blob. This header is only
394350
* returned when the blob was encrypted with a customer-provided key.
395351
*/
396-
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
352+
Nullable<std::vector<std::uint8_t>> EncryptionKeySha256;
397353
/**
398354
* If the lease was auto-renewed with this request.
399355
*/
@@ -406,11 +362,11 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
406362
struct ListFileSystemPathsOptions final
407363
{
408364
Nullable<std::string> RequestId;
409-
Nullable<int32_t> Timeout;
365+
Nullable<std::int32_t> Timeout;
410366
Nullable<std::string> ContinuationToken;
411367
Nullable<std::string> Path;
412368
bool Recursive = bool();
413-
Nullable<int32_t> MaxResults;
369+
Nullable<std::int32_t> MaxResults;
414370
Nullable<bool> Upn;
415371
};
416372
static Response<Models::_detail::PathList> ListPaths(
@@ -424,7 +380,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
424380
struct CreatePathOptions final
425381
{
426382
Nullable<std::string> RequestId;
427-
Nullable<int32_t> Timeout;
383+
Nullable<std::int32_t> Timeout;
428384
Nullable<Models::PathResourceType> Resource;
429385
Nullable<std::string> ContinuationToken;
430386
Nullable<std::string> Mode;
@@ -448,13 +404,13 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
448404
Nullable<DateTime> SourceIfModifiedSince;
449405
Nullable<DateTime> SourceIfUnmodifiedSince;
450406
Nullable<std::string> EncryptionKey;
451-
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
407+
Nullable<std::vector<std::uint8_t>> EncryptionKeySha256;
452408
Nullable<std::string> EncryptionAlgorithm;
453409
Nullable<std::string> Owner;
454410
Nullable<std::string> Group;
455411
Nullable<std::string> Acl;
456412
Nullable<std::string> ProposedLeaseId;
457-
Nullable<int64_t> LeaseDuration;
413+
Nullable<std::int64_t> LeaseDuration;
458414
Nullable<std::string> ExpiryOptions;
459415
Nullable<std::string> ExpiresOn;
460416
Nullable<std::string> EncryptionContext;
@@ -467,7 +423,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
467423
struct DeletePathOptions final
468424
{
469425
Nullable<std::string> RequestId;
470-
Nullable<int32_t> Timeout;
426+
Nullable<std::int32_t> Timeout;
471427
Nullable<bool> Recursive;
472428
Nullable<std::string> ContinuationToken;
473429
Nullable<std::string> LeaseId;
@@ -504,7 +460,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
504460
Nullable<std::string> ContinuationToken;
505461
std::string Mode;
506462
Nullable<bool> ForceFlag;
507-
Nullable<int32_t> MaxRecords;
463+
Nullable<std::int32_t> MaxRecords;
508464
Nullable<std::string> Acl;
509465
};
510466
static Response<Models::_detail::SetAccessControlListRecursiveResult>
@@ -541,13 +497,13 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
541497
public:
542498
struct FlushFileOptions final
543499
{
544-
Nullable<int64_t> Position;
500+
Nullable<std::int64_t> Position;
545501
Nullable<bool> RetainUncommittedData;
546502
Nullable<bool> Close;
547-
Nullable<std::vector<uint8_t>> ContentMD5;
503+
Nullable<std::vector<std::uint8_t>> ContentMD5;
548504
Nullable<std::string> LeaseId;
549505
Nullable<Models::LeaseAction> LeaseAction;
550-
Nullable<int64_t> LeaseDuration;
506+
Nullable<std::int64_t> LeaseDuration;
551507
Nullable<std::string> ProposedLeaseId;
552508
Nullable<std::string> CacheControl;
553509
Nullable<std::string> ContentType;
@@ -559,7 +515,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
559515
Nullable<DateTime> IfModifiedSince;
560516
Nullable<DateTime> IfUnmodifiedSince;
561517
Nullable<std::string> EncryptionKey;
562-
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
518+
Nullable<std::vector<std::uint8_t>> EncryptionKeySha256;
563519
Nullable<std::string> EncryptionAlgorithm;
564520
};
565521
static Response<Models::FlushFileResult> Flush(
@@ -569,15 +525,15 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
569525
const Core::Context& context);
570526
struct AppendFileOptions final
571527
{
572-
Nullable<int64_t> Position;
573-
Nullable<std::vector<uint8_t>> TransactionalContentHash;
574-
Nullable<std::vector<uint8_t>> TransactionalContentCrc64;
528+
Nullable<std::int64_t> Position;
529+
Nullable<std::vector<std::uint8_t>> TransactionalContentHash;
530+
Nullable<std::vector<std::uint8_t>> TransactionalContentCrc64;
575531
Nullable<std::string> LeaseId;
576532
Nullable<Models::LeaseAction> LeaseAction;
577-
Nullable<int64_t> LeaseDuration;
533+
Nullable<std::int64_t> LeaseDuration;
578534
Nullable<std::string> ProposedLeaseId;
579535
Nullable<std::string> EncryptionKey;
580-
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
536+
Nullable<std::vector<std::uint8_t>> EncryptionKeySha256;
581537
Nullable<std::string> EncryptionAlgorithm;
582538
Nullable<bool> Flush;
583539
};

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
108108
vectorElement2.LastModified = DateTime::Parse(
109109
var0["lastModified"].get<std::string>(), Azure::DateTime::DateFormat::Rfc1123);
110110
vectorElement2.FileSize = var0["contentLength"].is_number_integer()
111-
? var0["contentLength"].get<int64_t>()
111+
? var0["contentLength"].get<std::int64_t>()
112112
: std::stoll(var0["contentLength"].get<std::string>());
113113
vectorElement2.Owner = var0["owner"].get<std::string>();
114114
vectorElement2.Group = var0["group"].get<std::string>();
@@ -504,13 +504,13 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
504504
= Core::Json::_internal::json::parse(responseBody.begin(), responseBody.end());
505505
response.NumberOfSuccessfulDirectories
506506
= jsonRoot["directoriesSuccessful"].is_number_integer()
507-
? jsonRoot["directoriesSuccessful"].get<int32_t>()
507+
? jsonRoot["directoriesSuccessful"].get<std::int32_t>()
508508
: std::stoi(jsonRoot["directoriesSuccessful"].get<std::string>());
509509
response.NumberOfSuccessfulFiles = jsonRoot["filesSuccessful"].is_number_integer()
510-
? jsonRoot["filesSuccessful"].get<int32_t>()
510+
? jsonRoot["filesSuccessful"].get<std::int32_t>()
511511
: std::stoi(jsonRoot["filesSuccessful"].get<std::string>());
512512
response.NumberOfFailures = jsonRoot["failureCount"].is_number_integer()
513-
? jsonRoot["failureCount"].get<int32_t>()
513+
? jsonRoot["failureCount"].get<std::int32_t>()
514514
: std::stoi(jsonRoot["failureCount"].get<std::string>());
515515
for (const auto& var0 :
516516
jsonRoot.count("failedEntries") != 0 && jsonRoot["failedEntries"].is_array()

0 commit comments

Comments
 (0)