Added deprecated constructors for attestation service (#4313)
* Added deprecated constructors for attestation service * Disable deprecation warnings for clang; improved documentation to reflect deprecated functions * Use doxygen @deprecated on deprecated functions * Co-authored-by: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com> --------- Co-authored-by: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com>
This commit is contained in:
parent
b8ddcc616f
commit
5d6b6f72c1
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
*.runsettings
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
@ -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<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>&& perRetryPolicies,
|
||||
std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>&& 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.
|
||||
*
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>(0),
|
||||
std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>(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 {
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user