Loading...
Searching...
No Matches
RestClientDataProvider.qc.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
namespace RestClientDataProvider {
class RestClientDataProvider : public AbstractDataProvider {
public:
const ProviderInfo = <DataProviderInfo>{
"type": "RestClientDataProvider",
"constructor_options": ConstructorOptions,
"supports_children": True,
"children_can_support_apis": True,
"children_can_support_records": False,
"children_can_support_observers": False,
};
const ConstructorOptions = {
"assume_encoding": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "Assumes the given encoding if the server does not send a `charset` value",
},
"connect_timeout": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(IntType),
"desc": "The connection timeout to use in milliseconds (default: 45 seconds)",
"default_value": 45000,
},
"content_encoding": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "Sets the send encoding (if the `send_encoding` option is not set) and the "
"response encoding to request"
"Sets the send encoding (if the `send_encoding` option is not set) and the requested response "
"encoding (note that only outgoing message bodies over `1024` bytes in size are compressed)",
"default_value": "gzip",
"allowed_values": (
<AllowedValueInfo>{
"value": "gzip",
"desc": "use GNU zip encoding ([RFC 1952](https://tools.ietf.org/html/rfc1952))",
}, <AllowedValueInfo>{
"value": "bzip2",
"desc": "use bzip2 encoding",
}, <AllowedValueInfo>{
"value": "deflate",
"desc": "use the deflate algorithm ([RFC 1951](https://tools.ietf.org/html/rfc1951))",
}, <AllowedValueInfo>{
"value": "identity",
"desc": "use no content encoding",
},
),
},
"data": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "Determines how message bodies are serialized",
"default_value": "auto",
"allowed_values": (
<AllowedValueInfo>{
"value": "auto",
"desc": "Prefers in this order: `json`, `yaml`, `rawxml`, `xml`, `url`, and `text`",
}, <AllowedValueInfo>{
"value": "bin",
"desc": "For binary message bodies without data serialization",
}, <AllowedValueInfo>{
"value": "json",
"desc": "Use JSON serialization",
}, <AllowedValueInfo>{
"value": "rawxml",
"desc": "Message bodies are encoded with XML without any data type encodings",
}, <AllowedValueInfo>{
"value": "text",
"desc": "Use only plain text; no serialization is used",
}, <AllowedValueInfo>{
"value": "url",
"desc": "For URL-encoded message bodies "
"(see [RFC 2738 2.2](https://tools.ietf.org/html/rfc1738))",
}, <AllowedValueInfo>{
"value": "xml",
"desc": "Use only XML-RPC value serialization",
}, <AllowedValueInfo>{
"value": "yaml",
"desc": "Use only YAML serialization",
},
),
},
"error_passthru": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(BoolType),
"desc": "If `True` then REST status codes indicating errors will not cause an "
"`REST-CLIENT-RECEIVE-ERROR` exception to be raised, rather such responses will be "
"passed through to the caller like any other response",
"default_value": False,
},
"headers": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(HashType),
"desc": "An optional hash of headers to send with every request"
},
"http_version": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "HTTP version to use (`1.0` or `1.1`, defaults to `1.1`)",
"default_value": "1.1",
"allowed_values": (
<AllowedValueInfo>{
"value": "1.0",
"desc": "Use HTTP version \"1.0\"",
}, <AllowedValueInfo>{
"value": "1.1",
"desc": "Use HTTP version \"1.1\" (the default)",
},
),
},
"max_redirects": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(IntType),
"desc": "Maximum redirects to support",
},
"no_charset": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(BoolType),
"desc": "If `True` no charset will be added to the `Content-Type` header",
},
"proxy": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "The proxy URL to use",
},
"redirect_passthru": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(BoolType),
"desc": "if `True` then redirect responses will be passed to the caller instead of processed",
"default_value": False,
},
"send_encoding": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "Sets the send encoding (if the `send_encoding` option is not set) and the requested response "
"encoding (note that only outgoing message bodies over `1024` bytes in size are compressed)",
"allowed_values": (
<AllowedValueInfo>{
"value": "gzip",
"desc": "use GNU zip encoding ([RFC 1952](https://tools.ietf.org/html/rfc1952))",
}, <AllowedValueInfo>{
"value": "bzip2",
"desc": "use bzip2 encoding",
}, <AllowedValueInfo>{
"value": "deflate",
"desc": "use the deflate algorithm ([RFC 1951](https://tools.ietf.org/html/rfc1951))",
}, <AllowedValueInfo>{
"value": "identity",
"desc": "use no content encoding",
},
),
},
"ssl_cert_der": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(BoolType),
"desc": "If `True` then the data represented by `ssl_cert_location` will be assumed to be in binary "
"DER format",
"default_value": False,
},
"ssl_cert_location": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType, NOTHING, {
DTT_FromFile: True,
DTT_FromLocation: True,
}),
"desc": "A path or location to an X.509 client certificate file",
},
"ssl_key_der": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(BoolType),
"desc": "If `True` then the data represented by `ssl_key_location` will be assumed to be in binary "
"DER format",
"default_value": False,
},
"ssl_key_location": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType, NOTHING, {
DTT_FromFile: True,
DTT_FromLocation: True,
}),
"desc": "A path or location to a private key file for the X.509 client certificate",
},
"ssl_key_password": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "The password to the private key given with `ssl_key_path` (text PEM format only)",
"sensitive": True,
},
"ssl_verify_cert": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(BoolType),
"desc": "if `True` then the server's certificate will only be accepted if it's verified",
"default_value": False,
},
"swagger": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType, NOTHING, {
DTT_FromFile: True,
DTT_FromLocation: True,
}),
"desc": "A Swagger 2.0 schema location or file data for the REST connection",
},
"timeout": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(IntType),
"desc": "Transfer timeout to use in milliseconds (default: 45 seconds)",
"default_value": 45000,
},
"url": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "A URL for a REST or RESTS connection",
"required": True,
},
"validator_base_path": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "In case a REST validator is used, the base path in the schema can be overridden with this "
"option",
},
};
RestClient rest;
protected:
const ChildMap = {
"call": Class::forName("RestClientDataProvider::RestClientCallDataProvider"),
"delete": Class::forName("RestClientDataProvider::RestClientDeleteDataProvider"),
"get": Class::forName("RestClientDataProvider::RestClientGetDataProvider"),
"head": Class::forName("RestClientDataProvider::RestClientHeadDataProvider"),
"options": Class::forName("RestClientDataProvider::RestClientOptionsDataProvider"),
"patch": Class::forName("RestClientDataProvider::RestClientPatchDataProvider"),
"post": Class::forName("RestClientDataProvider::RestClientPostDataProvider"),
"put": Class::forName("RestClientDataProvider::RestClientPutDataProvider"),
};
public:
constructor(*hash<auto> options);
constructor(RestClient rest);
string getName();
*string getDesc();
*list<hash<DataProviderSummaryInfo>> getChildProviderSummaryInfo();
static RestClient getRestConnection(hash<auto> options);
static hash<auto> makeRequest(RestClient rest, string meth, *data body, string path, *hash<auto> hdr);
static hash<auto> processRestOptions(hash<auto> options);
protected:
*list<string> getChildProviderNamesImpl();
public:
protected:
*AbstractDataProvider getChildProviderImpl(string name);
public:
protected:
hash<DataProviderInfo> getStaticInfoImpl();
public:
};
};
RestClientDataProvider::RestClientDataProvider::getChildProviderNamesImpl
*list< string > getChildProviderNamesImpl()
Returns a list of child data provider names, if any.
RestClientDataProvider::RestClientDataProvider::getChildProviderImpl
*AbstractDataProvider getChildProviderImpl(string name)
Returns the given child provider or NOTHING if the given child is unknown.
RestClientDataProvider::RestClientDataProvider::getStaticInfoImpl
hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
RestClientDataProvider::RestClientDataProvider::constructor
constructor(*hash< auto > options)
Creates the object from constructor options.
RestClientDataProvider::RestClientDataProvider::getDesc
*string getDesc()
Returns the data provider description.
RestClientDataProvider::RestClientDataProvider::constructor
constructor(RestClient rest)
Creates the object from a REST connection.
RestClientDataProvider::RestClientDataProvider::getName
string getName()
Returns the data provider name.
RestClientDataProvider::RestClientDataProvider::getChildProviderSummaryInfo
*list< hash< DataProviderSummaryInfo > > getChildProviderSummaryInfo()
Return data provider summary info.
RestClientDataProvider::RestClientDataProvider::processRestOptions
static hash< auto > processRestOptions(hash< auto > options)
Processes common REST options.
RestClientDataProvider::RestClientDataProvider::makeRequest
static hash< auto > makeRequest(RestClient rest, string meth, *data body, string path, *hash< auto > hdr)
Makes a REST request and returns the response.
RestClientDataProvider::RestClientDataProvider::getRestConnection
static RestClient getRestConnection(hash< auto > options)
Returns a REST connection.
RestClientDataProvider
Qore RestClientDataProvider module definition.
Definition: RestClientCallDataProvider.qc.dox.h:26
RestClient