Loading...
Searching...
No Matches
FileLocationHandlerRest.qc.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
/* FileLocationHandlerRest Copyright 2021 - 2023 Qore Technologies, s.r.o.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
namespace FileLocationHandler {
class FileLocationHandlerRest : public AbstractFileLocationHandler {
public:
const RestClientLocationOpts = {
"connect_timeout": <FileHandlerOptionInfo>{
"type": "int",
"desc": "Connection timeout in milliseconds",
},
"content_encoding": <FileHandlerOptionInfo>{
"type": "string",
"desc": "The content encoding (compression algorithm) for sending (if `send_encoding` is not set) "
"and receiving",
},
"data": <FileHandlerOptionInfo>{
"type": "string",
"desc": "The data serialization option to use",
"default_value": "auto",
},
"error_passthru": <FileHandlerOptionInfo>{
"type": "bool",
"desc": "Error responses will be passed to the caller instead of causing an exception to be raised",
},
"headers": <FileHandlerOptionInfo>{
"type": "hash",
"desc": "An optional hash of headers to send with the request",
},
"http_version": <FileHandlerOptionInfo>{
"type": "string",
"desc": "The HTTP version to use",
"default_value": "1.1",
},
"max_redirects": <FileHandlerOptionInfo>{
"type": "int",
"desc": "The maximum number of redirect responses to process",
"default_value": 5,
},
"method": <FileHandlerOptionInfo>{
"type": "string",
"desc": "The HTTP method to use; if not given then `GET` is used for reads, and `POST` is used for "
"writes",
},
"proxy": <FileHandlerOptionInfo>{
"type": "string",
"desc": "The proxy URL for connecting through a proxy",
},
"redirect_passthru": <FileHandlerOptionInfo>{
"type": "bool",
"desc": "Redirect responses will be passed to the caller instead of followed",
},
"send_encoding": <FileHandlerOptionInfo>{
"type": "string",
"desc": "The content encoding (compression algorithm) to use when sending data",
},
"ssl_cert_data": <FileHandlerOptionInfo>{
"type": "data",
"desc": "The X.509 certificate data in PEM format (string) or in DER format (binary); if this "
"option is set, then `ssl_cert_path` is ignored",
},
"ssl_cert_path": <FileHandlerOptionInfo>{
"type": "string",
"desc": "A path to an X.509 client certificate file in PEM format; if this option is used, then the "
"calling context must not be restricted with sandbox restriction `PO_NO_FILESYSTEM` which is "
"checked at runtime",
},
"ssl_key_data": <FileHandlerOptionInfo>{
"type": "data",
"desc": "The X.509 private key data in PEM format (string) or in DER format (binary); if this "
"option is set, then `ssl_key_path` is ignored",
},
"ssl_key_path": <FileHandlerOptionInfo>{
"type": "string",
"desc": "A path to a private key file in PEM format; if this option is used, then the "
"calling context must not be restricted with sandbox restriction `PO_NO_FILESYSTEM` which is "
"checked at runtime",
},
"ssl_key_password": <FileHandlerOptionInfo>{
"type": "string",
"desc": "The password to the private key given with `ssl_key_path`",
},
"ssl_verify_cert": <FileHandlerOptionInfo>{
"type": "bool",
"desc": "The server's certificate will only be accepted if it's verified",
},
"swagger": <FileHandlerOptionInfo>{
"type": "string",
"desc": "The location of a Swagger schema to use for message validation",
},
"swagger_base_path": <FileHandlerOptionInfo>{
"type": "string",
"desc": "In case a REST validator is used, the base path in the schema can be overridden "
"with this option (applies to any REST validator; not just Swagger validators)",
},
"timeout": <FileHandlerOptionInfo>{
"type": "int",
"desc": "I/O timeout in milliseconds",
},
};
protected:
string getTextFileImpl(string scheme, string location, *hash<auto> opts);
public:
protected:
binary getBinaryFileImpl(string scheme, string location, *hash<auto> opts);
public:
protected:
Qore::StreamReader getStreamReaderImpl(string scheme, string location, *hash<auto> opts);
public:
protected:
Qore::InputStream getBinaryStreamImpl(string scheme, string location, *hash<auto> opts);
public:
protected:
writeFileImpl(string scheme, string location, data contents, *hash<auto> opts);
public:
protected:
OutputStreamWrapper getOutputStreamImpl(string scheme, string location, *hash<auto> opts);
public:
protected:
hash<string, hash<FileHandlerOptionInfo>> getReadOptionsImpl();
public:
protected:
hash<string, hash<FileHandlerOptionInfo>> getWriteOptionsImpl();
public:
protected:
object getRestClient(string scheme, string location, *hash<auto> opts, reference<string> path);
public:
};
};
FileLocationHandler::AbstractFileLocationHandler
The abstract file location handler class.
Definition: FileLocationHandler.qc.dox.h:53
FileLocationHandler::FileLocationHandlerRest
The class for handling "rest(s)://"" locations.
Definition: FileLocationHandlerRest.qc.dox.h:30
FileLocationHandler::FileLocationHandlerRest::getBinaryFileImpl
binary getBinaryFileImpl(string scheme, string location, *hash< auto > opts)
Retrieves a binary file from the given location.
FileLocationHandler::FileLocationHandlerRest::getReadOptionsImpl
hash< string, hash< FileHandlerOptionInfo > > getReadOptionsImpl()
Gets supported read options.
FileLocationHandler::FileLocationHandlerRest::getRestClient
object getRestClient(string scheme, string location, *hash< auto > opts, reference< string > path)
Returns a RestClient object for the given location.
FileLocationHandler::FileLocationHandlerRest::getOutputStreamImpl
OutputStreamWrapper getOutputStreamImpl(string scheme, string location, *hash< auto > opts)
This method only throws a STREAM-WRITE-ERROR exception.
FileLocationHandler::FileLocationHandlerRest::writeFileImpl
writeFileImpl(string scheme, string location, data contents, *hash< auto > opts)
Writes data to a file at the given location.
FileLocationHandler::FileLocationHandlerRest::RestClientLocationOpts
const RestClientLocationOpts
Valid REST location options.
Definition: FileLocationHandlerRest.qc.dox.h:36
FileLocationHandler::FileLocationHandlerRest::getStreamReaderImpl
Qore::StreamReader getStreamReaderImpl(string scheme, string location, *hash< auto > opts)
Returns a stream reader for the file's data at the given location.
FileLocationHandler::FileLocationHandlerRest::getTextFileImpl
string getTextFileImpl(string scheme, string location, *hash< auto > opts)
Retrieves a text file from the given location.
FileLocationHandler::FileLocationHandlerRest::getBinaryStreamImpl
Qore::InputStream getBinaryStreamImpl(string scheme, string location, *hash< auto > opts)
Retrieves a binary file from the given location.
FileLocationHandler::FileLocationHandlerRest::getWriteOptionsImpl
hash< string, hash< FileHandlerOptionInfo > > getWriteOptionsImpl()
Gets supported write options.
FileLocationHandler::OutputStreamWrapper
The abstract file location handler class.
Definition: OutputStramWrapper.qc.dox.h:28
Qore::InputStream
Qore::StreamReader
FileLocationHandler
Contains all public definitions in the FileLocationHandler module.
Definition: FileLocationHandler.qc.dox.h:26
FileLocationHandler::FileHandlerOptionInfo
File handler option info.
Definition: FileLocationHandler.qc.dox.h:28