diff --git a/sdk/storage/assets.json b/sdk/storage/assets.json index 4ccae44ca4..da2ed90f7b 100644 --- a/sdk/storage/assets.json +++ b/sdk/storage/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "cpp", "TagPrefix": "cpp/storage", - "Tag": "cpp/storage_8eb3907e27" + "Tag": "cpp/storage_f113099cfb" } diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/rest_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/rest_client.hpp index 55c69e8021..af6aa6af18 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/rest_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/rest_client.hpp @@ -420,6 +420,20 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { * returned for shares, not for snapshots. */ Nullable EnableSnapshotVirtualDirectoryAccess; + /** + * Optional. Boolean. Default if not specified is false. This property enables paid bursting. + */ + Nullable PaidBurstingEnabled; + /** + * 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. + */ + Nullable PaidBurstingMaxIops; + /** + * 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. + */ + Nullable PaidBurstingMaxBandwidthMibps; }; /** * @brief A listed Azure Storage share item. @@ -603,6 +617,20 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { * returned for shares, not for snapshots. */ Nullable EnableSnapshotVirtualDirectoryAccess; + /** + * Optional. Boolean. Default if not specified is false. This property enables paid bursting. + */ + Nullable PaidBurstingEnabled; + /** + * 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. + */ + Nullable PaidBurstingMaxIops; + /** + * 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. + */ + Nullable PaidBurstingMaxBandwidthMibps; }; /** * @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 { Nullable EnabledProtocols; Nullable RootSquash; Nullable EnableSnapshotVirtualDirectoryAccess; + Nullable PaidBurstingEnabled; + Nullable PaidBurstingMaxBandwidthMibps; + Nullable PaidBurstingMaxIops; Nullable FileRequestIntent; }; static Response Create( @@ -2226,6 +2257,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Nullable LeaseId; Nullable RootSquash; Nullable EnableSnapshotVirtualDirectoryAccess; + Nullable PaidBurstingEnabled; + Nullable PaidBurstingMaxBandwidthMibps; + Nullable PaidBurstingMaxIops; Nullable FileRequestIntent; }; static Response SetProperties( diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp index 4e81ead933..d02d1e2065 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp @@ -181,6 +181,24 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { * returned for shares, not for snapshots. */ Nullable EnableSnapshotVirtualDirectoryAccess; + + /** + * Optional. Boolean. Version 2023-11-03 and newer. Default if not specified is false. This + * property enables paid bursting. + */ + Nullable EnablePaidBursting; + + /** + * Optional. Integer. Version 2023-11-03 and newer. Default if not specified is the maximum IOPS + * the file share can support. Current maximum for a file share is 102,400 IOPS. + */ + Nullable PaidBurstingMaxIops; + + /** + * Optional. Integer. Version 2023-11-03 and newer. Default if not specified is the maximum + * throughput the file share can support. Current maximum for a file share is 10,340 MiB/sec. + */ + Nullable PaidBurstingMaxBandwidthMibps; }; /** @@ -240,6 +258,24 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { * returned for shares, not for snapshots. */ Nullable EnableSnapshotVirtualDirectoryAccess; + + /** + * Optional. Boolean. Version 2023-11-03 and newer. Default if not specified is false. This + * property enables paid bursting. + */ + Nullable EnablePaidBursting; + + /** + * Optional. Integer. Version 2023-11-03 and newer. Default if not specified is the maximum IOPS + * the file share can support. Current maximum for a file share is 102,400 IOPS. + */ + Nullable PaidBurstingMaxIops; + + /** + * Optional. Integer. Version 2023-11-03 and newer. Default if not specified is the maximum + * throughput the file share can support. Current maximum for a file share is 10,340 MiB/sec. + */ + Nullable PaidBurstingMaxBandwidthMibps; }; /** diff --git a/sdk/storage/azure-storage-files-shares/src/rest_client.cpp b/sdk/storage/azure-storage-files-shares/src/rest_client.cpp index b44a9ce69d..acc3e0a984 100644 --- a/sdk/storage/azure-storage-files-shares/src/rest_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/rest_client.cpp @@ -629,6 +629,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { kEnabledProtocols, kRootSquash, kEnableSnapshotVirtualDirectoryAccess, + kPaidBurstingEnabled, + kPaidBurstingMaxIops, + kPaidBurstingMaxBandwidthMibps, kNextMarker, }; const std::unordered_map XmlTagEnumMap{ @@ -664,6 +667,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { {"RootSquash", XmlTagEnum::kRootSquash}, {"EnableSnapshotVirtualDirectoryAccess", XmlTagEnum::kEnableSnapshotVirtualDirectoryAccess}, + {"PaidBurstingEnabled", XmlTagEnum::kPaidBurstingEnabled}, + {"PaidBurstingMaxIops", XmlTagEnum::kPaidBurstingMaxIops}, + {"PaidBurstingMaxBandwidthMibps", XmlTagEnum::kPaidBurstingMaxBandwidthMibps}, {"NextMarker", XmlTagEnum::kNextMarker}, }; std::vector xmlPath; @@ -891,6 +897,30 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { vectorElement1.Details.EnableSnapshotVirtualDirectoryAccess = node.Value == std::string("true"); } + else if ( + xmlPath.size() == 5 && xmlPath[0] == XmlTagEnum::kEnumerationResults + && xmlPath[1] == XmlTagEnum::kShares && xmlPath[2] == XmlTagEnum::kShare + && xmlPath[3] == XmlTagEnum::kProperties + && xmlPath[4] == XmlTagEnum::kPaidBurstingEnabled) + { + vectorElement1.Details.PaidBurstingEnabled = node.Value == std::string("true"); + } + else if ( + xmlPath.size() == 5 && xmlPath[0] == XmlTagEnum::kEnumerationResults + && xmlPath[1] == XmlTagEnum::kShares && xmlPath[2] == XmlTagEnum::kShare + && xmlPath[3] == XmlTagEnum::kProperties + && xmlPath[4] == XmlTagEnum::kPaidBurstingMaxIops) + { + vectorElement1.Details.PaidBurstingMaxIops = std::stoll(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::kPaidBurstingMaxBandwidthMibps) + { + vectorElement1.Details.PaidBurstingMaxBandwidthMibps = std::stoll(node.Value); + } else if ( xmlPath.size() == 2 && xmlPath[0] == XmlTagEnum::kEnumerationResults && xmlPath[1] == XmlTagEnum::kNextMarker) @@ -964,6 +994,24 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { "x-ms-enable-snapshot-virtual-directory-access", options.EnableSnapshotVirtualDirectoryAccess.Value() ? "true" : "false"); } + if (options.PaidBurstingEnabled.HasValue()) + { + request.SetHeader( + "x-ms-share-paid-bursting-enabled", + options.PaidBurstingEnabled.Value() ? "true" : "false"); + } + if (options.PaidBurstingMaxBandwidthMibps.HasValue()) + { + request.SetHeader( + "x-ms-share-paid-bursting-max-bandwidth-mibps", + std::to_string(options.PaidBurstingMaxBandwidthMibps.Value())); + } + if (options.PaidBurstingMaxIops.HasValue()) + { + request.SetHeader( + "x-ms-share-paid-bursting-max-iops", + std::to_string(options.PaidBurstingMaxIops.Value())); + } if (options.FileRequestIntent.HasValue() && !options.FileRequestIntent.Value().ToString().empty()) { @@ -1092,6 +1140,22 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { = pRawResponse->GetHeaders().at("x-ms-enable-snapshot-virtual-directory-access") == std::string("true"); } + if (pRawResponse->GetHeaders().count("x-ms-share-paid-bursting-enabled") != 0) + { + response.PaidBurstingEnabled + = pRawResponse->GetHeaders().at("x-ms-share-paid-bursting-enabled") + == std::string("true"); + } + if (pRawResponse->GetHeaders().count("x-ms-share-paid-bursting-max-iops") != 0) + { + response.PaidBurstingMaxIops + = std::stoll(pRawResponse->GetHeaders().at("x-ms-share-paid-bursting-max-iops")); + } + if (pRawResponse->GetHeaders().count("x-ms-share-paid-bursting-max-bandwidth-mibps") != 0) + { + response.PaidBurstingMaxBandwidthMibps = std::stoll( + pRawResponse->GetHeaders().at("x-ms-share-paid-bursting-max-bandwidth-mibps")); + } return Response(std::move(response), std::move(pRawResponse)); } Response ShareClient::Delete( @@ -1472,6 +1536,24 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { "x-ms-enable-snapshot-virtual-directory-access", options.EnableSnapshotVirtualDirectoryAccess.Value() ? "true" : "false"); } + if (options.PaidBurstingEnabled.HasValue()) + { + request.SetHeader( + "x-ms-share-paid-bursting-enabled", + options.PaidBurstingEnabled.Value() ? "true" : "false"); + } + if (options.PaidBurstingMaxBandwidthMibps.HasValue()) + { + request.SetHeader( + "x-ms-share-paid-bursting-max-bandwidth-mibps", + std::to_string(options.PaidBurstingMaxBandwidthMibps.Value())); + } + if (options.PaidBurstingMaxIops.HasValue()) + { + request.SetHeader( + "x-ms-share-paid-bursting-max-iops", + std::to_string(options.PaidBurstingMaxIops.Value())); + } if (options.FileRequestIntent.HasValue() && !options.FileRequestIntent.Value().ToString().empty()) { diff --git a/sdk/storage/azure-storage-files-shares/src/share_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_client.cpp index d3f628e021..cf91e30536 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_client.cpp @@ -152,6 +152,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { protocolLayerOptions.EnableSnapshotVirtualDirectoryAccess = options.EnableSnapshotVirtualDirectoryAccess; protocolLayerOptions.FileRequestIntent = m_shareTokenIntent; + protocolLayerOptions.PaidBurstingEnabled = options.EnablePaidBursting; + protocolLayerOptions.PaidBurstingMaxIops = options.PaidBurstingMaxIops; + protocolLayerOptions.PaidBurstingMaxBandwidthMibps = options.PaidBurstingMaxBandwidthMibps; auto result = _detail::ShareClient::Create(*m_pipeline, m_shareUrl, protocolLayerOptions, context); Models::CreateShareResult ret; @@ -254,6 +257,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { protocolLayerOptions.EnableSnapshotVirtualDirectoryAccess = options.EnableSnapshotVirtualDirectoryAccess; protocolLayerOptions.FileRequestIntent = m_shareTokenIntent; + protocolLayerOptions.PaidBurstingEnabled = options.EnablePaidBursting; + protocolLayerOptions.PaidBurstingMaxIops = options.PaidBurstingMaxIops; + protocolLayerOptions.PaidBurstingMaxBandwidthMibps = options.PaidBurstingMaxBandwidthMibps; return _detail::ShareClient::SetProperties( *m_pipeline, m_shareUrl, protocolLayerOptions, context); } diff --git a/sdk/storage/azure-storage-files-shares/swagger/README.md b/sdk/storage/azure-storage-files-shares/swagger/README.md index 7246b74824..d0fe69848c 100644 --- a/sdk/storage/azure-storage-files-shares/swagger/README.md +++ b/sdk/storage/azure-storage-files-shares/swagger/README.md @@ -9,7 +9,7 @@ package-name: azure-storage-files-shares namespace: Azure::Storage::Files::Shares output-folder: generated clear-output-folder: true -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-11-04/file.json ``` ## ModelFour Options @@ -470,6 +470,9 @@ directive: $["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; + $["x-ms-share-paid-bursting-enabled"]["x-nullable"] = true; + $["x-ms-share-paid-bursting-max-iops"]["x-nullable"] = true; + $["x-ms-share-paid-bursting-max-bandwidth-mibps"]["x-nullable"] = true; - from: swagger-document where: $["x-ms-paths"]["/{shareName}?restype=share"].get.responses["200"] transform: > @@ -1069,6 +1072,9 @@ directive: $.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."; + $.ShareItemDetails.properties["PaidBurstingEnabled"].description = "Optional. Boolean. Default if not specified is false. This property enables paid bursting."; + $.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."; + $.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."; $.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."; diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_service_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_service_client_test.cpp index 8fcab27f3c..27942c8b51 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_service_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_service_client_test.cpp @@ -437,4 +437,64 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_NO_THROW(shareServiceClient.ListShares()); } + TEST_F(FileShareServiceClientTest, PremiumSharePaidBurst_PLAYBACKONLY_) + { + auto shareServiceClient = *m_premiumShareServiceClient; + auto shareName = LowercaseRandomString(); + auto shareClient = shareServiceClient.GetShareClient(shareName); + + // Create + Files::Shares::CreateShareOptions createOptions; + createOptions.EnablePaidBursting = true; + createOptions.PaidBurstingMaxIops = 1000; + createOptions.PaidBurstingMaxBandwidthMibps = 5000; + shareClient.Create(createOptions); + + // Get Properties + auto properties = shareClient.GetProperties().Value; + EXPECT_TRUE(properties.PaidBurstingEnabled.HasValue()); + EXPECT_TRUE(properties.PaidBurstingEnabled.Value()); + EXPECT_TRUE(properties.PaidBurstingMaxIops.HasValue()); + EXPECT_EQ(properties.PaidBurstingMaxIops.Value(), 1000); + EXPECT_TRUE(properties.PaidBurstingMaxBandwidthMibps.HasValue()); + EXPECT_EQ(properties.PaidBurstingMaxBandwidthMibps.Value(), 5000); + + // Set Properties + Files::Shares::SetSharePropertiesOptions setPropertiesOptions; + setPropertiesOptions.EnablePaidBursting = true; + setPropertiesOptions.PaidBurstingMaxIops = 500; + setPropertiesOptions.PaidBurstingMaxBandwidthMibps = 1000; + shareClient.SetProperties(setPropertiesOptions); + + // List Shares + Azure::Nullable shareItem; + for (auto page = shareServiceClient.ListShares(); page.HasPage(); page.MoveToNextPage()) + { + for (const auto& share : page.Shares) + { + if (share.Name == shareName) + { + shareItem = share; + } + } + } + ASSERT_TRUE(shareItem.HasValue()); + EXPECT_TRUE(shareItem.Value().Details.PaidBurstingEnabled.HasValue()); + EXPECT_TRUE(shareItem.Value().Details.PaidBurstingEnabled.Value()); + EXPECT_TRUE(shareItem.Value().Details.PaidBurstingMaxIops.HasValue()); + EXPECT_EQ(shareItem.Value().Details.PaidBurstingMaxIops.Value(), 500); + EXPECT_TRUE(shareItem.Value().Details.PaidBurstingMaxBandwidthMibps.HasValue()); + EXPECT_EQ(shareItem.Value().Details.PaidBurstingMaxBandwidthMibps.Value(), 1000); + + // Set Properties EnablePaidBursting = false + setPropertiesOptions.EnablePaidBursting = false; + setPropertiesOptions.PaidBurstingMaxIops.Reset(); + setPropertiesOptions.PaidBurstingMaxBandwidthMibps.Reset(); + shareClient.SetProperties(setPropertiesOptions); + properties = shareClient.GetProperties().Value; + EXPECT_TRUE(properties.PaidBurstingEnabled.HasValue()); + EXPECT_FALSE(properties.PaidBurstingEnabled.Value()); + + shareClient.DeleteIfExists(); + } }}} // namespace Azure::Storage::Test