MySQL 8.4.0
Source Code Documentation
RestApi Class Reference

#include <rest_api_plugin.h>

Public Types

using PathList = std::list< std::tuple< std::regex, std::unique_ptr< BaseRestApiHandler > > >

Public Member Functions

 RestApi (const std::string &uri_prefix, const std::string &uri_prefix_regex)
 RestApi (const RestApi &)=delete
RestApioperator= (const RestApi &)=delete
 RestApi (RestApi &&)=delete
RestApioperator= (RestApi &&)=delete
void process_spec (RestApiComponent::SpecProcessor spec_processor)
 process the spec's Json JsonDocument. More...
void add_path (const std::string &path, std::unique_ptr< BaseRestApiHandler > handler)
 add handler for URI path. More...
void remove_path (const std::string &path)
 remove handle for URI path. More...
void handle_paths (http::base::Request &req)
 handle request for all register URI paths. More...
std::string uri_prefix () const
 get the uri path prefix. More...
std::string uri_prefix_regex () const
 get the regex for the URI path prefix. More...
std::string spec ()
 get the spec as JSON. More...

Protected Attributes

std::string uri_prefix_
std::string uri_prefix_regex_
std::shared_timed_mutex rest_api_handler_mutex_
std::list< std::tuple< std::string, std::regex, std::unique_ptr< BaseRestApiHandler > > > rest_api_handlers_
std::mutex spec_doc_mutex_
RestApiComponent::JsonDocument spec_doc_

Member Typedef Documentation

◆ PathList

using RestApi::PathList = std::list<std::tuple<std::regex, std::unique_ptr<BaseRestApiHandler> >>

Constructor & Destructor Documentation

◆ RestApi() [1/3]

RestApi::RestApi ( const std::string &  uri_prefix,
const std::string &  uri_prefix_regex 

◆ RestApi() [2/3]

RestApi::RestApi ( const RestApi )

◆ RestApi() [3/3]

RestApi::RestApi ( RestApi &&  )

Member Function Documentation

◆ add_path()

void RestApi::add_path ( const std::string &  path,
std::unique_ptr< BaseRestApiHandler handler 

add handler for URI path.

◆ handle_paths()

void RestApi::handle_paths ( http::base::Request req)

handle request for all register URI paths.

if no handler accepts the request, a HTTP response with status 404 will be sent.

◆ operator=() [1/2]

RestApi & RestApi::operator= ( const RestApi )

◆ operator=() [2/2]

RestApi & RestApi::operator= ( RestApi &&  )

◆ process_spec()

void RestApi::process_spec ( RestApiComponent::SpecProcessor  spec_processor)

process the spec's Json JsonDocument.

◆ remove_path()

void RestApi::remove_path ( const std::string &  path)

remove handle for URI path.

◆ spec()

std::string RestApi::spec ( )

get the spec as JSON.

◆ uri_prefix()

std::string RestApi::uri_prefix ( ) const

get the uri path prefix.

◆ uri_prefix_regex()

std::string RestApi::uri_prefix_regex ( ) const

get the regex for the URI path prefix.

Member Data Documentation

◆ rest_api_handler_mutex_

std::shared_timed_mutex RestApi::rest_api_handler_mutex_

◆ rest_api_handlers_

std::list< std::tuple<std::string, std::regex, std::unique_ptr<BaseRestApiHandler> > > RestApi::rest_api_handlers_

◆ spec_doc_

RestApiComponent::JsonDocument RestApi::spec_doc_

◆ spec_doc_mutex_

std::mutex RestApi::spec_doc_mutex_

◆ uri_prefix_

std::string RestApi::uri_prefix_

◆ uri_prefix_regex_

std::string RestApi::uri_prefix_regex_

The documentation for this class was generated from the following files: