107 const DefaultSendEncoding =
"gzip";
110 const RequiredOptions = ...;
114 const QoreDigest = CRYPTO_DIGEST_SHA256;
117 const AwsSignatureAlgorithm =
"AWS4-HMAC-SHA256";
120 const AwsTermination =
"aws4_request";
136 string credential_scope_suffix;
210 hash<auto> sendAndDecodeResponse(*data body,
string m,
string path, hash<auto> hdr, *reference<hash<auto>> info, *softbool decode_errors);
213 string getSignature(
string http_method,
string path, reference<hash<auto>> hdr, *data body, date gmtime,
214 string scope, reference<string> signed_headers) {
215 string req_string = getRequestString(http_method, path, \hdr, body, gmtime, scope, \signed_headers);
218 string gmdate = gmtime.format(
"YYYYMMDD");
220 binary signing_key = hmac(QoreDigest, gmdate,
"AWS4" + aws_secret);
222 signing_key = hmac(QoreDigest, aws_region, signing_key);
224 signing_key = hmac(QoreDigest, aws_service, signing_key);
226 signing_key = hmac(QoreDigest, AwsTermination, signing_key);
228 string sig = hmac(QoreDigest, req_string, signing_key).toHex();
233 private string getRequestString(
string http_method,
string path, reference<hash<auto>> hdr, *data body, date gmtime,
234 string scope, reference<string> signed_headers) {
236 string aws_date = gmtime.format(
"YYYYMMDDTHHmmSS") +
"Z";
237 hdr.
"X-Amz-Date" = aws_date;
238 string csig = getCanonicalSignature(http_method, path, hdr, body, \signed_headers);
240 string msg = AwsSignatureAlgorithm +
"\n"
248 private string getCanonicalSignature(
string http_method,
string path, hash<auto> hdr, *data body,
249 reference<string> signed_headers) {
252 string cstr = http_method +
"\n";
255 hash<UriQueryInfo> uri_info = parse_uri_query(path);
258 string uri = uri_info.method ??
"/";
265 uri = encode_url(uri, False);
274 if (uri_info.params);
280 hdr = map {$1.key.lwr(): $1.value}, hdr.pairIterator();
282 hdr += {
"host": getHostHeaderValue()};
285 hdr = map {$1: hdr{$1}},
sort(keys hdr);
291 static string trimall(
string str) {
"cls": Class::forName(
"AwsRestConnection"),
292 "options": RestConnection::ConnectionScheme.options + {
293 "data": <ConnectionOptionInfo>{
295 "desc":
"data serialization options are limited to `json` with this object",
299 "desc":
"use JSON serialization",
302 "default_value":
"json",
304 "aws_keyid": <ConnectionOptionInfo>{
306 "desc":
"AWS key ID",
308 "aws_secret": <ConnectionOptionInfo>{
310 "desc":
"the AWS secret access key value",
313 "aws_region": <ConnectionOptionInfo>{
315 "desc":
"the AWS region to use (ex: `us-east-1`)",
317 "aws_service": <ConnectionOptionInfo>{
319 "desc":
"the AWS service to use (ex: `iam`)",
321 "aws_s3": <ConnectionOptionInfo>{
323 "desc":
"set to `True` to flag this object for use with AWS S3, which requires special "
325 "default_value":
False,
327 "aws_token": <ConnectionOptionInfo>{
329 "desc":
"a temporary session token from AWS Security Token Service for this HTTP session",
347 constructor(
string name,
string description,
string url, hash<auto> attributes = {}, hash<auto> options = {})
constructor(hash< auto > opts, *softbool do_not_connect)
creates the object with the given options
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
AwsRestClient getImpl(bool connect=True, *hash< auto > rtopts)
returns a AwsRestClient::AwsRestClient object
DataProvider::AbstractDataProvider getDataProvider()
returns a data provider object for this connection
string getType()
returns "awsrest"
const RequiredOptions
required options
Definition: AwsRestClient.qm.dox.h:110
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl()
Returns the ConnectionSchemeInfo hash for this object.
the AwsRestClient namespace contains all the objects in the AwsRestClient module
Definition: AwsRestClient.qm.dox.h:95