From c82f0e8efcd57a0a0c010e358e15c3e8800e4a50 Mon Sep 17 00:00:00 2001 From: Victor Vazquez Date: Wed, 28 Apr 2021 17:49:47 +0000 Subject: [PATCH] Rename paged models from key vault (#2160) rename pageable APIs and models from keyvault --- .../keyvault/common/internal/single_page.hpp | 2 +- .../azure-security-keyvault-keys/CHANGELOG.md | 12 ++++- .../keyvault/keys/details/key_serializers.hpp | 8 ++-- .../inc/azure/keyvault/keys/key_client.hpp | 40 ++++++++--------- .../keys/list_keys_single_page_result.hpp | 45 +++++++++---------- .../samples/sample3_get_keys.md | 34 +++++++------- .../src/key_client.cpp | 32 ++++++------- .../src/list_keys_single_page_result.cpp | 38 ++++++++-------- .../sample3-get-keys/sample3_get_keys.cpp | 14 +++--- .../test/ut/key_client_base_test.hpp | 6 +-- .../test/ut/key_client_get_test_live.cpp | 11 +++-- 11 files changed, 122 insertions(+), 120 deletions(-) diff --git a/sdk/keyvault/azure-security-keyvault-common/inc/azure/keyvault/common/internal/single_page.hpp b/sdk/keyvault/azure-security-keyvault-common/inc/azure/keyvault/common/internal/single_page.hpp index 0c5e551af..e08f93f6c 100644 --- a/sdk/keyvault/azure-security-keyvault-common/inc/azure/keyvault/common/internal/single_page.hpp +++ b/sdk/keyvault/azure-security-keyvault-common/inc/azure/keyvault/common/internal/single_page.hpp @@ -13,7 +13,7 @@ #include namespace Azure { namespace Security { namespace KeyVault { namespace _internal { - struct GetSinglePageOptions + struct GetPageResultOptions { Azure::Nullable NextPageToken; Azure::Nullable MaxPageResults; diff --git a/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md b/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md index b8a3d9b44..b321dc760 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md +++ b/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md @@ -8,13 +8,21 @@ ### Breaking Changes +- Renamed `GetPropertiesOfKeysSinglePage()` to `GetPropertiesOfKeys()`. +- Renamed `GetPropertiesOfKeyVersionsSinglePage()` to `GetPropertiesOfKeyVersions()`. +- Renamed `GetDeletedKeysSinglePage()` to `GetDeletedKeys()`. +- Renamed `KeyPropertiesSinglePage` to `KeyPropertiesPageResult`. +- Renamed `DeletedKeySinglePage` to `DeletedKeyPageResult`. +- Renamed `GetPropertiesOfKeysSinglePageOptions` to `GetPropertiesOfKeysOptions`. +- Renamed `GetPropertiesOfKeyVersionsSinglePageOptions` to `GetPropertiesOfKeyVersionsOptions`. +- Renamed `GetDeletedKeysSinglePageOptions` to `GetDeletedKeysOptions`. - Removed `Azure::Security::KeyVault::Keys::JsonWebKey::to_json`. - Replaced static functions from `KeyOperation` and `KeyCurveName` with static const members. - Replaced the enum `JsonWebKeyType` for a class with static const members as an extensible enum called `KeyVaultKeyType`. - Renamed `MaxResults` to `MaxPageResults` for `GetSinglePageOptions`. - Changed the returned type for list keys, key versions, and deleted keys from `Response` to `PagedResponse` affecting: - - `GetPropertiesOfKeysSinglePage()` and `GetPropertiesOfKeyVersionsSinglePage()` now returns `KeyPropertiesSinglePage`. - - `GetDeletedKeysSinglePage()` now returns `DeletedKeySinglePage`. + - `GetPropertiesOfKeysSinglePage()` and `GetPropertiesOfKeyVersionsSinglePage()` now returns `KeyProperties`. + - `GetDeletedKeysSinglePage()` now returns `DeletedKey`. ### Bug Fixes diff --git a/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/details/key_serializers.hpp b/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/details/key_serializers.hpp index 057e5851c..ae6728983 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/details/key_serializers.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/details/key_serializers.hpp @@ -96,12 +96,12 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam static std::string ImportKeyOptionsSerialize(ImportKeyOptions const& importKeyOptions); }; - /**************** Key Properties Single Page ************/ - struct KeyPropertiesSinglePageSerializer + /**************** Key Properties ************/ + struct KeyPropertiesPageResultSerializer { - static KeyPropertiesSinglePage KeyPropertiesSinglePageDeserialize( + static KeyPropertiesPageResult KeyPropertiesPageResultDeserialize( Azure::Core::Http::RawResponse const& rawResponse); - static DeletedKeySinglePage DeletedKeySinglePageDeserialize( + static DeletedKeyPageResult DeletedKeyPageResultDeserialize( Azure::Core::Http::RawResponse const& rawResponse); }; diff --git a/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/key_client.hpp b/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/key_client.hpp index 822e0d7ed..290db5eac 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/key_client.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/key_client.hpp @@ -174,17 +174,16 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { * are not listed in the response. This operation requires the keys/list permission. * * @remark Use \p options to control which page to get. If - * #GetPropertiesOfKeysSinglePageOptions.NextLink is not set, the operation will get the first - * page and it will set the `NextPageToken` from the #KeyPropertiesSinglePage as the next + * #GetPropertiesOfKeysOptions.NextLink is not set, the operation will get the first + * page and it will set the `NextPageToken` from the #KeyPropertiesPageResult as the next * page of the response if there is a next page. * - * @param options The #GetPropertiesOfKeysSinglePageOptions object to for setting the operation + * @param options The #GetPropertiesOfKeysOptions object to for setting the operation * up. * @param context A #Azure::Core::Context controlling the request lifetime. */ - KeyPropertiesSinglePage GetPropertiesOfKeysSinglePage( - GetPropertiesOfKeysSinglePageOptions const& options - = GetPropertiesOfKeysSinglePageOptions(), + KeyPropertiesPageResult GetPropertiesOfKeys( + GetPropertiesOfKeysOptions const& options = GetPropertiesOfKeysOptions(), Azure::Core::Context const& context = Azure::Core::Context()) const; /** @@ -196,19 +195,18 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { * operation requires the keys/list permission. * * @remark Use \p options to control which page to get. If - * #GetPropertiesOfKeyVersionsSinglePageOptions.NextLink is not set, the operation will get the - * first page and it will set the `NextPageToken` from the #KeyPropertiesSinglePage as the + * #GetPropertiesOfKeyVersionsOptions.NextLink is not set, the operation will get the + * first page and it will set the `NextPageToken` from the #KeyPropertiesPageResult as the * next page of the response if there is a next page. * * @param name The name of the key. - * @param options The #GetPropertiesOfKeyVersionsSinglePageOptions object to for setting the + * @param options The #GetPropertiesOfKeyVersionsOptions object to for setting the * operation up. * @param context A #Azure::Core::Context controlling the request lifetime. */ - KeyPropertiesSinglePage GetPropertiesOfKeyVersionsSinglePage( + KeyPropertiesPageResult GetPropertiesOfKeyVersions( std::string const& name, - GetPropertiesOfKeyVersionsSinglePageOptions const& options - = GetPropertiesOfKeyVersionsSinglePageOptions(), + GetPropertiesOfKeyVersionsOptions const& options = GetPropertiesOfKeyVersionsOptions(), Azure::Core::Context const& context = Azure::Core::Context()) const; /** @@ -258,25 +256,25 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { Azure::Core::Context const& context = Azure::Core::Context()) const; /** - * @brief Get on page listing the deleted keys in the specified vault. + * @brief Get a page listing the deleted keys in the specified vault. * - * @remark Retrieves a list of the keys in the Key Vault that contains the public part od the + * @remark Retrieves the list of the keys in the Key Vault that contains the public part of the * deleted key. This operation includes deletion-specific information. This operation is - * applicable for vaults enabled fr soft-delete. While the operation can be invoked on any + * applicable for vaults enabled for soft-delete. While the operation can be invoked on any * vault, it will return error if invoked on a non soft-delete enabled vault. This operation * requires the keys/list permission. * * @remark Use \p options to control which page to get. If - * #GetPropertiesOfKeyVersionsSinglePageOptions.NextPageToken is not set, the operation will get - * the first page and it will set the `NextPageToken` from the #KeyPropertiesSinglePage as the + * #GetPropertiesOfKeyVersionsOptions.NextPageToken is not set, the operation will get + * the first page and it will set the `NextPageToken` from the #KeyPropertiesPageResult as the * next page of the response if there is a next page. * - * @param options The #GetDeletedKeysSinglePageOptions object to for setting the operation up. + * @param options The #GetDeletedKeysOptions object to for setting the operation up. * @param context A #Azure::Core::Context controlling the request lifetime. - * @return Azure::Response + * @return Azure::Response */ - DeletedKeySinglePage GetDeletedKeysSinglePage( - GetDeletedKeysSinglePageOptions const& options = GetDeletedKeysSinglePageOptions(), + DeletedKeyPageResult GetDeletedKeys( + GetDeletedKeysOptions const& options = GetDeletedKeysOptions(), Azure::Core::Context const& context = Azure::Core::Context()) const; /** diff --git a/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/list_keys_single_page_result.hpp b/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/list_keys_single_page_result.hpp index 5502858ac..8267d79c7 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/list_keys_single_page_result.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/list_keys_single_page_result.hpp @@ -28,10 +28,10 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { * @brief Define a single page to list the keys from the Key Vault. * */ - class KeyPropertiesSinglePage : public Azure::Core::PagedResponse { + class KeyPropertiesPageResult : public Azure::Core::PagedResponse { private: friend class KeyClient; - friend class Azure::Core::PagedResponse; + friend class Azure::Core::PagedResponse; std::string m_keyName; std::shared_ptr m_keyClient; @@ -42,15 +42,15 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { * * @remark The constructor is private and only a key client or PagedResponse can init this. * - * @param keyProperties A previously created #KeyPropertiesSinglePage that is used to init this + * @param keyProperties A previously created #KeyPropertiesPageResult that is used to init this * instance. - * @param rawResponse The Http raw response from where the #KeyPropertiesSinglePage was parsed. + * @param rawResponse The Http raw response from where the #KeyPropertiesPageResult was parsed. * @param keyClient A key client required for getting the next pages. * @param keyName When \p keyName is set, the response is listing key versions. Otherwise, the * response is for listing keys from the Key Vault. */ - KeyPropertiesSinglePage( - KeyPropertiesSinglePage&& keyProperties, + KeyPropertiesPageResult( + KeyPropertiesPageResult&& keyProperties, std::unique_ptr rawResponse, std::shared_ptr keyClient, std::string const& keyName = std::string()) @@ -64,7 +64,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { * @brief Construct a new key properties object. * */ - KeyPropertiesSinglePage() = default; + KeyPropertiesPageResult() = default; /** * @brief Each #KeyProperties represent a Key in the Key Vault. @@ -77,10 +77,10 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { * @brief Define a single page containing the deleted keys from the Key Vault. * */ - class DeletedKeySinglePage : public Azure::Core::PagedResponse { + class DeletedKeyPageResult : public Azure::Core::PagedResponse { private: friend class KeyClient; - friend class Azure::Core::PagedResponse; + friend class Azure::Core::PagedResponse; std::shared_ptr m_keyClient; void OnNextPage(const Azure::Core::Context& context); @@ -90,15 +90,15 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { * * @remark The constructor is private and only a key client or PagedResponse can init this. * - * @param deletedKeyProperties A previously created #DeletedKeySinglePage that is used to init + * @param deletedKeyProperties A previously created #DeletedKeyPageResult that is used to init * this new instance. - * @param rawResponse The Http raw response from where the #DeletedKeySinglePage was parsed. + * @param rawResponse The Http raw response from where the #DeletedKeyPageResult was parsed. * @param keyClient A key client required for getting the next pages. * @param keyName When \p keyName is set, the response is listing key versions. Otherwise, the * response is for listing keys from the Key Vault. */ - DeletedKeySinglePage( - DeletedKeySinglePage&& deletedKeyProperties, + DeletedKeyPageResult( + DeletedKeyPageResult&& deletedKeyProperties, std::unique_ptr rawResponse, std::shared_ptr keyClient) : m_keyClient(keyClient), Items(std::move(deletedKeyProperties.Items)) @@ -111,7 +111,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { * @brief Construct a new Deleted Key Single Page object * */ - DeletedKeySinglePage() = default; + DeletedKeyPageResult() = default; /** * @brief Each #DeletedKey represent a deleted key in the Key Vault. @@ -121,29 +121,28 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { }; /** - * @brief The options for calling an operation #GetPropertiesOfKeysSinglePage. + * @brief The options for calling an operation #GetPropertiesOfKeys. * */ - struct GetPropertiesOfKeysSinglePageOptions - : public Azure::Security::KeyVault::_internal::GetSinglePageOptions + struct GetPropertiesOfKeysOptions + : public Azure::Security::KeyVault::_internal::GetPageResultOptions { }; /** - * @brief The options for calling an operation #GetPropertiesOfKeyVersionsSinglePage. + * @brief The options for calling an operation #GetPropertiesOfKeyVersions. * */ - struct GetPropertiesOfKeyVersionsSinglePageOptions - : public Azure::Security::KeyVault::_internal::GetSinglePageOptions + struct GetPropertiesOfKeyVersionsOptions + : public Azure::Security::KeyVault::_internal::GetPageResultOptions { }; /** - * @brief The options for calling an operation #GetDeletedKeysSinglePage. + * @brief The options for calling an operation #GetDeletedKeys. * */ - struct GetDeletedKeysSinglePageOptions - : public Azure::Security::KeyVault::_internal::GetSinglePageOptions + struct GetDeletedKeysOptions : public Azure::Security::KeyVault::_internal::GetPageResultOptions { }; }}}} // namespace Azure::Security::KeyVault::Keys diff --git a/sdk/keyvault/azure-security-keyvault-keys/samples/sample3_get_keys.md b/sdk/keyvault/azure-security-keyvault-keys/samples/sample3_get_keys.md index 3308fd656..039f75e7a 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/samples/sample3_get_keys.md +++ b/sdk/keyvault/azure-security-keyvault-keys/samples/sample3_get_keys.md @@ -51,9 +51,9 @@ Let's list the keys and print their types. List operations don't return the actu So, for each returned key we call GetKey to get the actual key. ```cpp Snippet:KeysSample3ListKeys -for (auto keysSinglePage = keyClient.GetPropertiesOfKeysSinglePage().ExtractValue();;) +for (auto keys = keyClient.GetPropertiesOfKeys().ExtractValue();;) { - for (auto const& key : keysSinglePage.Items) + for (auto const& key : keys.Items) { if (key.Managed) { @@ -65,16 +65,16 @@ for (auto keysSinglePage = keyClient.GetPropertiesOfKeysSinglePage().ExtractValu << std::endl; } - if (!keysSinglePage.ContinuationToken.HasValue()) + if (!keys.ContinuationToken.HasValue()) { // No more pages for the response, break the loop break; } // Get the next page - GetPropertiesOfKeysSinglePageOptions options; - options.ContinuationToken = keysSinglePage.ContinuationToken.GetValue(); - keysSinglePage = keyClient.GetPropertiesOfKeysSinglePage(options).ExtractValue(); + GetPropertiesOfKeysOptions options; + options.ContinuationToken = keys.ContinuationToken.GetValue(); + keys = keyClient.GetPropertiesOfKeys(options).ExtractValue(); } ``` @@ -97,26 +97,26 @@ You need to check all the different versions cloud RSA key had previously. Lets print all the versions of this key. ```cpp Snippet:KeysSample3ListKeyVersions -for (auto keyVersionsSinglePage - = keyClient.GetPropertiesOfKeyVersionsSinglePage(rsaKeyName).ExtractValue(); +for (auto keyVersions + = keyClient.GetPropertiesOfKeyVersions(rsaKeyName).ExtractValue(); ;) { - for (auto const& key : keyVersionsSinglePage.Items) + for (auto const& key : keyVersions.Items) { std::cout << "Key's version: " << key.Version << " with name: " << key.Name << std::endl; } - if (!keyVersionsSinglePage.ContinuationToken.HasValue()) + if (!keyVersions.ContinuationToken.HasValue()) { // No more pages for the response, break the loop break; } // Get the next page - GetPropertiesOfKeyVersionsSinglePageOptions options; - options.ContinuationToken = keyVersionsSinglePage.ContinuationToken.GetValue(); - keyVersionsSinglePage - = keyClient.GetPropertiesOfKeyVersionsSinglePage(rsaKeyName, options).ExtractValue(); + GetPropertiesOfKeyVersionsOptions options; + options.ContinuationToken = keyVersions.ContinuationToken.GetValue(); + keyVersions + = keyClient.GetPropertiesOfKeyVersions(rsaKeyName, options).ExtractValue(); } ``` @@ -140,7 +140,7 @@ You can list all the deleted and non-purged keys, assuming Azure Key Vault is so ```cpp Snippet:KeysSample3ListDeletedKeys nextPage = true; -for (auto keysDeletedPage = keyClient.GetDeletedKeysSinglePage().ExtractValue();;) +for (auto keysDeletedPage = keyClient.GetDeletedKeys().ExtractValue();;) { for (auto const& key : keysDeletedPage.Items) { @@ -156,9 +156,9 @@ for (auto keysDeletedPage = keyClient.GetDeletedKeysSinglePage().ExtractValue(); } // Get the next page - GetDeletedKeysSinglePageOptions options; + GetDeletedKeysOptions options; options.ContinuationToken = keysDeletedPage.ContinuationToken.GetValue(); - keysDeletedPage = keyClient.GetDeletedKeysSinglePage(options).ExtractValue(); + keysDeletedPage = keyClient.GetDeletedKeys(options).ExtractValue(); } ``` diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/key_client.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/key_client.cpp index 4ed46b811..b3533d9f8 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/key_client.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/key_client.cpp @@ -30,7 +30,7 @@ struct RequestWithContinuationToken }; static inline RequestWithContinuationToken BuildRequestFromContinuationToken( - Azure::Security::KeyVault::_internal::GetSinglePageOptions const& options, + Azure::Security::KeyVault::_internal::GetPageResultOptions const& options, std::vector&& defaultPath) { RequestWithContinuationToken request; @@ -155,45 +155,45 @@ Azure::Response KeyClient::CreateOctKey( {_detail::KeysPath, keyName, "create"}); } -KeyPropertiesSinglePage KeyClient::GetPropertiesOfKeysSinglePage( - GetPropertiesOfKeysSinglePageOptions const& options, +KeyPropertiesPageResult KeyClient::GetPropertiesOfKeys( + GetPropertiesOfKeysOptions const& options, Azure::Core::Context const& context) const { auto const request = BuildRequestFromContinuationToken(options, {_detail::KeysPath}); - auto response = m_pipeline->SendRequest( + auto response = m_pipeline->SendRequest( context, Azure::Core::Http::HttpMethod::Get, [](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyPropertiesSinglePageSerializer::KeyPropertiesSinglePageDeserialize( + return _detail::KeyPropertiesPageResultSerializer::KeyPropertiesPageResultDeserialize( rawResponse); }, request.Path, request.Query); - return KeyPropertiesSinglePage( + return KeyPropertiesPageResult( std::move(response.Value), std::move(response.RawResponse), std::make_unique(*this)); } -KeyPropertiesSinglePage KeyClient::GetPropertiesOfKeyVersionsSinglePage( +KeyPropertiesPageResult KeyClient::GetPropertiesOfKeyVersions( std::string const& name, - GetPropertiesOfKeyVersionsSinglePageOptions const& options, + GetPropertiesOfKeyVersionsOptions const& options, Azure::Core::Context const& context) const { auto const request = BuildRequestFromContinuationToken(options, {_detail::KeysPath, name, "versions"}); - auto response = m_pipeline->SendRequest( + auto response = m_pipeline->SendRequest( context, Azure::Core::Http::HttpMethod::Get, [](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyPropertiesSinglePageSerializer::KeyPropertiesSinglePageDeserialize( + return _detail::KeyPropertiesPageResultSerializer::KeyPropertiesPageResultDeserialize( rawResponse); }, request.Path, request.Query); - return KeyPropertiesSinglePage( + return KeyPropertiesPageResult( std::move(response.Value), std::move(response.RawResponse), std::make_unique(*this), @@ -265,22 +265,22 @@ Azure::Response KeyClient::GetDeletedKey( {_detail::DeletedKeysPath, name}); } -DeletedKeySinglePage KeyClient::GetDeletedKeysSinglePage( - GetDeletedKeysSinglePageOptions const& options, +DeletedKeyPageResult KeyClient::GetDeletedKeys( + GetDeletedKeysOptions const& options, Azure::Core::Context const& context) const { auto const request = BuildRequestFromContinuationToken(options, {_detail::DeletedKeysPath}); - auto response = m_pipeline->SendRequest( + auto response = m_pipeline->SendRequest( context, Azure::Core::Http::HttpMethod::Get, [](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyPropertiesSinglePageSerializer::DeletedKeySinglePageDeserialize( + return _detail::KeyPropertiesPageResultSerializer::DeletedKeyPageResultDeserialize( rawResponse); }, request.Path, request.Query); - return DeletedKeySinglePage( + return DeletedKeyPageResult( std::move(response.Value), std::move(response.RawResponse), std::make_unique(*this)); diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/list_keys_single_page_result.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/list_keys_single_page_result.cpp index b689b42da..7cc36b710 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/list_keys_single_page_result.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/list_keys_single_page_result.cpp @@ -17,11 +17,11 @@ using namespace Azure::Security::KeyVault::Keys; using namespace Azure::Core::Json::_internal; using Azure::Security::KeyVault::_internal::UnixTimeConverter; -KeyPropertiesSinglePage -_detail::KeyPropertiesSinglePageSerializer::KeyPropertiesSinglePageDeserialize( +KeyPropertiesPageResult +_detail::KeyPropertiesPageResultSerializer::KeyPropertiesPageResultDeserialize( Azure::Core::Http::RawResponse const& rawResponse) { - KeyPropertiesSinglePage result; + KeyPropertiesPageResult result; auto const& body = rawResponse.GetBody(); auto jsonParser = json::parse(body); @@ -84,15 +84,15 @@ _detail::KeyPropertiesSinglePageSerializer::KeyPropertiesSinglePageDeserialize( return result; } -DeletedKeySinglePage _detail::KeyPropertiesSinglePageSerializer::DeletedKeySinglePageDeserialize( +DeletedKeyPageResult _detail::KeyPropertiesPageResultSerializer::DeletedKeyPageResultDeserialize( Azure::Core::Http::RawResponse const& rawResponse) { auto const& body = rawResponse.GetBody(); auto jsonParser = Azure::Core::Json::_internal::json::parse(body); - DeletedKeySinglePage deletedKeySinglePage; + DeletedKeyPageResult deletedKeyPageResult; - JsonOptional::SetIfExists(deletedKeySinglePage.NextPageToken, jsonParser, "nextLink"); + JsonOptional::SetIfExists(deletedKeyPageResult.NextPageToken, jsonParser, "nextLink"); auto deletedKeys = jsonParser["value"]; for (auto const& key : deletedKeys) @@ -122,44 +122,44 @@ DeletedKeySinglePage _detail::KeyPropertiesSinglePageSerializer::DeletedKeySingl _detail::ScheduledPurgeDatePropertyName, UnixTimeConverter::UnixTimeToDatetime); - deletedKeySinglePage.Items.emplace_back(deletedKey); + deletedKeyPageResult.Items.emplace_back(deletedKey); } - return deletedKeySinglePage; + return deletedKeyPageResult; } -void DeletedKeySinglePage::OnNextPage(const Azure::Core::Context& context) +void DeletedKeyPageResult::OnNextPage(const Azure::Core::Context& context) { // Before calling `OnNextPage` pagedResponse validates there is a next page, so we are sure // NextPageToken is valid. - GetDeletedKeysSinglePageOptions options; + GetDeletedKeysOptions options; options.NextPageToken = NextPageToken; - *this = m_keyClient->GetDeletedKeysSinglePage(options, context); + *this = m_keyClient->GetDeletedKeys(options, context); CurrentPageToken = options.NextPageToken.Value(); } -void KeyPropertiesSinglePage::OnNextPage(const Azure::Core::Context& context) +void KeyPropertiesPageResult::OnNextPage(const Azure::Core::Context& context) { // Notes // - Before calling `OnNextPage` pagedResponse validates there is a next page, so we are sure // NextPageToken is valid. - // - KeyPropertiesSinglePage is used to list keys from a Key Vault and also to list the key - // versions from a specific key. When KeyPropertiesSinglePage is listing keys, the `m_keyName` - // fields will be empty, but for listing the key versions, the KeyPropertiesSinglePage needs to + // - KeyPropertiesPageResult is used to list keys from a Key Vault and also to list the key + // versions from a specific key. When KeyPropertiesPageResult is listing keys, the `m_keyName` + // fields will be empty, but for listing the key versions, the KeyPropertiesPageResult needs to // keep the name of the key in `m_keyName` because it is required to get more pages. // if (m_keyName.empty()) { - GetPropertiesOfKeysSinglePageOptions options; + GetPropertiesOfKeysOptions options; options.NextPageToken = NextPageToken; - *this = m_keyClient->GetPropertiesOfKeysSinglePage(options, context); + *this = m_keyClient->GetPropertiesOfKeys(options, context); CurrentPageToken = options.NextPageToken.Value(); } else { - GetPropertiesOfKeyVersionsSinglePageOptions options; + GetPropertiesOfKeyVersionsOptions options; options.NextPageToken = NextPageToken; - *this = m_keyClient->GetPropertiesOfKeyVersionsSinglePage(m_keyName, options, context); + *this = m_keyClient->GetPropertiesOfKeyVersions(m_keyName, options, context); CurrentPageToken = options.NextPageToken.Value(); } } diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/samples/sample3-get-keys/sample3_get_keys.cpp b/sdk/keyvault/azure-security-keyvault-keys/test/samples/sample3-get-keys/sample3_get_keys.cpp index 6cfae8770..14e6a34a8 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/samples/sample3-get-keys/sample3_get_keys.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/samples/sample3-get-keys/sample3_get_keys.cpp @@ -56,10 +56,9 @@ int main() keyClient.CreateEcKey(ecKey); std::cout << "\t-List Keys" << std::endl; - for (auto keysSinglePage = keyClient.GetPropertiesOfKeysSinglePage(); keysSinglePage.HasPage(); - keysSinglePage.MoveToNextPage()) + for (auto keys = keyClient.GetPropertiesOfKeys(); keys.HasPage(); keys.MoveToNextPage()) { - for (auto const& key : keysSinglePage.Items) + for (auto const& key : keys.Items) { if (key.Managed) { @@ -80,11 +79,10 @@ int main() // List key versions std::cout << "\t-List Key versions" << std::endl; - for (auto keyVersionsSinglePage = keyClient.GetPropertiesOfKeyVersionsSinglePage(rsaKeyName); - keyVersionsSinglePage.HasPage(); - keyVersionsSinglePage.MoveToNextPage()) + for (auto keyVersions = keyClient.GetPropertiesOfKeyVersions(rsaKeyName); keyVersions.HasPage(); + keyVersions.MoveToNextPage()) { - for (auto const& key : keyVersionsSinglePage.Items) + for (auto const& key : keyVersions.Items) { std::cout << "Key's version: " << key.Version << " with name: " << key.Name << std::endl; } @@ -101,7 +99,7 @@ int main() std::cout << "\t-List Deleted Keys" << std::endl; // Start getting the first page. - for (auto keysDeletedPage = keyClient.GetDeletedKeysSinglePage(); keysDeletedPage.HasPage(); + for (auto keysDeletedPage = keyClient.GetDeletedKeys(); keysDeletedPage.HasPage(); keysDeletedPage.MoveToNextPage()) { for (auto const& key : keysDeletedPage.Items) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp index 670f290b1..9534d79c3 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp @@ -70,7 +70,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam static inline void CleanUpKeyVault(KeyClient const& keyClient) { std::vector deletedKeys; - for (auto keyResponse = keyClient.GetDeletedKeysSinglePage(); keyResponse.HasPage(); + for (auto keyResponse = keyClient.GetDeletedKeys(); keyResponse.HasPage(); keyResponse.MoveToNextPage()) { for (auto& key : keyResponse.Items) @@ -92,8 +92,8 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam static inline void RemoveAllKeysFromVault(KeyClient const& keyClient, bool waitForPurge = true) { std::vector deletedKeys; - GetPropertiesOfKeysSinglePageOptions options; - for (auto keyResponse = keyClient.GetPropertiesOfKeysSinglePage(); keyResponse.HasPage(); + GetPropertiesOfKeysOptions options; + for (auto keyResponse = keyClient.GetPropertiesOfKeys(); keyResponse.HasPage(); keyResponse.MoveToNextPage()) { for (auto& key : keyResponse.Items) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_get_test_live.cpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_get_test_live.cpp index f28050595..b48ea7128 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_get_test_live.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_get_test_live.cpp @@ -52,8 +52,8 @@ TEST_F(KeyVaultClientTest, GetPropertiesOfKeysOnePage) } // Get Key properties std::vector keyPropertiesList; - GetPropertiesOfKeysSinglePageOptions options; - for (auto keyResponse = keyClient.GetPropertiesOfKeysSinglePage(options); keyResponse.HasPage(); + GetPropertiesOfKeysOptions options; + for (auto keyResponse = keyClient.GetPropertiesOfKeys(options); keyResponse.HasPage(); keyResponse.MoveToNextPage()) { for (auto& key : keyResponse.Items) @@ -89,9 +89,8 @@ TEST_F(KeyVaultClientTest, GetKeysVersionsOnePage) } // Get Key versions std::vector keyPropertiesList; - GetPropertiesOfKeyVersionsSinglePageOptions getKeyOptions; - for (auto keyResponse = keyClient.GetPropertiesOfKeyVersionsSinglePage(keyName); - keyResponse.HasPage(); + GetPropertiesOfKeyVersionsOptions getKeyOptions; + for (auto keyResponse = keyClient.GetPropertiesOfKeyVersions(keyName); keyResponse.HasPage(); keyResponse.MoveToNextPage()) { for (auto& key : keyResponse.Items) @@ -141,7 +140,7 @@ TEST_F(KeyVaultClientTest, GetDeletedKeysOnePage) // Get all deleted Keys std::vector deletedKeys; - for (auto keyResponse = keyClient.GetDeletedKeysSinglePage(); keyResponse.HasPage(); + for (auto keyResponse = keyClient.GetDeletedKeys(); keyResponse.HasPage(); keyResponse.MoveToNextPage()) { for (auto& key : keyResponse.Items)