diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 20d02a1c7..f40443f06 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -20,6 +20,7 @@ ### Features Added - Added new constructor for `Azure::Core::Context` that takes a `std::chrono::system_clock::time_point` deadline. This enables creating a new context directly with a deadline. +- Added an `Azure::Core::ResourceIdentifier` type. ### Breaking Changes diff --git a/sdk/core/azure-core/CMakeLists.txt b/sdk/core/azure-core/CMakeLists.txt index 59bfac109..30a4f9d4c 100644 --- a/sdk/core/azure-core/CMakeLists.txt +++ b/sdk/core/azure-core/CMakeLists.txt @@ -108,6 +108,7 @@ set( inc/azure/core/paged_response.hpp inc/azure/core/platform.hpp inc/azure/core/response.hpp + inc/azure/core/resource_identifier.hpp inc/azure/core/rtti.hpp inc/azure/core/tracing/tracing.hpp inc/azure/core/url.hpp diff --git a/sdk/core/azure-core/inc/azure/core/resource_identifier.hpp b/sdk/core/azure-core/inc/azure/core/resource_identifier.hpp new file mode 100644 index 000000000..e3baaa278 --- /dev/null +++ b/sdk/core/azure-core/inc/azure/core/resource_identifier.hpp @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @file + * @brief An Azure Resource Manager resource identifier. + */ + +#pragma once + +#include + +namespace Azure { namespace Core { + + /** + * @brief An Azure Resource Manager resource identifier. + */ + class ResourceIdentifier final { + std::string m_resourceId; + + public: + /** + * @brief Constructs a resource identifier. + * + * @param resourceId The id string to create the ResourceIdentifier from. + */ + explicit ResourceIdentifier(std::string const& resourceId) : m_resourceId(resourceId){}; + + /** + * @brief The string representation of this resource identifier. + * + * @return The resource identifier string. + */ + std::string ToString() const { return m_resourceId; } + }; + +}} // namespace Azure::Core diff --git a/sdk/core/azure-core/test/ut/CMakeLists.txt b/sdk/core/azure-core/test/ut/CMakeLists.txt index 9dbcfec81..43c5ab32a 100644 --- a/sdk/core/azure-core/test/ut/CMakeLists.txt +++ b/sdk/core/azure-core/test/ut/CMakeLists.txt @@ -82,6 +82,7 @@ add_executable ( policy_test.cpp request_activity_policy_test.cpp request_id_policy_test.cpp + resource_identifier_test response_t_test.cpp retry_policy_test.cpp service_tracing_test.cpp diff --git a/sdk/identity/azure-identity/test/ut/resource_identifier_test.cpp b/sdk/core/azure-core/test/ut/resource_identifier_test.cpp similarity index 82% rename from sdk/identity/azure-identity/test/ut/resource_identifier_test.cpp rename to sdk/core/azure-core/test/ut/resource_identifier_test.cpp index f9bf8a280..de08d20e5 100644 --- a/sdk/identity/azure-identity/test/ut/resource_identifier_test.cpp +++ b/sdk/core/azure-core/test/ut/resource_identifier_test.cpp @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -#include "azure/identity/managed_identity_credential.hpp" +#include "azure/core/resource_identifier.hpp" #include #include -using namespace Azure::Identity; +using namespace Azure::Core; TEST(ResourceIdentifier, Basic) { diff --git a/sdk/identity/azure-identity/inc/azure/identity/managed_identity_credential.hpp b/sdk/identity/azure-identity/inc/azure/identity/managed_identity_credential.hpp index 8bc492d2e..a4cb73340 100644 --- a/sdk/identity/azure-identity/inc/azure/identity/managed_identity_credential.hpp +++ b/sdk/identity/azure-identity/inc/azure/identity/managed_identity_credential.hpp @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -19,29 +20,6 @@ namespace Azure { namespace Identity { class ManagedIdentitySource; } - // This will move to Azure::Core. - /** - * @brief An Azure Resource Manager resource identifier. - */ - class ResourceIdentifier final { - std::string m_resourceId; - - public: - /** - * @brief Constructs a resource identifier. - * - * @param resourceId The id string to create the ResourceIdentifier from. - */ - explicit ResourceIdentifier(std::string const& resourceId) : m_resourceId(resourceId){}; - - /** - * @brief The string representation of this resource identifier. - * - * @return The resource identifier string. - */ - std::string ToString() const { return m_resourceId; } - }; - /** * @brief The type of managed identity identifier depending on how the managed identity is * configured. diff --git a/sdk/identity/azure-identity/test/ut/CMakeLists.txt b/sdk/identity/azure-identity/test/ut/CMakeLists.txt index 3b2bbee69..fe44d0c43 100644 --- a/sdk/identity/azure-identity/test/ut/CMakeLists.txt +++ b/sdk/identity/azure-identity/test/ut/CMakeLists.txt @@ -28,7 +28,6 @@ add_executable ( environment_credential_test.cpp macro_guard_test.cpp managed_identity_credential_test.cpp - resource_identifier_test.cpp simplified_header_test.cpp tenant_id_resolver_test.cpp token_cache_test.cpp