![]() |
MySQL 9.3.0
Source Code Documentation
|
Namespaces | |
namespace | anonymous_namespace{handler.cc} |
namespace | anonymous_namespace{openapi_object_creator.cc} |
namespace | cvt |
namespace | entry |
Classes | |
class | Handler |
class | OpenApiCreator |
Helper class that facilitates generating OpenAPI swagger for the given DBobject entry. More... | |
class | ParseOptions |
struct | RequestContext |
class | RestRequestHandler |
Typedefs | |
using | RestError = mrs::interface::RestError |
using | ETagMismatch = mrs::interface::ETagMismatch |
using | AuthHandler = mrs::interface::AuthorizeManager::AuthorizeHandlerPtr |
using | AuthHandlers = mrs::interface::AuthorizeManager::AuthHandlers |
using | WwwAuthenticationHandler = mrs::authentication::WwwAuthenticationHandler |
using | Parameters = mrs::interface::RestHandler::Parameters |
using | HttpHeaders = ::http::base::Headers |
using | HttpBuffer = ::http::base::IOBuffer |
using | HttpRequest = ::http::base::Request |
using | ApplyToV3 = mrs::database::entry::AuthPrivilege::ApplyToV3 |
using | ApplyToV4 = mrs::database::entry::AuthPrivilege::ApplyToV4 |
using | DbObject = mrs::database::entry::DbObject |
using | DbService = mrs::database::entry::DbService |
using | DbObjectPtr = std::shared_ptr< DbObject > |
Functions | |
template<typename T > | |
std::string | to_string (const std::optional< T > &v) |
static bool | check_privileges_v3 (const ApplyToV3 &p, const UniversalId &service_id, const UniversalId &schema_id, const UniversalId &db_object_id) |
static bool | check_privileges_v4 (const ApplyToV4 &p, const std::string &service_path, const std::string &schema_path, const std::string &db_object_path) |
uint32_t | do_privilege_check (const std::vector< database::entry::AuthPrivilege > &privileges, const UniversalId &service_id, const std::string &service_path, const UniversalId &schema_id, const std::string &schema_path, const UniversalId &db_object_id, const std::string &db_object_path) |
uint32_t | get_access_right_from_http_method (const uint32_t method) |
static const char * | get_content_type (const Handler::HttpResult::Type type, const std::optional< std::string > &type_text) |
std::string | get_http_method_name (HttpMethod::key_type type) |
static const char * | to_cstr (const bool b) |
template<typename ValueType , bool default_value = false> | |
bool | to_bool (const ValueType &value) |
template<typename ValueType > | |
uint64_t | to_uint (const ValueType &value) |
template<typename ValueType > | |
double | to_double (const ValueType &value) |
mrs::interface::Options | parse_json_options (const std::optional< std::string > &options) |
rapidjson::Value | get_header_info (std::shared_ptr< DbService > service, rapidjson::Document::AllocatorType &allocator) |
Create OpenAPI title, version and description. More... | |
rapidjson::Value | get_security_scheme (rapidjson::Document::AllocatorType &allocator) |
Create security scheme for OpenAPI. More... | |
static std::optional< int > | get_type_size (std::string_view datatype) |
rapidjson::Value | get_route_openapi_component (DbObjectPtr entry, rapidjson::Document::AllocatorType &allocator) |
Create OpenAPI components section containing security schemes and schemas (type information with constraints) for each db object passed as a parameter. More... | |
void | get_procedure_metadata_component (rapidjson::Value &schema_properties, rapidjson::Document::AllocatorType &allocator) |
Create "_metadata" schema component item from a procedure call. More... | |
static rapidjson::Value | get_http_500_schema (rapidjson::Document::AllocatorType &allocator) |
rapidjson::Value | get_route_openapi_schema_path (const std::optional< uint32_t > privileges, DbObjectPtr entry, const std::string &url, rapidjson::Document::AllocatorType &allocator) |
Create OpenAPI 'paths' section. More... | |
bool | is_supported (const std::shared_ptr< mrs::database::entry::DbObject > &db_obj, const std::shared_ptr< mrs::database::entry::DbSchema > &db_schema) |
Check if the given DB Object entry can be used for getting an OpenAPI description. More... | |
template<typename R > | |
std::vector< R * > | sort_children_by_request_path (std::vector< std::shared_ptr< mrs::interface::EndpointBase > > children) |
Sort Endpoint children by request path. More... | |
Variables | |
constexpr std::string_view | k_auth_method_name = "mrs_login" |
constexpr std::string_view | k_schema_version {"1.0.0"} |
constexpr std::string_view | k_openapi_version {"3.1.0"} |
using mrs::rest::ApplyToV3 = typedef mrs::database::entry::AuthPrivilege::ApplyToV3 |
using mrs::rest::ApplyToV4 = typedef mrs::database::entry::AuthPrivilege::ApplyToV4 |
using mrs::rest::DbObject = typedef mrs::database::entry::DbObject |
using mrs::rest::DbObjectPtr = typedef std::shared_ptr<DbObject> |
using mrs::rest::DbService = typedef mrs::database::entry::DbService |
using mrs::rest::ETagMismatch = typedef mrs::interface::ETagMismatch |
using mrs::rest::HttpBuffer = typedef ::http::base::IOBuffer |
using mrs::rest::HttpHeaders = typedef ::http::base::Headers |
using mrs::rest::HttpRequest = typedef ::http::base::Request |
using mrs::rest::Parameters = typedef mrs::interface::RestHandler::Parameters |
using mrs::rest::RestError = typedef mrs::interface::RestError |
|
static |
|
static |
uint32_t mrs::rest::do_privilege_check | ( | const std::vector< database::entry::AuthPrivilege > & | privileges, |
const UniversalId & | service_id, | ||
const std::string & | service_path, | ||
const UniversalId & | schema_id, | ||
const std::string & | schema_path, | ||
const UniversalId & | db_object_id, | ||
const std::string & | db_object_path | ||
) |
uint32_t mrs::rest::get_access_right_from_http_method | ( | const uint32_t | method | ) |
|
static |
rapidjson::Value mrs::rest::get_header_info | ( | std::shared_ptr< DbService > | service, |
rapidjson::Document::AllocatorType & | allocator | ||
) |
Create OpenAPI title, version and description.
[in] | service | DBservice entry. |
[in] | allocator | JSON allocator that is used to create OpenAPI swagger. |
|
static |
std::string mrs::rest::get_http_method_name | ( | HttpMethod::key_type | type | ) |
void mrs::rest::get_procedure_metadata_component | ( | rapidjson::Value & | schema_properties, |
rapidjson::Document::AllocatorType & | allocator | ||
) |
Create "_metadata" schema component item from a procedure call.
[in,out] | schema_properties | JSON containing schema components. |
[in] | allocator | JSON allocator that is used to create OpenAPI swagger. |
rapidjson::Value mrs::rest::get_route_openapi_component | ( | DbObjectPtr | entry, |
rapidjson::Document::AllocatorType & | allocator | ||
) |
Create OpenAPI components section containing security schemes and schemas (type information with constraints) for each db object passed as a parameter.
[in] | entry | DBobject entry |
[in] | allocator | JSON allocator that is used to create OpenAPI swagger. |
rapidjson::Value mrs::rest::get_route_openapi_schema_path | ( | const std::optional< uint32_t > | privileges, |
DbObjectPtr | entry, | ||
const std::string & | url, | ||
rapidjson::Document::AllocatorType & | allocator | ||
) |
Create OpenAPI 'paths' section.
Each path contains supported HTTP methods with HTTP responses and optional parameters.
[in] | privileges | User privileges |
[in] | entry | DBobject entry |
[in] | url | path used by DBobject entry |
[in] | allocator | JSON allocator that is used to create OpenAPI swagger. |
rapidjson::Value mrs::rest::get_security_scheme | ( | rapidjson::Document::AllocatorType & | allocator | ) |
Create security scheme for OpenAPI.
[in] | allocator | JSON allocator that is used to create OpenAPI swagger. |
|
static |
bool mrs::rest::is_supported | ( | const std::shared_ptr< mrs::database::entry::DbObject > & | db_obj, |
const std::shared_ptr< mrs::database::entry::DbSchema > & | db_schema | ||
) |
Check if the given DB Object entry can be used for getting an OpenAPI description.
It must be enabled, its schema must be enabled, and it have to be in appropriate type.
[in] | db_obj | DB Object entry |
[in] | db_schema | DB Schema entry |
true | DB Object entry might be used. |
false | DB Object entry might not be used. |
mrs::interface::Options mrs::rest::parse_json_options | ( | const std::optional< std::string > & | options | ) |
std::vector< R * > mrs::rest::sort_children_by_request_path | ( | std::vector< std::shared_ptr< mrs::interface::EndpointBase > > | children | ) |
Sort Endpoint children by request path.
[in] | children | Endpoint children. |
R | returned Endpoint type. |
bool mrs::rest::to_bool | ( | const ValueType & | value | ) |
|
static |
double mrs::rest::to_double | ( | const ValueType & | value | ) |
uint64_t mrs::rest::to_uint | ( | const ValueType & | value | ) |
|
constexpr |
|
constexpr |
|
constexpr |