1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum CredentialsError {
5 #[error("Not an AWS instance")]
6 NotEc2,
7 #[error("Not a container")]
8 NotContainer,
9 #[error("Config not found")]
10 ConfigNotFound,
11 #[error("Missing aws_access_key_id section in config")]
12 ConfigMissingAccessKeyId,
13 #[error("Missing aws_access_key_id section in config")]
14 ConfigMissingSecretKey,
15 #[error("Neither {0}, nor {1} exists in the environment")]
16 MissingEnvVar(String, String),
17 #[cfg(feature = "http-credentials")]
18 #[error("attohttpc: {0}")]
19 Atto(#[from] attohttpc::Error),
20 #[error("ini: {0}")]
21 Ini(#[from] ini::Error),
22 #[error("serde_xml: {0}")]
23 SerdeXml(#[from] quick_xml::de::DeError),
24 #[error("url parse: {0}")]
25 UrlParse(#[from] url::ParseError),
26 #[error("io: {0}")]
27 Io(#[from] std::io::Error),
28 #[error("env var: {0}")]
29 Env(#[from] std::env::VarError),
30 #[error("Invalid home dir")]
31 HomeDir,
32 #[error("Could not get valid credentials from STS, ENV, Profile or Instance metadata")]
33 NoCredentials,
34 #[error("unexpected status code: {0}")]
35 UnexpectedStatusCode(u16),
36}