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 = {});
60 : io_context_{io_ctx},
62 http_client_{std::make_unique<http::client::Client>(io_ctx)} {}
66 : io_context_{io_ctx},
68 http_client_{std::make_unique<http::client::Client>(
69 io_ctx, std::move(tls_context))} {}
74 const std::string &request_body = {},
75 const std::string &content_type =
"application/json");
79 const std::string &
path,
80 const std::string &request_body = {},
81 const std::string &content_type =
"application/json");
83 operator bool()
const {
return http_client_->operator bool(); }
85 std::string
error_msg()
const {
return http_client_->error_message(); }
Definition: rest_client.h:46
std::string error_msg() const
Definition: rest_client.h:85
net::io_context & io_context_
Definition: rest_client.h:99
static std::string make_userinfo(const std::string &user, const std::string &password)
Definition: rest_client.h:88
RestClient(IOContext &io_ctx, TlsClientContext &&tls_context, const HttpUri &default_uri=HttpUri{"http://127.0.0.1"})
Definition: rest_client.h:64
RestClient(IOContext &io_ctx, const HttpUri &default_uri=HttpUri{"http://127.0.0.1"})
Definition: rest_client.h:58
std::unique_ptr< http::client::Client > http_client_
Definition: rest_client.h:101
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