userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
s3api_connection_type.cpp
1
#
include
<
userver
/
s3api
/
models
/
s3api_connection_type
.
hpp
>
2
3
#
include
<
userver
/
formats
/
json
/
value
.
hpp
>
4
#
include
<
userver
/
utils
/
assert
.
hpp
>
5
6
USERVER_NAMESPACE_BEGIN
7
8
namespace
s3api {
9
10
S3ConnectionType Parse(
const
formats::
json
::
Value
& elem, formats::
parse
::
To
<S3ConnectionType>) {
11
const
auto
as_string = elem
.
As
<
std
::
string
>
(
)
;
12
if
(as_string ==
"http"
) {
13
return
S3ConnectionType::kHttp;
14
}
15
if
(as_string ==
"https"
) {
16
return
S3ConnectionType::kHttps;
17
}
18
UINVARIANT
(
false
,
"invalid value of connection_type"
);
19
// Never reaches
20
return
S3ConnectionType::kHttp;
21
}
22
23
std::string_view ToStringView(S3ConnectionType connection_type) {
24
switch
(connection_type) {
25
case
S3ConnectionType::kHttp:
26
return
"http"
;
27
case
S3ConnectionType::kHttps:
28
return
"https"
;
29
}
30
return
"unknown"
;
31
}
32
33
std::string ToString(S3ConnectionType connection_type) {
return
std::string{ToStringView(connection_type)}; }
34
35
}
// namespace s3api
36
37
USERVER_NAMESPACE_END
src
s3api
models
s3api_connection_type.cpp
Generated on
for userver by
Doxygen
1.17.0