userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
s3_connection.hpp
1
#
pragma
once
2
3
#
include
<
optional
>
4
#
include
<
string
>
5
6
#
include
<
userver
/
clients
/
http
/
request
.
hpp
>
7
#
include
<
userver
/
clients
/
http
/
response
.
hpp
>
8
#
include
<
userver
/
utils
/
str_icase
.
hpp
>
9
10
#
include
<
userver
/
s3api
/
clients
/
s3api
.
hpp
>
11
#
include
<
userver
/
s3api
/
models
/
fwd
.
hpp
>
12
#
include
<
userver
/
s3api
/
models
/
s3api_connection_type
.
hpp
>
13
14
USERVER_NAMESPACE_BEGIN
15
16
namespace
clients::http {
17
class
Client
;
18
}
19
20
namespace
s3api {
21
22
// Represents a connection to s3 api
23
// includes an url to the api and a http interface
24
class
S3Connection
:
public
std::enable_shared_from_this<
S3Connection
> {
25
public
:
26
S3Connection(
27
clients::http::
Client
& http_client,
28
S3ConnectionType connection_type,
29
std::string server_url,
30
const
ConnectionCfg
& params
31
)
32
: api_url_(std::move(server_url)),
33
connection_type_(connection_type),
34
http_client_(http_client),
35
config_(params)
36
{}
37
38
S3Connection(
const
S3Connection
& other) =
default
;
39
40
~S3Connection() =
default
;
41
42
std::shared_ptr<clients::http::Response> RequestApi(
Request
& r, std::string_view method_name);
43
44
std::shared_ptr<clients::http::Response> DoStartApiRequest(
const
Request
& r)
const
;
45
46
std::shared_ptr<clients::http::Response> StartApiRequest(
const
Request
& r)
const
;
47
48
std::string GetHost()
const
{
return
api_url_; }
49
50
void
UpdateConfig(
ConnectionCfg
&& config) { config_ = config; }
51
52
private
:
53
std::string GetUrl(
const
Request
& r, S3ConnectionType connection_type)
const
;
54
55
ConnectionCfg
GetConfig()
const
{
return
config_; }
56
57
const
std::string api_url_;
58
S3ConnectionType connection_type_;
59
clients::http::
Client
& http_client_;
60
ConnectionCfg
config_;
61
};
62
63
std::shared_ptr<
S3Connection
>
MakeS3Connection
(
64
clients::http::
Client
& http_client,
65
S3ConnectionType connection_type,
66
std::string server_url,
67
const
ConnectionCfg
& params
68
);
69
70
}
// namespace s3api
71
72
USERVER_NAMESPACE_END
src
s3api
s3_connection.hpp
Generated on
for userver by
Doxygen
1.17.0