canonical_request: Construct a Canonical Request

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/canonical_request.R

Description

Construct a Canonical Request from request elements

Usage

1
2
canonical_request(verb, canonical_uri = "", query_args = list(),
  canonical_headers, request_body = "")

Arguments

verb

A character string containing the HTTP verb being used in the request.

canonical_uri

A character string containing the “canonical URI”, meaning the contents of the API request URI excluding the host and the query parameters.

query_args

A named list of character strings containing the query string values (if any) used in the API request.

canonical_headers

A named list of character strings containing the headers used in the request.

request_body

The body of the HTTP request, or a filename. If a filename, hashing is performed on the file without reading it into memory.

Details

This function creates a “Canonical Request”, which is part of the Signature Version 4.

Value

A list containing

Author(s)

Thomas J. Leeper <thosjleeper@gmail.com>

References

Create a Canonical Request For Signature Version 4

See Also

signature_v4, signature_v4_auth

link{signature_v4_aut}, string_to_sign

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# From AWS documentation
# http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
fromDocs <- "POST
/

content-type:application/x-www-form-urlencoded; charset=utf-8
host:iam.amazonaws.com
x-amz-date:20110909T233600Z

content-type;host;x-amz-date
b6359072c78d70ebee1e81adcbab4f01bf2c23245fa365ef83fe8f1f955085e2"

hdrs <- list(`Content-Type` = "application/x-www-form-urlencoded; charset=utf-8",
             Host = "iam.amazonaws.com",
             `x-amz-date` = "20110909T233600Z")
r <- canonical_request(verb = "POST",
                       canonical_uri = "/",
                       query_args = list(),
                       canonical_headers = hdrs,
                       request_body = "Action=ListUsers&Version=2010-05-08")

identical(fromDocs, r$canonical)

zhangxing-love/qingstor.signature documentation built on May 23, 2019, 9:35 a.m.