rename types (#2594)

* rename header

* format

* update name

* changelog

* format

* name updates
This commit is contained in:
Victor Vazquez 2021-07-15 10:36:21 -07:00 committed by GitHub
parent e69f6e182a
commit 76fd63b2b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 51 deletions

View File

@ -19,6 +19,8 @@
- Removed the `MaxPageResults` field from `GetPropertiesOfKeysOptions`, `GetPropertiesOfKeyVersionsOptions`, and `GetDeletedKeysOptions`.
- Renamed header `list_keys_single_page_result.hpp` to `list_keys_responses.hpp`.
- Updated `BackupKey()` API return type to `BackupKeyResult` model type.
- Renamed `KeyPropertiesPageResult` to `KeyPropertiesPagedResponse`.
- Renamed `DeletedKeyPageResult` to `DeletedKeyPagedResponse`.
## 4.0.0-beta.3 (2021-06-08)

View File

@ -188,14 +188,14 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
*
* @remark Use \p options to control which page to get. If
* #GetPropertiesOfKeysOptions.NextPageToken is not set, the operation will get the first
* page and it will set the `NextPageToken` from the #KeyPropertiesPageResult as the next
* page and it will set the `NextPageToken` from the #KeyPropertiesPagedResult as the next
* page of the response if there is a next page.
*
* @param options The #GetPropertiesOfKeysOptions object to for setting the operation
* up.
* @param context A #Azure::Core::Context controlling the request lifetime.
*/
KeyPropertiesPageResult GetPropertiesOfKeys(
KeyPropertiesPagedResponse GetPropertiesOfKeys(
GetPropertiesOfKeysOptions const& options = GetPropertiesOfKeysOptions(),
Azure::Core::Context const& context = Azure::Core::Context()) const;
@ -209,7 +209,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
*
* @remark Use \p options to control which page to get. If
* #GetPropertiesOfKeyVersionsOptions.NextPageToken is not set, the operation will get the
* first page and it will set the `NextPageToken` from the #KeyPropertiesPageResult as the
* first page and it will set the `NextPageToken` from the #KeyPropertiesPagedResult as the
* next page of the response if there is a next page.
*
* @param name The name of the key.
@ -217,7 +217,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
* operation up.
* @param context A #Azure::Core::Context controlling the request lifetime.
*/
KeyPropertiesPageResult GetPropertiesOfKeyVersions(
KeyPropertiesPagedResponse GetPropertiesOfKeyVersions(
std::string const& name,
GetPropertiesOfKeyVersionsOptions const& options = GetPropertiesOfKeyVersionsOptions(),
Azure::Core::Context const& context = Azure::Core::Context()) const;
@ -267,14 +267,14 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
*
* @remark Use \p options to control which page to get. If
* #GetDeletedKeysOptions.NextPageToken is not set, the operation will get
* the first page and it will set the `NextPageToken` from the #DeletedKeyPageResult as the
* the first page and it will set the `NextPageToken` from the #DeletedKeyPagedResult as the
* next page of the response if there is a next page.
*
* @param options The #GetDeletedKeysOptions object to for setting the operation up.
* @param context A #Azure::Core::Context controlling the request lifetime.
* @return Azure::Response<DeletedKeyPageResult>
* @return Azure::Response<DeletedKeyPagedResponse>
*/
DeletedKeyPageResult GetDeletedKeys(
DeletedKeyPagedResponse GetDeletedKeys(
GetDeletedKeysOptions const& options = GetDeletedKeysOptions(),
Azure::Core::Context const& context = Azure::Core::Context()) const;

View File

@ -26,10 +26,11 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
* @brief Define a single page to list the keys from the Key Vault.
*
*/
class KeyPropertiesPageResult final : public Azure::Core::PagedResponse<KeyPropertiesPageResult> {
class KeyPropertiesPagedResponse final
: public Azure::Core::PagedResponse<KeyPropertiesPagedResponse> {
private:
friend class KeyClient;
friend class Azure::Core::PagedResponse<KeyPropertiesPageResult>;
friend class Azure::Core::PagedResponse<KeyPropertiesPagedResponse>;
std::string m_keyName;
std::shared_ptr<KeyClient> m_keyClient;
@ -40,15 +41,16 @@ 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 #KeyPropertiesPageResult that is used to init this
* instance.
* @param rawResponse The HTTP raw response from where the #KeyPropertiesPageResult was parsed.
* @param keyProperties A previously created #KeyPropertiesPageResponse that is used to init
* this instance.
* @param rawResponse The HTTP raw response from where the #KeyPropertiesPagedResponse 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.
*/
KeyPropertiesPageResult(
KeyPropertiesPageResult&& keyProperties,
KeyPropertiesPagedResponse(
KeyPropertiesPagedResponse&& keyProperties,
std::unique_ptr<Azure::Core::Http::RawResponse> rawResponse,
std::shared_ptr<KeyClient> keyClient,
std::string const& keyName = std::string())
@ -62,7 +64,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
* @brief Construct a new key properties object.
*
*/
KeyPropertiesPageResult() = default;
KeyPropertiesPagedResponse() = default;
/**
* @brief Each #KeyProperties represent a Key in the Key Vault.
@ -75,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 DeletedKeyPageResult final : public Azure::Core::PagedResponse<DeletedKeyPageResult> {
class DeletedKeyPagedResponse final : public Azure::Core::PagedResponse<DeletedKeyPagedResponse> {
private:
friend class KeyClient;
friend class Azure::Core::PagedResponse<DeletedKeyPageResult>;
friend class Azure::Core::PagedResponse<DeletedKeyPagedResponse>;
std::shared_ptr<KeyClient> m_keyClient;
void OnNextPage(const Azure::Core::Context& context);
@ -88,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 #DeletedKeyPageResult that is used to init
* this new instance.
* @param rawResponse The HTTP raw response from where the #DeletedKeyPageResult was parsed.
* @param deletedKeyProperties A previously created #DeletedKeyPagedResponse that is used to
* init this new instance.
* @param rawResponse The HTTP raw response from where the #DeletedKeyPagedResponse 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.
*/
DeletedKeyPageResult(
DeletedKeyPageResult&& deletedKeyProperties,
DeletedKeyPagedResponse(
DeletedKeyPagedResponse&& deletedKeyProperties,
std::unique_ptr<Azure::Core::Http::RawResponse> rawResponse,
std::shared_ptr<KeyClient> keyClient)
: m_keyClient(keyClient), Items(std::move(deletedKeyProperties.Items))
@ -109,7 +111,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
* @brief Construct a new Deleted Key Single Page object
*
*/
DeletedKeyPageResult() = default;
DeletedKeyPagedResponse() = default;
/**
* @brief Each #DeletedKey represent a deleted key in the Key Vault.

View File

@ -187,45 +187,45 @@ Azure::Response<KeyVaultKey> KeyClient::CreateOctKey(
{_detail::KeysPath, keyName, "create"});
}
KeyPropertiesPageResult KeyClient::GetPropertiesOfKeys(
KeyPropertiesPagedResponse KeyClient::GetPropertiesOfKeys(
GetPropertiesOfKeysOptions const& options,
Azure::Core::Context const& context) const
{
auto const request = BuildRequestFromContinuationToken(options, {_detail::KeysPath});
auto response = m_pipeline->SendRequest<KeyPropertiesPageResult>(
auto response = m_pipeline->SendRequest<KeyPropertiesPagedResponse>(
context,
Azure::Core::Http::HttpMethod::Get,
[](Azure::Core::Http::RawResponse const& rawResponse) {
return _detail::KeyPropertiesPageResultSerializer::KeyPropertiesPageResultDeserialize(
return _detail::KeyPropertiesPagedResultSerializer::KeyPropertiesPagedResultDeserialize(
rawResponse);
},
request.Path,
request.Query);
return KeyPropertiesPageResult(
return KeyPropertiesPagedResponse(
std::move(response.Value),
std::move(response.RawResponse),
std::make_unique<KeyClient>(*this));
}
KeyPropertiesPageResult KeyClient::GetPropertiesOfKeyVersions(
KeyPropertiesPagedResponse KeyClient::GetPropertiesOfKeyVersions(
std::string const& name,
GetPropertiesOfKeyVersionsOptions const& options,
Azure::Core::Context const& context) const
{
auto const request
= BuildRequestFromContinuationToken(options, {_detail::KeysPath, name, "versions"});
auto response = m_pipeline->SendRequest<KeyPropertiesPageResult>(
auto response = m_pipeline->SendRequest<KeyPropertiesPagedResponse>(
context,
Azure::Core::Http::HttpMethod::Get,
[](Azure::Core::Http::RawResponse const& rawResponse) {
return _detail::KeyPropertiesPageResultSerializer::KeyPropertiesPageResultDeserialize(
return _detail::KeyPropertiesPagedResultSerializer::KeyPropertiesPagedResultDeserialize(
rawResponse);
},
request.Path,
request.Query);
return KeyPropertiesPageResult(
return KeyPropertiesPagedResponse(
std::move(response.Value),
std::move(response.RawResponse),
std::make_unique<KeyClient>(*this),
@ -275,22 +275,22 @@ Azure::Response<DeletedKey> KeyClient::GetDeletedKey(
{_detail::DeletedKeysPath, name});
}
DeletedKeyPageResult KeyClient::GetDeletedKeys(
DeletedKeyPagedResponse KeyClient::GetDeletedKeys(
GetDeletedKeysOptions const& options,
Azure::Core::Context const& context) const
{
auto const request = BuildRequestFromContinuationToken(options, {_detail::DeletedKeysPath});
auto response = m_pipeline->SendRequest<DeletedKeyPageResult>(
auto response = m_pipeline->SendRequest<DeletedKeyPagedResponse>(
context,
Azure::Core::Http::HttpMethod::Get,
[](Azure::Core::Http::RawResponse const& rawResponse) {
return _detail::KeyPropertiesPageResultSerializer::DeletedKeyPageResultDeserialize(
return _detail::KeyPropertiesPagedResultSerializer::DeletedKeyPagedResultDeserialize(
rawResponse);
},
request.Path,
request.Query);
return DeletedKeyPageResult(
return DeletedKeyPagedResponse(
std::move(response.Value),
std::move(response.RawResponse),
std::make_unique<KeyClient>(*this));

View File

@ -14,13 +14,13 @@
using namespace Azure::Security::KeyVault::Keys;
using namespace Azure::Core::Json::_internal;
KeyPropertiesPageResult
_detail::KeyPropertiesPageResultSerializer::KeyPropertiesPageResultDeserialize(
KeyPropertiesPagedResponse
_detail::KeyPropertiesPagedResultSerializer::KeyPropertiesPagedResultDeserialize(
Azure::Core::Http::RawResponse const& rawResponse)
{
using Azure::Core::_internal::PosixTimeConverter;
KeyPropertiesPageResult result;
KeyPropertiesPagedResponse result;
auto const& body = rawResponse.GetBody();
auto jsonParser = json::parse(body);
@ -83,7 +83,8 @@ _detail::KeyPropertiesPageResultSerializer::KeyPropertiesPageResultDeserialize(
return result;
}
DeletedKeyPageResult _detail::KeyPropertiesPageResultSerializer::DeletedKeyPageResultDeserialize(
DeletedKeyPagedResponse
_detail::KeyPropertiesPagedResultSerializer::DeletedKeyPagedResultDeserialize(
Azure::Core::Http::RawResponse const& rawResponse)
{
using Azure::Core::_internal::PosixTimeConverter;
@ -91,9 +92,9 @@ DeletedKeyPageResult _detail::KeyPropertiesPageResultSerializer::DeletedKeyPageR
auto const& body = rawResponse.GetBody();
auto jsonParser = Azure::Core::Json::_internal::json::parse(body);
DeletedKeyPageResult deletedKeyPageResult;
DeletedKeyPagedResponse deletedKeyPagedResult;
JsonOptional::SetIfExists(deletedKeyPageResult.NextPageToken, jsonParser, "nextLink");
JsonOptional::SetIfExists(deletedKeyPagedResult.NextPageToken, jsonParser, "nextLink");
auto deletedKeys = jsonParser["value"];
for (auto const& key : deletedKeys)
@ -123,13 +124,13 @@ DeletedKeyPageResult _detail::KeyPropertiesPageResultSerializer::DeletedKeyPageR
_detail::ScheduledPurgeDatePropertyName,
PosixTimeConverter::PosixTimeToDateTime);
deletedKeyPageResult.Items.emplace_back(deletedKey);
deletedKeyPagedResult.Items.emplace_back(deletedKey);
}
return deletedKeyPageResult;
return deletedKeyPagedResult;
}
void DeletedKeyPageResult::OnNextPage(const Azure::Core::Context& context)
void DeletedKeyPagedResponse::OnNextPage(const Azure::Core::Context& context)
{
// Before calling `OnNextPage` pagedResponse validates there is a next page, so we are sure
// NextPageToken is valid.
@ -139,14 +140,14 @@ void DeletedKeyPageResult::OnNextPage(const Azure::Core::Context& context)
CurrentPageToken = options.NextPageToken.Value();
}
void KeyPropertiesPageResult::OnNextPage(const Azure::Core::Context& context)
void KeyPropertiesPagedResponse::OnNextPage(const Azure::Core::Context& context)
{
// Notes
// - Before calling `OnNextPage` pagedResponse validates there is a next page, so we are sure
// NextPageToken is valid.
// - 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
// - KeyPropertiesPagedResponse is used to list keys from a Key Vault and also to list the key
// versions from a specific key. When KeyPropertiesPagedResponse is listing keys, the `m_keyName`
// fields will be empty, but for listing the key versions, the KeyPropertiesPagedResponse needs to
// keep the name of the key in `m_keyName` because it is required to get more pages.
//
if (m_keyName.empty())

View File

@ -97,11 +97,11 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam
};
/**************** Key Properties ************/
struct KeyPropertiesPageResultSerializer final
struct KeyPropertiesPagedResultSerializer final
{
static KeyPropertiesPageResult KeyPropertiesPageResultDeserialize(
static KeyPropertiesPagedResponse KeyPropertiesPagedResultDeserialize(
Azure::Core::Http::RawResponse const& rawResponse);
static DeletedKeyPageResult DeletedKeyPageResultDeserialize(
static DeletedKeyPagedResponse DeletedKeyPagedResultDeserialize(
Azure::Core::Http::RawResponse const& rawResponse);
};