diff --git a/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_deleted_secret.hpp b/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_deleted_secret.hpp index 17e0f26e4..a0ed0a852 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_deleted_secret.hpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_deleted_secret.hpp @@ -15,7 +15,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @brief A Deleted Secret consisting of its previous id, attributes and its tags, * as well as information on when it will be purged. */ - struct KeyVaultDeletedSecret : public KeyVaultSecret + struct DeletedSecret : public Secret { /** * @brief A Deleted Secret consisting of its previous id, attributes and its tags, @@ -36,13 +36,13 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { /** * @brief Default constructor. */ - KeyVaultDeletedSecret() = default; + DeletedSecret() = default; /** * @brief Constructor. * * @param name Name of the deleted secret. */ - KeyVaultDeletedSecret(std::string name) : KeyVaultSecret(std::move(name)) {} + DeletedSecret(std::string name) : Secret(std::move(name)) {} }; }}}} // namespace Azure::Security::KeyVault::Secrets diff --git a/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_operations.hpp b/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_operations.hpp index 884e4aa07..ca0f74178 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_operations.hpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_operations.hpp @@ -20,16 +20,15 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { /** * @brief Represents a long running operation to restore a deleted secret. */ - class KeyVaultRestoreDeletedSecretOperation final - : public Azure::Core::Operation { + class RestoreDeletedSecretOperation final : public Azure::Core::Operation { private: friend class SecretClient; std::shared_ptr m_secretClient; - KeyVaultSecret m_value; + Secret m_value; std::string m_continuationToken; - Azure::Response PollUntilDoneInternal( + Azure::Response PollUntilDoneInternal( std::chrono::milliseconds period, Azure::Core::Context& context) override; @@ -42,11 +41,11 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * * Since C++ doesn't offer `internal` access, we use friends-only instead. */ - KeyVaultRestoreDeletedSecretOperation( + RestoreDeletedSecretOperation( std::shared_ptr secretClient, - Azure::Response response); + Azure::Response response); - KeyVaultRestoreDeletedSecretOperation( + RestoreDeletedSecretOperation( std::string resumeToken, std::shared_ptr secretClient); @@ -62,11 +61,11 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { public: /** - * @brief Get the #Azure::Security::KeyVault::Secrets::KeyVaultSecret object. + * @brief Get the #Azure::Security::KeyVault::Secrets::Secret object. * - * @return A KeyVaultSecret object. + * @return A Secret object. */ - KeyVaultSecret Value() const override { return m_value; } + Secret Value() const override { return m_value; } /** * @brief Get an Url as string which can be used to get the status of the operation. @@ -76,7 +75,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { std::string GetResumeToken() const override { return m_continuationToken; } /** - * @brief Create a #KeyVaultRestoreDeletedSecretOperation from the \p resumeToken fetched from + * @brief Create a #RestoreDeletedSecretOperation from the \p resumeToken fetched from * another `Operation`, updated to the the latest operation status. * * @remark After the operation is initialized, it is used to poll the last update from the @@ -86,9 +85,9 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * operation. * @param client A #secretClient that is used for getting status updates. * @param context A #Azure::Core::Context controlling the request lifetime. - * @return KeyVaultRestoreDeletedSecretOperation + * @return RestoreDeletedSecretOperation */ - static KeyVaultRestoreDeletedSecretOperation CreateFromResumeToken( + static RestoreDeletedSecretOperation CreateFromResumeToken( std::string const& resumeToken, SecretClient const& client, Azure::Core::Context const& context = Azure::Core::Context()); @@ -97,15 +96,15 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { /** * @brief Represents a delete secret long running operation */ - class KeyVaultDeleteSecretOperation final : public Azure::Core::Operation { + class DeleteSecretOperation final : public Azure::Core::Operation { private: friend class SecretClient; std::shared_ptr m_secretClient; - KeyVaultDeletedSecret m_value; + DeletedSecret m_value; std::string m_continuationToken; - Azure::Response PollUntilDoneInternal( + Azure::Response PollUntilDoneInternal( std::chrono::milliseconds period, Azure::Core::Context& context) override; @@ -118,13 +117,11 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * * Since C++ doesn't offer `internal` access, we use friends-only instead. */ - KeyVaultDeleteSecretOperation( + DeleteSecretOperation( std::shared_ptr secretClient, - Azure::Response response); + Azure::Response response); - KeyVaultDeleteSecretOperation( - std::string resumeToken, - std::shared_ptr secretClient); + DeleteSecretOperation(std::string resumeToken, std::shared_ptr secretClient); /** * @brief Get the #Azure::Core::Http::RawResponse of the operation request. @@ -138,13 +135,13 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { public: /** - * @brief Get the #Azure::Security::KeyVault::Secrets::KeyVaultDeletedSecret object. + * @brief Get the #Azure::Security::KeyVault::Secrets::DeletedSecret object. * * @remark The deleted secret contains the recovery id if the key can be recovered. * * @return A deleted secret object. */ - KeyVaultDeletedSecret Value() const override { return m_value; } + DeletedSecret Value() const override { return m_value; } /** * @brief Get an Url as string which can be used to get the status of the delete secret @@ -155,7 +152,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { std::string GetResumeToken() const override { return m_continuationToken; } /** - * @brief Create a #KeyVaultDeleteSecretOperation from the \p resumeToken fetched from another + * @brief Create a #DeleteSecretOperation from the \p resumeToken fetched from another * `Operation`, updated to the the latest operation status. * * @remark After the operation is initialized, it is used to poll the last update from the @@ -165,9 +162,9 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * operation. * @param client A #secretClient that is used for getting status updates. * @param context A #Azure::Core::Context controlling the request lifetime. - * @return KeyVaultDeleteSecretOperation + * @return DeleteSecretOperation */ - static KeyVaultDeleteSecretOperation CreateFromResumeToken( + static DeleteSecretOperation CreateFromResumeToken( std::string const& resumeToken, SecretClient const& client, Azure::Core::Context const& context = Azure::Core::Context()); diff --git a/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_secret.hpp b/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_secret.hpp index f28bccc04..dbb1c2123 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_secret.hpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_secret.hpp @@ -10,7 +10,7 @@ #include "azure/keyvault/secrets/keyvault_secret_properties.hpp" namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { - struct KeyVaultSecret + struct Secret { /** * @brief The name of the secret. @@ -34,21 +34,21 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @brief The secret Properties bundle. * */ - KeyvaultSecretProperties Properties; + SecretProperties Properties; /** - * @brief Construct a new KeyVaultSecret object. + * @brief Construct a new Secret object. * */ - KeyVaultSecret() = default; + Secret() = default; /** - * @brief Construct a new KeyVaultSecret object. + * @brief Construct a new Secret object. * * @param name The name of the secret. * @param value The name of the secret. */ - KeyVaultSecret(std::string const& name, std::string const& value) + Secret(std::string const& name, std::string const& value) : Name(name), Value(value), Properties(name) { if (Name.empty()) @@ -63,7 +63,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { }; private: - KeyVaultSecret(std::string name) : Name(std::move(name)) + Secret(std::string name) : Name(std::move(name)) { if (Name.empty()) { @@ -71,7 +71,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { } } - friend struct KeyVaultDeletedSecret; + friend struct DeletedSecret; }; }}}} // namespace Azure::Security::KeyVault::Secrets diff --git a/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_secret_paged_response.hpp b/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_secret_paged_response.hpp index 8b68134ec..a67f7459b 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_secret_paged_response.hpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_secret_paged_response.hpp @@ -23,19 +23,18 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @brief Define a single page to list the secrets from the Key Vault. * */ - class KeyVaultSecretPropertiesPagedResponse final - : public Azure::Core::PagedResponse { + class SecretPropertiesPagedResponse final : public Azure::Core::PagedResponse { private: friend class SecretClient; - friend class Azure::Core::PagedResponse; + friend class Azure::Core::PagedResponse; std::string m_secretName; std::shared_ptr m_secretClient; void OnNextPage(const Azure::Core::Context& context); - KeyVaultSecretPropertiesPagedResponse( - KeyVaultSecretPropertiesPagedResponse&& secretProperties, + SecretPropertiesPagedResponse( + SecretPropertiesPagedResponse&& secretProperties, std::unique_ptr rawResponse, std::shared_ptr secretClient, std::string const& secretName = std::string()) @@ -47,33 +46,33 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { public: /** - * @brief Construct a new KeyVaultSecretPropertiesPagedResponse object. + * @brief Construct a new SecretPropertiesPagedResponse object. * */ - KeyVaultSecretPropertiesPagedResponse() = default; + SecretPropertiesPagedResponse() = default; /** - * @brief Each #KeyvaultSecretProperties represent a Secret in the Key Vault. + * @brief Each #SecretProperties represent a Secret in the Key Vault. * */ - std::vector Items; + std::vector Items; }; /** * @brief Define a single page containing the deleted keys from the Key Vault. * */ - class KeyvaultSecretDeletedSecretPagedResponse final - : public Azure::Core::PagedResponse { + class DeletedSecretPagedResponse final + : public Azure::Core::PagedResponse { private: friend class SecretClient; - friend class Azure::Core::PagedResponse; + friend class Azure::Core::PagedResponse; std::shared_ptr m_secretClient; void OnNextPage(const Azure::Core::Context& context); - KeyvaultSecretDeletedSecretPagedResponse( - KeyvaultSecretDeletedSecretPagedResponse&& deletedKeyProperties, + DeletedSecretPagedResponse( + DeletedSecretPagedResponse&& deletedKeyProperties, std::unique_ptr rawResponse, std::shared_ptr secretClient) : PagedResponse(std::move(deletedKeyProperties)), m_secretClient(secretClient), @@ -87,12 +86,12 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @brief Construct a new Deleted Key Single Page object * */ - KeyvaultSecretDeletedSecretPagedResponse() = default; + DeletedSecretPagedResponse() = default; /** * @brief Each #DeletedKey represent a deleted key in the Key Vault. * */ - std::vector Items; + std::vector Items; }; }}}} // namespace Azure::Security::KeyVault::Secrets diff --git a/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_secret_properties.hpp b/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_secret_properties.hpp index 6e42f44bd..5b04bfd6c 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_secret_properties.hpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/keyvault_secret_properties.hpp @@ -19,7 +19,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @brief The Secret attributes managed by the KeyVault service. * */ - struct KeyvaultSecretProperties final + struct SecretProperties final { /** @@ -122,13 +122,13 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @brief Construct a new secret Properties object. * */ - KeyvaultSecretProperties() = default; + SecretProperties() = default; /** * @brief Construct a new secret Properties object. * */ - KeyvaultSecretProperties(std::string const& name) : Name(name) + SecretProperties(std::string const& name) : Name(name) { if (Name.empty()) { diff --git a/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/secret_client.hpp b/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/secret_client.hpp index ce3876553..f4c046351 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/secret_client.hpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/inc/azure/keyvault/secrets/secret_client.hpp @@ -84,7 +84,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @param context The context for the operation can be used for request cancellation. * @return The Secret wrapped in the Response. */ - Azure::Response GetSecret( + Azure::Response GetSecret( std::string const& name, GetSecretOptions const& options = GetSecretOptions(), Azure::Core::Context const& context = Azure::Core::Context()) const; @@ -99,7 +99,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * * @return The Secret wrapped in the Response. */ - Azure::Response GetDeletedSecret( + Azure::Response GetDeletedSecret( std::string const& name, Azure::Core::Context const& context = Azure::Core::Context()) const; @@ -112,7 +112,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @param context The context for the operation can be used for request cancellation. * @return The Secret wrapped in the Response. */ - Azure::Response SetSecret( + Azure::Response SetSecret( std::string const& name, std::string const& value, Azure::Core::Context const& context = Azure::Core::Context()) const; @@ -126,9 +126,9 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @param context The context for the operation can be used for request cancellation. * @return The Secret wrapped in the Response. */ - Azure::Response SetSecret( + Azure::Response SetSecret( std::string const& name, - KeyVaultSecret const& secret, + Secret const& secret, Azure::Core::Context const& context = Azure::Core::Context()) const; /** @@ -145,10 +145,10 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * * @return The Secret wrapped in the Response. */ - Azure::Response UpdateSecretProperties( + Azure::Response UpdateSecretProperties( std::string const& name, UpdateSecretPropertiesOptions const& options, - KeyvaultSecretProperties const& properties, + SecretProperties const& properties, Azure::Core::Context const& context = Azure::Core::Context()) const; /** @@ -165,10 +165,10 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * * @return The Secret wrapped in the Response. */ - Azure::Response UpdateSecretProperties( + Azure::Response UpdateSecretProperties( std::string const& name, std::string const& version, - KeyvaultSecretProperties const& properties, + SecretProperties const& properties, Azure::Core::Context const& context = Azure::Core::Context()) const; /** @@ -196,7 +196,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * * @return The Secret wrapped in the Response. */ - Azure::Response RestoreSecretBackup( + Azure::Response RestoreSecretBackup( std::vector const& backup, Azure::Core::Context const& context = Azure::Core::Context()) const; @@ -225,7 +225,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @param name The name of the secret. * @param context The context for the operation can be used for request cancellation. */ - Azure::Security::KeyVault::Secrets::KeyVaultDeleteSecretOperation StartDeleteSecret( + Azure::Security::KeyVault::Secrets::DeleteSecretOperation StartDeleteSecret( std::string const& name, Azure::Core::Context const& context = Azure::Core::Context()) const; @@ -239,8 +239,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @param name The name of the secret. * @param context The context for the operation can be used for request cancellation. */ - Azure::Security::KeyVault::Secrets::KeyVaultRestoreDeletedSecretOperation - StartRecoverDeletedSecret( + Azure::Security::KeyVault::Secrets::RestoreDeletedSecretOperation StartRecoverDeletedSecret( std::string const& name, Azure::Core::Context const& context = Azure::Core::Context()) const; @@ -257,7 +256,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @return Response containing a list of secrets in the vault along with a link to the next page * of secrets. */ - KeyVaultSecretPropertiesPagedResponse GetPropertiesOfSecrets( + SecretPropertiesPagedResponse GetPropertiesOfSecrets( GetPropertiesOfSecretsOptions const& options = GetPropertiesOfSecretsOptions(), Azure::Core::Context const& context = Azure::Core::Context()) const; @@ -273,7 +272,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @return Response containing a list of secrets in the vault along with a link to the next page * of secrets. */ - KeyVaultSecretPropertiesPagedResponse GetPropertiesOfSecretsVersions( + SecretPropertiesPagedResponse GetPropertiesOfSecretsVersions( std::string const& name, GetPropertiesOfSecretVersionsOptions const& options = GetPropertiesOfSecretVersionsOptions(), @@ -290,7 +289,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { * @return Response containing a list of deleted secrets in the vault, along with a link to the * next page of deleted secrets. */ - KeyvaultSecretDeletedSecretPagedResponse GetDeletedSecrets( + DeletedSecretPagedResponse GetDeletedSecrets( GetDeletedSecretsOptions const& options = GetDeletedSecretsOptions(), Azure::Core::Context const& context = Azure::Core::Context()) const; }; diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/keyvault_operations.cpp b/sdk/keyvault/azure-security-keyvault-secrets/src/keyvault_operations.cpp index b930765e9..2fb6c5dc2 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/keyvault_operations.cpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/keyvault_operations.cpp @@ -9,9 +9,9 @@ #include "azure/keyvault/secrets/keyvault_operations.hpp" #include "azure/keyvault/secrets/secret_client.hpp" #include "private/secret_serializers.hpp" -// KeyVaultRestoreDeletedSecretOperation +// RestoreDeletedSecretOperation -Azure::Response KeyVaultRestoreDeletedSecretOperation::PollUntilDoneInternal( +Azure::Response RestoreDeletedSecretOperation::PollUntilDoneInternal( std::chrono::milliseconds period, Azure::Core::Context& context) { @@ -26,11 +26,11 @@ Azure::Response KeyVaultRestoreDeletedSecretOperation::PollUntil std::this_thread::sleep_for(period); } - return Azure::Response( + return Azure::Response( m_value, std::make_unique(*m_rawResponse)); } -std::unique_ptr KeyVaultRestoreDeletedSecretOperation::PollInternal( +std::unique_ptr RestoreDeletedSecretOperation::PollInternal( Azure::Core::Context const& context) { std::unique_ptr rawResponse; @@ -63,16 +63,15 @@ std::unique_ptr KeyVaultRestoreDeletedSecretOper if (m_status == Azure::Core::OperationStatus::Succeeded) { - m_value = _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize( - m_value.Name, *rawResponse); + m_value = _detail::SecretSerializer::Deserialize(m_value.Name, *rawResponse); } } return rawResponse; } -KeyVaultRestoreDeletedSecretOperation::KeyVaultRestoreDeletedSecretOperation( +RestoreDeletedSecretOperation::RestoreDeletedSecretOperation( std::shared_ptr secretClient, - Azure::Response response) + Azure::Response response) : m_secretClient(secretClient) { m_value = response.Value; @@ -87,7 +86,7 @@ KeyVaultRestoreDeletedSecretOperation::KeyVaultRestoreDeletedSecretOperation( } } -KeyVaultRestoreDeletedSecretOperation::KeyVaultRestoreDeletedSecretOperation( +RestoreDeletedSecretOperation::RestoreDeletedSecretOperation( std::string resumeToken, std::shared_ptr secretClient) : m_secretClient(secretClient), m_continuationToken(std::move(resumeToken)) @@ -95,18 +94,17 @@ KeyVaultRestoreDeletedSecretOperation::KeyVaultRestoreDeletedSecretOperation( m_value.Name = resumeToken; } -KeyVaultRestoreDeletedSecretOperation KeyVaultRestoreDeletedSecretOperation::CreateFromResumeToken( +RestoreDeletedSecretOperation RestoreDeletedSecretOperation::CreateFromResumeToken( std::string const& resumeToken, SecretClient const& client, Azure::Core::Context const& context) { - KeyVaultRestoreDeletedSecretOperation operation( - resumeToken, std::make_shared(client)); + RestoreDeletedSecretOperation operation(resumeToken, std::make_shared(client)); operation.Poll(context); return operation; } -// KeyVaultDeleteSecretOperation -Azure::Response KeyVaultDeleteSecretOperation::PollUntilDoneInternal( +// DeleteSecretOperation +Azure::Response DeleteSecretOperation::PollUntilDoneInternal( std::chrono::milliseconds period, Azure::Core::Context& context) { @@ -120,11 +118,11 @@ Azure::Response KeyVaultDeleteSecretOperation::PollUntilD std::this_thread::sleep_for(period); } - return Azure::Response( + return Azure::Response( m_value, std::make_unique(*m_rawResponse)); } -std::unique_ptr KeyVaultDeleteSecretOperation::PollInternal( +std::unique_ptr DeleteSecretOperation::PollInternal( Azure::Core::Context const& context) { std::unique_ptr rawResponse; @@ -156,16 +154,15 @@ std::unique_ptr KeyVaultDeleteSecretOperation::P if (m_status == Azure::Core::OperationStatus::Succeeded) { - m_value = _detail::KeyVaultDeletedSecretSerializer::KeyVaultDeletedSecretDeserialize( - m_value.Name, *rawResponse); + m_value = _detail::DeletedSecretSerializer::Deserialize(m_value.Name, *rawResponse); } } return rawResponse; } -KeyVaultDeleteSecretOperation::KeyVaultDeleteSecretOperation( +DeleteSecretOperation::DeleteSecretOperation( std::shared_ptr secretClient, - Azure::Response response) + Azure::Response response) : m_secretClient(secretClient) { m_value = response.Value; @@ -178,7 +175,7 @@ KeyVaultDeleteSecretOperation::KeyVaultDeleteSecretOperation( } } -KeyVaultDeleteSecretOperation::KeyVaultDeleteSecretOperation( +DeleteSecretOperation::DeleteSecretOperation( std::string resumeToken, std::shared_ptr secretClient) : m_secretClient(secretClient), m_continuationToken(std::move(resumeToken)) @@ -186,12 +183,12 @@ KeyVaultDeleteSecretOperation::KeyVaultDeleteSecretOperation( m_value.Name = resumeToken; } -KeyVaultDeleteSecretOperation KeyVaultDeleteSecretOperation::CreateFromResumeToken( +DeleteSecretOperation DeleteSecretOperation::CreateFromResumeToken( std::string const& resumeToken, SecretClient const& client, Azure::Core::Context const& context) { - KeyVaultDeleteSecretOperation operation(resumeToken, std::make_shared(client)); + DeleteSecretOperation operation(resumeToken, std::make_shared(client)); operation.Poll(context); return operation; } diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/keyvault_secret_paged_response.cpp b/sdk/keyvault/azure-security-keyvault-secrets/src/keyvault_secret_paged_response.cpp index ca99794ee..ff2617ebe 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/keyvault_secret_paged_response.cpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/keyvault_secret_paged_response.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MIT /** * @file - * @brief Defines KeyVaultSecretPropertiesPagedResponse. + * @brief Defines SecretPropertiesPagedResponse. * */ @@ -11,7 +11,7 @@ using namespace Azure::Security::KeyVault::Secrets; -void KeyVaultSecretPropertiesPagedResponse::OnNextPage(const Azure::Core::Context& context) +void SecretPropertiesPagedResponse::OnNextPage(const Azure::Core::Context& context) { // Before calling `OnNextPage` pagedResponse validates there is a next page, so we are sure // NextPageToken is valid. @@ -31,7 +31,7 @@ void KeyVaultSecretPropertiesPagedResponse::OnNextPage(const Azure::Core::Contex } } -void KeyvaultSecretDeletedSecretPagedResponse::OnNextPage(const Azure::Core::Context& context) +void DeletedSecretPagedResponse::OnNextPage(const Azure::Core::Context& context) { // Before calling `OnNextPage` pagedResponse validates there is a next page, so we are sure // NextPageToken is valid. diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/private/secret_serializers.hpp b/sdk/keyvault/azure-security-keyvault-secrets/src/private/secret_serializers.hpp index fdf4ab95c..66d91bfc1 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/private/secret_serializers.hpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/private/secret_serializers.hpp @@ -20,24 +20,21 @@ using namespace Azure::Security::KeyVault::Secrets; namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { namespace _detail { - struct KeyVaultSecretSerializer final + struct SecretSerializer final { // Creates a new key based on a name and an HTTP raw response. - static KeyVaultSecret KeyVaultSecretDeserialize( + static Secret Deserialize( std::string const& name, Azure::Core::Http::RawResponse const& rawResponse); // Create from HTTP raw response only. - static KeyVaultSecret KeyVaultSecretDeserialize( - Azure::Core::Http::RawResponse const& rawResponse); + static Secret Deserialize(Azure::Core::Http::RawResponse const& rawResponse); // Updates a Key based on an HTTP raw response. - static void KeyVaultSecretDeserialize( - KeyVaultSecret& key, - Azure::Core::Http::RawResponse const& rawResponse); + static void Deserialize(Secret& key, Azure::Core::Http::RawResponse const& rawResponse); // Serializes a key vault secret for set action - static std::string KeyVaultSecretSerialize(KeyVaultSecret const& parameters); + static std::string Serialize(Secret const& parameters); // Extract the host out of the URL (with port if available) static std::string GetUrlAuthorityWithScheme(Azure::Core::Url const& url) @@ -56,9 +53,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { } // parse the ID url to extract relevant data - void static inline ParseIDUrl( - KeyvaultSecretProperties& secretProperties, - std::string const& url) + void static inline ParseIDUrl(SecretProperties& secretProperties, std::string const& url) { Azure::Core::Url sid(url); secretProperties.Id = url; @@ -85,50 +80,46 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { } }; - struct KeyVaultDeletedSecretSerializer final + struct DeletedSecretSerializer final { // Creates a new deleted secret based on a name and an HTTP raw response. - static KeyVaultDeletedSecret KeyVaultDeletedSecretDeserialize( + static DeletedSecret Deserialize( std::string const& name, Azure::Core::Http::RawResponse const& rawResponse); // Create deleted secret from HTTP raw response only. - static KeyVaultDeletedSecret KeyVaultDeletedSecretDeserialize( - Azure::Core::Http::RawResponse const& rawResponse); + static DeletedSecret Deserialize(Azure::Core::Http::RawResponse const& rawResponse); // Updates a deleted secret based on an HTTP raw response. - static void KeyVaultDeletedSecretDeserialize( - KeyVaultDeletedSecret& secret, + static void Deserialize( + DeletedSecret& secret, Azure::Core::Http::RawResponse const& rawResponse); }; - struct KeyVaultSecretPropertiesSerializer final + struct SecretPropertiesSerializer final { - static std::string KeyVaultSecretPropertiesSerialize( - KeyvaultSecretProperties const& properties); + static std::string Serialize(SecretProperties const& properties); }; - struct KeyvaultBackupSecretSerializer final + struct BackupSecretSerializer final { - static BackupSecretResult KeyvaultBackupSecretDeserialize( - Azure::Core::Http::RawResponse const& rawResponse); + static BackupSecretResult Deserialize(Azure::Core::Http::RawResponse const& rawResponse); }; - struct KeyvaultRestoreSecretSerializer final + struct RestoreSecretSerializer final { - static std::string KeyvaultRestoreSecretSerialize(std::vector const& backup); + static std::string Serialize(std::vector const& backup); }; - class KeyVaultSecretPropertiesPagedResultSerializer final { + class SecretPropertiesPagedResultSerializer final { public: - static KeyVaultSecretPropertiesPagedResponse KeyVaultSecretPropertiesPagedResponseDeserialize( + static SecretPropertiesPagedResponse Deserialize( Azure::Core::Http::RawResponse const& rawResponse); }; - class KeyVaultSecretDeletedSecretPagedResultSerializer final { + class DeletedSecretPagedResultSerializer final { public: - static KeyvaultSecretDeletedSecretPagedResponse - KeyVaultSecretDeletedSecretPagedResultDeserialize( + static DeletedSecretPagedResponse Deserialize( Azure::Core::Http::RawResponse const& rawResponse); }; }}}}} // namespace Azure::Security::KeyVault::Secrets::_detail diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/secret_client.cpp b/sdk/keyvault/azure-security-keyvault-secrets/src/secret_client.cpp index a25073db8..38b15b6c4 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/secret_client.cpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/secret_client.cpp @@ -77,81 +77,77 @@ SecretClient::SecretClient( options, TelemetryName, apiVersion, std::move(perRetrypolicies), {})); } -Azure::Response SecretClient::GetSecret( +Azure::Response SecretClient::GetSecret( std::string const& name, GetSecretOptions const& options, Azure::Core::Context const& context) const { - return m_protocolClient->SendRequest( + return m_protocolClient->SendRequest( context, Azure::Core::Http::HttpMethod::Get, [&name](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize(name, rawResponse); + return _detail::SecretSerializer::Deserialize(name, rawResponse); }, {_detail::SecretPath, name, options.Version}); } -Azure::Response SecretClient::GetDeletedSecret( +Azure::Response SecretClient::GetDeletedSecret( std::string const& name, Azure::Core::Context const& context) const { - return m_protocolClient->SendRequest( + return m_protocolClient->SendRequest( context, Azure::Core::Http::HttpMethod::Get, [&name](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyVaultDeletedSecretSerializer::KeyVaultDeletedSecretDeserialize( - name, rawResponse); + return _detail::DeletedSecretSerializer::Deserialize(name, rawResponse); }, {_detail::DeletedSecretPath, name}); } -Azure::Response SecretClient::SetSecret( +Azure::Response SecretClient::SetSecret( std::string const& name, std::string const& value, Azure::Core::Context const& context) const { - KeyVaultSecret setParameters(name, value); + Secret setParameters(name, value); return SetSecret(name, setParameters, context); } -Azure::Response SecretClient::SetSecret( +Azure::Response SecretClient::SetSecret( std::string const& name, - KeyVaultSecret const& secret, + Secret const& secret, Azure::Core::Context const& context) const { - return m_protocolClient->SendRequest( + return m_protocolClient->SendRequest( context, Azure::Core::Http::HttpMethod::Put, - [&secret]() { return _detail::KeyVaultSecretSerializer::KeyVaultSecretSerialize(secret); }, + [&secret]() { return _detail::SecretSerializer::Serialize(secret); }, [&name](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize(name, rawResponse); + return _detail::SecretSerializer::Deserialize(name, rawResponse); }, {_detail::SecretPath, name}); } -Azure::Response SecretClient::UpdateSecretProperties( +Azure::Response SecretClient::UpdateSecretProperties( std::string const& name, UpdateSecretPropertiesOptions const& options, - KeyvaultSecretProperties const& properties, + SecretProperties const& properties, Azure::Core::Context const& context) const { - return m_protocolClient->SendRequest( + return m_protocolClient->SendRequest( context, Azure::Core::Http::HttpMethod::Patch, - [&properties]() { - return _detail::KeyVaultSecretPropertiesSerializer::KeyVaultSecretPropertiesSerialize( - properties); - }, + [&properties]() { return _detail::SecretPropertiesSerializer::Serialize(properties); }, [&name](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize(name, rawResponse); + return _detail::SecretSerializer::Deserialize(name, rawResponse); }, {_detail::SecretPath, name, options.Version}); } -Azure::Response SecretClient::UpdateSecretProperties( +Azure::Response SecretClient::UpdateSecretProperties( std::string const& name, std::string const& version, - KeyvaultSecretProperties const& properties, + SecretProperties const& properties, Azure::Core::Context const& context) const { UpdateSecretPropertiesOptions options; @@ -168,24 +164,21 @@ Azure::Response SecretClient::BackupSecret( context, Azure::Core::Http::HttpMethod::Post, [](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyvaultBackupSecretSerializer::KeyvaultBackupSecretDeserialize( - rawResponse); + return _detail::BackupSecretSerializer::Deserialize(rawResponse); }, {_detail::SecretPath, name, _detail::BackupSecretPath}); } -Azure::Response SecretClient::RestoreSecretBackup( +Azure::Response SecretClient::RestoreSecretBackup( std::vector const& backup, Azure::Core::Context const& context) const { - return m_protocolClient->SendRequest( + return m_protocolClient->SendRequest( context, Azure::Core::Http::HttpMethod::Post, - [&backup]() { - return _detail::KeyvaultRestoreSecretSerializer::KeyvaultRestoreSecretSerialize(backup); - }, + [&backup]() { return _detail::RestoreSecretSerializer::Serialize(backup); }, [](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize(rawResponse); + return _detail::SecretSerializer::Deserialize(rawResponse); }, {_detail::SecretPath, _detail::RestoreSecretPath}); } @@ -201,37 +194,36 @@ Azure::Response SecretClient::PurgeDeletedSecret( {_detail::DeletedSecretPath, name}); } -Azure::Security::KeyVault::Secrets::KeyVaultDeleteSecretOperation SecretClient::StartDeleteSecret( +Azure::Security::KeyVault::Secrets::DeleteSecretOperation SecretClient::StartDeleteSecret( std::string const& name, Azure::Core::Context const& context) const { - return Azure::Security::KeyVault::Secrets::KeyVaultDeleteSecretOperation( + return Azure::Security::KeyVault::Secrets::DeleteSecretOperation( std::make_shared(*this), - m_protocolClient->SendRequest( + m_protocolClient->SendRequest( context, Azure::Core::Http::HttpMethod::Delete, [&name](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyVaultDeletedSecretSerializer::KeyVaultDeletedSecretDeserialize( - name, rawResponse); + return _detail::DeletedSecretSerializer::Deserialize(name, rawResponse); }, {_detail::SecretPath, name})); } -Azure::Security::KeyVault::Secrets::KeyVaultRestoreDeletedSecretOperation SecretClient:: +Azure::Security::KeyVault::Secrets::RestoreDeletedSecretOperation SecretClient:: StartRecoverDeletedSecret(std::string const& name, Azure::Core::Context const& context) const { - return Azure::Security::KeyVault::Secrets::KeyVaultRestoreDeletedSecretOperation( + return Azure::Security::KeyVault::Secrets::RestoreDeletedSecretOperation( std::make_shared(*this), - m_protocolClient->SendRequest( + m_protocolClient->SendRequest( context, Azure::Core::Http::HttpMethod::Post, [&name](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize(name, rawResponse); + return _detail::SecretSerializer::Deserialize(name, rawResponse); }, {_detail::DeletedSecretPath, name, _detail::RecoverDeletedSecretPath})); } -KeyVaultSecretPropertiesPagedResponse SecretClient::GetPropertiesOfSecrets( +SecretPropertiesPagedResponse SecretClient::GetPropertiesOfSecrets( GetPropertiesOfSecretsOptions const& options, Azure::Core::Context const& context) const { @@ -245,23 +237,22 @@ KeyVaultSecretPropertiesPagedResponse SecretClient::GetPropertiesOfSecrets( request.Query->emplace(_detail::PagedMaxResultsName, std::to_string(maxResults)); - auto response = m_protocolClient->SendRequest( + auto response = m_protocolClient->SendRequest( context, Azure::Core::Http::HttpMethod::Get, [](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyVaultSecretPropertiesPagedResultSerializer:: - KeyVaultSecretPropertiesPagedResponseDeserialize(rawResponse); + return _detail::SecretPropertiesPagedResultSerializer::Deserialize(rawResponse); }, request.Path, request.Query); - return KeyVaultSecretPropertiesPagedResponse( + return SecretPropertiesPagedResponse( std::move(response.Value), std::move(response.RawResponse), std::make_unique(*this)); } -KeyVaultSecretPropertiesPagedResponse SecretClient::GetPropertiesOfSecretsVersions( +SecretPropertiesPagedResponse SecretClient::GetPropertiesOfSecretsVersions( std::string const& name, GetPropertiesOfSecretVersionsOptions const& options, Azure::Core::Context const& context) const @@ -276,24 +267,23 @@ KeyVaultSecretPropertiesPagedResponse SecretClient::GetPropertiesOfSecretsVersio request.Query->emplace(_detail::PagedMaxResultsName, std::to_string(maxResults)); - auto response = m_protocolClient->SendRequest( + auto response = m_protocolClient->SendRequest( context, Azure::Core::Http::HttpMethod::Get, [](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyVaultSecretPropertiesPagedResultSerializer:: - KeyVaultSecretPropertiesPagedResponseDeserialize(rawResponse); + return _detail::SecretPropertiesPagedResultSerializer::Deserialize(rawResponse); }, request.Path, request.Query); - return KeyVaultSecretPropertiesPagedResponse( + return SecretPropertiesPagedResponse( std::move(response.Value), std::move(response.RawResponse), std::make_unique(*this), name); } -KeyvaultSecretDeletedSecretPagedResponse SecretClient::GetDeletedSecrets( +DeletedSecretPagedResponse SecretClient::GetDeletedSecrets( GetDeletedSecretsOptions const& options, Azure::Core::Context const& context) const { @@ -307,17 +297,16 @@ KeyvaultSecretDeletedSecretPagedResponse SecretClient::GetDeletedSecrets( request.Query->emplace(_detail::PagedMaxResultsName, std::to_string(maxResults)); - auto response = m_protocolClient->SendRequest( + auto response = m_protocolClient->SendRequest( context, Azure::Core::Http::HttpMethod::Get, [](Azure::Core::Http::RawResponse const& rawResponse) { - return _detail::KeyVaultSecretDeletedSecretPagedResultSerializer:: - KeyVaultSecretDeletedSecretPagedResultDeserialize(rawResponse); + return _detail::DeletedSecretPagedResultSerializer::Deserialize(rawResponse); }, request.Path, request.Query); - return KeyvaultSecretDeletedSecretPagedResponse( + return DeletedSecretPagedResponse( std::move(response.Value), std::move(response.RawResponse), std::make_unique(*this)); diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/secret_serializers.cpp b/sdk/keyvault/azure-security-keyvault-secrets/src/secret_serializers.cpp index e8b2af4f3..e87df96a6 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/secret_serializers.cpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/secret_serializers.cpp @@ -20,28 +20,27 @@ using namespace Azure::Security::KeyVault::Secrets; using namespace Azure::Security::KeyVault::Secrets::_detail; // Creates a new key based on a name and an HTTP raw response. -KeyVaultSecret KeyVaultSecretSerializer::KeyVaultSecretDeserialize( +Secret SecretSerializer::Deserialize( std::string const& name, Azure::Core::Http::RawResponse const& rawResponse) { - KeyVaultSecret secret; + Secret secret; secret.Name = name; - _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize(secret, rawResponse); + _detail::SecretSerializer::Deserialize(secret, rawResponse); return secret; } // Create from HTTP raw response only. -KeyVaultSecret KeyVaultSecretSerializer::KeyVaultSecretDeserialize( - Azure::Core::Http::RawResponse const& rawResponse) +Secret SecretSerializer::Deserialize(Azure::Core::Http::RawResponse const& rawResponse) { - KeyVaultSecret secret; - _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize(secret, rawResponse); + Secret secret; + _detail::SecretSerializer::Deserialize(secret, rawResponse); return secret; } // Updates a Key based on an HTTP raw response. -void KeyVaultSecretSerializer::KeyVaultSecretDeserialize( - KeyVaultSecret& secret, +void SecretSerializer::Deserialize( + Secret& secret, Azure::Core::Http::RawResponse const& rawResponse) { auto const& body = rawResponse.GetBody(); @@ -119,30 +118,30 @@ void KeyVaultSecretSerializer::KeyVaultSecretDeserialize( secret.Properties.ContentType, jsonParser, _detail::ContentTypePropertyName); } -KeyVaultDeletedSecret KeyVaultDeletedSecretSerializer::KeyVaultDeletedSecretDeserialize( +DeletedSecret DeletedSecretSerializer::Deserialize( std::string const& name, Azure::Core::Http::RawResponse const& rawResponse) { - KeyVaultDeletedSecret deletedSecret(name); - KeyVaultDeletedSecretDeserialize(deletedSecret, rawResponse); + DeletedSecret deletedSecret(name); + Deserialize(deletedSecret, rawResponse); return deletedSecret; } // Create deleted secret from HTTP raw response only. -KeyVaultDeletedSecret KeyVaultDeletedSecretSerializer::KeyVaultDeletedSecretDeserialize( +DeletedSecret DeletedSecretSerializer::Deserialize( Azure::Core::Http::RawResponse const& rawResponse) { - KeyVaultDeletedSecret deletedSecret; - KeyVaultDeletedSecretDeserialize(deletedSecret, rawResponse); + DeletedSecret deletedSecret; + Deserialize(deletedSecret, rawResponse); return deletedSecret; } // Updates a deleted secret based on an HTTP raw response. -void KeyVaultDeletedSecretSerializer::KeyVaultDeletedSecretDeserialize( - KeyVaultDeletedSecret& secret, +void DeletedSecretSerializer::Deserialize( + DeletedSecret& secret, Azure::Core::Http::RawResponse const& rawResponse) { - KeyVaultSecretSerializer::KeyVaultSecretDeserialize(secret, rawResponse); + SecretSerializer::Deserialize(secret, rawResponse); auto const& body = rawResponse.GetBody(); auto jsonParser = json::parse(body); @@ -155,7 +154,7 @@ void KeyVaultDeletedSecretSerializer::KeyVaultDeletedSecretDeserialize( } // serializes a set secret parameters object -std::string KeyVaultSecretSerializer::KeyVaultSecretSerialize(KeyVaultSecret const& parameters) +std::string SecretSerializer::Serialize(Secret const& parameters) { json payload; @@ -203,8 +202,7 @@ std::string KeyVaultSecretSerializer::KeyVaultSecretSerialize(KeyVaultSecret con return payload.dump(); } -std::string KeyVaultSecretPropertiesSerializer::KeyVaultSecretPropertiesSerialize( - KeyvaultSecretProperties const& properties) +std::string SecretPropertiesSerializer::Serialize(SecretProperties const& properties) { json payload; @@ -238,7 +236,7 @@ std::string KeyVaultSecretPropertiesSerializer::KeyVaultSecretPropertiesSerializ return payload.dump(); } -BackupSecretResult KeyvaultBackupSecretSerializer::KeyvaultBackupSecretDeserialize( +BackupSecretResult BackupSecretSerializer::Deserialize( Azure::Core::Http::RawResponse const& rawResponse) { auto const& body = rawResponse.GetBody(); @@ -250,19 +248,17 @@ BackupSecretResult KeyvaultBackupSecretSerializer::KeyvaultBackupSecretDeseriali return data; } -std::string KeyvaultRestoreSecretSerializer::KeyvaultRestoreSecretSerialize( - std::vector const& backup) +std::string RestoreSecretSerializer::Serialize(std::vector const& backup) { json payload; payload[_detail::ValuePropertyName] = Base64Url::Base64UrlEncode(backup); return payload.dump(); } -KeyVaultSecretPropertiesPagedResponse -KeyVaultSecretPropertiesPagedResultSerializer::KeyVaultSecretPropertiesPagedResponseDeserialize( +SecretPropertiesPagedResponse SecretPropertiesPagedResultSerializer::Deserialize( Azure::Core::Http::RawResponse const& rawResponse) { - KeyVaultSecretPropertiesPagedResponse result; + SecretPropertiesPagedResponse result; auto const& body = rawResponse.GetBody(); auto jsonParser = json::parse(body); @@ -273,9 +269,9 @@ KeyVaultSecretPropertiesPagedResultSerializer::KeyVaultSecretPropertiesPagedResp for (auto const& secretProperties : secretsPropertiesJson) { - KeyvaultSecretProperties item; + SecretProperties item; item.Id = secretProperties[_detail::IdPropertyName].get(); - _detail::KeyVaultSecretSerializer::ParseIDUrl(item, item.Id); + _detail::SecretSerializer::ParseIDUrl(item, item.Id); // Parse URL for the various attributes if (secretProperties.contains(_detail::AttributesPropertyName)) { @@ -336,12 +332,11 @@ KeyVaultSecretPropertiesPagedResultSerializer::KeyVaultSecretPropertiesPagedResp return result; } -KeyvaultSecretDeletedSecretPagedResponse -KeyVaultSecretDeletedSecretPagedResultSerializer::KeyVaultSecretDeletedSecretPagedResultDeserialize( +DeletedSecretPagedResponse DeletedSecretPagedResultSerializer::Deserialize( Azure::Core::Http::RawResponse const& rawResponse) { - KeyvaultSecretDeletedSecretPagedResponse result; + DeletedSecretPagedResponse result; auto const& body = rawResponse.GetBody(); auto jsonParser = json::parse(body); auto string = jsonParser.dump(); @@ -352,9 +347,9 @@ KeyVaultSecretDeletedSecretPagedResultSerializer::KeyVaultSecretDeletedSecretPag for (auto const& secretProperties : secretsPropertiesJson) { - KeyVaultDeletedSecret item; + DeletedSecret item; item.Id = secretProperties[_detail::IdPropertyName].get(); - _detail::KeyVaultSecretSerializer::ParseIDUrl(item.Properties, item.Id); + _detail::SecretSerializer::ParseIDUrl(item.Properties, item.Id); // Parse URL for the various attributes if (secretProperties.contains(_detail::AttributesPropertyName)) { diff --git a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_backup_deserialize_test.cpp b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_backup_deserialize_test.cpp index 3f913ee1a..4e6bff8f0 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_backup_deserialize_test.cpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_backup_deserialize_test.cpp @@ -9,43 +9,43 @@ using namespace Azure::Security::KeyVault::Secrets; using namespace Azure::Security::KeyVault::Secrets::_test; using namespace Azure::Security::KeyVault::Secrets::_detail; using namespace Azure::Core::Json::_internal; -TEST(KeyvaultBackupSecretSerializer, EmptyValue) +TEST(BackupSecretSerializer, EmptyValue) { auto response = BackupHelpers::GetEmptyResponse(); - auto secret = _detail::KeyvaultBackupSecretSerializer::KeyvaultBackupSecretDeserialize(response); + auto secret = _detail::BackupSecretSerializer::Deserialize(response); EXPECT_EQ(secret.Secret.size(), size_t(0)); } -TEST(KeyvaultBackupSecretSerializer, FullValue) +TEST(BackupSecretSerializer, FullValue) { auto response = BackupHelpers::GetFullResponse(); - auto secret = _detail::KeyvaultBackupSecretSerializer::KeyvaultBackupSecretDeserialize(response); + auto secret = _detail::BackupSecretSerializer::Deserialize(response); EXPECT_EQ(secret.Secret.size(), size_t(10)); std::string str(secret.Secret.begin(), secret.Secret.end()); EXPECT_EQ(str, "my name is"); } -TEST(KeyvaultRestoreSecretSerializer, EmptyValue) +TEST(RestoreSecretSerializer, EmptyValue) { std::string str = ""; auto data = std::vector(str.begin(), str.end()); - auto secret = _detail::KeyvaultRestoreSecretSerializer::KeyvaultRestoreSecretSerialize(data); + auto secret = _detail::RestoreSecretSerializer::Serialize(data); auto jsonParser = json::parse(secret); EXPECT_EQ(secret.size(), size_t(12)); EXPECT_EQ(jsonParser["value"].get().empty(), true); } -TEST(KeyvaultRestoreSecretSerializer, SomeValue) +TEST(RestoreSecretSerializer, SomeValue) { std::string str = "my name is"; auto data = std::vector(str.begin(), str.end()); - auto secret = _detail::KeyvaultRestoreSecretSerializer::KeyvaultRestoreSecretSerialize(data); + auto secret = _detail::RestoreSecretSerializer::Serialize(data); auto jsonParser = json::parse(secret); EXPECT_EQ(secret.size(), size_t(26)); diff --git a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_get_client_deserialize_test.cpp b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_get_client_deserialize_test.cpp index 2e317e287..1c24575b5 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_get_client_deserialize_test.cpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_get_client_deserialize_test.cpp @@ -14,7 +14,7 @@ TEST(KeyVaultSecretSerializer, GetClientDeserializePartial1) { auto response = Helpers::GetPartialResponse(); - KeyVaultSecret secret = _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize(response); + Secret secret = _detail::SecretSerializer::Deserialize(response); Helpers::RunPartialExpect(secret); } @@ -22,8 +22,7 @@ TEST(KeyVaultSecretSerializer, GetClientDeserializePartial2) { auto response = Helpers::GetPartialResponse(); - KeyVaultSecret secret - = _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize("name1", response); + Secret secret = _detail::SecretSerializer::Deserialize("name1", response); Helpers::RunPartialExpect(secret); } @@ -32,8 +31,8 @@ TEST(KeyVaultSecretSerializer, GetClientDeserializePartial3) { auto response = Helpers::GetPartialResponse(); - KeyVaultSecret secret = KeyVaultSecret("name2", "a"); - _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize(secret, response); + Secret secret = Secret("name2", "a"); + _detail::SecretSerializer::Deserialize(secret, response); Helpers::RunPartialExpect(secret); } @@ -42,7 +41,7 @@ TEST(KeyVaultSecretSerializer, GetClientdeserializeFull1) { auto response = Helpers::GetFullResponse(); - KeyVaultSecret secret = _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize(response); + Secret secret = _detail::SecretSerializer::Deserialize(response); Helpers::RunFullExpect(secret); } @@ -50,8 +49,7 @@ TEST(KeyVaultSecretSerializer, GetClientdeserializeFull2) { auto response = Helpers::GetFullResponse(); - KeyVaultSecret secret - = _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize("name1", response); + Secret secret = _detail::SecretSerializer::Deserialize("name1", response); Helpers::RunFullExpect(secret); } @@ -60,41 +58,38 @@ TEST(KeyVaultSecretSerializer, GetClientdeserializeFull3) { auto response = Helpers::GetFullResponse(); - KeyVaultSecret secret = KeyVaultSecret("name2", "a"); - _detail::KeyVaultSecretSerializer::KeyVaultSecretDeserialize(secret, response); + Secret secret = Secret("name2", "a"); + _detail::SecretSerializer::Deserialize(secret, response); Helpers::RunFullExpect(secret); } -TEST(KeyVaultDeletedSecretSerializer, GetDeletedClientDeserializeFull1) +TEST(DeletedSecretSerializer, GetDeletedClientDeserializeFull1) { auto response = Helpers::GetDeletedFullResponse(); - KeyVaultDeletedSecret secret - = _detail::KeyVaultDeletedSecretSerializer::KeyVaultDeletedSecretDeserialize(response); + DeletedSecret secret = _detail::DeletedSecretSerializer::Deserialize(response); Helpers::RunFullExpect(secret, false); Helpers::RunDeletedExtras(secret); } -TEST(KeyVaultDeletedSecretSerializer, GetDeletedClientDeserializeFull2) +TEST(DeletedSecretSerializer, GetDeletedClientDeserializeFull2) { auto response = Helpers::GetDeletedFullResponse(); - KeyVaultDeletedSecret secret - = _detail::KeyVaultDeletedSecretSerializer::KeyVaultDeletedSecretDeserialize( - "name1", response); + DeletedSecret secret = _detail::DeletedSecretSerializer::Deserialize("name1", response); Helpers::RunFullExpect(secret, false); Helpers::RunDeletedExtras(secret); } -TEST(KeyVaultDeletedSecretSerializer, GetDeletedClientDeserializeFull3) +TEST(DeletedSecretSerializer, GetDeletedClientDeserializeFull3) { auto response = Helpers::GetDeletedFullResponse(); - KeyVaultDeletedSecret secret = KeyVaultDeletedSecret("name2"); - _detail::KeyVaultDeletedSecretSerializer::KeyVaultDeletedSecretDeserialize(secret, response); + DeletedSecret secret = DeletedSecret("name2"); + _detail::DeletedSecretSerializer::Deserialize(secret, response); Helpers::RunFullExpect(secret, false); Helpers::RunDeletedExtras(secret); diff --git a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_get_client_deserialize_test.hpp b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_get_client_deserialize_test.hpp index 8f4b18f4a..1978286b9 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_get_client_deserialize_test.hpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_get_client_deserialize_test.hpp @@ -102,7 +102,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { return response; } - static void RunPartialExpect(KeyVaultSecret& secret, bool expectValue = true) + static void RunPartialExpect(Secret& secret, bool expectValue = true) { if (expectValue) { @@ -123,7 +123,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { EXPECT_EQ(secret.Properties.CreatedOn.HasValue(), true); } - static void RunFullExpect(KeyVaultSecret& secret, bool expectValue = true) + static void RunFullExpect(Secret& secret, bool expectValue = true) { if (expectValue) { @@ -146,7 +146,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { EXPECT_EQ(secret.Properties.CreatedOn.HasValue(), true); } - static void RunDeletedExtras(KeyVaultDeletedSecret& secret) + static void RunDeletedExtras(DeletedSecret& secret) { EXPECT_EQ( secret.RecoveryId, "https://myvault.vault.azure.net/deletedsecrets/GetDeletedSecretTest"); diff --git a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_paged_deserialize_test.cpp b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_paged_deserialize_test.cpp index 6b38d2434..165b3c229 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_paged_deserialize_test.cpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_paged_deserialize_test.cpp @@ -8,12 +8,11 @@ using namespace Azure::Security::KeyVault::Secrets::_test; using namespace Azure::Security::KeyVault::Secrets::_detail; using namespace Azure::Core::Json::_internal; -TEST(KeyVaultSecretPropertiesPagedResponse, SingleWithNext) +TEST(SecretPropertiesPagedResponse, SingleWithNext) { auto response = _test::PagedHelpers::GetFirstResponse(); - auto result = _detail::KeyVaultSecretPropertiesPagedResultSerializer:: - KeyVaultSecretPropertiesPagedResponseDeserialize(response); + auto result = _detail::SecretPropertiesPagedResultSerializer::Deserialize(response); EXPECT_EQ(result.Items.size(), size_t(1)); EXPECT_EQ( @@ -30,12 +29,11 @@ TEST(KeyVaultSecretPropertiesPagedResponse, SingleWithNext) EXPECT_EQ(item.Id, "https://gearama-test2.vault.azure.net/secrets/gdfgfd"); } -TEST(KeyVaultSecretPropertiesPagedResponse, MultipleNoNext) +TEST(SecretPropertiesPagedResponse, MultipleNoNext) { auto response = _test::PagedHelpers::GetMultipleResponse(); - auto result = _detail::KeyVaultSecretPropertiesPagedResultSerializer:: - KeyVaultSecretPropertiesPagedResponseDeserialize(response); + auto result = _detail::SecretPropertiesPagedResultSerializer::Deserialize(response); EXPECT_EQ(result.Items.size(), size_t(3)); EXPECT_EQ(result.NextPageToken.HasValue(), false); @@ -71,23 +69,21 @@ TEST(KeyVaultSecretPropertiesPagedResponse, MultipleNoNext) EXPECT_EQ(item.Version, "d75080822f03400ab4d658bd0e988ac5"); } -TEST(KeyVaultSecretPropertiesPagedResponse, NoneNoNext) +TEST(SecretPropertiesPagedResponse, NoneNoNext) { auto response = _test::PagedHelpers::GetEmptyResponse(); - auto result = _detail::KeyVaultSecretPropertiesPagedResultSerializer:: - KeyVaultSecretPropertiesPagedResponseDeserialize(response); + auto result = _detail::SecretPropertiesPagedResultSerializer::Deserialize(response); EXPECT_EQ(result.Items.size(), size_t(0)); EXPECT_EQ(result.NextPageToken.HasValue(), false); } -TEST(KeyVaultSecretDeletedSecretPagedResultSerializer, SingleWithNext) +TEST(DeletedSecretPagedResultSerializer, SingleWithNext) { auto response = _test::PagedHelpers::GetDeletedFirstResponse(); - auto result = _detail::KeyVaultSecretDeletedSecretPagedResultSerializer:: - KeyVaultSecretDeletedSecretPagedResultDeserialize(response); + auto result = _detail::DeletedSecretPagedResultSerializer::Deserialize(response); EXPECT_EQ(result.Items.size(), size_t(1)); EXPECT_EQ(result.NextPageToken.Value(), "nextLink"); @@ -100,12 +96,11 @@ TEST(KeyVaultSecretDeletedSecretPagedResultSerializer, SingleWithNext) EXPECT_EQ(item.RecoveryId, "https://gearama-test2.vault.azure.net/deletedsecrets/eqwewq"); } -TEST(KeyVaultSecretDeletedSecretPagedResultSerializer, MultipleNoNext) +TEST(DeletedSecretPagedResultSerializer, MultipleNoNext) { auto response = _test::PagedHelpers::GetDeletedMultipleResponse(); - auto result = _detail::KeyVaultSecretDeletedSecretPagedResultSerializer:: - KeyVaultSecretDeletedSecretPagedResultDeserialize(response); + auto result = _detail::DeletedSecretPagedResultSerializer::Deserialize(response); EXPECT_EQ(result.Items.size(), size_t(3)); EXPECT_FALSE(result.NextPageToken.HasValue()); @@ -132,12 +127,11 @@ TEST(KeyVaultSecretDeletedSecretPagedResultSerializer, MultipleNoNext) EXPECT_EQ(item.RecoveryId, "https://gearama-test2.vault.azure.net/deletedsecrets/someSecret2"); } -TEST(KeyVaultSecretDeletedSecretPagedResultSerializer, NoneNoNext) +TEST(DeletedSecretPagedResultSerializer, NoneNoNext) { auto response = _test::PagedHelpers::GetEmptyResponse(); - auto result = _detail::KeyVaultSecretDeletedSecretPagedResultSerializer:: - KeyVaultSecretDeletedSecretPagedResultDeserialize(response); + auto result = _detail::DeletedSecretPagedResultSerializer::Deserialize(response); EXPECT_EQ(result.Items.size(), size_t(0)); EXPECT_EQ(result.NextPageToken.HasValue(), false); diff --git a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_set_parameters_serializer_test.cpp b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_set_parameters_serializer_test.cpp index 4ae1e351a..1469aa56f 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_set_parameters_serializer_test.cpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_set_parameters_serializer_test.cpp @@ -17,9 +17,9 @@ using namespace Azure::Core::Json::_internal; TEST(KeyvaultSecretSetParametersSerializer, SetValue) { - KeyVaultSecret params("name", "value"); + Secret params("name", "value"); - std::string result = KeyVaultSecretSerializer::KeyVaultSecretSerialize(params); + std::string result = SecretSerializer::Serialize(params); auto jsonParser = json::parse(result); @@ -30,11 +30,11 @@ TEST(KeyvaultSecretSetParametersSerializer, SetValue) TEST(KeyvaultSecretSetParametersSerializer, SetValueCT) { - KeyVaultSecret params("name", "value"); + Secret params("name", "value"); params.Properties.ContentType = "ct"; - std::string result = KeyVaultSecretSerializer::KeyVaultSecretSerialize(params); + std::string result = SecretSerializer::Serialize(params); auto jsonParser = json::parse(result); @@ -44,13 +44,13 @@ TEST(KeyvaultSecretSetParametersSerializer, SetValueCT) TEST(KeyvaultSecretSetParametersSerializer, SetValueCTAttrTag) { - KeyVaultSecret params("name", "value"); + Secret params("name", "value"); params.Properties.ContentType = "ct"; params.Properties.Enabled = true; params.Properties.Tags = std::unordered_map{{"a", "b"}}; - std::string result = KeyVaultSecretSerializer::KeyVaultSecretSerialize(params); + std::string result = SecretSerializer::Serialize(params); auto jsonParser = json::parse(result); diff --git a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_update_properties_test.cpp b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_update_properties_test.cpp index b1ea955d7..0bd83a172 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_update_properties_test.cpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_update_properties_test.cpp @@ -10,16 +10,15 @@ using namespace Azure::Security::KeyVault::Secrets; using namespace Azure::Security::KeyVault::Secrets::_detail; using namespace Azure::Core::Json::_internal; -TEST(KeyVaultSecretPropertiesSerializer, Serialize1) +TEST(SecretPropertiesSerializer, Serialize1) { - KeyvaultSecretProperties properties; + SecretProperties properties; properties.ContentType = "contentType"; properties.Enabled = true; properties.RecoverableDays = 5; - auto serialized - = _detail::KeyVaultSecretPropertiesSerializer::KeyVaultSecretPropertiesSerialize(properties); + auto serialized = _detail::SecretPropertiesSerializer::Serialize(properties); auto jsonParser = json::parse(serialized); @@ -32,17 +31,16 @@ TEST(KeyVaultSecretPropertiesSerializer, Serialize1) jsonParser[_detail::AttributesPropertyName][_detail::RecoverableDaysPropertyName]); } -TEST(KeyVaultSecretPropertiesSerializer, Serialize2) +TEST(SecretPropertiesSerializer, Serialize2) { - KeyvaultSecretProperties properties; + SecretProperties properties; properties.ContentType = "contentType"; properties.Enabled = true; properties.RecoverableDays = 5; properties.Tags.emplace("a", "b"); - auto serialized - = _detail::KeyVaultSecretPropertiesSerializer::KeyVaultSecretPropertiesSerialize(properties); + auto serialized = _detail::SecretPropertiesSerializer::Serialize(properties); auto jsonParser = json::parse(serialized); @@ -56,9 +54,9 @@ TEST(KeyVaultSecretPropertiesSerializer, Serialize2) EXPECT_EQ(properties.Tags["a"], jsonParser[_detail::TagsPropertyName]["a"]); } -TEST(KeyVaultSecretPropertiesSerializer, Serialize3) +TEST(SecretPropertiesSerializer, Serialize3) { - KeyvaultSecretProperties properties; + SecretProperties properties; properties.ContentType = "contentType"; properties.Enabled = true; @@ -66,8 +64,7 @@ TEST(KeyVaultSecretPropertiesSerializer, Serialize3) properties.Tags.emplace("a", "b"); properties.Tags.emplace("c", "d"); - auto serialized - = _detail::KeyVaultSecretPropertiesSerializer::KeyVaultSecretPropertiesSerialize(properties); + auto serialized = _detail::SecretPropertiesSerializer::Serialize(properties); auto jsonParser = json::parse(serialized);