Qore FileLocationHandler Module Reference 2.2
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
172protected:
173 Qore::StreamReader getStreamReaderImpl(string scheme, string location, *hash<auto> opts);
174public:
175
176
178
188protected:
189 Qore::InputStream getBinaryStreamImpl(string scheme, string location, *hash<auto> opts);
190public:
191
192
194
201protected:
202 writeFileImpl(string scheme, string location, data contents, *hash<auto> opts);
203public:
204
205
207
215protected:
216 OutputStreamWrapper getOutputStreamImpl(string scheme, string location, *hash<auto> opts);
217public:
218
219
221
223protected:
224 hash<string, hash<FileHandlerOptionInfo>> getReadOptionsImpl();
225public:
226
227
229
231protected:
232 hash<string, hash<FileHandlerOptionInfo>> getWriteOptionsImpl();
233public:
234
235
237
240protected:
241 object getRestClient(string scheme, string location, *hash<auto> opts, reference<string> path);
242public:
243
244};
245};
The abstract file location handler class.
Definition: FileLocationHandler.qc.dox.h:43
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)
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.
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.
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