Struct rusoto_signature::signature::SignedRequest[][src]

pub struct SignedRequest {
    pub method: String,
    pub service: String,
    pub region: Region,
    pub path: String,
    pub headers: BTreeMap<String, Vec<Vec<u8>>>,
    pub params: Params,
    pub scheme: Option<String>,
    pub hostname: Option<String>,
    pub payload: Option<SignedRequestPayload>,
    pub canonical_query_string: String,
    pub canonical_uri: String,
}

A data structure for all the elements of an HTTP request that are involved in the Amazon Signature Version 4 signing process

Fields

method: String

The HTTP Method

service: String

The AWS Service

region: Region

The AWS Region

path: String

The HTTP request path

headers: BTreeMap<String, Vec<Vec<u8>>>

The HTTP Request Headers

params: Params

The HTTP request paramaters

scheme: Option<String>

The HTTP/HTTPS protocol

hostname: Option<String>

The AWS hostname

payload: Option<SignedRequestPayload>

The HTTP Content

canonical_query_string: String

The Standardised query string

canonical_uri: String

The Standardised URI

Implementations

impl SignedRequest[src]

pub fn new(
    method: &str,
    service: &str,
    region: &Region,
    path: &str
) -> SignedRequest
[src]

Default constructor

pub fn set_content_type(&mut self, content_type: String)[src]

Sets the value of the “content-type” header.

pub fn set_hostname(&mut self, hostname: Option<String>)[src]

Sets the target hostname

pub fn set_endpoint_prefix(&mut self, endpoint_prefix: String)[src]

Sets the target hostname using the current service type and region

See the implementation of build_hostname to see how this is done

pub fn set_payload<B: Into<Bytes>>(&mut self, payload: Option<B>)[src]

Sets the new body (payload)

pub fn set_payload_stream(&mut self, stream: ByteStream)[src]

Sets the new body (payload) as a stream

pub fn set_content_md5_header(&mut self)[src]

Computes and sets the Content-MD5 header based on the current payload.

Has no effect if the payload is not set, or is not a buffer.

pub fn method(&self) -> &str[src]

Returns the current HTTP method

pub fn path(&self) -> &str[src]

Returns the current path

pub fn canonical_path(&self) -> String[src]

Invokes canonical_uri(path) to return a canonical path

pub fn canonical_uri(&self) -> &str[src]

Returns the current canonical URI

pub fn canonical_query_string(&self) -> &str[src]

Returns the current query string

Converts a paramater such as “example param”: “examplekey” into “&example+param=examplekey”

pub fn headers(&self) -> &BTreeMap<String, Vec<Vec<u8>>>[src]

Returns the current headers

pub fn scheme(&self) -> String[src]

Returns the current http scheme (https or http)

pub fn region_for_service(&self) -> String[src]

Modify the region used for signing if needed, such as for AWS Organizations

pub fn hostname(&self) -> String[src]

Converts hostname to String if it exists, else it invokes build_hostname()

pub fn remove_header(&mut self, key: &str)[src]

If the key exists in headers, set it to blank/unoccupied:

pub fn add_header<K: ToString>(&mut self, key: K, value: &str)[src]

Add a value to the array of headers for the specified key. Headers are kept sorted by key name for use at signing (BTreeMap)

pub fn add_optional_header<K: ToString, V: ToString>(
    &mut self,
    key: K,
    value: Option<V>
)
[src]

pub fn add_param<S>(&mut self, key: S, value: S) where
    S: Into<String>, 
[src]

Adds parameter to the HTTP Request

pub fn set_params(&mut self, params: Params)[src]

Sets paramaters with a given variable of Params type

pub fn generate_presigned_url(
    &mut self,
    creds: &AwsCredentials,
    expires_in: &Duration,
    should_sha256_sign_payload: bool
) -> String
[src]

Generate a Presigned URL for AWS

See the documentation for more information.

pub fn complement(&mut self)[src]

Complement SignedRequest by ensuring the following HTTP headers are set accordingly:

  • host
  • content-type
  • content-length (if applicable)

pub fn sign(&mut self, creds: &AwsCredentials)[src]

Signs the request using Amazon Signature version 4 to verify identity. Authorization header uses AWS4-HMAC-SHA256 for signing.

Trait Implementations

impl Debug for SignedRequest[src]

impl TryInto<Request<Body>> for SignedRequest[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl !RefUnwindSafe for SignedRequest

impl Send for SignedRequest

impl Sync for SignedRequest

impl Unpin for SignedRequest

impl !UnwindSafe for SignedRequest

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.