Skip to content

Storage/STG93 Features #5508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from 10 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_e7e6f27e95"
"Tag": "cpp/storage_5d0c2e81b0"
}
2 changes: 2 additions & 0 deletions sdk/storage/azure-storage-blobs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Features Added

- Bumped up API version to `2023-11-03`.

### Breaking Changes

### Bugs Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "azure/storage/blobs/blob_options.hpp"
#include "azure/storage/blobs/blob_responses.hpp"
#include "azure/storage/blobs/dll_import_export.hpp"

#include <azure/core/credentials/credentials.hpp>
#include <azure/storage/common/storage_credential.hpp>
Expand All @@ -22,6 +23,11 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {

namespace Azure { namespace Storage { namespace Blobs {

namespace _detail {
AZ_STORAGE_BLOBS_DLLEXPORT extern const Azure::Core::Context::Key
DataLakeInteroperabilityExtraOptionsKey;
} // namespace _detail

class BlockBlobClient;
class AppendBlobClient;
class PageBlobClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Azure { namespace Storage { namespace Blobs {
/**
* The version used for the operations to Azure storage services.
*/
constexpr static const char* ApiVersion = "2022-11-02";
constexpr static const char* ApiVersion = "2023-11-03";
} // namespace _detail
namespace Models {
/**
Expand Down Expand Up @@ -3683,6 +3683,7 @@ namespace Azure { namespace Storage { namespace Blobs {
ETag IfMatch;
ETag IfNoneMatch;
Nullable<std::string> IfTags;
Nullable<bool> UserPrincipalName;
};
static Response<Models::DownloadBlobResult> Download(
Core::Http::_internal::HttpPipeline& pipeline,
Expand All @@ -3702,6 +3703,7 @@ namespace Azure { namespace Storage { namespace Blobs {
ETag IfMatch;
ETag IfNoneMatch;
Nullable<std::string> IfTags;
Nullable<bool> UserPrincipalName;
};
static Response<Models::BlobProperties> GetProperties(
Core::Http::_internal::HttpPipeline& pipeline,
Expand Down
20 changes: 20 additions & 0 deletions sdk/storage/azure-storage-blobs/src/blob_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@

namespace Azure { namespace Storage { namespace Blobs {

namespace _detail {
Azure::Core::Context::Key const DataLakeInteroperabilityExtraOptionsKey;
}

BlobClient BlobClient::CreateFromConnectionString(
const std::string& connectionString,
const std::string& blobContainerName,
Expand Down Expand Up @@ -191,6 +195,14 @@ namespace Azure { namespace Storage { namespace Blobs {
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
{
bool includeUserPrincipalName = false;
if (context.TryGetValue(
_detail::DataLakeInteroperabilityExtraOptionsKey, includeUserPrincipalName))
{
protocolLayerOptions.UserPrincipalName = includeUserPrincipalName;
}
}
if (m_customerProvidedKey.HasValue())
{
protocolLayerOptions.EncryptionKey = m_customerProvidedKey.Value().Key;
Expand Down Expand Up @@ -535,6 +547,14 @@ namespace Azure { namespace Storage { namespace Blobs {
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
{
bool includeUserPrincipalName = false;
if (context.TryGetValue(
_detail::DataLakeInteroperabilityExtraOptionsKey, includeUserPrincipalName))
{
protocolLayerOptions.UserPrincipalName = includeUserPrincipalName;
}
}
if (m_customerProvidedKey.HasValue())
{
protocolLayerOptions.EncryptionKey = m_customerProvidedKey.Value().Key;
Expand Down
142 changes: 75 additions & 67 deletions sdk/storage/azure-storage-blobs/src/rest_client.cpp

Large diffs are not rendered by default.

21 changes: 19 additions & 2 deletions sdk/storage/azure-storage-blobs/swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ directive:
"name": "ApiVersion",
"modelAsString": false
},
"enum": ["2022-11-02"]
"enum": ["2023-11-03"]
};
- from: swagger-document
where: $.parameters
transform: >
$.ApiVersionParameter.enum[0] = "2022-11-02";
$.ApiVersionParameter.enum[0] = "2023-11-03";
```

### Rename Operations
Expand Down Expand Up @@ -397,6 +397,14 @@ directive:
$.BlobCacheControl["required"] = true;
$.MaxResults["x-ms-client-name"] = "MaxResults";
$.BlobPublicAccess["required"] = true;
$.UserPrincipalName = {
"name": "x-ms-upn",
"x-ms-client-name": "UserPrincipalName",
"in": "header",
"required": false,
"type": "boolean",
"x-ms-parameter-location": "method"
}
- from: swagger-document
where: $.definitions
transform: >
Expand Down Expand Up @@ -963,6 +971,10 @@ directive:
"BodyStream": {"type": "object", "format": "file"}
}
};
- from: swagger-document
where: $["x-ms-paths"]["/{containerName}/{blob}"].get.parameters
transform: >
$.push({"$ref": "#/parameters/UserPrincipalName"});
- from: swagger-document
where: $["x-ms-paths"]["/{containerName}/{blob}"].get.responses
transform: >
Expand Down Expand Up @@ -1027,6 +1039,10 @@ directive:

```yaml
directive:
- from: swagger-document
where: $["x-ms-paths"]["/{containerName}/{blob}"].head.parameters
transform: >
$.push({"$ref": "#/parameters/UserPrincipalName"});
- from: swagger-document
where: $["x-ms-paths"]["/{containerName}/{blob}"].head.responses
transform: >
Expand Down Expand Up @@ -1859,6 +1875,7 @@ directive:
where: $.parameters
transform: >
$.ListBlobsShowOnly.description = "Include this parameter to specify one or more datasets to include in the response.";
$.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."
- from: swagger-document
where: $["x-ms-paths"].*.*.responses.*.headers
transform: >
Expand Down
4 changes: 4 additions & 0 deletions sdk/storage/azure-storage-files-datalake/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

### Features Added

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

### Breaking Changes

### Bugs Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,11 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
/**
* Valid only when Hierarchical Namespace is enabled for the account. If "true", the user
* identity values returned in the owner and group fields of each list entry 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.
* from Azure Active Directory Object IDs to User Principal Names. If "false" or not provided,
* the values will be returned as Azure Active Directory Object IDs. Note that group and
* application Object IDs are not translated because they do not have unique friendly names.
* More Details about UserPrincipalName, See
* https://learn.microsoft.com/entra/identity/hybrid/connect/plan-connect-userprincipalname#what-is-userprincipalname
*/
Azure::Nullable<bool> UserPrincipalName;

Expand Down Expand Up @@ -766,6 +768,17 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
* Specify the access condition for the path.
*/
PathAccessConditions AccessConditions;

/**
* Valid only when Hierarchical Namespace is enabled for the account. If "true", the user
* identity values returned in the owner and group fields of each list entry will be transformed
* from Azure Active Directory Object IDs to User Principal Names. If "false" or not provided,
* the values will be returned as Azure Active Directory Object IDs. Note that group and
* application Object IDs are not translated because they do not have unique friendly names.
* More Details about UserPrincipalName, See
* https://learn.microsoft.com/entra/identity/hybrid/connect/plan-connect-userprincipalname#what-is-userprincipalname
*/
Nullable<bool> IncludeUserPrincipalName;
};

/**
Expand All @@ -778,6 +791,17 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
* Specify the access condition for the path.
*/
PathAccessConditions AccessConditions;

/**
* Valid only when Hierarchical Namespace is enabled for the account. If "true", the user
* identity values returned in the owner and group fields of each list entry will be transformed
* from Azure Active Directory Object IDs to User Principal Names. If "false" or not provided,
* the values will be returned as Azure Active Directory Object IDs. Note that group and
* application Object IDs are not translated because they do not have unique friendly names.
* More Details about UserPrincipalName, See
* https://learn.microsoft.com/entra/identity/hybrid/connect/plan-connect-userprincipalname#what-is-userprincipalname
*/
Nullable<bool> IncludeUserPrincipalName;
};

/**
Expand All @@ -802,6 +826,17 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
* Specify the access condition for the path.
*/
PathAccessConditions AccessConditions;

/**
* Valid only when Hierarchical Namespace is enabled for the account. If "true", the user
* identity values returned in the owner and group fields of each list entry will be transformed
* from Azure Active Directory Object IDs to User Principal Names. If "false" or not provided,
* the values will be returned as Azure Active Directory Object IDs. Note that group and
* application Object IDs are not translated because they do not have unique friendly names.
* More Details about UserPrincipalName, See
* https://learn.microsoft.com/entra/identity/hybrid/connect/plan-connect-userprincipalname#what-is-userprincipalname
*/
Nullable<bool> IncludeUserPrincipalName;
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
*/
Azure::Nullable<bool> IsCurrentVersion;

/**
* The acls of the path.
*/
Azure::Nullable<std::vector<Acl>> Acls;

/**
* The owner of the path.
*/
Expand Down Expand Up @@ -707,6 +712,11 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
*/
Nullable<std::string> EncryptionContext;

/**
* The acls of the file.
*/
Azure::Nullable<std::vector<Acl>> Acls;

/**
* The owner of the file.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
/**
* The version used for the operations to Azure storage services.
*/
constexpr static const char* ApiVersion = "2023-08-03";
constexpr static const char* ApiVersion = "2023-11-03";
} // namespace _detail
namespace Models {
namespace _detail {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
blobOptions.AccessConditions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
blobOptions.AccessConditions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
blobOptions.AccessConditions.LeaseId = options.AccessConditions.LeaseId;
auto response = m_blobClient.Download(blobOptions, context);
auto response = m_blobClient.Download(
blobOptions,
options.IncludeUserPrincipalName.HasValue() ? context.WithValue(
Blobs::_detail::DataLakeInteroperabilityExtraOptionsKey,
options.IncludeUserPrincipalName.Value())
: context);
Models::DownloadFileResult ret;
ret.Body = std::move(response.Value.BodyStream);
ret.Details.HttpHeaders = std::move(response.Value.Details.HttpHeaders);
Expand Down Expand Up @@ -221,6 +226,11 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
{
ret.Details.EncryptionContext = encryptionContext->second;
}
auto acl = headers.find(_detail::AclHeaderName);
if (acl != headers.end())
{
ret.Details.Acls = Models::Acl::DeserializeAcls(acl->second);
}
auto owner = headers.find(_detail::OwnerHeaderName);
if (owner != headers.end())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,12 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
blobOptions.AccessConditions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
blobOptions.AccessConditions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
blobOptions.AccessConditions.LeaseId = options.AccessConditions.LeaseId;
auto response = m_blobClient.GetProperties(blobOptions, context);
auto response = m_blobClient.GetProperties(
blobOptions,
options.IncludeUserPrincipalName.HasValue() ? context.WithValue(
Blobs::_detail::DataLakeInteroperabilityExtraOptionsKey,
options.IncludeUserPrincipalName.Value())
: context);
Models::PathProperties ret;
ret.ETag = std::move(response.Value.ETag);
ret.LastModified = std::move(response.Value.LastModified);
Expand Down Expand Up @@ -383,6 +388,11 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
{
ret.EncryptionContext = encryptionContext->second;
}
auto acl = headers.find(_detail::AclHeaderName);
if (acl != headers.end())
{
ret.Acls = Models::Acl::DeserializeAcls(acl->second);
}
auto owner = headers.find(_detail::OwnerHeaderName);
if (owner != headers.end())
{
Expand Down Expand Up @@ -411,6 +421,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
protocolLayerOptions.Upn = options.IncludeUserPrincipalName;
auto response = _detail::PathClient::GetAccessControlList(
*m_pipeline, m_pathUrl, protocolLayerOptions, _internal::WithReplicaStatus(context));
Azure::Nullable<std::vector<Models::Acl>> acl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { nam
constexpr static const char* DataLakePathAlreadyExists = "PathAlreadyExists";
constexpr static const char* DataLakeIsDirectoryKey = "hdi_isFolder";
constexpr static const char* EncryptionContextHeaderName = "x-ms-encryption-context";
constexpr static const char* AclHeaderName = "x-ms-acl";
constexpr static const char* OwnerHeaderName = "x-ms-owner";
constexpr static const char* GroupHeaderName = "x-ms-group";
constexpr static const char* PermissionsHeaderName = "x-ms-permissions";
Expand Down
Loading