Struct GetSigningKeyRequest

Source
pub struct GetSigningKeyRequest {
    pub signing_key_kind: SigningKeyKind,
    pub access_key: String,
    pub session_token: Option<String>,
    pub request_date: NaiveDate,
    pub region: String,
    pub service: String,
}
Expand description

A request for retrieving a signing key from an outside source.

Fields§

§signing_key_kind: SigningKeyKind

The type of signing key to retrieve.

§access_key: String

The access key to use to retrieve the signing key.

§session_token: Option<String>

An optional session token to use to retrieve the signing key.

§request_date: NaiveDate

The date of the request.

§region: String

The region of the service being accessed.

§service: String

The service being accessed.

Trait Implementations§

Source§

impl<F, Fut, E> Service<GetSigningKeyRequest> for GetSigningKeyFn<F>

Implementation of a Service for GetSigningKeyFn.

To send the request, use the call method.

Source§

fn call(&mut self, req: GetSigningKeyRequest) -> Self::Future

Invoke the underlying function to retrieve a signing key.

§Example
use tower::Service;

async fn get_key(
    kind: SigningKeyKind,
    access_key: String,
    session_token: Option<String>,
    request_date: NaiveDate,
    region: String,
    service: String)
-> Result<(PrincipalActor, SigningKey), SignatureError> {
    // Replace with your implementation for obtaining a key.
    let actor = PrincipalActor::user(
        "aws", "123456789012", "/", "user", "AIDAQXZEAEXAMPLEUSER").unwrap();
    let key = SigningKey {
        kind: SigningKeyKind::KSecret,
        key: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY".as_bytes().to_vec()
    };
    Ok((actor, key.try_derive(kind, &request_date, region, service)?))
}

let mut get_key_service = get_signing_key_fn(get_key);
let req = GetSigningKeyRequest {
    signing_key_kind: SigningKeyKind::KSigning,
    access_key: "AKIAIOSFODNN7EXAMPLE".to_string(),
    session_token: None,
    request_date: NaiveDate::from_ymd_opt(2021, 1, 1).unwrap(),
    region: "us-east-1".to_string(),
    service: "example".to_string(),
};
let (actor, key) = get_key_service.call(req).await.unwrap();
Source§

type Response = (PrincipalActor, SigningKey)

Responses given by the service.
Source§

type Error = E

Errors produced by the service.
Source§

type Future = Fut

The future response value.
Source§

fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>

Returns Poll::Ready(Ok(())) when the service is able to process requests. 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> 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, 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.