Qore FileLocationHandler Module Reference 2.3
Loading...
Searching...
No Matches
FileLocationHandlerRest.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* FileLocationHandlerRest Copyright 2021 - 2023 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
26namespace FileLocationHandler {
28
31
32public:
34
37 "connect_timeout": <FileHandlerOptionInfo>{
38 "type": "int",
39 "desc": "Connection timeout in milliseconds",
40 },
41 "content_encoding": <FileHandlerOptionInfo>{
42 "type": "string",
43 "desc": "The content encoding (compression algorithm) for sending (if `send_encoding` is not set) "
44 "and receiving",
45 },
46 "data": <FileHandlerOptionInfo>{
47 "type": "string",
48 "desc": "The data serialization option to use",
49 "default_value": "auto",
50 },
51 "error_passthru": <FileHandlerOptionInfo>{
52 "type": "bool",
53 "desc": "Error responses will be passed to the caller instead of causing an exception to be raised",
54 },
55 "headers": <FileHandlerOptionInfo>{
56 "type": "hash",
57 "desc": "An optional hash of headers to send with the request",
58 },
59 "http_version": <FileHandlerOptionInfo>{
60 "type": "string",
61 "desc": "The HTTP version to use",
62 "default_value": "1.1",
63 },
64 "max_redirects": <FileHandlerOptionInfo>{
65 "type": "int",
66 "desc": "The maximum number of redirect responses to process",
67 "default_value": 5,
68 },
69 "method": <FileHandlerOptionInfo>{
70 "type": "string",
71 "desc": "The HTTP method to use; if not given then `GET` is used for reads, and `POST` is used for "
72 "writes",
73 },
74 "proxy": <FileHandlerOptionInfo>{
75 "type": "string",
76 "desc": "The proxy URL for connecting through a proxy",
77 },
78 "redirect_passthru": <FileHandlerOptionInfo>{
79 "type": "bool",
80 "desc": "Redirect responses will be passed to the caller instead of followed",
81 },
82 "send_encoding": <FileHandlerOptionInfo>{
83 "type": "string",
84 "desc": "The content encoding (compression algorithm) to use when sending data",
85 },
86 "ssl_cert_data": <FileHandlerOptionInfo>{
87 "type": "data",
88 "desc": "The X.509 certificate data in PEM format (string) or in DER format (binary); if this "
89 "option is set, then `ssl_cert_path` is ignored",
90 },
91 "ssl_cert_path": <FileHandlerOptionInfo>{
92 "type": "string",
93 "desc": "A path to an X.509 client certificate file in PEM format; if this option is used, then the "
94 "calling context must not be restricted with sandbox restriction `PO_NO_FILESYSTEM` which is "
95 "checked at runtime",
96 },
97 "ssl_key_data": <FileHandlerOptionInfo>{
98 "type": "data",
99 "desc": "The X.509 private key data in PEM format (string) or in DER format (binary); if this "
100 "option is set, then `ssl_key_path` is ignored",
101 },
102 "ssl_key_path": <FileHandlerOptionInfo>{
103 "type": "string",
104 "desc": "A path to a private key file in PEM format; if this option is used, then the "
105 "calling context must not be restricted with sandbox restriction `PO_NO_FILESYSTEM` which is "
106 "checked at runtime",
107 },
108 "ssl_key_password": <FileHandlerOptionInfo>{
109 "type": "string",
110 "desc": "The password to the private key given with `ssl_key_path`",
111 },
112 "ssl_verify_cert": <FileHandlerOptionInfo>{
113 "type": "bool",
114 "desc": "The server's certificate will only be accepted if it's verified",
115 },
116 "swagger": <FileHandlerOptionInfo>{
117 "type": "string",
118 "desc": "The location of a Swagger schema to use for message validation",
119 },
120 "swagger_base_path": <FileHandlerOptionInfo>{
121 "type": "string",
122 "desc": "In case a REST validator is used, the base path in the schema can be overridden "
123 "with this option (applies to any REST validator; not just Swagger validators)",
124 },
125 "timeout": <FileHandlerOptionInfo>{
126 "type": "int",
127 "desc": "I/O timeout in milliseconds",
128 },
129 };
130
132
142protected:
143 string getTextFileImpl(string scheme, string location, *hash<auto> opts);
144public:
145
146
148
156protected:
157 binary getBinaryFileImpl(string scheme, string location, *hash<auto> opts);
158public:
159
160
162
168protected:
169 Qore::AbstractPollOperation getIoPollerForLocationImpl(string scheme, string location, *hash<auto> opts);
170public:
171
172
174
184protected:
185 Qore::StreamReader getStreamReaderImpl(string scheme, string location, *hash<auto> opts);
186public:
187
188
190
200protected:
201 Qore::InputStream getBinaryStreamImpl(string scheme, string location, *hash<auto> opts);
202public:
203
204
206
213protected:
214 writeFileImpl(string scheme, string location, data contents, *hash<auto> opts);
215public:
216
217
219
227protected:
228 OutputStreamWrapper getOutputStreamImpl(string scheme, string location, *hash<auto> opts);
229public:
230
231
233
235protected:
236 hash<string, hash<FileHandlerOptionInfo>> getReadOptionsImpl();
237public:
238
239
241
243protected:
244 hash<string, hash<FileHandlerOptionInfo>> getWriteOptionsImpl();
245public:
246
247
249
252protected:
253 object getRestClient(string scheme, string location, *hash<auto> opts, reference<string> path, bool do_connect = True);
254public:
255
256};
257
259class HttpPollWrapper : public AbstractPollOperation {
260
261public:
262protected:
264 AbstractPollOperation op;
265
266public:
267
269 constructor(AbstractPollOperation op);
270
271
273 string getGoal();
274
275
277 string getState();
278
279
282
283
285 *hash<SocketPollInfo> continuePoll();
286
287
289 auto getOutput();
290
291};
292};
The abstract file location handler class.
Definition: FileLocationHandler.qc.dox.h:53
The class for handling "rest(s)://"" locations.
Definition: FileLocationHandlerRest.qc.dox.h:30
binary getBinaryFileImpl(string scheme, string location, *hash< auto > opts)
Retrieves a binary file from the given location.
hash< string, hash< FileHandlerOptionInfo > > getReadOptionsImpl()
Gets supported read options.
object getRestClient(string scheme, string location, *hash< auto > opts, reference< string > path, bool do_connect=True)
Returns a RestClient object for the given location.
OutputStreamWrapper getOutputStreamImpl(string scheme, string location, *hash< auto > opts)
This method only throws a STREAM-WRITE-ERROR exception.
writeFileImpl(string scheme, string location, data contents, *hash< auto > opts)
Writes data to a file at the given location.
const RestClientLocationOpts
Valid REST location options.
Definition: FileLocationHandlerRest.qc.dox.h:36
Qore::StreamReader getStreamReaderImpl(string scheme, string location, *hash< auto > opts)
Returns a stream reader for the file's data at the given location.
Qore::AbstractPollOperation getIoPollerForLocationImpl(string scheme, string location, *hash< auto > opts)
Retrieves an I/O poller to retrieve a binary file from the given location.
string getTextFileImpl(string scheme, string location, *hash< auto > opts)
Retrieves a text file from the given location.
Qore::InputStream getBinaryStreamImpl(string scheme, string location, *hash< auto > opts)
Retrieves a binary file from the given location.
hash< string, hash< FileHandlerOptionInfo > > getWriteOptionsImpl()
Gets supported write options.
Wraps an HTTP poller so that the response body is always returned as the output.
Definition: FileLocationHandlerRest.qc.dox.h:259
bool goalReached()
Calls the corresponding method in the wrapped poller and returns the return value.
string getState()
Calls the corresponding method in the wrapped poller and returns the return value.
AbstractPollOperation op
The HTTP poller to execute.
Definition: FileLocationHandlerRest.qc.dox.h:264
auto getOutput()
Returns the value of the "response-body" key in the wrapped HTTP poller's output data.
constructor(AbstractPollOperation op)
Creates the object wrapping the HTTP poller passed as an argument.
string getGoal()
Calls the corresponding method in the wrapped poller and returns the return value.
*hash< SocketPollInfo > continuePoll()
Calls the corresponding method in the wrapped poller and returns the return value.
The abstract file location handler class.
Definition: OutputStramWrapper.qc.dox.h:28
Contains all public definitions in the FileLocationHandler module.
Definition: FileLocationHandler.qc.dox.h:26
File handler option info.
Definition: FileLocationHandler.qc.dox.h:28