CanonicalRequest

Struct CanonicalRequest 

Source
pub struct CanonicalRequest { /* private fields */ }
Available on crate feature unstable only.
Expand description

A canonicalized request for AWS SigV4.

This is mainly used internally for generating the canonical request for signing, but is exposed for testing and debugging purposes.

The stability of this struct is not guaranteed. The fields and methods are subject to change in minor/patch versions.

Implementations§

Source§

impl CanonicalRequest

Source

pub fn from_request_parts( parts: Parts, body: Bytes, options: SignatureOptions, ) -> Result<(Self, Parts, Bytes), SignatureError>

Create a CanonicalRequest from an HTTP request Parts and a body of Bytes.

Source

pub fn request_method(&self) -> &str

Retrieve the HTTP request method.

Source

pub fn canonical_path(&self) -> &str

Retrieve the canonicalized URI path from the request.

Source

pub fn query_parameters(&self) -> &HashMap<String, Vec<String>>

Retrieve the query parameters from the request. Values are ordered as they appear in the URL, followed by any values in the request body if the request body is of type application/x-www-form-urlencoded. Values are normalized to be percent-encoded.

Source

pub fn headers(&self) -> &HashMap<String, Vec<Vec<u8>>>

Retrieve the headers from the request. Values are ordered as they appear in the HTTP request.

Source

pub fn body_sha256(&self) -> &str

Retrieve the SHA-256 hash of the request body.

Source

pub fn canonical_query_string(&self) -> String

Get the canonical query string from the request.

Source

pub fn canonical_request(&self, signed_headers: &Vec<String>) -> Vec<u8>

Get the canonical request to hash for the request.

Source

pub fn canonical_request_sha256(&self, signed_headers: &Vec<String>) -> [u8; 32]

Get the SHA-256 hash of the canonical request.

Source

pub fn get_authenticator<S>( &self, signed_header_requirements: &S, ) -> Result<SigV4Authenticator, SignatureError>

Create a SigV4Authenticator for the request. This performs steps 1-8 from the AWS Auth Error Ordering workflow.

Source

pub fn get_authenticator_from_auth_parameters( &self, auth_params: AuthParams, ) -> Result<SigV4Authenticator, SignatureError>

Create an authenticator based on the provided AuthParams.

Source

pub fn get_auth_parameters<S>( &self, signed_header_requirements: &S, ) -> Result<AuthParams, SignatureError>

Create an AuthParams structure, either from the Authorization header or the query strings as appropriate. This performs step 5 and either performs steps 6a-6d or 7a-7d from the AWS Auth Error Ordering workflow.

Source

pub fn get_auth_parameters_from_auth_header<'a>( &'a self, auth_header: &'a [u8], ) -> Result<AuthParams, SignatureError>

Create an AuthParams structure from the Authorization header. This performs steps 6a-6d of the AWS Auth Error Ordering workflow.

Source

pub fn get_auth_parameters_from_query_parameters( &self, query_alg: &str, ) -> Result<AuthParams, SignatureError>

Create an AuthParams structure from the query parameters. This performs steps 7a-7d of the AWS Auth Error Ordering workflow.

Trait Implementations§

Source§

impl Clone for CanonicalRequest

Source§

fn clone(&self) -> CanonicalRequest

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CanonicalRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.