add nfs support (#5267)
This commit is contained in:
Родитель
e62da2f2d7
Коммит
fc043e1db7
|
@ -2,5 +2,5 @@
|
|||
"AssetsRepo": "Azure/azure-sdk-assets",
|
||||
"AssetsRepoPrefixPath": "cpp",
|
||||
"TagPrefix": "cpp/storage",
|
||||
"Tag": "cpp/storage_9093786628"
|
||||
"Tag": "cpp/storage_56979c9851"
|
||||
}
|
||||
|
|
|
@ -393,6 +393,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
* Root squash to set on the share. Only valid for NFS shares.
|
||||
*/
|
||||
Nullable<ShareRootSquash> RootSquash;
|
||||
/**
|
||||
* Version 2023-08-03 and newer. Specifies whether the snapshot virtual directory should be
|
||||
* accessible at the root of share mount point when NFS is enabled. This header is only
|
||||
* returned for shares, not for snapshots.
|
||||
*/
|
||||
Nullable<bool> EnableSnapshotVirtualDirectoryAccess;
|
||||
};
|
||||
/**
|
||||
* @brief A listed Azure Storage share item.
|
||||
|
@ -570,6 +576,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
* Valid for NFS shares only.
|
||||
*/
|
||||
Nullable<ShareRootSquash> RootSquash;
|
||||
/**
|
||||
* Version 2023-08-03 and newer. Specifies whether the snapshot virtual directory should be
|
||||
* accessible at the root of share mount point when NFS is enabled. This header is only
|
||||
* returned for shares, not for snapshots.
|
||||
*/
|
||||
Nullable<bool> EnableSnapshotVirtualDirectoryAccess;
|
||||
};
|
||||
/**
|
||||
* @brief Specifies the option include to delete the base share and all of its snapshots.
|
||||
|
@ -2085,6 +2097,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
Nullable<Models::AccessTier> AccessTier;
|
||||
Nullable<Models::ShareProtocols> EnabledProtocols;
|
||||
Nullable<Models::ShareRootSquash> RootSquash;
|
||||
Nullable<bool> EnableSnapshotVirtualDirectoryAccess;
|
||||
};
|
||||
static Response<Models::CreateShareResult> Create(
|
||||
Core::Http::_internal::HttpPipeline& pipeline,
|
||||
|
@ -2200,6 +2213,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
Nullable<Models::AccessTier> AccessTier;
|
||||
Nullable<std::string> LeaseId;
|
||||
Nullable<Models::ShareRootSquash> RootSquash;
|
||||
Nullable<bool> EnableSnapshotVirtualDirectoryAccess;
|
||||
};
|
||||
static Response<Models::SetSharePropertiesResult> SetProperties(
|
||||
Core::Http::_internal::HttpPipeline& pipeline,
|
||||
|
|
|
@ -174,6 +174,13 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
* specified, the default is NoRootSquash.
|
||||
*/
|
||||
Azure::Nullable<Models::ShareRootSquash> RootSquash;
|
||||
|
||||
/**
|
||||
* Version 2023-08-03 and newer. Specifies whether the snapshot virtual directory should be
|
||||
* accessible at the root of share mount point when NFS is enabled. This header is only
|
||||
* returned for shares, not for snapshots.
|
||||
*/
|
||||
Nullable<bool> EnableSnapshotVirtualDirectoryAccess;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -226,6 +233,13 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
* specified, the default is NoRootSquash.
|
||||
*/
|
||||
Azure::Nullable<Models::ShareRootSquash> RootSquash;
|
||||
|
||||
/**
|
||||
* Version 2023-08-03 and newer. Specifies whether the snapshot virtual directory should be
|
||||
* accessible at the root of share mount point when NFS is enabled. This header is only
|
||||
* returned for shares, not for snapshots.
|
||||
*/
|
||||
Nullable<bool> EnableSnapshotVirtualDirectoryAccess;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <azure/core/http/http_status_code.hpp>
|
||||
#include <azure/core/internal/http/pipeline.hpp>
|
||||
#include <azure/core/internal/json/json.hpp>
|
||||
#include <azure/core/internal/strings.hpp>
|
||||
#include <azure/core/io/body_stream.hpp>
|
||||
#include <azure/core/response.hpp>
|
||||
#include <azure/core/url.hpp>
|
||||
|
@ -422,20 +423,26 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
xmlPath.size() == 3 && xmlPath[0] == XmlTagEnum::kStorageServiceProperties
|
||||
&& xmlPath[1] == XmlTagEnum::kHourMetrics && xmlPath[2] == XmlTagEnum::kEnabled)
|
||||
{
|
||||
response.HourMetrics.Enabled = node.Value == std::string("true");
|
||||
response.HourMetrics.Enabled
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
else if (
|
||||
xmlPath.size() == 3 && xmlPath[0] == XmlTagEnum::kStorageServiceProperties
|
||||
&& xmlPath[1] == XmlTagEnum::kHourMetrics && xmlPath[2] == XmlTagEnum::kIncludeAPIs)
|
||||
{
|
||||
response.HourMetrics.IncludeApis = node.Value == std::string("true");
|
||||
response.HourMetrics.IncludeApis
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
else if (
|
||||
xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kStorageServiceProperties
|
||||
&& xmlPath[1] == XmlTagEnum::kHourMetrics
|
||||
&& xmlPath[2] == XmlTagEnum::kRetentionPolicy && xmlPath[3] == XmlTagEnum::kEnabled)
|
||||
{
|
||||
response.HourMetrics.RetentionPolicy.Enabled = node.Value == std::string("true");
|
||||
response.HourMetrics.RetentionPolicy.Enabled
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
else if (
|
||||
xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kStorageServiceProperties
|
||||
|
@ -454,21 +461,27 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
xmlPath.size() == 3 && xmlPath[0] == XmlTagEnum::kStorageServiceProperties
|
||||
&& xmlPath[1] == XmlTagEnum::kMinuteMetrics && xmlPath[2] == XmlTagEnum::kEnabled)
|
||||
{
|
||||
response.MinuteMetrics.Enabled = node.Value == std::string("true");
|
||||
response.MinuteMetrics.Enabled
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
else if (
|
||||
xmlPath.size() == 3 && xmlPath[0] == XmlTagEnum::kStorageServiceProperties
|
||||
&& xmlPath[1] == XmlTagEnum::kMinuteMetrics
|
||||
&& xmlPath[2] == XmlTagEnum::kIncludeAPIs)
|
||||
{
|
||||
response.MinuteMetrics.IncludeApis = node.Value == std::string("true");
|
||||
response.MinuteMetrics.IncludeApis
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
else if (
|
||||
xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kStorageServiceProperties
|
||||
&& xmlPath[1] == XmlTagEnum::kMinuteMetrics
|
||||
&& xmlPath[2] == XmlTagEnum::kRetentionPolicy && xmlPath[3] == XmlTagEnum::kEnabled)
|
||||
{
|
||||
response.MinuteMetrics.RetentionPolicy.Enabled = node.Value == std::string("true");
|
||||
response.MinuteMetrics.RetentionPolicy.Enabled
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
else if (
|
||||
xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kStorageServiceProperties
|
||||
|
@ -518,7 +531,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
&& xmlPath[3] == XmlTagEnum::kMultichannel && xmlPath[4] == XmlTagEnum::kEnabled)
|
||||
{
|
||||
response.Protocol.Value().Settings.Multichannel.Enabled
|
||||
= node.Value == std::string("true");
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
}
|
||||
else if (node.Type == _internal::XmlNodeType::Attribute)
|
||||
|
@ -614,6 +628,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
kLeaseDuration,
|
||||
kEnabledProtocols,
|
||||
kRootSquash,
|
||||
kEnableSnapshotVirtualDirectoryAccess,
|
||||
kNextMarker,
|
||||
};
|
||||
const std::unordered_map<std::string, XmlTagEnum> XmlTagEnumMap{
|
||||
|
@ -647,6 +662,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
{"LeaseDuration", XmlTagEnum::kLeaseDuration},
|
||||
{"EnabledProtocols", XmlTagEnum::kEnabledProtocols},
|
||||
{"RootSquash", XmlTagEnum::kRootSquash},
|
||||
{"EnableSnapshotVirtualDirectoryAccess",
|
||||
XmlTagEnum::kEnableSnapshotVirtualDirectoryAccess},
|
||||
{"NextMarker", XmlTagEnum::kNextMarker},
|
||||
};
|
||||
std::vector<XmlTagEnum> xmlPath;
|
||||
|
@ -709,7 +726,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
&& xmlPath[1] == XmlTagEnum::kShares && xmlPath[2] == XmlTagEnum::kShare
|
||||
&& xmlPath[3] == XmlTagEnum::kDeleted)
|
||||
{
|
||||
vectorElement1.Deleted = node.Value == std::string("true");
|
||||
vectorElement1.Deleted
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
else if (
|
||||
xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults
|
||||
|
@ -865,6 +884,16 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
{
|
||||
vectorElement1.Details.RootSquash = Models::ShareRootSquash(node.Value);
|
||||
}
|
||||
else if (
|
||||
xmlPath.size() == 5 && xmlPath[0] == XmlTagEnum::kEnumerationResults
|
||||
&& xmlPath[1] == XmlTagEnum::kShares && xmlPath[2] == XmlTagEnum::kShare
|
||||
&& xmlPath[3] == XmlTagEnum::kProperties
|
||||
&& xmlPath[4] == XmlTagEnum::kEnableSnapshotVirtualDirectoryAccess)
|
||||
{
|
||||
vectorElement1.Details.EnableSnapshotVirtualDirectoryAccess
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
else if (
|
||||
xmlPath.size() == 2 && xmlPath[0] == XmlTagEnum::kEnumerationResults
|
||||
&& xmlPath[1] == XmlTagEnum::kNextMarker)
|
||||
|
@ -932,6 +961,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
{
|
||||
request.SetHeader("x-ms-root-squash", options.RootSquash.Value().ToString());
|
||||
}
|
||||
if (options.EnableSnapshotVirtualDirectoryAccess.HasValue())
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-enable-snapshot-virtual-directory-access",
|
||||
options.EnableSnapshotVirtualDirectoryAccess.Value() ? "true" : "false");
|
||||
}
|
||||
auto pRawResponse = pipeline.Send(request, context);
|
||||
auto httpStatusCode = pRawResponse->GetStatusCode();
|
||||
if (httpStatusCode != Core::Http::HttpStatusCode::Created)
|
||||
|
@ -1044,6 +1079,13 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
response.RootSquash
|
||||
= Models::ShareRootSquash(pRawResponse->GetHeaders().at("x-ms-root-squash"));
|
||||
}
|
||||
if (pRawResponse->GetHeaders().count("x-ms-enable-snapshot-virtual-directory-access") != 0)
|
||||
{
|
||||
response.EnableSnapshotVirtualDirectoryAccess
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-enable-snapshot-virtual-directory-access"),
|
||||
"true");
|
||||
}
|
||||
return Response<Models::ShareProperties>(std::move(response), std::move(pRawResponse));
|
||||
}
|
||||
Response<Models::DeleteShareResult> ShareClient::Delete(
|
||||
|
@ -1383,6 +1425,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
{
|
||||
request.SetHeader("x-ms-root-squash", options.RootSquash.Value().ToString());
|
||||
}
|
||||
if (options.EnableSnapshotVirtualDirectoryAccess.HasValue())
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-enable-snapshot-virtual-directory-access",
|
||||
options.EnableSnapshotVirtualDirectoryAccess.Value() ? "true" : "false");
|
||||
}
|
||||
auto pRawResponse = pipeline.Send(request, context);
|
||||
auto httpStatusCode = pRawResponse->GetStatusCode();
|
||||
if (httpStatusCode != Core::Http::HttpStatusCode::Ok)
|
||||
|
@ -1735,8 +1783,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
response.ETag = ETag(pRawResponse->GetHeaders().at("ETag"));
|
||||
response.LastModified = DateTime::Parse(
|
||||
pRawResponse->GetHeaders().at("Last-Modified"), Azure::DateTime::DateFormat::Rfc1123);
|
||||
response.IsServerEncrypted
|
||||
= pRawResponse->GetHeaders().at("x-ms-request-server-encrypted") == std::string("true");
|
||||
response.IsServerEncrypted = !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-request-server-encrypted"), "true");
|
||||
if (pRawResponse->GetHeaders().count("x-ms-file-permission-key") != 0)
|
||||
{
|
||||
response.SmbProperties.PermissionKey
|
||||
|
@ -1806,8 +1854,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
response.ETag = ETag(pRawResponse->GetHeaders().at("ETag"));
|
||||
response.LastModified = DateTime::Parse(
|
||||
pRawResponse->GetHeaders().at("Last-Modified"), Azure::DateTime::DateFormat::Rfc1123);
|
||||
response.IsServerEncrypted
|
||||
= pRawResponse->GetHeaders().at("x-ms-server-encrypted") == std::string("true");
|
||||
response.IsServerEncrypted = !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-server-encrypted"), "true");
|
||||
response.SmbProperties.Attributes
|
||||
= Models::FileAttributes(pRawResponse->GetHeaders().at("x-ms-file-attributes"));
|
||||
if (pRawResponse->GetHeaders().count("x-ms-file-creation-time") != 0)
|
||||
|
@ -1919,8 +1967,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
response.ETag = ETag(pRawResponse->GetHeaders().at("ETag"));
|
||||
response.LastModified = DateTime::Parse(
|
||||
pRawResponse->GetHeaders().at("Last-Modified"), Azure::DateTime::DateFormat::Rfc1123);
|
||||
response.IsServerEncrypted
|
||||
= pRawResponse->GetHeaders().at("x-ms-request-server-encrypted") == std::string("true");
|
||||
response.IsServerEncrypted = !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-request-server-encrypted"), "true");
|
||||
if (pRawResponse->GetHeaders().count("x-ms-file-permission-key") != 0)
|
||||
{
|
||||
response.SmbProperties.PermissionKey
|
||||
|
@ -1983,8 +2031,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
}
|
||||
Models::SetDirectoryMetadataResult response;
|
||||
response.ETag = ETag(pRawResponse->GetHeaders().at("ETag"));
|
||||
response.IsServerEncrypted
|
||||
= pRawResponse->GetHeaders().at("x-ms-request-server-encrypted") == std::string("true");
|
||||
response.IsServerEncrypted = !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-request-server-encrypted"), "true");
|
||||
return Response<Models::SetDirectoryMetadataResult>(
|
||||
std::move(response), std::move(pRawResponse));
|
||||
}
|
||||
|
@ -2333,7 +2381,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
xmlPath.size() == 1 && xmlPath[0] == XmlTagEnum::kEnumerationResults
|
||||
&& node.Name == "Encoded")
|
||||
{
|
||||
response.Encoded = node.Value == std::string("true");
|
||||
response.Encoded = !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
else if (
|
||||
xmlPath.size() == 1 && xmlPath[0] == XmlTagEnum::kEnumerationResults
|
||||
|
@ -2345,21 +2394,27 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
xmlPath.size() == 2 && xmlPath[0] == XmlTagEnum::kEnumerationResults
|
||||
&& xmlPath[1] == XmlTagEnum::kPrefix && node.Name == "Encoded")
|
||||
{
|
||||
response.Prefix.Encoded = node.Value == std::string("true");
|
||||
response.Prefix.Encoded
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
else if (
|
||||
xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults
|
||||
&& xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kDirectory
|
||||
&& xmlPath[3] == XmlTagEnum::kName && node.Name == "Encoded")
|
||||
{
|
||||
vectorElement1.Name.Encoded = node.Value == std::string("true");
|
||||
vectorElement1.Name.Encoded
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
else if (
|
||||
xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults
|
||||
&& xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kFile
|
||||
&& xmlPath[3] == XmlTagEnum::kName && node.Name == "Encoded")
|
||||
{
|
||||
vectorElement2.Name.Encoded = node.Value == std::string("true");
|
||||
vectorElement2.Name.Encoded
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
}
|
||||
else if (node.Type == _internal::XmlNodeType::EndTag)
|
||||
|
@ -2571,7 +2626,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
&& xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle
|
||||
&& xmlPath[3] == XmlTagEnum::kPath && node.Name == "Encoded")
|
||||
{
|
||||
vectorElement1.Path.Encoded = node.Value == std::string("true");
|
||||
vectorElement1.Path.Encoded
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
}
|
||||
else if (node.Type == _internal::XmlNodeType::EndTag)
|
||||
|
@ -2740,8 +2797,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
response.ETag = ETag(pRawResponse->GetHeaders().at("ETag"));
|
||||
response.LastModified = DateTime::Parse(
|
||||
pRawResponse->GetHeaders().at("Last-Modified"), Azure::DateTime::DateFormat::Rfc1123);
|
||||
response.IsServerEncrypted
|
||||
= pRawResponse->GetHeaders().at("x-ms-request-server-encrypted") == std::string("true");
|
||||
response.IsServerEncrypted = !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-request-server-encrypted"), "true");
|
||||
response.FilePermissionKey = pRawResponse->GetHeaders().at("x-ms-file-permission-key");
|
||||
response.FileAttributes = pRawResponse->GetHeaders().at("x-ms-file-attributes");
|
||||
response.FileCreationTime = DateTime::Parse(
|
||||
|
@ -2847,8 +2904,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
response.ETag = ETag(pRawResponse->GetHeaders().at("ETag"));
|
||||
response.LastModified = DateTime::Parse(
|
||||
pRawResponse->GetHeaders().at("Last-Modified"), Azure::DateTime::DateFormat::Rfc1123);
|
||||
response.IsServerEncrypted
|
||||
= pRawResponse->GetHeaders().at("x-ms-request-server-encrypted") == std::string("true");
|
||||
response.IsServerEncrypted = !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-request-server-encrypted"), "true");
|
||||
if (pRawResponse->GetHeaders().count("x-ms-file-permission-key") != 0)
|
||||
{
|
||||
response.SmbProperties.PermissionKey
|
||||
|
@ -3002,7 +3059,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
response.HttpHeaders.ContentHash.Algorithm = HashAlgorithm::Md5;
|
||||
}
|
||||
response.Details.IsServerEncrypted
|
||||
= pRawResponse->GetHeaders().at("x-ms-server-encrypted") == std::string("true");
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-server-encrypted"), "true");
|
||||
response.Details.SmbProperties.Attributes
|
||||
= Models::FileAttributes(pRawResponse->GetHeaders().at("x-ms-file-attributes"));
|
||||
if (pRawResponse->GetHeaders().count("x-ms-file-creation-time") != 0)
|
||||
|
@ -3156,8 +3214,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
{
|
||||
response.CopyStatus = Models::CopyStatus(pRawResponse->GetHeaders().at("x-ms-copy-status"));
|
||||
}
|
||||
response.IsServerEncrypted
|
||||
= pRawResponse->GetHeaders().at("x-ms-server-encrypted") == std::string("true");
|
||||
response.IsServerEncrypted = !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-server-encrypted"), "true");
|
||||
response.SmbProperties.Attributes
|
||||
= Models::FileAttributes(pRawResponse->GetHeaders().at("x-ms-file-attributes"));
|
||||
if (pRawResponse->GetHeaders().count("x-ms-file-creation-time") != 0)
|
||||
|
@ -3320,8 +3378,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
response.ETag = ETag(pRawResponse->GetHeaders().at("ETag"));
|
||||
response.LastModified = DateTime::Parse(
|
||||
pRawResponse->GetHeaders().at("Last-Modified"), Azure::DateTime::DateFormat::Rfc1123);
|
||||
response.IsServerEncrypted
|
||||
= pRawResponse->GetHeaders().at("x-ms-request-server-encrypted") == std::string("true");
|
||||
response.IsServerEncrypted = !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-request-server-encrypted"), "true");
|
||||
if (pRawResponse->GetHeaders().count("x-ms-file-permission-key") != 0)
|
||||
{
|
||||
response.SmbProperties.PermissionKey
|
||||
|
@ -3387,8 +3445,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
}
|
||||
Models::SetFileMetadataResult response;
|
||||
response.ETag = ETag(pRawResponse->GetHeaders().at("ETag"));
|
||||
response.IsServerEncrypted
|
||||
= pRawResponse->GetHeaders().at("x-ms-request-server-encrypted") == std::string("true");
|
||||
response.IsServerEncrypted = !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-request-server-encrypted"), "true");
|
||||
return Response<Models::SetFileMetadataResult>(std::move(response), std::move(pRawResponse));
|
||||
}
|
||||
Response<Models::_detail::AcquireFileLeaseResult> FileClient::AcquireLease(
|
||||
|
@ -3612,7 +3670,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
if (pRawResponse->GetHeaders().count("x-ms-request-server-encrypted") != 0)
|
||||
{
|
||||
response.IsServerEncrypted
|
||||
= pRawResponse->GetHeaders().at("x-ms-request-server-encrypted") == std::string("true");
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-request-server-encrypted"), "true");
|
||||
}
|
||||
return Response<Models::UploadFileRangeResult>(std::move(response), std::move(pRawResponse));
|
||||
}
|
||||
|
@ -3711,7 +3770,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
if (pRawResponse->GetHeaders().count("x-ms-request-server-encrypted") != 0)
|
||||
{
|
||||
response.IsServerEncrypted
|
||||
= pRawResponse->GetHeaders().at("x-ms-request-server-encrypted") == std::string("true");
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-request-server-encrypted"), "true");
|
||||
}
|
||||
return Response<Models::UploadFileRangeFromUriResult>(
|
||||
std::move(response), std::move(pRawResponse));
|
||||
|
@ -4169,7 +4229,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
&& xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle
|
||||
&& xmlPath[3] == XmlTagEnum::kPath && node.Name == "Encoded")
|
||||
{
|
||||
vectorElement1.Path.Encoded = node.Value == std::string("true");
|
||||
vectorElement1.Path.Encoded
|
||||
= !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
node.Value, "true");
|
||||
}
|
||||
}
|
||||
else if (node.Type == _internal::XmlNodeType::EndTag)
|
||||
|
@ -4337,8 +4399,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
response.ETag = ETag(pRawResponse->GetHeaders().at("ETag"));
|
||||
response.LastModified = DateTime::Parse(
|
||||
pRawResponse->GetHeaders().at("Last-Modified"), Azure::DateTime::DateFormat::Rfc1123);
|
||||
response.IsServerEncrypted
|
||||
= pRawResponse->GetHeaders().at("x-ms-request-server-encrypted") == std::string("true");
|
||||
response.IsServerEncrypted = !Core::_internal::StringExtensions::CaseInsensitiveComparator()(
|
||||
pRawResponse->GetHeaders().at("x-ms-request-server-encrypted"), "true");
|
||||
response.FilePermissionKey = pRawResponse->GetHeaders().at("x-ms-file-permission-key");
|
||||
response.FileAttributes = pRawResponse->GetHeaders().at("x-ms-file-attributes");
|
||||
response.FileCreationTime = DateTime::Parse(
|
||||
|
|
|
@ -149,6 +149,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
protocolLayerOptions.AccessTier = options.AccessTier;
|
||||
protocolLayerOptions.EnabledProtocols = options.EnabledProtocols;
|
||||
protocolLayerOptions.RootSquash = options.RootSquash;
|
||||
protocolLayerOptions.EnableSnapshotVirtualDirectoryAccess
|
||||
= options.EnableSnapshotVirtualDirectoryAccess;
|
||||
auto result
|
||||
= _detail::ShareClient::Create(*m_pipeline, m_shareUrl, protocolLayerOptions, context);
|
||||
Models::CreateShareResult ret;
|
||||
|
@ -245,6 +247,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
|||
protocolLayerOptions.Quota = options.ShareQuotaInGiB;
|
||||
protocolLayerOptions.AccessTier = options.AccessTier;
|
||||
protocolLayerOptions.RootSquash = options.RootSquash;
|
||||
protocolLayerOptions.EnableSnapshotVirtualDirectoryAccess
|
||||
= options.EnableSnapshotVirtualDirectoryAccess;
|
||||
return _detail::ShareClient::SetProperties(
|
||||
*m_pipeline, m_shareUrl, protocolLayerOptions, context);
|
||||
}
|
||||
|
|
|
@ -469,6 +469,7 @@ directive:
|
|||
$["x-ms-enabled-protocols"]["enum"] = ["Smb", "Nfs"];
|
||||
$["x-ms-enabled-protocols"]["x-ms-enum"] = {"name": "ShareProtocols", "modelAsString": false};
|
||||
$["x-ms-enabled-protocols"]["x-ms-enum"]["values"] = [{"value": "SMB", "name": "Smb"},{"value": "NFS", "name": "Nfs"}];
|
||||
$["x-ms-enable-snapshot-virtual-directory-access"]["x-nullable"] = true;
|
||||
- from: swagger-document
|
||||
where: $["x-ms-paths"]["/{shareName}?restype=share"].get.responses["200"]
|
||||
transform: >
|
||||
|
@ -1067,6 +1068,7 @@ directive:
|
|||
$.ShareItemDetails.properties["EnabledProtocols"].description = "The protocols which have been enabled on the share.";
|
||||
$.ShareItemDetails.properties["RootSquash"].description = "Root squash to set on the share. Only valid for NFS shares.";
|
||||
$.ShareItemDetails.properties["Last-Modified"].description = "The date and time the share was last modified.";
|
||||
$.ShareItemDetails.properties["EnableSnapshotVirtualDirectoryAccess"].description = "Version 2023-08-03 and newer. Specifies whether the snapshot virtual directory should be accessible at the root of share mount point when NFS is enabled. This header is only returned for shares, not for snapshots.";
|
||||
$.ShareItemInternal.properties["Name"].description = "The name of the share.";
|
||||
$.ShareItemInternal.properties["Snapshot"].description = "The snapshot of the share.";
|
||||
$.ShareItemInternal.properties["Deleted"].description = "True if the share is deleted.";
|
||||
|
|
|
@ -729,4 +729,30 @@ namespace Azure { namespace Storage { namespace Test {
|
|||
shareClient = Files::Shares::ShareClient(m_shareClient->GetUrl(), credential, clientOptions);
|
||||
EXPECT_THROW(shareClient.GetPermission(created.FilePermissionKey), StorageException);
|
||||
}
|
||||
|
||||
TEST_F(FileShareClientTest, EnableSnapshotVirtualDirectoryAccess_PLAYBACKONLY_)
|
||||
{
|
||||
std::string shareName = LowercaseRandomString();
|
||||
auto shareClient = m_shareServiceClient->GetShareClient(shareName);
|
||||
Files::Shares::CreateShareOptions createOptions;
|
||||
createOptions.EnabledProtocols = Files::Shares::Models::ShareProtocols::Nfs;
|
||||
shareClient.Create(createOptions);
|
||||
|
||||
Files::Shares::SetSharePropertiesOptions setPropertiesOptions;
|
||||
// EnableSnapshotVirtualDirectoryAccess = true
|
||||
setPropertiesOptions.EnableSnapshotVirtualDirectoryAccess = true;
|
||||
shareClient.SetProperties(setPropertiesOptions);
|
||||
auto properties = shareClient.GetProperties().Value;
|
||||
EXPECT_TRUE(
|
||||
properties.EnableSnapshotVirtualDirectoryAccess.HasValue()
|
||||
&& properties.EnableSnapshotVirtualDirectoryAccess.Value());
|
||||
|
||||
// EnableSnapshotVirtualDirectoryAccess = false
|
||||
setPropertiesOptions.EnableSnapshotVirtualDirectoryAccess = false;
|
||||
shareClient.SetProperties(setPropertiesOptions);
|
||||
properties = shareClient.GetProperties().Value;
|
||||
EXPECT_TRUE(
|
||||
properties.EnableSnapshotVirtualDirectoryAccess.HasValue()
|
||||
&& !properties.EnableSnapshotVirtualDirectoryAccess.Value());
|
||||
}
|
||||
}}} // namespace Azure::Storage::Test
|
||||
|
|
|
@ -132,6 +132,48 @@ namespace Azure { namespace Storage { namespace Test {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_F(FileShareServiceClientTest, ListSharesEnableSnapshotVirtualDirectoryAccess_PLAYBACKONLY_)
|
||||
{
|
||||
std::string shareName1 = LowercaseRandomString();
|
||||
std::string shareName2 = LowercaseRandomString();
|
||||
auto shareClient1 = m_shareServiceClient->GetShareClient(shareName1);
|
||||
auto shareClient2 = m_shareServiceClient->GetShareClient(shareName2);
|
||||
Files::Shares::CreateShareOptions createOptions;
|
||||
createOptions.EnabledProtocols = Files::Shares::Models::ShareProtocols::Nfs;
|
||||
shareClient1.Create(createOptions);
|
||||
shareClient2.Create(createOptions);
|
||||
|
||||
Files::Shares::SetSharePropertiesOptions setPropertiesOptions;
|
||||
setPropertiesOptions.EnableSnapshotVirtualDirectoryAccess = true;
|
||||
shareClient1.SetProperties(setPropertiesOptions);
|
||||
setPropertiesOptions.EnableSnapshotVirtualDirectoryAccess = false;
|
||||
shareClient2.SetProperties(setPropertiesOptions);
|
||||
|
||||
Azure::Nullable<Files::Shares::Models::ShareItem> share1;
|
||||
Azure::Nullable<Files::Shares::Models::ShareItem> share2;
|
||||
for (auto page = m_shareServiceClient->ListShares(); page.HasPage(); page.MoveToNextPage())
|
||||
{
|
||||
for (const auto& share : page.Shares)
|
||||
{
|
||||
if (share.Name == shareName1)
|
||||
{
|
||||
share1 = share;
|
||||
}
|
||||
else if (share.Name == shareName2)
|
||||
{
|
||||
share2 = share;
|
||||
}
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(share1.HasValue() && share2.HasValue());
|
||||
EXPECT_TRUE(
|
||||
share1.Value().Details.EnableSnapshotVirtualDirectoryAccess.HasValue()
|
||||
&& share1.Value().Details.EnableSnapshotVirtualDirectoryAccess.Value());
|
||||
EXPECT_TRUE(
|
||||
share2.Value().Details.EnableSnapshotVirtualDirectoryAccess.HasValue()
|
||||
&& !share2.Value().Details.EnableSnapshotVirtualDirectoryAccess.Value());
|
||||
}
|
||||
|
||||
TEST_F(FileShareServiceClientTest, GetProperties)
|
||||
{
|
||||
auto ret = m_shareServiceClient->GetProperties();
|
||||
|
|
Загрузка…
Ссылка в новой задаче