Skip to content

Commit 4f95657

Browse files
committed
fix api view comments
1 parent c578ecf commit 4f95657

File tree

14 files changed

+59
-43
lines changed

14 files changed

+59
-43
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3675,7 +3675,6 @@ namespace Azure { namespace Storage { namespace Blobs {
36753675
Nullable<std::string> LeaseId;
36763676
Nullable<bool> RangeGetContentMD5;
36773677
Nullable<bool> RangeGetContentCRC64;
3678-
Nullable<bool> UserPrincipalName;
36793678
Nullable<std::string> EncryptionKey;
36803679
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
36813680
Nullable<std::string> EncryptionAlgorithm;
@@ -3684,6 +3683,7 @@ namespace Azure { namespace Storage { namespace Blobs {
36843683
ETag IfMatch;
36853684
ETag IfNoneMatch;
36863685
Nullable<std::string> IfTags;
3686+
Nullable<bool> UserPrincipalName;
36873687
};
36883688
static Response<Models::DownloadBlobResult> Download(
36893689
Core::Http::_internal::HttpPipeline& pipeline,
@@ -3698,12 +3698,12 @@ namespace Azure { namespace Storage { namespace Blobs {
36983698
Nullable<std::string> EncryptionKey;
36993699
Nullable<std::vector<uint8_t>> EncryptionKeySha256;
37003700
Nullable<std::string> EncryptionAlgorithm;
3701-
Nullable<bool> UserPrincipalName;
37023701
Nullable<DateTime> IfModifiedSince;
37033702
Nullable<DateTime> IfUnmodifiedSince;
37043703
ETag IfMatch;
37053704
ETag IfNoneMatch;
37063705
Nullable<std::string> IfTags;
3706+
Nullable<bool> UserPrincipalName;
37073707
};
37083708
static Response<Models::BlobProperties> GetProperties(
37093709
Core::Http::_internal::HttpPipeline& pipeline,

sdk/storage/azure-storage-blobs/src/blob_client.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,11 @@ namespace Azure { namespace Storage { namespace Blobs {
196196
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
197197
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
198198
{
199-
bool userPrincipalName = false;
200-
if (context.TryGetValue(_detail::DataLakeInteroperabilityExtraOptionsKey, userPrincipalName))
199+
bool includeUserPrincipalName = false;
200+
if (context.TryGetValue(
201+
_detail::DataLakeInteroperabilityExtraOptionsKey, includeUserPrincipalName))
201202
{
202-
protocolLayerOptions.UserPrincipalName = userPrincipalName;
203+
protocolLayerOptions.UserPrincipalName = includeUserPrincipalName;
203204
}
204205
}
205206
if (m_customerProvidedKey.HasValue())
@@ -547,10 +548,11 @@ namespace Azure { namespace Storage { namespace Blobs {
547548
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
548549
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
549550
{
550-
bool userPrincipalName = false;
551-
if (context.TryGetValue(_detail::DataLakeInteroperabilityExtraOptionsKey, userPrincipalName))
551+
bool includeUserPrincipalName = false;
552+
if (context.TryGetValue(
553+
_detail::DataLakeInteroperabilityExtraOptionsKey, includeUserPrincipalName))
552554
{
553-
protocolLayerOptions.UserPrincipalName = userPrincipalName;
555+
protocolLayerOptions.UserPrincipalName = includeUserPrincipalName;
554556
}
555557
}
556558
if (m_customerProvidedKey.HasValue())

sdk/storage/azure-storage-blobs/src/rest_client.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3633,10 +3633,6 @@ namespace Azure { namespace Storage { namespace Blobs {
36333633
"x-ms-range-get-content-crc64",
36343634
options.RangeGetContentCRC64.Value() ? "true" : "false");
36353635
}
3636-
if (options.UserPrincipalName.HasValue())
3637-
{
3638-
request.SetHeader("x-ms-upn", options.UserPrincipalName.Value() ? "true" : "false");
3639-
}
36403636
if (options.EncryptionKey.HasValue() && !options.EncryptionKey.Value().empty())
36413637
{
36423638
request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
@@ -3677,6 +3673,10 @@ namespace Azure { namespace Storage { namespace Blobs {
36773673
request.SetHeader("x-ms-if-tags", options.IfTags.Value());
36783674
}
36793675
request.SetHeader("x-ms-version", "2023-11-03");
3676+
if (options.UserPrincipalName.HasValue())
3677+
{
3678+
request.SetHeader("x-ms-upn", options.UserPrincipalName.Value() ? "true" : "false");
3679+
}
36803680
auto pRawResponse = pipeline.Send(request, context);
36813681
auto httpStatusCode = pRawResponse->GetStatusCode();
36823682
if (!(httpStatusCode == Core::Http::HttpStatusCode::Ok
@@ -3928,10 +3928,6 @@ namespace Azure { namespace Storage { namespace Blobs {
39283928
{
39293929
request.SetHeader("x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value());
39303930
}
3931-
if (options.UserPrincipalName.HasValue())
3932-
{
3933-
request.SetHeader("x-ms-upn", options.UserPrincipalName.Value() ? "true" : "false");
3934-
}
39353931
if (options.IfModifiedSince.HasValue())
39363932
{
39373933
request.SetHeader(
@@ -3957,6 +3953,10 @@ namespace Azure { namespace Storage { namespace Blobs {
39573953
request.SetHeader("x-ms-if-tags", options.IfTags.Value());
39583954
}
39593955
request.SetHeader("x-ms-version", "2023-11-03");
3956+
if (options.UserPrincipalName.HasValue())
3957+
{
3958+
request.SetHeader("x-ms-upn", options.UserPrincipalName.Value() ? "true" : "false");
3959+
}
39603960
auto pRawResponse = pipeline.Send(request, context);
39613961
auto httpStatusCode = pRawResponse->GetStatusCode();
39623962
if (httpStatusCode != Core::Http::HttpStatusCode::Ok)

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

Lines changed: 18 additions & 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/preview/2024-05-04/blob.json
12+
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.BlobStorage/preview/2021-12-02/blob.json
1313
```
1414
1515
## ModelFour Options
@@ -397,6 +397,14 @@ directive:
397397
$.BlobCacheControl["required"] = true;
398398
$.MaxResults["x-ms-client-name"] = "MaxResults";
399399
$.BlobPublicAccess["required"] = true;
400+
$.UserPrincipalName = {
401+
"name": "x-ms-upn",
402+
"x-ms-client-name": "UserPrincipalName",
403+
"in": "header",
404+
"required": false,
405+
"type": "boolean",
406+
"x-ms-parameter-location": "method"
407+
}
400408
- from: swagger-document
401409
where: $.definitions
402410
transform: >
@@ -963,6 +971,10 @@ directive:
963971
"BodyStream": {"type": "object", "format": "file"}
964972
}
965973
};
974+
- from: swagger-document
975+
where: $["x-ms-paths"]["/{containerName}/{blob}"].get.parameters
976+
transform: >
977+
$.push({"$ref": "#/parameters/UserPrincipalName"});
966978
- from: swagger-document
967979
where: $["x-ms-paths"]["/{containerName}/{blob}"].get.responses
968980
transform: >
@@ -1027,6 +1039,10 @@ directive:
10271039
10281040
```yaml
10291041
directive:
1042+
- from: swagger-document
1043+
where: $["x-ms-paths"]["/{containerName}/{blob}"].head.parameters
1044+
transform: >
1045+
$.push({"$ref": "#/parameters/UserPrincipalName"});
10301046
- from: swagger-document
10311047
where: $["x-ms-paths"]["/{containerName}/{blob}"].head.responses
10321048
transform: >
@@ -1859,6 +1875,7 @@ directive:
18591875
where: $.parameters
18601876
transform: >
18611877
$.ListBlobsShowOnly.description = "Include this parameter to specify one or more datasets to include in the response.";
1878+
$.UserPrincipalName.description = "Optional. Valid only when Hierarchical Namespace is enabled for the account. If \"true\", the user identity values returned in the x-ms-owner, x-ms-group, and x-ms-acl response headers will be transformed from Azure Active Directory Object IDs to User Principal Names. If \"false\", the values will be returned as Azure Active Directory Object IDs. The default value is false. Note that group and application Object IDs are not translated because they do not have unique friendly names."
18621879
- from: swagger-document
18631880
where: $["x-ms-paths"].*.*.responses.*.headers
18641881
transform: >

sdk/storage/azure-storage-files-datalake/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### Features Added
66

77
- Bumped up API version to `2023-11-03`.
8-
- Added new field `UserPrincipalName` in `GetPathPropertiesOptions` and `DownloadFileOptions`.
8+
- Added new field `IncludeUserPrincipalName` in `GetPathAccessControlListOptions`, `GetPathPropertiesOptions` and `DownloadFileOptions`.
99
- Added new field `Acls` in `PathProperties` and `DownloadFileDetails`.
1010

1111
### Breaking Changes

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
774774
* be returned as Azure Active Directory Object IDs. The default value is false. Note that group
775775
* and application Object IDs are not translated because they do not have unique friendly names.
776776
*/
777-
Nullable<bool> UserPrincipalName;
777+
Nullable<bool> IncludeUserPrincipalName;
778778
};
779779

780780
/**
@@ -795,7 +795,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
795795
* be returned as Azure Active Directory Object IDs. The default value is false. Note that group
796796
* and application Object IDs are not translated because they do not have unique friendly names.
797797
*/
798-
Nullable<bool> UserPrincipalName;
798+
Nullable<bool> IncludeUserPrincipalName;
799799
};
800800

801801
/**
@@ -828,7 +828,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
828828
* be returned as Azure Active Directory Object IDs. The default value is false. Note that group
829829
* and application Object IDs are not translated because they do not have unique friendly names.
830830
*/
831-
Nullable<bool> UserPrincipalName;
831+
Nullable<bool> IncludeUserPrincipalName;
832832
};
833833

834834
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
184184
blobOptions.AccessConditions.LeaseId = options.AccessConditions.LeaseId;
185185
auto response = m_blobClient.Download(
186186
blobOptions,
187-
options.UserPrincipalName.HasValue() ? context.WithValue(
187+
options.IncludeUserPrincipalName.HasValue() ? context.WithValue(
188188
Blobs::_detail::DataLakeInteroperabilityExtraOptionsKey,
189-
options.UserPrincipalName.Value())
190-
: context);
189+
options.IncludeUserPrincipalName.Value())
190+
: context);
191191
Models::DownloadFileResult ret;
192192
ret.Body = std::move(response.Value.BodyStream);
193193
ret.Details.HttpHeaders = std::move(response.Value.Details.HttpHeaders);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,10 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
349349
blobOptions.AccessConditions.LeaseId = options.AccessConditions.LeaseId;
350350
auto response = m_blobClient.GetProperties(
351351
blobOptions,
352-
options.UserPrincipalName.HasValue() ? context.WithValue(
352+
options.IncludeUserPrincipalName.HasValue() ? context.WithValue(
353353
Blobs::_detail::DataLakeInteroperabilityExtraOptionsKey,
354-
options.UserPrincipalName.Value())
355-
: context);
354+
options.IncludeUserPrincipalName.Value())
355+
: context);
356356
Models::PathProperties ret;
357357
ret.ETag = std::move(response.Value.ETag);
358358
ret.LastModified = std::move(response.Value.LastModified);
@@ -421,7 +421,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
421421
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
422422
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
423423
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
424-
protocolLayerOptions.Upn = options.UserPrincipalName;
424+
protocolLayerOptions.Upn = options.IncludeUserPrincipalName;
425425
auto response = _detail::PathClient::GetAccessControlList(
426426
*m_pipeline, m_pathUrl, protocolLayerOptions, _internal::WithReplicaStatus(context));
427427
Azure::Nullable<std::vector<Models::Acl>> acl;

sdk/storage/azure-storage-files-datalake/test/ut/datalake_file_client_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ namespace Azure { namespace Storage { namespace Test {
737737
Files::DataLake::DownloadFileOptions options;
738738

739739
// UserPrincipalName = true
740-
options.UserPrincipalName = true;
740+
options.IncludeUserPrincipalName = true;
741741
auto downloadResult = m_fileClient->Download(options).Value;
742742
ASSERT_TRUE(
743743
downloadResult.Details.Acls.HasValue() && !downloadResult.Details.Acls.Value().empty());
@@ -751,7 +751,7 @@ namespace Azure { namespace Storage { namespace Test {
751751
EXPECT_NE(it, acls.end());
752752

753753
// UserPrincipalName = false
754-
options.UserPrincipalName = false;
754+
options.IncludeUserPrincipalName = false;
755755
downloadResult = m_fileClient->Download(options).Value;
756756
ASSERT_TRUE(
757757
downloadResult.Details.Acls.HasValue() && !downloadResult.Details.Acls.Value().empty());

sdk/storage/azure-storage-files-datalake/test/ut/datalake_path_client_test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ namespace Azure { namespace Storage { namespace Test {
496496
Files::DataLake::GetPathPropertiesOptions options;
497497

498498
// UserPrincipalName = true
499-
options.UserPrincipalName = true;
499+
options.IncludeUserPrincipalName = true;
500500
auto properties = m_pathClient->GetProperties(options).Value;
501501
ASSERT_TRUE(properties.Acls.HasValue() && !properties.Acls.Value().empty());
502502
EXPECT_TRUE(properties.Owner.HasValue());
@@ -509,7 +509,7 @@ namespace Azure { namespace Storage { namespace Test {
509509
EXPECT_NE(it, acls.end());
510510

511511
// UserPrincipalName = false
512-
options.UserPrincipalName = false;
512+
options.IncludeUserPrincipalName = false;
513513
properties = m_pathClient->GetProperties(options).Value;
514514
ASSERT_TRUE(properties.Acls.HasValue() && !properties.Acls.Value().empty());
515515
EXPECT_TRUE(properties.Owner.HasValue());
@@ -536,7 +536,7 @@ namespace Azure { namespace Storage { namespace Test {
536536
Files::DataLake::GetPathAccessControlListOptions options;
537537

538538
// UserPrincipalName = true
539-
options.UserPrincipalName = true;
539+
options.IncludeUserPrincipalName = true;
540540
auto properties = m_pathClient->GetAccessControlList(options).Value;
541541
ASSERT_TRUE(!properties.Acls.empty());
542542
// Validate that the user principal name is returned
@@ -546,7 +546,7 @@ namespace Azure { namespace Storage { namespace Test {
546546
EXPECT_NE(it, acls.end());
547547

548548
// UserPrincipalName = false
549-
options.UserPrincipalName = false;
549+
options.IncludeUserPrincipalName = false;
550550
properties = m_pathClient->GetAccessControlList(options).Value;
551551
ASSERT_TRUE(!properties.Acls.empty());
552552
// Validate that the user principal name is returned

sdk/storage/azure-storage-files-shares/CHANGELOG.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44

55
### Features Added
66

7-
### Breaking Changes
8-
9-
### Bugs Fixed
10-
11-
### Other Changes
7+
- Added new field `ClientName` in `HandleItem`.
8+
- Added new field `IncludeRenames` in `GetFileRangeListOptions`.
129

1310
## 12.8.0 (2023-11-07)
1411

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
799799
* is true, the valid changed ranges for the file will be returned. If the value is false, the
800800
* operation will result in a failure with 409 (Conflict) response.
801801
*/
802-
Azure::Nullable<bool> SupportRename;
802+
Azure::Nullable<bool> IncludeRenames;
803803
};
804804

805805
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
669669
protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
670670
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
671671
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
672-
protocolLayerOptions.SupportRename = options.SupportRename;
672+
protocolLayerOptions.SupportRename = options.IncludeRenames;
673673
return _detail::FileClient::GetRangeList(
674674
*m_pipeline, m_shareFileUrl, protocolLayerOptions, context);
675675
}

sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,14 +927,14 @@ namespace Azure { namespace Storage { namespace Test {
927927
Files::Shares::Models::GetFileRangeListResult result;
928928

929929
// SupportRename == true
930-
options.SupportRename = true;
930+
options.IncludeRenames = true;
931931
EXPECT_NO_THROW(result = fileClient.GetRangeListDiff(snapshot, options).Value);
932932
EXPECT_EQ(1U, result.Ranges.size());
933933
EXPECT_EQ(64, result.Ranges[0].Offset);
934934
EXPECT_TRUE(result.Ranges[0].Length.HasValue());
935935

936936
// SupportRename == false
937-
options.SupportRename = false;
937+
options.IncludeRenames = false;
938938
EXPECT_THROW(fileClient.GetRangeListDiff(snapshot, options), StorageException);
939939
}
940940

0 commit comments

Comments
 (0)