Struct rusoto_signature::signature::SignedRequest
source · [−]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,
}
Expand description
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
sourceimpl SignedRequest
impl SignedRequest
sourcepub fn new(
method: &str,
service: &str,
region: &Region,
path: &str
) -> SignedRequest
pub fn new(
method: &str,
service: &str,
region: &Region,
path: &str
) -> SignedRequest
Default constructor
sourcepub fn set_content_type(&mut self, content_type: String)
pub fn set_content_type(&mut self, content_type: String)
Sets the value of the “content-type” header.
sourcepub fn set_hostname(&mut self, hostname: Option<String>)
pub fn set_hostname(&mut self, hostname: Option<String>)
Sets the target hostname
sourcepub fn set_endpoint_prefix(&mut self, endpoint_prefix: String)
pub fn set_endpoint_prefix(&mut self, endpoint_prefix: String)
Sets the target hostname using the current service type and region
See the implementation of build_hostname to see how this is done
sourcepub fn set_payload<B: Into<Bytes>>(&mut self, payload: Option<B>)
pub fn set_payload<B: Into<Bytes>>(&mut self, payload: Option<B>)
Sets the new body (payload)
sourcepub fn set_payload_stream(&mut self, stream: ByteStream)
pub fn set_payload_stream(&mut self, stream: ByteStream)
Sets the new body (payload) as a stream
sourcepub fn maybe_set_content_md5_header(&mut self)
pub fn maybe_set_content_md5_header(&mut self)
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. Will not
override an existing value for the Content-MD5
header.
sourcepub fn canonical_path(&self) -> String
pub fn canonical_path(&self) -> String
Invokes canonical_uri(path)
to return a canonical path
sourcepub fn canonical_uri(&self) -> &str
pub fn canonical_uri(&self) -> &str
Returns the current canonical URI
sourcepub fn canonical_query_string(&self) -> &str
pub fn canonical_query_string(&self) -> &str
Returns the current query string
Converts a paramater such as “example param”: “examplekey” into “&example+param=examplekey”
sourcepub fn region_for_service(&self) -> String
pub fn region_for_service(&self) -> String
Modify the region used for signing if needed, such as for AWS Organizations
sourcepub fn hostname(&self) -> String
pub fn hostname(&self) -> String
Converts hostname to String if it exists, else it invokes build_hostname()
sourcepub fn remove_header(&mut self, key: &str)
pub fn remove_header(&mut self, key: &str)
If the key exists in headers, set it to blank/unoccupied:
sourcepub fn add_header<K: ToString>(&mut self, key: K, value: &str)
pub fn add_header<K: ToString>(&mut self, key: K, value: &str)
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>
)
sourcepub fn add_param<S>(&mut self, key: S, value: S) where
S: Into<String>,
pub fn add_param<S>(&mut self, key: S, value: S) where
S: Into<String>,
Adds parameter to the HTTP Request
sourcepub fn set_params(&mut self, params: Params)
pub fn set_params(&mut self, params: Params)
Sets paramaters with a given variable of Params
type
sourcepub fn generate_presigned_url(
&mut self,
creds: &AwsCredentials,
expires_in: &Duration,
should_sha256_sign_payload: bool
) -> String
pub fn generate_presigned_url(
&mut self,
creds: &AwsCredentials,
expires_in: &Duration,
should_sha256_sign_payload: bool
) -> String
Generate a Presigned URL for AWS
See the documentation for more information.
sourcepub fn complement(&mut self)
pub fn complement(&mut self)
Complement SignedRequest by ensuring the following HTTP headers are set accordingly:
- host
- content-type
- content-length (if applicable)
sourcepub fn sign(&mut self, creds: &AwsCredentials)
pub fn sign(&mut self, creds: &AwsCredentials)
Signs the request using Amazon Signature version 4 to verify identity. Authorization header uses AWS4-HMAC-SHA256 for signing.
Trait Implementations
sourceimpl Debug for SignedRequest
impl Debug for SignedRequest
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more