From 384552adff3d6cdea46cdf8a345120b183bdcc1e Mon Sep 17 00:00:00 2001 From: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:41:53 -0800 Subject: [PATCH] Remove unused includes (#6209) * Remove unused includes * Fixes * move statics instantiation into cpp * clang-format --------- Co-authored-by: Anton Kolesnyk --- .../src/attestation_administration_client.cpp | 3 -- .../src/attestation_client.cpp | 2 - .../private/attestation_client_private.cpp | 2 - .../attestation_deserializers_private.cpp | 4 -- .../src/private/jsonhelpers.cpp | 4 -- .../azure-core/src/http/transport_policy.cpp | 1 - .../azure-core/src/resource_identifier.cpp | 1 - .../src/consumer_client.cpp | 1 - .../src/event_data.cpp | 2 - .../CMakeLists.txt | 2 +- .../src/certificate_client.cpp | 1 - .../src/certificate_client_models.cpp | 34 ++++++++++++++++ .../src/certificate_serializers.cpp | 1 - .../keyvault_certificates_common_request.cpp | 2 - .../src/private/certificate_key_usage.hpp | 40 ------------------- .../src/cryptography/decrypt_parameters.cpp | 1 - .../src/cryptography/decrypt_result.cpp | 1 - .../src/cryptography/encrypt_parameters.cpp | 1 - .../src/cryptography/key_sign_parameters.cpp | 1 - .../src/cryptography/key_wrap_parameters.cpp | 2 - .../src/cryptography/sign_result.cpp | 1 - .../src/cryptography/wrap_result.cpp | 1 - .../src/key_backup.cpp | 2 - .../src/key_client_paged_responses.cpp | 1 - .../src/key_get_random_bytes.cpp | 1 - .../src/key_release_policy.cpp | 3 -- .../src/key_type.cpp | 2 - .../src/keyvault_key.cpp | 1 - .../src/recover_deleted_key_operation.cpp | 1 - 29 files changed, 35 insertions(+), 84 deletions(-) create mode 100644 sdk/keyvault/azure-security-keyvault-certificates/src/certificate_client_models.cpp delete mode 100644 sdk/keyvault/azure-security-keyvault-certificates/src/private/certificate_key_usage.hpp diff --git a/sdk/attestation/azure-security-attestation/src/attestation_administration_client.cpp b/sdk/attestation/azure-security-attestation/src/attestation_administration_client.cpp index 1627211c9..da9ff53d9 100644 --- a/sdk/attestation/azure-security-attestation/src/attestation_administration_client.cpp +++ b/sdk/attestation/azure-security-attestation/src/attestation_administration_client.cpp @@ -3,7 +3,6 @@ #include "azure/attestation/attestation_administration_client.hpp" -#include "azure/attestation/attestation_client.hpp" #include "private/attestation_client_models_private.hpp" #include "private/attestation_client_private.hpp" #include "private/attestation_common_request.hpp" @@ -12,7 +11,6 @@ #include #include -#include #include #include @@ -28,7 +26,6 @@ using namespace Azure::Core::Http; using namespace Azure::Core::Http::Policies; using namespace Azure::Core::Http::Policies::_internal; using namespace Azure::Core::Http::_internal; -using namespace Azure::Core::Diagnostics::_internal; using namespace Azure::Core::Diagnostics; using namespace Azure::Core::_internal; diff --git a/sdk/attestation/azure-security-attestation/src/attestation_client.cpp b/sdk/attestation/azure-security-attestation/src/attestation_client.cpp index db066520f..aee46a7a9 100644 --- a/sdk/attestation/azure-security-attestation/src/attestation_client.cpp +++ b/sdk/attestation/azure-security-attestation/src/attestation_client.cpp @@ -3,7 +3,6 @@ #include "azure/attestation/attestation_client.hpp" -#include "azure/attestation/attestation_administration_client.hpp" #include "private/attestation_client_models_private.hpp" #include "private/attestation_client_private.hpp" #include "private/attestation_common_request.hpp" @@ -13,7 +12,6 @@ #include #include #include -#include #include #include diff --git a/sdk/attestation/azure-security-attestation/src/private/attestation_client_private.cpp b/sdk/attestation/azure-security-attestation/src/private/attestation_client_private.cpp index 7854df705..5de6d9cb5 100644 --- a/sdk/attestation/azure-security-attestation/src/private/attestation_client_private.cpp +++ b/sdk/attestation/azure-security-attestation/src/private/attestation_client_private.cpp @@ -12,8 +12,6 @@ #include -#include -#include #include #include #include diff --git a/sdk/attestation/azure-security-attestation/src/private/attestation_deserializers_private.cpp b/sdk/attestation/azure-security-attestation/src/private/attestation_deserializers_private.cpp index e85bac4a4..5a3c77726 100644 --- a/sdk/attestation/azure-security-attestation/src/private/attestation_deserializers_private.cpp +++ b/sdk/attestation/azure-security-attestation/src/private/attestation_deserializers_private.cpp @@ -19,14 +19,10 @@ #include "jsonhelpers_private.hpp" #include -#include #include -#include #include #include -#include #include -#include #include #include diff --git a/sdk/attestation/azure-security-attestation/src/private/jsonhelpers.cpp b/sdk/attestation/azure-security-attestation/src/private/jsonhelpers.cpp index d7132cbca..1016b0bd3 100644 --- a/sdk/attestation/azure-security-attestation/src/private/jsonhelpers.cpp +++ b/sdk/attestation/azure-security-attestation/src/private/jsonhelpers.cpp @@ -14,13 +14,9 @@ #include "jsonhelpers_private.hpp" #include -#include #include -#include -#include #include -#include #include #include diff --git a/sdk/core/azure-core/src/http/transport_policy.cpp b/sdk/core/azure-core/src/http/transport_policy.cpp index 10d037011..78b235c9e 100644 --- a/sdk/core/azure-core/src/http/transport_policy.cpp +++ b/sdk/core/azure-core/src/http/transport_policy.cpp @@ -2,7 +2,6 @@ // Licensed under the MIT License. #include "azure/core/http/policies/policy.hpp" -#include "azure/core/platform.hpp" #if defined(BUILD_CURL_HTTP_TRANSPORT_ADAPTER) #include "azure/core/http/curl_transport.hpp" diff --git a/sdk/core/azure-core/src/resource_identifier.cpp b/sdk/core/azure-core/src/resource_identifier.cpp index f23f853eb..d9c1e853d 100644 --- a/sdk/core/azure-core/src/resource_identifier.cpp +++ b/sdk/core/azure-core/src/resource_identifier.cpp @@ -4,7 +4,6 @@ #include "azure/core/resource_identifier.hpp" #include -#include namespace { const std::string SubscriptionStart = "/subscriptions/"; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/consumer_client.cpp b/sdk/eventhubs/azure-messaging-eventhubs/src/consumer_client.cpp index 97e98a7f3..fd5f3d3a2 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/consumer_client.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/consumer_client.cpp @@ -6,7 +6,6 @@ #include "private/package_version.hpp" #include -#include #include using namespace Azure::Core::Diagnostics::_internal; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/event_data.cpp b/sdk/eventhubs/azure-messaging-eventhubs/src/event_data.cpp index 5212e9a41..2c7a11393 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/event_data.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/event_data.cpp @@ -9,9 +9,7 @@ #include #include -#include #include -#include using namespace Azure::Core::Diagnostics::_internal; using namespace Azure::Core::Diagnostics; diff --git a/sdk/keyvault/azure-security-keyvault-certificates/CMakeLists.txt b/sdk/keyvault/azure-security-keyvault-certificates/CMakeLists.txt index 0c08f1576..3e314ebd6 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/CMakeLists.txt +++ b/sdk/keyvault/azure-security-keyvault-certificates/CMakeLists.txt @@ -60,12 +60,12 @@ set( set( AZURE_KEYVAULT_CERTIFICATES_SOURCE src/certificate_client.cpp + src/certificate_client_models.cpp src/certificate_client_operations.cpp src/certificate_client_paged_response.cpp src/certificate_serializers.cpp src/keyvault_certificates_common_request.cpp src/private/certificate_constants.hpp - src/private/certificate_key_usage.hpp src/private/certificate_serializers.hpp src/private/keyvault_certificates_common_request.hpp src/private/package_version.hpp diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/certificate_client.cpp b/sdk/keyvault/azure-security-keyvault-certificates/src/certificate_client.cpp index dfb8eb889..188fdb5ca 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/certificate_client.cpp +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/certificate_client.cpp @@ -10,7 +10,6 @@ #include "private/keyvault_certificates_common_request.hpp" #include "private/package_version.hpp" -#include #include #include #include diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/certificate_client_models.cpp b/sdk/keyvault/azure-security-keyvault-certificates/src/certificate_client_models.cpp new file mode 100644 index 000000000..0280d6b64 --- /dev/null +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/certificate_client_models.cpp @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +#include "azure/keyvault/certificates/certificate_client_models.hpp" + +#include "private/certificate_constants.hpp" + +using namespace Azure::Security::KeyVault::Certificates; + +const CertificateKeyUsage CertificateKeyUsage::DigitalSignature(_detail::DigitalSignatureValue); +const CertificateKeyUsage CertificateKeyUsage::NonRepudiation(_detail::NonRepudiationValue); +const CertificateKeyUsage CertificateKeyUsage::KeyEncipherment(_detail::KeyEnciphermentValue); +const CertificateKeyUsage CertificateKeyUsage::DataEncipherment(_detail::DataEnciphermentValue); +const CertificateKeyUsage CertificateKeyUsage::KeyAgreement(_detail::KeyAgreementValue); +const CertificateKeyUsage CertificateKeyUsage::KeyCertSign(_detail::KeyCertSignValue); +const CertificateKeyUsage CertificateKeyUsage::CrlSign(_detail::CrlSignValue); +const CertificateKeyUsage CertificateKeyUsage::EncipherOnly(_detail::EncipherOnlyValue); +const CertificateKeyUsage CertificateKeyUsage::DecipherOnly(_detail::DecipherOnlyValue); + +const CertificateKeyType CertificateKeyType::Ec(_detail::EcValue); +const CertificateKeyType CertificateKeyType::EcHsm(_detail::EcHsmValue); +const CertificateKeyType CertificateKeyType::Rsa(_detail::RsaValue); +const CertificateKeyType CertificateKeyType::RsaHsm(_detail::RsaHsmValue); + +const CertificateKeyCurveName CertificateKeyCurveName::P256(_detail::P256Value); +const CertificateKeyCurveName CertificateKeyCurveName::P256K(_detail::P256KValue); +const CertificateKeyCurveName CertificateKeyCurveName::P384(_detail::P384Value); +const CertificateKeyCurveName CertificateKeyCurveName::P521(_detail::P521Value); + +const CertificateContentType CertificateContentType::Pkcs12(_detail::Pkc12Value); +const CertificateContentType CertificateContentType::Pem(_detail::PemValue); + +const CertificatePolicyAction CertificatePolicyAction::AutoRenew(_detail::AutoRenewValue); +const CertificatePolicyAction CertificatePolicyAction::EmailContacts(_detail::EmailContactsValue); diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/certificate_serializers.cpp b/sdk/keyvault/azure-security-keyvault-certificates/src/certificate_serializers.cpp index 3ace87d76..dedca3b1f 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/certificate_serializers.cpp +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/certificate_serializers.cpp @@ -5,7 +5,6 @@ #include "azure/keyvault/certificates/certificate_client_models.hpp" #include "private/certificate_constants.hpp" -#include "private/certificate_key_usage.hpp" #include #include diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/keyvault_certificates_common_request.cpp b/sdk/keyvault/azure-security-keyvault-certificates/src/keyvault_certificates_common_request.cpp index 5c5c1dcb0..de0e0efa9 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/keyvault_certificates_common_request.cpp +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/keyvault_certificates_common_request.cpp @@ -3,8 +3,6 @@ #include "private/keyvault_certificates_common_request.hpp" -#include "private/certificate_constants.hpp" - #include #include diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/private/certificate_key_usage.hpp b/sdk/keyvault/azure-security-keyvault-certificates/src/private/certificate_key_usage.hpp deleted file mode 100644 index 4e81d3828..000000000 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/private/certificate_key_usage.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @file - * @brief Key Usage constants. - * - */ -#pragma once -#include - -namespace Azure { namespace Security { namespace KeyVault { namespace Certificates { - - const CertificateKeyUsage CertificateKeyUsage::DigitalSignature(_detail::DigitalSignatureValue); - const CertificateKeyUsage CertificateKeyUsage::NonRepudiation(_detail::NonRepudiationValue); - const CertificateKeyUsage CertificateKeyUsage::KeyEncipherment(_detail::KeyEnciphermentValue); - const CertificateKeyUsage CertificateKeyUsage::DataEncipherment(_detail::DataEnciphermentValue); - const CertificateKeyUsage CertificateKeyUsage::KeyAgreement(_detail::KeyAgreementValue); - const CertificateKeyUsage CertificateKeyUsage::KeyCertSign(_detail::KeyCertSignValue); - const CertificateKeyUsage CertificateKeyUsage::CrlSign(_detail::CrlSignValue); - const CertificateKeyUsage CertificateKeyUsage::EncipherOnly(_detail::EncipherOnlyValue); - const CertificateKeyUsage CertificateKeyUsage::DecipherOnly(_detail::DecipherOnlyValue); - - const CertificateKeyType CertificateKeyType::Ec(_detail::EcValue); - const CertificateKeyType CertificateKeyType::EcHsm(_detail::EcHsmValue); - const CertificateKeyType CertificateKeyType::Rsa(_detail::RsaValue); - const CertificateKeyType CertificateKeyType::RsaHsm(_detail::RsaHsmValue); - - const CertificateKeyCurveName CertificateKeyCurveName::P256(_detail::P256Value); - const CertificateKeyCurveName CertificateKeyCurveName::P256K(_detail::P256KValue); - const CertificateKeyCurveName CertificateKeyCurveName::P384(_detail::P384Value); - const CertificateKeyCurveName CertificateKeyCurveName::P521(_detail::P521Value); - - const CertificateContentType CertificateContentType::Pkcs12(_detail::Pkc12Value); - const CertificateContentType CertificateContentType::Pem(_detail::PemValue); - - const CertificatePolicyAction CertificatePolicyAction::AutoRenew(_detail::AutoRenewValue); - const CertificatePolicyAction CertificatePolicyAction::EmailContacts(_detail::EmailContactsValue); - -}}}} // namespace Azure::Security::KeyVault::Certificates diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/decrypt_parameters.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/decrypt_parameters.cpp index 1887a4523..d74d3aa4b 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/decrypt_parameters.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/decrypt_parameters.cpp @@ -8,7 +8,6 @@ #include #include -#include namespace Azure { namespace Security { diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/decrypt_result.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/decrypt_result.cpp index 6e58c4eb5..b6e6c0a46 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/decrypt_result.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/decrypt_result.cpp @@ -9,7 +9,6 @@ #include #include -#include using namespace Azure::Core::_internal; using namespace Azure::Core::Json::_internal; diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/encrypt_parameters.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/encrypt_parameters.cpp index 1091aaf06..60cb487fa 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/encrypt_parameters.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/encrypt_parameters.cpp @@ -8,7 +8,6 @@ #include #include -#include namespace Azure { namespace Security { diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/key_sign_parameters.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/key_sign_parameters.cpp index 2364ae1c8..fa3dfebba 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/key_sign_parameters.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/key_sign_parameters.cpp @@ -9,7 +9,6 @@ #include #include -#include namespace Azure { namespace Security { diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/key_wrap_parameters.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/key_wrap_parameters.cpp index 9af8b2698..eb209edb8 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/key_wrap_parameters.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/key_wrap_parameters.cpp @@ -3,12 +3,10 @@ #include "../private/cryptography_serializers.hpp" #include "../private/key_constants.hpp" -#include "azure/keyvault/keys/cryptography/cryptography_client_models.hpp" #include #include -#include namespace Azure { namespace Security { diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/sign_result.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/sign_result.cpp index c338c1b72..417175859 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/sign_result.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/sign_result.cpp @@ -9,7 +9,6 @@ #include #include -#include using namespace Azure::Core::_internal; using namespace Azure::Core::Json::_internal; diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/wrap_result.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/wrap_result.cpp index 3bb62b347..e7ad1f982 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/wrap_result.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/wrap_result.cpp @@ -9,7 +9,6 @@ #include #include -#include using namespace Azure::Core::_internal; using namespace Azure::Core::Json::_internal; diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/key_backup.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/key_backup.cpp index 493e55a6b..fa8d448ce 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/key_backup.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/key_backup.cpp @@ -3,8 +3,6 @@ #include "private/key_backup.hpp" -#include "private/key_constants.hpp" - #include #include #include diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/key_client_paged_responses.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/key_client_paged_responses.cpp index c0810ab85..2ce014d88 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/key_client_paged_responses.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/key_client_paged_responses.cpp @@ -9,7 +9,6 @@ #include #include #include -#include using namespace Azure::Security::KeyVault::Keys; using namespace Azure::Core::Json::_internal; diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/key_get_random_bytes.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/key_get_random_bytes.cpp index 863ead57c..eeee95a64 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/key_get_random_bytes.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/key_get_random_bytes.cpp @@ -7,7 +7,6 @@ #include #include -#include using namespace Azure::Security::KeyVault::Keys; using namespace Azure::Core::Json::_internal; diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/key_release_policy.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/key_release_policy.cpp index 5076155c2..058d2f54a 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/key_release_policy.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/key_release_policy.cpp @@ -5,12 +5,9 @@ #include "private/key_constants.hpp" #include "private/key_serializers.hpp" -#include #include -#include #include -#include using namespace Azure::Security::KeyVault::Keys; using namespace Azure::Core::_internal; diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/key_type.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/key_type.cpp index daff4ae4a..783c156ad 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/key_type.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/key_type.cpp @@ -4,8 +4,6 @@ #include "azure/keyvault/keys/key_client_models.hpp" #include "private/key_constants.hpp" -#include - using namespace Azure::Security::KeyVault::Keys; const KeyVaultKeyType KeyVaultKeyType::Ec(_detail::EcValue); diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/keyvault_key.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/keyvault_key.cpp index 865f5cdf9..429b1b66b 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/keyvault_key.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/keyvault_key.cpp @@ -8,7 +8,6 @@ #include #include #include -#include using namespace Azure::Security::KeyVault::Keys; using namespace Azure::Core::Json::_internal; diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/recover_deleted_key_operation.cpp b/sdk/keyvault/azure-security-keyvault-keys/src/recover_deleted_key_operation.cpp index 25a65a3ff..3753e7cdc 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/recover_deleted_key_operation.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/recover_deleted_key_operation.cpp @@ -3,7 +3,6 @@ #include "azure/keyvault/keys/key_client.hpp" #include "azure/keyvault/keys/key_client_models.hpp" -#include "private/key_constants.hpp" #include "private/key_serializers.hpp" #include