diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 5072d301eb..1a49bed14c 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.14.1 (2024-10-31) +## 1.14.1 (2024-11-01) ### Bugs Fixed diff --git a/sdk/core/azure-core/CMakeLists.txt b/sdk/core/azure-core/CMakeLists.txt index c7d29c3f2a..ad83b71d04 100644 --- a/sdk/core/azure-core/CMakeLists.txt +++ b/sdk/core/azure-core/CMakeLists.txt @@ -90,7 +90,6 @@ set( inc/azure/core/internal/extendable_enumeration.hpp inc/azure/core/internal/http/http_sanitizer.hpp inc/azure/core/internal/http/pipeline.hpp - inc/azure/core/internal/http/user_agent.hpp inc/azure/core/internal/io/null_body_stream.hpp inc/azure/core/internal/json/json.hpp inc/azure/core/internal/json/json_optional.hpp diff --git a/sdk/core/azure-core/inc/azure/core/http/http.hpp b/sdk/core/azure-core/inc/azure/core/http/http.hpp index 373d55bb21..27b93beb5e 100644 --- a/sdk/core/azure-core/inc/azure/core/http/http.hpp +++ b/sdk/core/azure-core/inc/azure/core/http/http.hpp @@ -412,6 +412,34 @@ namespace Azure { namespace Core { namespace Http { } return {}; // empty string } + + /** + * @brief Generates User-Agent string for telemetry. + * + * @param componentName the name of the SDK component. + * @param componentVersion the version of the SDK component. + * @param applicationId user application ID + * @param cplusplusValue value of the `__cplusplus` macro. + * + * @return User-Agent string. + * + * @see https://azure.github.io/azure-sdk/general_azurecore.html#telemetry-policy + * + * @note Values for @a cplusplusValue: `__cplusplus` when value comes from the code being + * built after the Azure SDK has been built. `0L` when being sent from sample code, `-1L` when + * being sent from tests code, `-2L` when being sent from the SDK code, and `-3L` when being + * sent from the SDK code for compatibility reasons. + * + */ + static std::string GenerateUserAgent( + std::string const& componentName, + std::string const& componentVersion, + std::string const& applicationId, + long cplusplusValue); + + private: + HttpShared() = delete; + ~HttpShared() = delete; }; } // namespace _internal diff --git a/sdk/core/azure-core/inc/azure/core/http/policies/policy.hpp b/sdk/core/azure-core/inc/azure/core/http/policies/policy.hpp index 513871b905..58bb484840 100644 --- a/sdk/core/azure-core/inc/azure/core/http/policies/policy.hpp +++ b/sdk/core/azure-core/inc/azure/core/http/policies/policy.hpp @@ -15,7 +15,6 @@ #include "azure/core/http/http.hpp" #include "azure/core/http/transport.hpp" #include "azure/core/internal/http/http_sanitizer.hpp" -#include "azure/core/internal/http/user_agent.hpp" #include "azure/core/uuid.hpp" #include @@ -550,7 +549,7 @@ namespace Azure { namespace Core { namespace Http { namespace Policies { std::string const& packageName, std::string const& packageVersion, TelemetryOptions options = TelemetryOptions()) - : m_telemetryId(Azure::Core::Http::_internal::UserAgentGenerator::GenerateUserAgent( + : m_telemetryId(Azure::Core::Http::_internal::HttpShared::GenerateUserAgent( packageName, packageVersion, options.ApplicationId, diff --git a/sdk/core/azure-core/inc/azure/core/internal/http/user_agent.hpp b/sdk/core/azure-core/inc/azure/core/internal/http/user_agent.hpp deleted file mode 100644 index 3d5a0ad732..0000000000 --- a/sdk/core/azure-core/inc/azure/core/internal/http/user_agent.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @file - * @brief Declaration of the UserAgentGenerator type. - */ - -#pragma once - -#include - -namespace Azure { namespace Core { namespace Http { namespace _internal { - /** - * @brief Telemetry User-Agent string generator. - * - */ - class UserAgentGenerator { - public: - /** - * @brief Generates User-Agent string for telemetry. - * - * @param componentName the name of the SDK component. - * @param componentVersion the version of the SDK component. - * @param applicationId user application ID - * @param cplusplusValue value of the `__cplusplus` macro. - * - * @return User-Agent string. - * - * @see https://azure.github.io/azure-sdk/general_azurecore.html#telemetry-policy - * - * @note Values for @a cplusplusValue: `__cplusplus` when value comes from the code being built - * after the Azure SDK has been built. `0L` when being sent from sample code, `-1L` when being - * sent from tests code, `-2L` when being sent from the SDK code, and `-3L` when being sent from - * the SDK code for compatibility reasons. - * - */ - static std::string GenerateUserAgent( - std::string const& componentName, - std::string const& componentVersion, - std::string const& applicationId, - long cplusplusValue); - }; -}}}} // namespace Azure::Core::Http::_internal diff --git a/sdk/core/azure-core/inc/azure/core/internal/tracing/service_tracing.hpp b/sdk/core/azure-core/inc/azure/core/internal/tracing/service_tracing.hpp index 637ee2b3c6..8fa725b6d6 100644 --- a/sdk/core/azure-core/inc/azure/core/internal/tracing/service_tracing.hpp +++ b/sdk/core/azure-core/inc/azure/core/internal/tracing/service_tracing.hpp @@ -4,7 +4,6 @@ #include "azure/core/context.hpp" #include "azure/core/internal/client_options.hpp" #include "azure/core/internal/extendable_enumeration.hpp" -#include "azure/core/internal/http/user_agent.hpp" #include "azure/core/internal/tracing/tracing_impl.hpp" #pragma once diff --git a/sdk/core/azure-core/src/http/user_agent.cpp b/sdk/core/azure-core/src/http/user_agent.cpp index ae2bcd58ec..5aab715700 100644 --- a/sdk/core/azure-core/src/http/user_agent.cpp +++ b/sdk/core/azure-core/src/http/user_agent.cpp @@ -7,13 +7,12 @@ */ #include "azure/core/context.hpp" +#include "azure/core/http/http.hpp" #include "azure/core/http/policies/policy.hpp" #include "azure/core/internal/strings.hpp" #include "azure/core/internal/tracing/service_tracing.hpp" #include "azure/core/platform.hpp" -#include - #include #if defined(AZ_PLATFORM_WINDOWS) @@ -150,7 +149,7 @@ std::string TrimString(std::string s) namespace Azure { namespace Core { namespace Http { namespace _internal { - std::string UserAgentGenerator::GenerateUserAgent( + std::string HttpShared::GenerateUserAgent( std::string const& componentName, std::string const& componentVersion, std::string const& applicationId, diff --git a/sdk/core/azure-core/test/ut/telemetry_policy_test.cpp b/sdk/core/azure-core/test/ut/telemetry_policy_test.cpp index d931d6e26d..8522171de3 100644 --- a/sdk/core/azure-core/test/ut/telemetry_policy_test.cpp +++ b/sdk/core/azure-core/test/ut/telemetry_policy_test.cpp @@ -100,7 +100,7 @@ TEST(TelemetryPolicy, UserAgentCppVer) EXPECT_EQ(cppversion.str(), "TEST:201402"); } { - const std::string ua = Http::_internal::UserAgentGenerator::GenerateUserAgent( + const std::string ua = Http::_internal::HttpShared::GenerateUserAgent( "storage.blobs", "11.0.0-beta.1", "MyApp", 201402L); EXPECT_GE(ua.length(), 11); @@ -108,7 +108,7 @@ TEST(TelemetryPolicy, UserAgentCppVer) } { - const std::string ua = Http::_internal::UserAgentGenerator::GenerateUserAgent( + const std::string ua = Http::_internal::HttpShared::GenerateUserAgent( "storage.blobs", "11.0.0-beta.1", "MyApp", 201703L); EXPECT_GE(ua.length(), 11); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md index a918a006e1..7dd181b093 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.10 (2024-10-31) +## 1.0.0-beta.10 (2024-11-01) ### Bugs Fixed diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/private/eventhubs_utilities.hpp b/sdk/eventhubs/azure-messaging-eventhubs/src/private/eventhubs_utilities.hpp index 111538cfbe..934efcf06e 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/private/eventhubs_utilities.hpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/private/eventhubs_utilities.hpp @@ -14,8 +14,8 @@ #include #include #include +#include #include -#include #include @@ -277,7 +277,7 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace _detail #endif options.Properties.emplace( "user-agent", - Azure::Core::Http::_internal::UserAgentGenerator::GenerateUserAgent( + Azure::Core::Http::_internal::HttpShared::GenerateUserAgent( packageName, PackageVersion::ToString(), applicationId, cplusplusValue)); }