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,
 
  211            *softbool decode_errors) {
 
  215        string scope = sprintf(
"%s/%s", gmtime.format(
"YYYYMMDD"), credential_scope_suffix);
 
  218        string signed_headers;
 
  224        string sig = getSignature(m, path, \hdr, body, gmtime, scope, \signed_headers);
 
  227        hdr.Authorization = sprintf(
"%s Credential=%s/%s, SignedHeaders=%s, Signature=%s",
 
  228            AwsSignatureAlgorithm, aws_keyid, scope, signed_headers, sig);
 
  233    string getSignature(
string http_method, 
string path, reference<hash<auto>> hdr, *data body, date gmtime,
 
  234        string scope, reference<string> signed_headers) {
 
  235        string req_string = getRequestString(http_method, path, \hdr, body, gmtime, scope, \signed_headers);
 
  238        string gmdate = gmtime.format(
"YYYYMMDD");
 
  240        binary signing_key = hmac(QoreDigest, gmdate, 
"AWS4" + aws_secret);
 
  242        signing_key = hmac(QoreDigest, aws_region, signing_key);
 
  244        signing_key = hmac(QoreDigest, aws_service, signing_key);
 
  246        signing_key = hmac(QoreDigest, AwsTermination, signing_key);
 
  248        string sig = hmac(QoreDigest, req_string, signing_key).toHex();
 
  253    private string getRequestString(
string http_method, 
string path, reference<hash<auto>> hdr, *data body,
 
  254            date gmtime, 
string scope, reference<string> signed_headers) {
 
  256        string aws_date = gmtime.format(
"YYYYMMDDTHHmmSS") + 
"Z";
 
  257        hdr.
"X-Amz-Date" = aws_date;
 
  258        string csig = getCanonicalSignature(http_method, path, hdr, body, \signed_headers);
 
  260        string msg = AwsSignatureAlgorithm + 
"\n" 
  268    private string getCanonicalSignature(
string http_method, 
string path, hash<auto> hdr, *data body,
 
  269        reference<string> signed_headers) {
 
  272        string cstr = http_method + 
"\n";
 
  275        hash<UriQueryInfo> uri_info = parse_uri_query(path);
 
  278        string uri = uri_info.method ?? 
"/";
 
  294        if (uri_info.params);
 
  300        hdr = map {$1.key.lwr(): $1.value}, hdr.pairIterator();
 
  302        hdr += {
"host": getHostHeaderValue()};
 
  305        hdr = map {$1: hdr{$1}}, 
sort(keys hdr);
 
  311      static string trimall(
string str) {            
"cls": Class::forName(
"AwsRestConnection"),
 
  313                "data": <ConnectionOptionInfo>{
 
  315                    "desc": 
"data serialization options are limited to `json` with this object",
 
  319                            "desc": 
"use JSON serialization",
 
  322                    "default_value": 
"json",
 
  324                "aws_keyid": <ConnectionOptionInfo>{
 
  326                    "desc": 
"AWS key ID",
 
  328                "aws_secret": <ConnectionOptionInfo>{
 
  330                    "desc": 
"the AWS secret access key value",
 
  333                "aws_region": <ConnectionOptionInfo>{
 
  335                    "desc": 
"the AWS region to use (ex: `us-east-1`)",
 
  337                "aws_service": <ConnectionOptionInfo>{
 
  339                    "desc": 
"the AWS service to use (ex: `iam`)",
 
  341                "aws_s3": <ConnectionOptionInfo>{
 
  343                    "desc": 
"set to `True` to flag this object for use with AWS S3, which requires special " 
  345                    "default_value": 
False,
 
  347                "aws_token": <ConnectionOptionInfo>{
 
  349                    "desc": 
"a temporary session token from AWS Security Token Service for this HTTP session",
 
  367    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.
 
string encode_url(string url, softbool encode_all=False)
 
the AwsRestClient namespace contains all the objects in the AwsRestClient module
Definition: AwsRestClient.qm.dox.h:95
 
private hash< auto > sendAndDecodeResponse(*data body, string m, string path, hash< auto > hdr, *reference< hash< auto > > info, *softbool decode_errors)