1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use super::credentials::{CredentialsError, CredentialsProvider};
use async_trait::async_trait;
use aws_types::Credentials;

/// A [`CredentialsProvider`] created from explicit AWS credentials
pub struct ExplicitCredentialsProvider {
    credentials: Credentials,
}

impl ExplicitCredentialsProvider {
    pub fn new(credentials: Credentials) -> Self {
        Self { credentials }
    }
}

#[async_trait]
impl CredentialsProvider for ExplicitCredentialsProvider {
    type Credentials = Credentials;

    fn is_expired(&self) -> bool {
        false
    }

    async fn acquire_credentials(&self) -> Result<Credentials, CredentialsError> {
        Ok(self.credentials.clone())
    }
}