Skip to content

Commit 6ced010

Browse files
authored
Storage/STG95 Premium Files Paid Burst (#5795)
* paid burst * update record
1 parent 8b8b522 commit 6ced010

7 files changed

Lines changed: 226 additions & 2 deletions

File tree

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_8eb3907e27"
5+
"Tag": "cpp/storage_f113099cfb"
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
@@ -420,6 +420,20 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
420420
* returned for shares, not for snapshots.
421421
*/
422422
Nullable<bool> EnableSnapshotVirtualDirectoryAccess;
423+
/**
424+
* Optional. Boolean. Default if not specified is false. This property enables paid bursting.
425+
*/
426+
Nullable<bool> PaidBurstingEnabled;
427+
/**
428+
* Optional. Integer. Default if not specified is the maximum IOPS the file share can support.
429+
* Current maximum for a file share is 102,400 IOPS.
430+
*/
431+
Nullable<int64_t> PaidBurstingMaxIops;
432+
/**
433+
* Optional. Integer. Default if not specified is the maximum throughput the file share can
434+
* support. Current maximum for a file share is 10,340 MiB/sec.
435+
*/
436+
Nullable<int64_t> PaidBurstingMaxBandwidthMibps;
423437
};
424438
/**
425439
* @brief A listed Azure Storage share item.
@@ -603,6 +617,20 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
603617
* returned for shares, not for snapshots.
604618
*/
605619
Nullable<bool> EnableSnapshotVirtualDirectoryAccess;
620+
/**
621+
* Optional. Boolean. Default if not specified is false. This property enables paid bursting.
622+
*/
623+
Nullable<bool> PaidBurstingEnabled;
624+
/**
625+
* Optional. Integer. Default if not specified is the maximum IOPS the file share can support.
626+
* Current maximum for a file share is 102,400 IOPS.
627+
*/
628+
Nullable<int64_t> PaidBurstingMaxIops;
629+
/**
630+
* Optional. Integer. Default if not specified is the maximum throughput the file share can
631+
* support. Current maximum for a file share is 10,340 MiB/sec.
632+
*/
633+
Nullable<int64_t> PaidBurstingMaxBandwidthMibps;
606634
};
607635
/**
608636
* @brief Specifies the option include to delete the base share and all of its snapshots.
@@ -2101,6 +2129,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
21012129
Nullable<Models::ShareProtocols> EnabledProtocols;
21022130
Nullable<Models::ShareRootSquash> RootSquash;
21032131
Nullable<bool> EnableSnapshotVirtualDirectoryAccess;
2132+
Nullable<bool> PaidBurstingEnabled;
2133+
Nullable<int64_t> PaidBurstingMaxBandwidthMibps;
2134+
Nullable<int64_t> PaidBurstingMaxIops;
21042135
Nullable<Models::ShareTokenIntent> FileRequestIntent;
21052136
};
21062137
static Response<Models::CreateShareResult> Create(
@@ -2226,6 +2257,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
22262257
Nullable<std::string> LeaseId;
22272258
Nullable<Models::ShareRootSquash> RootSquash;
22282259
Nullable<bool> EnableSnapshotVirtualDirectoryAccess;
2260+
Nullable<bool> PaidBurstingEnabled;
2261+
Nullable<int64_t> PaidBurstingMaxBandwidthMibps;
2262+
Nullable<int64_t> PaidBurstingMaxIops;
22292263
Nullable<Models::ShareTokenIntent> FileRequestIntent;
22302264
};
22312265
static Response<Models::SetSharePropertiesResult> SetProperties(

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,24 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
181181
* returned for shares, not for snapshots.
182182
*/
183183
Nullable<bool> EnableSnapshotVirtualDirectoryAccess;
184+
185+
/**
186+
* Optional. Boolean. Version 2023-11-03 and newer. Default if not specified is false. This
187+
* property enables paid bursting.
188+
*/
189+
Nullable<bool> EnablePaidBursting;
190+
191+
/**
192+
* Optional. Integer. Version 2023-11-03 and newer. Default if not specified is the maximum IOPS
193+
* the file share can support. Current maximum for a file share is 102,400 IOPS.
194+
*/
195+
Nullable<int64_t> PaidBurstingMaxIops;
196+
197+
/**
198+
* Optional. Integer. Version 2023-11-03 and newer. Default if not specified is the maximum
199+
* throughput the file share can support. Current maximum for a file share is 10,340 MiB/sec.
200+
*/
201+
Nullable<int64_t> PaidBurstingMaxBandwidthMibps;
184202
};
185203

