25#ifndef MYSQL_ROUTER_REST_CLIENT_H_INCLUDED
26#define MYSQL_ROUTER_REST_CLIENT_H_INCLUDED
53 uint16_t default_port,
const std::string &default_username = {},
54 const std::string &default_password = {},
55 const bool use_http2 =
false);
61 const bool use_http2 =
false)
62 : io_context_{io_ctx},
64 http_client_{std::make_unique<http::client::Client>(io_ctx, use_http2)},
65 use_http2_{use_http2} {}
69 const bool use_http2 =
false)
70 : io_context_{io_ctx},
72 http_client_{std::make_unique<http::client::Client>(
73 io_ctx, std::move(tls_context), use_http2)},
74 use_http2_{use_http2} {}
79 const std::string &request_body = {},
80 const std::string &content_type =
"application/json");
84 const std::string &
path,
85 const std::string &request_body = {},
86 const std::string &content_type =
"application/json");
88 operator bool()
const {
return http_client_->operator bool(); }
90 std::string
error_msg()
const {
return http_client_->error_message(); }
Definition: rest_client.h:46
std::string error_msg() const
Definition: rest_client.h:90
net::io_context & io_context_
Definition: rest_client.h:104
static std::string make_userinfo(const std::string &user, const std::string &password)
Definition: rest_client.h:93
RestClient(IOContext &io_ctx, TlsClientContext &&tls_context, const HttpUri &default_uri=HttpUri{"http://127.0.0.1"}, const bool use_http2=false)
Definition: rest_client.h:67
RestClient(IOContext &io_ctx, const HttpUri &default_uri=HttpUri{"http://127.0.0.1"}, const bool use_http2=false)
Definition: rest_client.h:59
bool use_http2_
Definition: rest_client.h:107
std::unique_ptr< http::client::Client > http_client_
Definition: rest_client.h:106
Client TLS Context.
Definition: tls_client_context.h:43
Definition: io_context.h:61
#define HTTP_CLIENT_EXPORT
Definition: http_client_export.h:15
static char * password
Definition: mysql_secure_installation.cc:58
char * user
Definition: mysqladmin.cc:66
static char * path
Definition: mysqldump.cc:149
int key_type
Definition: method.h:38
Request::Uri Uri
Definition: request.cc:37
struct result result
Definition: result.h:34
RestClient::Request Request
Definition: rest_client.cc:29
constexpr const char kRestAPIVersion[]
Definition: rest_client.h:42