Qore AwsRestClient Module Reference 1.2
Loading...
Searching...
No Matches
AwsRestClient.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* AwsRestClient.qm Copyright (C) 2019 - 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
25// minimum qore version
26
27// require type definitions everywhere
28
29// enable all warnings
30
31// don't use "$" for vars, members, and methods, assume local variable scope
32
33// do not ignore argument errors
34
35
36
94namespace AwsRestClient {
96
103
104public:
106 const DefaultSendEncoding = "gzip";
107
109 const RequiredOptions = ...;
110
111
113 const QoreDigest = CRYPTO_DIGEST_SHA256;
114
116 const AwsSignatureAlgorithm = "AWS4-HMAC-SHA256";
117
119 const AwsTermination = "aws4_request";
120
121private:
122 // the AWS access key ID
123 string aws_keyid;
124 // the AWS secret access key
125 string aws_secret;
126 // the AWS region
127 string aws_region;
128 // the AWS service
129 string aws_service;
130 // is this request for AWS S3?
131 bool aws_s3 = False;
132 // temporary session token
133 string aws_token;
134 // credential scope suffix
135 string credential_scope_suffix;
136
137public:
138
140
206 constructor(hash<auto> opts, *softbool do_not_connect) ;
207
208
209 hash<auto> sendAndDecodeResponse(*data body, string m, string path, hash<auto> hdr, *reference<hash<auto>> info, *softbool decode_errors);
210
211
212 string getSignature(string http_method, string path, reference<hash<auto>> hdr, *data body, date gmtime, string scope, reference<string> signed_headers);
213
214
215protected:
216 string getRequestString(string http_method, string path, reference<hash<auto>> hdr, *data body, date gmtime, string scope, reference<string> signed_headers);
217public:
218
219
220protected:
221 string getCanonicalSignature(string http_method, string path, hash<auto> hdr, *data body, reference<string> signed_headers);
222public:
223
224
225private:
226 static string trimall(string str);
227public:
228
229};
230
232
263
264public:
266 const ConnectionScheme = <ConnectionSchemeInfo>{
267 "cls": Class::forName("AwsRestConnection"),
268 "options": RestConnection::ConnectionScheme.options + {
269 "data": <ConnectionOptionInfo>{
270 "type": "string",
271 "desc": "data serialization options are limited to `json` with this object",
272 "allowed_values": (
273 <AllowedValueInfo>{
274 "value": "json",
275 "desc": "use JSON serialization",
276 },
277 ),
278 "default_value": "json",
279 },
280 "aws_keyid": <ConnectionOptionInfo>{
281 "type": "string",
282 "desc": "AWS key ID",
283 },
284 "aws_secret": <ConnectionOptionInfo>{
285 "type": "string",
286 "desc": "the AWS secret access key value",
287 "sensitive": True,
288 },
289 "aws_region": <ConnectionOptionInfo>{
290 "type": "string",
291 "desc": "the AWS region to use (ex: `us-east-1`)",
292 },
293 "aws_service": <ConnectionOptionInfo>{
294 "type": "string",
295 "desc": "the AWS service to use (ex: `iam`)",
296 },
297 "aws_s3": <ConnectionOptionInfo>{
298 "type": "bool",
299 "desc": "set to `True` to flag this object for use with AWS S3, which requires special "
300 "message encoding",
301 "default_value": False,
302 },
303 "aws_token": <ConnectionOptionInfo>{
304 "type": "string",
305 "desc": "a temporary session token from AWS Security Token Service for this HTTP session",
306 },
307 },
308 "required_options": foldl $1 + "," + $2, AwsRestClient::RequiredOptions,
309 };
310
312
322 constructor(string name, string description, string url, hash<auto> attributes = {}, hash<auto> options = {})
323 ;
324
325
327 string getType();
328
329
331
337 DataProvider::AbstractDataProvider getDataProvider();
338
339
341
346
347
349
354protected:
355 AwsRestClient getImpl(bool connect = True, *hash<auto> rtopts);
356public:
357
358
360protected:
361 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
362public:
363
364};
365};
constructor(hash< auto > opts, *softbool do_not_connect)
creates the object with the given options
const RequiredOptions
required options
Definition: AwsRestClient.qm.dox.h:109
class for AWS REST connections; returns AwsRestClient::AwsRestClient objects
Definition: AwsRestClient.qm.dox.h:262
DataProvider::AbstractDataProvider getDataProvider()
returns a data provider object for this connection
AwsRestClient getImpl(bool connect=True, *hash< auto > rtopts)
returns a AwsRestClient::AwsRestClient object
bool hasDataProvider()
returns True, as this connection always returns a data provider with the getDataProvider() method
constructor(string name, string description, string url, hash< auto > attributes={}, hash< auto > options={})
creates the AwsRestConnection object
const ConnectionScheme
Connection entry info.
Definition: AwsRestClient.qm.dox.h:266
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl()
Returns the ConnectionSchemeInfo hash for this object.
string getType()
returns "awsrest"
the AwsRestClient namespace contains all the objects in the AwsRestClient module
Definition: AwsRestClient.qm.dox.h:94