17#include "azure/core/internal/http/http_sanitizer.hpp"
22namespace Azure {
namespace Core {
namespace Http {
namespace _internal {
33 class HttpPipeline final {
35 std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>> m_policies;
46 explicit HttpPipeline(
47 const std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>& policies)
49 if (policies.size() == 0)
51 throw std::invalid_argument(
"policies cannot be empty");
54 m_policies.reserve(policies.size());
55 for (
auto& policy : policies)
57 m_policies.emplace_back(policy->Clone());
78 explicit HttpPipeline(
79 Azure::Core::_internal::ClientOptions
const& clientOptions,
80 std::string
const& telemetryPackageName,
81 std::string
const& telemetryPackageVersion,
82 std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>&& perRetryPolicies,
83 std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>&& perCallPolicies)
85 Azure::Core::Http::_internal::HttpSanitizer httpSanitizer(
86 clientOptions.Log.AllowedHttpQueryParameters, clientOptions.Log.AllowedHttpHeaders);
88 auto const& perCallClientPolicies = clientOptions.PerOperationPolicies;
89 auto const& perRetryClientPolicies = clientOptions.PerRetryPolicies;
97 auto pipelineSize = perCallClientPolicies.size() + perRetryClientPolicies.size()
98 + perRetryPolicies.size() + perCallPolicies.size() + 6;
100 m_policies.reserve(pipelineSize);
103 for (
auto& policy : perCallPolicies)
105 m_policies.emplace_back(policy->Clone());
109 m_policies.emplace_back(
110 std::make_unique<Azure::Core::Http::Policies::_internal::RequestIdPolicy>());
113 m_policies.emplace_back(
114 std::make_unique<Azure::Core::Http::Policies::_internal::TelemetryPolicy>(
115 telemetryPackageName, telemetryPackageVersion, clientOptions.Telemetry));
118 for (
auto& policy : perCallClientPolicies)
120 m_policies.emplace_back(policy->Clone());
124 m_policies.emplace_back(std::make_unique<Azure::Core::Http::Policies::_internal::RetryPolicy>(
125 clientOptions.Retry));
128 for (
auto& policy : perRetryPolicies)
130 m_policies.emplace_back(policy->Clone());
133 for (
auto& policy : perRetryClientPolicies)
135 m_policies.emplace_back(policy->Clone());
139 m_policies.emplace_back(
140 std::make_unique<Azure::Core::Http::Policies::_internal::RequestActivityPolicy>(
144 m_policies.emplace_back(
145 std::make_unique<Azure::Core::Http::Policies::_internal::LogPolicy>(clientOptions.Log));
148 m_policies.emplace_back(
149 std::make_unique<Azure::Core::Http::Policies::_internal::TransportPolicy>(
150 clientOptions.Transport));
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)
174 "security.attestation",
176 std::move(perRetryPolicies),
177 std::move(perCallPolicies))
189 explicit HttpPipeline(
190 std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>&& policies)
191 : m_policies(std::move(policies))
193 if (m_policies.size() == 0)
195 throw std::invalid_argument(
"policies cannot be empty");
207 HttpPipeline(
const HttpPipeline& other)
209 m_policies.reserve(other.m_policies.size());
210 for (
auto& policy : other.m_policies)
212 m_policies.emplace_back(policy->Clone());
224 std::unique_ptr<Azure::Core::Http::RawResponse> Send(
226 Context
const& context)
const
230 return m_policies[0]->Send(
The next HTTP policy in the stack sequence of policies.
Definition policy.hpp:331
A request message from a client to a server.
Definition http.hpp:182
Base type for all client option types, exposes various common client options like Retry and Transport...
Context for canceling long running operations.
HTTP request and response functionality.
Compute the hash value for the input binary data, using SHA256, SHA384 and SHA512.
Definition azure_assert.hpp:57
HTTP transport policies, and their options.
Utilities to be used by HTTP transport implementations.