AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
EndpointParameter.h
1
7#pragma once
8
9#include <aws/core/client/AWSError.h>
10#include <aws/core/utils/memory/stl/AWSVector.h>
11
12namespace Aws
13{
14 namespace Endpoint
15 {
16 class AWS_CORE_API EndpointParameter
17 {
18 public:
19 enum class ParameterType
20 {
21 BOOLEAN,
22 STRING,
23 STRING_ARRAY
24 };
25 enum class ParameterOrigin
26 {
27 STATIC_CONTEXT,
28 OPERATION_CONTEXT,
29 CLIENT_CONTEXT,
30 BUILT_IN,
31 NOT_SET = -1
32 };
33
34 EndpointParameter(Aws::String name, bool initialValue, ParameterOrigin parameterOrigin = ParameterOrigin::NOT_SET)
35 : m_storedType(ParameterType::BOOLEAN),
36 m_parameterOrigin(parameterOrigin),
37 m_name(std::move(name)),
38 m_boolValue(initialValue)
39 {}
40
41 EndpointParameter(Aws::String name, Aws::String initialValue, ParameterOrigin parameterOrigin = ParameterOrigin::NOT_SET)
42 : m_storedType(ParameterType::STRING),
43 m_parameterOrigin(parameterOrigin),
44 m_name(std::move(name)),
45 m_stringValue(std::move(initialValue))
46 {}
47
48 EndpointParameter(Aws::String name, const char* initialValue, ParameterOrigin parameterOrigin = ParameterOrigin::NOT_SET)
49 : m_storedType(ParameterType::STRING),
50 m_parameterOrigin(parameterOrigin),
51 m_name(std::move(name)),
52 m_stringValue(initialValue)
53 {}
54
55 EndpointParameter(Aws::String name, const Aws::Vector<Aws::String>& initialValue, ParameterOrigin parameterOrigin = ParameterOrigin::NOT_SET)
56 : m_storedType(ParameterType::STRING_ARRAY),
57 m_parameterOrigin(parameterOrigin),
58 m_name(std::move(name)),
59 m_stringArrayValue(initialValue)
60 {}
61
63 : m_storedType(storedType),
64 m_parameterOrigin(parameterOrigin),
65 m_name(std::move(name))
66 {}
67
72
74 {
75 return m_storedType;
76 }
77
79 {
80 return m_parameterOrigin;
81 }
82
83 inline const Aws::String& GetName() const
84 {
85 return m_name;
86 }
87
88 enum class GetSetResult
89 {
90 SUCCESS,
91 ERROR_WRONG_TYPE
92 };
93
94 inline GetSetResult GetBool(bool& ioValue) const
95 {
96 if(m_storedType != ParameterType::BOOLEAN)
97 return GetSetResult::ERROR_WRONG_TYPE;
98 ioValue = m_boolValue;
99 return GetSetResult::SUCCESS;
100 }
101
102 inline GetSetResult GetString(Aws::String& ioValue) const
103 {
104 // disabled RTTI...
105 if(m_storedType != ParameterType::STRING)
106 return GetSetResult::ERROR_WRONG_TYPE;
107 ioValue = m_stringValue;
108 return GetSetResult::SUCCESS;
109 }
110
112 {
113 if(m_storedType != ParameterType::STRING_ARRAY)
114 return GetSetResult::ERROR_WRONG_TYPE;
115 ioValue = m_stringArrayValue;
116 return GetSetResult::SUCCESS;
117 }
118
119 inline GetSetResult SetBool(bool iValue)
120 {
121 if(m_storedType != ParameterType::BOOLEAN)
122 return GetSetResult::ERROR_WRONG_TYPE;
123 m_boolValue = iValue;
124 return GetSetResult::SUCCESS;
125 }
126
128 {
129 if(m_storedType != ParameterType::STRING)
130 return GetSetResult::ERROR_WRONG_TYPE;
131 m_stringValue = std::move(iValue);
132 return GetSetResult::SUCCESS;
133 }
134
136 {
137 if(m_storedType != ParameterType::STRING_ARRAY)
138 return GetSetResult::ERROR_WRONG_TYPE;
139 m_stringArrayValue = iValue;
140 return GetSetResult::SUCCESS;
141 }
142
144 {
145 if(m_storedType != ParameterType::STRING_ARRAY)
146 return GetSetResult::ERROR_WRONG_TYPE;
147 m_stringArrayValue = std::move(iValue);
148 return GetSetResult::SUCCESS;
149 }
150
152 {
153 return m_boolValue;
154 }
156 {
157 return m_stringValue;
158 }
159
161 {
162 return m_stringArrayValue;
163 }
164
165 protected:
169
170 bool m_boolValue = false;
173 };
174
176 } // namespace Endpoint
177} // namespace Aws
EndpointParameter(ParameterType storedType, ParameterOrigin parameterOrigin, Aws::String name)
GetSetResult SetStringArray(Aws::Vector< Aws::String > &&iValue)
EndpointParameter(Aws::String name, Aws::String initialValue, ParameterOrigin parameterOrigin=ParameterOrigin::NOT_SET)
ParameterType GetStoredType() const
GetSetResult SetStringArray(const Aws::Vector< Aws::String > &iValue)
const Aws::Vector< Aws::String > & GetStrArrayValueNoCheck() const
Aws::Vector< Aws::String > m_stringArrayValue
EndpointParameter(EndpointParameter &&)=default
GetSetResult SetBool(bool iValue)
const Aws::String & GetName() const
EndpointParameter(Aws::String name, bool initialValue, ParameterOrigin parameterOrigin=ParameterOrigin::NOT_SET)
EndpointParameter(Aws::String name, const Aws::Vector< Aws::String > &initialValue, ParameterOrigin parameterOrigin=ParameterOrigin::NOT_SET)
GetSetResult GetStringArray(Aws::Vector< Aws::String > &ioValue) const
EndpointParameter(const EndpointParameter &)=default
const Aws::String & GetStrValueNoCheck() const
GetSetResult GetBool(bool &ioValue) const
EndpointParameter & operator=(EndpointParameter &&)=default
EndpointParameter & operator=(const EndpointParameter &)=default
ParameterOrigin GetParameterOrigin() const
EndpointParameter(Aws::String name, const char *initialValue, ParameterOrigin parameterOrigin=ParameterOrigin::NOT_SET)
GetSetResult SetString(Aws::String iValue)
GetSetResult GetString(Aws::String &ioValue) const
Aws::Vector< Aws::Endpoint::EndpointParameter > EndpointParameters
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition AWSString.h:97
std::vector< T, Aws::Allocator< T > > Vector
Definition AWSVector.h:17