Skip to content

Commit 5d6b6f7

Browse files
Added deprecated constructors for attestation service (Azure#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 <[email protected]> --------- Co-authored-by: Anton Kolesnyk <[email protected]>
1 parent b8ddcc6 commit 5d6b6f7

File tree

5 files changed

+100
-0
lines changed

5 files changed

+100
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*.user
99
*.userosscache
1010
*.sln.docstates
11+
*.runsettings
1112

1213
# User-specific files (MonoDevelop/Xamarin Studio)
1314
*.userprefs

sdk/core/azure-core/inc/azure/core/internal/http/pipeline.hpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,34 @@ namespace Azure { namespace Core { namespace Http { namespace _internal {
150150
clientOptions.Transport));
151151
}
152152

153+
/**
154+
* @brief Construct a new HTTP Pipeline object from clientOptions.
155+
*
156+
* @remark The client options includes per retry and per call policies which are merged with the
157+
* service-specific per retry policies.
158+
*
159+
* @param clientOptions The SDK client options.
160+
* @param perRetryPolicies The service-specific per retry policies.
161+
* @param perCallPolicies The service-specific per call policies.
162+
*
163+
* @deprecated This constructor is deprecated and should not be used by any service code. It
164+
* exists only to support an earlier release of the Attestation SDK and should not be used by
165+
* any code beyond that.
166+
*/
167+
168+
[[deprecated]] explicit HttpPipeline(
169+
Azure::Core::_internal::ClientOptions const& clientOptions,
170+
std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>&& perRetryPolicies,
171+
std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>&& perCallPolicies)
172+
: HttpPipeline(
173+
clientOptions,
174+
"security.attestation",
175+
"1.0.0",
176+
std::move(perRetryPolicies),
177+
std::move(perCallPolicies))
178+
{
179+
}
180+
153181
/**
154182
* @brief Construct HTTP pipeline with the sequence of HTTP policies provided.
155183
*

sdk/core/azure-core/inc/azure/core/internal/tracing/service_tracing.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,26 @@ namespace Azure { namespace Core { namespace Tracing { namespace _internal {
215215
->CreateTracer(packageName, packageVersion);
216216
}
217217
}
218+
/**
219+
* @brief Construct a new Tracing Context Factory object
220+
*
221+
* @param options Client Options for tracing.
222+
* @param serviceName Name of the resource provider for the service [See
223+
* also](https://docs.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers).
224+
* @param packageVersion Package version number for the package containing this
225+
* service. (https://opentelemetry.io/docs/reference/specification/trace/api/#get-a-tracer).
226+
*
227+
* @deprecated This constructor is deprecated and should not be used by any service code. It
228+
* exists only to support an earlier release of the Attestation SDK and should not be used by
229+
* any code beyond that.
230+
*/
231+
[[deprecated]] TracingContextFactory(
232+
Azure::Core::_internal::ClientOptions const& options,
233+
std::string const& serviceName,
234+
std::string packageVersion)
235+
: TracingContextFactory(options, serviceName, serviceName, packageVersion)
236+
{
237+
}
218238

219239
TracingContextFactory() = default;
220240
TracingContextFactory(TracingContextFactory const&) = default;

sdk/core/azure-core/test/ut/pipeline_test.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,31 @@ TEST(Pipeline, refrefEmptyPipeline)
5252
std::invalid_argument);
5353
}
5454

55+
TEST(Pipeline, attestationConstructor)
56+
{
57+
#ifdef _MSC_VER
58+
#pragma warning(push)
59+
#pragma warning(disable : 4996)
60+
#elif defined(__clang__)
61+
#pragma clang diagnostic push
62+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
63+
#elif defined(__GNUC__)
64+
#pragma GCC diagnostic push
65+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
66+
#endif // Construct pipeline without exception
67+
EXPECT_NO_THROW(Azure::Core::Http::_internal::HttpPipeline pipeline(
68+
Azure::Core::_internal::ClientOptions(),
69+
std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>(0),
70+
std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>(0)));
71+
#ifdef _MSC_VER
72+
#pragma warning(pop)
73+
#elif defined(__clang__)
74+
#pragma clang diagnostic pop
75+
#elif defined(__GNUC__)
76+
#pragma GCC diagnostic pop
77+
#endif // _MSC_VER
78+
}
79+
5580
TEST(Pipeline, AdditionalPolicies)
5681
{
5782
class TestPolicy : public Azure::Core::Http::Policies::HttpPolicy {

sdk/core/azure-core/test/ut/service_tracing_test.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,32 @@ TEST(TracingContextFactory, SimpleServiceSpanTests)
8888
EXPECT_FALSE(contextAndSpan.Context.IsCancelled());
8989
}
9090
}
91+
92+
TEST(TracingContextFactory, DeprecatedFactoryCtorForServiceWhichReleasedWithThisDependency)
93+
{
94+
Azure::Core::_internal::ClientOptions clientOptions;
95+
#ifdef _MSC_VER
96+
#pragma warning(push)
97+
#pragma warning(disable : 4996)
98+
#elif defined(__clang__)
99+
#pragma clang diagnostic push
100+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
101+
#elif defined(__GNUC__)
102+
#pragma GCC diagnostic push
103+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
104+
#endif
105+
106+
Azure::Core::Tracing::_internal::TracingContextFactory serviceTrace(
107+
clientOptions, "my.service", "1.0b2");
108+
109+
#ifdef _MSC_VER
110+
#pragma warning(pop)
111+
#elif defined(__clang__)
112+
#pragma clang diagnostic pop
113+
#elif defined(__GNUC__)
114+
#pragma GCC diagnostic pop
115+
#endif // _MSC_VER
116+
}
91117
namespace {
92118
// Dummy service tracing class.
93119
class TestSpan final : public Azure::Core::Tracing::_internal::Span {

0 commit comments

Comments
 (0)