186204
/**
@@ -240,6 +258,24 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
240258
* returned for shares, not for snapshots.
241259
*/
242260
Nullable<bool> EnableSnapshotVirtualDirectoryAccess;
261+
262+
/**
263+
* Optional. Boolean. Version 2023-11-03 and newer. Default if not specified is false. This
264+
* property enables paid bursting.
265+
*/
266+
Nullable<bool> EnablePaidBursting;
267+
268+
/**
269+
* Optional. Integer. Version 2023-11-03 and newer. Default if not specified is the maximum IOPS
270+
* the file share can support. Current maximum for a file share is 102,400 IOPS.
271+
*/
272+
Nullable<int64_t> PaidBurstingMaxIops;
273+
274+
/**
275+
* Optional. Integer. Version 2023-11-03 and newer. Default if not specified is the maximum
276+
* throughput the file share can support. Current maximum for a file share is 10,340 MiB/sec.
277+
*/
278+
Nullable<int64_t> PaidBurstingMaxBandwidthMibps;
243279
};
244280

245281
/**

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

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
629629
kEnabledProtocols,
630630
kRootSquash,
631631
kEnableSnapshotVirtualDirectoryAccess,
632+
kPaidBurstingEnabled,
633+
kPaidBurstingMaxIops,
634+
kPaidBurstingMaxBandwidthMibps,
632635
kNextMarker,
633636
};
634637
const std::unordered_map<std::string, XmlTagEnum> XmlTagEnumMap{
@@ -664,6 +667,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
664667
{"RootSquash", XmlTagEnum::kRootSquash},
665668
{"EnableSnapshotVirtualDirectoryAccess",
666669
XmlTagEnum::kEnableSnapshotVirtualDirectoryAccess},
670+
{"PaidBurstingEnabled", XmlTagEnum::kPaidBurstingEnabled},
671+
{"PaidBurstingMaxIops", XmlTagEnum::kPaidBurstingMaxIops},
672+
{"PaidBurstingMaxBandwidthMibps", XmlTagEnum::kPaidBurstingMaxBandwidthMibps},
667673
{"NextMarker", XmlTagEnum::kNextMarker},
668674
};
669675
std::vector<XmlTagEnum> xmlPath;
@@ -891,6 +897,30 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
891897
vectorElement1.Details.EnableSnapshotVirtualDirectoryAccess
892898
= node.Value == std::string("true");
893899
}
900+
else if (
901+
xmlPath.size() == 5 && xmlPath[0] == XmlTagEnum::kEnumerationResults
902+
&& xmlPath[1] == XmlTagEnum::kShares && xmlPath[2] == XmlTagEnum::kShare
903+
&& xmlPath[3] == XmlTagEnum::kProperties
904+
&& xmlPath[4] == XmlTagEnum::kPaidBurstingEnabled)
905+
{
906+
vectorElement1.Details.PaidBurstingEnabled = node.Value == std::string("true");
907+
}
908+
else if (
909+
xmlPath.size() == 5 && xmlPath[0] == XmlTagEnum::kEnumerationResults
910+
&& xmlPath[1] == XmlTagEnum::kShares && xmlPath[2] == XmlTagEnum::kShare
911+
&& xmlPath[3] == XmlTagEnum::kProperties
912+
&& xmlPath[4] == XmlTagEnum::kPaidBurstingMaxIops)
913+
{
914+
vectorElement1.Details.PaidBurstingMaxIops = std::stoll(node.Value);
915+
}
916+
else if (
917+
xmlPath.size() == 5 && xmlPath[0] == XmlTagEnum::kEnumerationResults
918+
&& xmlPath[1] == XmlTagEnum::kShares && xmlPath[2] == XmlTagEnum::kShare
919+
&& xmlPath[3] == XmlTagEnum::kProperties
920+
&& xmlPath[4] == XmlTagEnum::kPaidBurstingMaxBandwidthMibps)
921+
{
922+
vectorElement1.Details.PaidBurstingMaxBandwidthMibps = std::stoll(node.Value);
923+
}
894924
else if (
895925
xmlPath.size() == 2 && xmlPath[0] == XmlTagEnum::kEnumerationResults
896926
&& xmlPath[1] == XmlTagEnum::kNextMarker)
@@ -964,6 +994,24 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
964994
"x-ms-enable-snapshot-virtual-directory-access",
965995
options.EnableSnapshotVirtualDirectoryAccess.Value() ? "true" : "false");
966996
}
997+
if (options.PaidBurstingEnabled.HasValue())
998+
{
999+
request.SetHeader(
1000+
"x-ms-share-paid-bursting-enabled",
1001+
options.PaidBurstingEnabled.Value() ? "true" : "false");
1002+
}
1003+
if (options.PaidBurstingMaxBandwidthMibps.HasValue())
1004+
{
1005+
request.SetHeader(
1006+
"x-ms-share-paid-bursting-max-bandwidth-mibps",
1007+
std::to_string(options.PaidBurstingMaxBandwidthMibps.Value()));
1008+
}
1009+
if (options.PaidBurstingMaxIops.HasValue())
1010+
{
1011+
request.SetHeader(
1012+
"x-ms-share-paid-bursting-max-iops",
1013+
std::to_string(options.PaidBurstingMaxIops.Value()));
1014+
}
9671015
if (options.FileRequestIntent.HasValue()
9681016
&& !options.FileRequestIntent.Value().ToString().empty())
9691017
{
@@ -1092,6 +1140,22 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
10921140
= pRawResponse->GetHeaders().at("x-ms-enable-snapshot-virtual-directory-access")
10931141
== std::string("true");
10941142
}
1143+
if (pRawResponse->GetHeaders().count("x-ms-share-paid-bursting-enabled") != 0)
1144+
{
1145+
response.PaidBurstingEnabled
1146+
= pRawResponse->GetHeaders().at("x-ms-share-paid-bursting-enabled")
1147+
== std::string("true");
1148+
}
1149+
if (pRawResponse->GetHeaders().count("x-ms-share-paid-bursting-max-iops") != 0)
1150+
{
1151+
response.PaidBurstingMaxIops
1152+
= std::stoll(pRawResponse->GetHeaders().at("x-ms-share-paid-bursting-max-iops"));
1153+
}
1154+
if (pRawResponse->GetHeaders().count("x-ms-share-paid-bursting-max-bandwidth-mibps") != 0)
1155+
{
1156+
response.PaidBurstingMaxBandwidthMibps = std::stoll(
1157+
pRawResponse->GetHeaders().at("x-ms-share-paid-bursting-max-bandwidth-mibps"));
1158+
}
10951159
return Response<Models::ShareProperties>(std::move(response), std::move(pRawResponse));
10961160
}
10971161
Response<Models::DeleteShareResult> ShareClient::Delete(
@@ -1472,6 +1536,24 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
14721536
"x-ms-enable-snapshot-virtual-directory-access",
14731537
options.EnableSnapshotVirtualDirectoryAccess.Value() ? "true" : "false");
14741538
}
1539+
if (options.PaidBurstingEnabled.HasValue())
1540+
{
1541+
request.SetHeader(
1542+
"x-ms-share-paid-bursting-enabled",
1543+
options.PaidBurstingEnabled.Value() ? "true" : "false");
1544+
}
1545+
if (options.PaidBurstingMaxBandwidthMibps.HasValue())
1546+
{
1547+
request.SetHeader(
1548+
"x-ms-share-paid-bursting-max-bandwidth-mibps",
1549+
std::to_string(options.PaidBurstingMaxBandwidthMibps.Value()));
1550+
}
1551+
if (options.PaidBurstingMaxIops.HasValue())
1552+
{
1553+
request.SetHeader(
1554+
"x-ms-share-paid-bursting-max-iops",
1555+
std::to_string(options.PaidBurstingMaxIops.Value()));
1556+
}
14751557
if (options.FileRequestIntent.HasValue()
14761558
&& !options.FileRequestIntent.Value().ToString().empty())
14771559
{

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
152152
protocolLayerOptions.EnableSnapshotVirtualDirectoryAccess
153153
= options.EnableSnapshotVirtualDirectoryAccess;
154154
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
155+
protocolLayerOptions.PaidBurstingEnabled = options.EnablePaidBursting;
156+
protocolLayerOptions.PaidBurstingMaxIops = options.PaidBurstingMaxIops;
157+
protocolLayerOptions.PaidBurstingMaxBandwidthMibps = options.PaidBurstingMaxBandwidthMibps;
155158
auto result
156159
= _detail::ShareClient::Create(*m_pipeline, m_shareUrl, protocolLayerOptions, context);
157160
Models::CreateShareResult ret;
@@ -254,6 +257,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
254257
protocolLayerOptions.EnableSnapshotVirtualDirectoryAccess
255258
= options.EnableSnapshotVirtualDirectoryAccess;
256259
protocolLayerOptions.FileRequestIntent = m_shareTokenIntent;
260+
protocolLayerOptions.PaidBurstingEnabled = options.EnablePaidBursting;
261+
protocolLayerOptions.PaidBurstingMaxIops = options.PaidBurstingMaxIops;
262+
protocolLayerOptions.PaidBurstingMaxBandwidthMibps = options.PaidBurstingMaxBandwidthMibps;
257263
return _detail::ShareClient::SetProperties(
258264
*m_pipeline, m_shareUrl, protocolLayerOptions, context);
259265
}

sdk/storage/azure-storage-files-shares/swagger/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ package-name: azure-storage-files-shares
99
namespace: Azure::Storage::Files::Shares
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.FileStorage/stable/2024-08-04/file.json
12+
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-11-04/file.json
1313
```
1414
1515
## ModelFour Options
@@ -470,6 +470,9 @@ directive:
470470
$["x-ms-enabled-protocols"]["x-ms-enum"] = {"name": "ShareProtocols", "modelAsString": false};
471471
$["x-ms-enabled-protocols"]["x-ms-enum"]["values"] = [{"value": "SMB", "name": "Smb"},{"value": "NFS", "name": "Nfs"}];
472472
$["x-ms-enable-snapshot-virtual-directory-access"]["x-nullable"] = true;
473+
$["x-ms-share-paid-bursting-enabled"]["x-nullable"] = true;
474+
$["x-ms-share-paid-bursting-max-iops"]["x-nullable"] = true;
475+
$["x-ms-share-paid-bursting-max-bandwidth-mibps"]["x-nullable"] = true;
473476
- from: swagger-document
474477
where: $["x-ms-paths"]["/{shareName}?restype=share"].get.responses["200"]
475478
transform: >
@@ -1069,6 +1072,9 @@ directive:
10691072
$.ShareItemDetails.properties["RootSquash"].description = "Root squash to set on the share. Only valid for NFS shares.";
10701073
$.ShareItemDetails.properties["Last-Modified"].description = "The date and time the share was last modified.";
10711074
$.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.";
1075+
$.ShareItemDetails.properties["PaidBurstingEnabled"].description = "Optional. Boolean. Default if not specified is false. This property enables paid bursting.";
1076+
$.ShareItemDetails.properties["PaidBurstingMaxIops"].description = "Optional. Integer. Default if not specified is the maximum IOPS the file share can support. Current maximum for a file share is 102,400 IOPS.";
1077+
$.ShareItemDetails.properties["PaidBurstingMaxBandwidthMibps"].description = "Optional. Integer. Default if not specified is the maximum throughput the file share can support. Current maximum for a file share is 10,340 MiB/sec.";
10721078
$.ShareItemInternal.properties["Name"].description = "The name of the share.";
10731079
$.ShareItemInternal.properties["Snapshot"].description = "The snapshot of the share.";
10741080
$.ShareItemInternal.properties["Deleted"].description = "True if the share is deleted.";

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

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,4 +437,64 @@ namespace Azure { namespace Storage { namespace Test {
437437
EXPECT_NO_THROW(shareServiceClient.ListShares());
438438
}
439439

440+
TEST_F(FileShareServiceClientTest, PremiumSharePaidBurst_PLAYBACKONLY_)
441+
{
442+
auto shareServiceClient = *m_premiumShareServiceClient;
443+
auto shareName = LowercaseRandomString();
444+
auto shareClient = shareServiceClient.GetShareClient(shareName);
445+
446+
// Create
447+
Files::Shares::CreateShareOptions createOptions;
448+
createOptions.EnablePaidBursting = true;
449+
createOptions.PaidBurstingMaxIops = 1000;
450+
createOptions.PaidBurstingMaxBandwidthMibps = 5000;
451+
shareClient.Create(createOptions);
452+
453+
// Get Properties
454+
auto properties = shareClient.GetProperties().Value;
455+
EXPECT_TRUE(properties.PaidBurstingEnabled.HasValue());
456+
EXPECT_TRUE(properties.PaidBurstingEnabled.Value());
457+
EXPECT_TRUE(properties.PaidBurstingMaxIops.HasValue());
458+
EXPECT_EQ(properties.PaidBurstingMaxIops.Value(), 1000);
459+
EXPECT_TRUE(properties.PaidBurstingMaxBandwidthMibps.HasValue());
460+
EXPECT_EQ(properties.PaidBurstingMaxBandwidthMibps.Value(), 5000);
461+
462+
// Set Properties
463+
Files::Shares::SetSharePropertiesOptions setPropertiesOptions;
464+
setPropertiesOptions.EnablePaidBursting = true;
465+
setPropertiesOptions.PaidBurstingMaxIops = 500;
466+
setPropertiesOptions.PaidBurstingMaxBandwidthMibps = 1000;
467+
shareClient.SetProperties(setPropertiesOptions);
468+
469+
// List Shares
470+
Azure::Nullable<Files::Shares::Models::ShareItem> shareItem;
471+
for (auto page = shareServiceClient.ListShares(); page.HasPage(); page.MoveToNextPage())
472+
{
473+
for (const auto& share : page.Shares)
474+
{
475+
if (share.Name == shareName)
476+
{
477+
shareItem = share;
478+
}
479+
}
480+
}
481+
ASSERT_TRUE(shareItem.HasValue());
482+
EXPECT_TRUE(shareItem.Value().Details.PaidBurstingEnabled.HasValue());
483+
EXPECT_TRUE(shareItem.Value().Details.PaidBurstingEnabled.Value());
484+
EXPECT_TRUE(shareItem.Value().Details.PaidBurstingMaxIops.HasValue());
485+
EXPECT_EQ(shareItem.Value().Details.PaidBurstingMaxIops.Value(), 500);
486+
EXPECT_TRUE(shareItem.Value().Details.PaidBurstingMaxBandwidthMibps.HasValue());
487+
EXPECT_EQ(shareItem.Value().Details.PaidBurstingMaxBandwidthMibps.Value(), 1000);
488+
489+
// Set Properties EnablePaidBursting = false
490+
setPropertiesOptions.EnablePaidBursting = false;
491+
setPropertiesOptions.PaidBurstingMaxIops.Reset();
492+
setPropertiesOptions.PaidBurstingMaxBandwidthMibps.Reset();
493+
shareClient.SetProperties(setPropertiesOptions);
494+
properties = shareClient.GetProperties().Value;
495+
EXPECT_TRUE(properties.PaidBurstingEnabled.HasValue());
496+
EXPECT_FALSE(properties.PaidBurstingEnabled.Value());
497+
498+
shareClient.DeleteIfExists();
499+
}
440500
}}} // namespace Azure::Storage::Test

0 commit comments

Comments
 (0)