diff --git a/.gitignore b/.gitignore index 6c62b7275..b22eda13a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ *.user *.userosscache *.sln.docstates +*.runsettings # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/sdk/core/azure-core/inc/azure/core/internal/http/pipeline.hpp b/sdk/core/azure-core/inc/azure/core/internal/http/pipeline.hpp index abdadc6bf..7505cf441 100644 --- a/sdk/core/azure-core/inc/azure/core/internal/http/pipeline.hpp +++ b/sdk/core/azure-core/inc/azure/core/internal/http/pipeline.hpp @@ -150,6 +150,34 @@ namespace Azure { namespace Core { namespace Http { namespace _internal { clientOptions.Transport)); } + /** + * @brief Construct a new HTTP Pipeline object from clientOptions. + * + * @remark The client options includes per retry and per call policies which are merged with the + * service-specific per retry policies. + * + * @param clientOptions The SDK client options. + * @param perRetryPolicies The service-specific per retry policies. + * @param perCallPolicies The service-specific per call policies. + * + * @deprecated This constructor is deprecated and should not be used by any service code. It + * exists only to support an earlier release of the Attestation SDK and should not be used by + * any code beyond that. + */ + + [[deprecated]] explicit HttpPipeline( + Azure::Core::_internal::ClientOptions const& clientOptions, + std::vector>&& perRetryPolicies, + std::vector>&& perCallPolicies) + : HttpPipeline( + clientOptions, + "security.attestation", + "1.0.0", + std::move(perRetryPolicies), + std::move(perCallPolicies)) + { + } + /** * @brief Construct HTTP pipeline with the sequence of HTTP policies provided. * 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 038fb8e86..2ccdb45eb 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 @@ -215,6 +215,26 @@ namespace Azure { namespace Core { namespace Tracing { namespace _internal { ->CreateTracer(packageName, packageVersion); } } + /** + * @brief Construct a new Tracing Context Factory object + * + * @param options Client Options for tracing. + * @param serviceName Name of the resource provider for the service [See + * also](https://docs.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers). + * @param packageVersion Package version number for the package containing this + * service. (https://opentelemetry.io/docs/reference/specification/trace/api/#get-a-tracer). + * + * @deprecated This constructor is deprecated and should not be used by any service code. It + * exists only to support an earlier release of the Attestation SDK and should not be used by + * any code beyond that. + */ + [[deprecated]] TracingContextFactory( + Azure::Core::_internal::ClientOptions const& options, + std::string const& serviceName, + std::string packageVersion) + : TracingContextFactory(options, serviceName, serviceName, packageVersion) + { + } TracingContextFactory() = default; TracingContextFactory(TracingContextFactory const&) = default; diff --git a/sdk/core/azure-core/test/ut/pipeline_test.cpp b/sdk/core/azure-core/test/ut/pipeline_test.cpp index c311ab8b8..cabd6c5d0 100644 --- a/sdk/core/azure-core/test/ut/pipeline_test.cpp +++ b/sdk/core/azure-core/test/ut/pipeline_test.cpp @@ -52,6 +52,31 @@ TEST(Pipeline, refrefEmptyPipeline) std::invalid_argument); } +TEST(Pipeline, attestationConstructor) +{ +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4996) +#elif defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#elif defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif // Construct pipeline without exception + EXPECT_NO_THROW(Azure::Core::Http::_internal::HttpPipeline pipeline( + Azure::Core::_internal::ClientOptions(), + std::vector>(0), + std::vector>(0))); +#ifdef _MSC_VER +#pragma warning(pop) +#elif defined(__clang__) +#pragma clang diagnostic pop +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#endif // _MSC_VER +} + TEST(Pipeline, AdditionalPolicies) { class TestPolicy : public Azure::Core::Http::Policies::HttpPolicy { diff --git a/sdk/core/azure-core/test/ut/service_tracing_test.cpp b/sdk/core/azure-core/test/ut/service_tracing_test.cpp index 215f798c2..1823938f5 100644 --- a/sdk/core/azure-core/test/ut/service_tracing_test.cpp +++ b/sdk/core/azure-core/test/ut/service_tracing_test.cpp @@ -88,6 +88,32 @@ TEST(TracingContextFactory, SimpleServiceSpanTests) EXPECT_FALSE(contextAndSpan.Context.IsCancelled()); } } + +TEST(TracingContextFactory, DeprecatedFactoryCtorForServiceWhichReleasedWithThisDependency) +{ + Azure::Core::_internal::ClientOptions clientOptions; +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4996) +#elif defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#elif defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + + Azure::Core::Tracing::_internal::TracingContextFactory serviceTrace( + clientOptions, "my.service", "1.0b2"); + +#ifdef _MSC_VER +#pragma warning(pop) +#elif defined(__clang__) +#pragma clang diagnostic pop +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#endif // _MSC_VER +} namespace { // Dummy service tracing class. class TestSpan final : public Azure::Core::Tracing::_internal::Span {