AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
DefaultEndpointProvider.h
1
7#pragma once
8
9#include <aws/core/endpoint/AWSPartitions.h>
10#include <aws/core/endpoint/EndpointProviderBase.h>
11#include <aws/core/endpoint/EndpointParameter.h>
12#include <aws/core/endpoint/ClientContextParameters.h>
13#include <aws/core/endpoint/BuiltInParameters.h>
14#include <aws/core/utils/memory/stl/AWSArray.h>
15
16#include <aws/crt/endpoints/RuleEngine.h>
17
18#include <aws/core/utils/Outcome.h>
19#include <aws/core/client/AWSError.h>
20#include <aws/core/client/CoreErrors.h>
21#include "aws/core/utils/logging/LogMacros.h"
22
23namespace Aws
24{
25 namespace Endpoint
26 {
27 static const char DEFAULT_ENDPOINT_PROVIDER_TAG[] = "Aws::Endpoint::DefaultEndpointProvider";
28
37 AWS_CORE_API ResolveEndpointOutcome
38 ResolveEndpointDefaultImpl(const Aws::Crt::Endpoints::RuleEngine& ruleEngine,
39 const EndpointParameters& builtInParameters,
40 const EndpointParameters& clientContextParameters,
41 const EndpointParameters& endpointParameters);
42
46 template<typename ClientConfigurationT = Aws::Client::GenericClientConfiguration,
47 typename BuiltInParametersT = Aws::Endpoint::BuiltInParameters,
48 typename ClientContextParametersT = Aws::Endpoint::ClientContextParameters>
49 class AWS_CORE_API DefaultEndpointProvider : public EndpointProviderBase<ClientConfigurationT, BuiltInParametersT, ClientContextParametersT>
50 {
51 public:
52 DefaultEndpointProvider(const char* endpointRulesBlob, const size_t endpointRulesBlobSz)
53 : m_crtRuleEngine(Aws::Crt::ByteCursorFromArray((const uint8_t*) endpointRulesBlob, endpointRulesBlobSz),
54 Aws::Crt::ByteCursorFromArray((const uint8_t*) AWSPartitions::GetPartitionsBlob(), AWSPartitions::PartitionsBlobSize))
55 {
56 if(!m_crtRuleEngine) {
57 AWS_LOGSTREAM_FATAL(DEFAULT_ENDPOINT_PROVIDER_TAG, "Invalid CRT Rule Engine state");
58 }
59 }
60
62 {
63 }
64
65 void InitBuiltInParameters(const ClientConfigurationT& config) override
66 {
67 m_builtInParameters.SetFromClientConfiguration(config);
68 }
69
73 ResolveEndpointOutcome ResolveEndpoint(const EndpointParameters& endpointParameters) const override
74 {
76 return ResolveEndpointDefaultImpl(m_crtRuleEngine, m_builtInParameters.GetAllParameters(), m_clientContextParameters.GetAllParameters(), endpointParameters);
77 };
78
79 const ClientContextParametersT& GetClientContextParameters() const override
80 {
81 return m_clientContextParameters;
82 }
83 ClientContextParametersT& AccessClientContextParameters() override
84 {
85 return m_clientContextParameters;
86 }
87
88 const BuiltInParametersT& GetBuiltInParameters() const
89 {
90 return m_builtInParameters;
91 }
92 BuiltInParametersT& AccessBuiltInParameters()
93 {
94 return m_builtInParameters;
95 }
96
97 void OverrideEndpoint(const Aws::String& endpoint) override
98 {
99 m_builtInParameters.OverrideEndpoint(endpoint);
100 }
101
102 protected:
103 /* Crt RuleEngine evaluator built using the service's Rule engine */
104 Aws::Crt::Endpoints::RuleEngine m_crtRuleEngine;
105
106 /* Also known as a configurable parameters defined by the AWS Service in their c2j/smithy model definition */
107 ClientContextParametersT m_clientContextParameters;
108
109 /* Also known as parameters on the ClientConfiguration in this SDK */
110 BuiltInParametersT m_builtInParameters;
111 };
112
116 AWS_CORE_EXTERN template class AWS_CORE_API DefaultEndpointProvider<Aws::Client::GenericClientConfiguration,
119 } // namespace Endpoint
120} // namespace Aws
DefaultEndpointProvider(const char *endpointRulesBlob, const size_t endpointRulesBlobSz)
ResolveEndpointOutcome ResolveEndpoint(const EndpointParameters &endpointParameters) const override
const ClientContextParametersT & GetClientContextParameters() const override
void InitBuiltInParameters(const ClientConfigurationT &config) override
const BuiltInParametersT & GetBuiltInParameters() const
Aws::Crt::Endpoints::RuleEngine m_crtRuleEngine
ClientContextParametersT & AccessClientContextParameters() override
void OverrideEndpoint(const Aws::String &endpoint) override
AWS_CORE_API ResolveEndpointOutcome ResolveEndpointDefaultImpl(const Aws::Crt::Endpoints::RuleEngine &ruleEngine, const EndpointParameters &builtInParameters, const EndpointParameters &clientContextParameters, const EndpointParameters &endpointParameters)
Aws::Vector< Aws::Endpoint::EndpointParameter > EndpointParameters
static const char DEFAULT_ENDPOINT_PROVIDER_TAG[]
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition AWSString.h:97