pub enum Credentials {
None,
ApiKey {
key: String,
},
AccessKey {
access_key: String,
secret_key: String,
session_token: Option<String>,
},
OAuth2 {
access_token: String,
refresh_token: Option<String>,
expires_at: Option<DateTime<Utc>>,
},
ServiceAccount {
key_json: String,
project_id: Option<String>,
},
SasToken {
token: String,
expires_at: Option<DateTime<Utc>>,
},
IamRole {
role_arn: String,
session_name: String,
},
Custom {
data: HashMap<String, String>,
},
}Expand description
Authentication credentials
Variants§
None
No authentication
ApiKey
API key authentication
AccessKey
Access key and secret key (AWS-style)
Fields
OAuth2
OAuth 2.0 token
Fields
ServiceAccount
Service account key (GCP-style JSON)
SasToken
Shared Access Signature token (Azure-style)
IamRole
IAM role credentials
Custom
Custom credentials with arbitrary key-value pairs
Implementations§
Source§impl Credentials
impl Credentials
Sourcepub fn access_key(
access_key: impl Into<String>,
secret_key: impl Into<String>,
) -> Self
pub fn access_key( access_key: impl Into<String>, secret_key: impl Into<String>, ) -> Self
Creates access key credentials
Sourcepub fn access_key_with_session(
access_key: impl Into<String>,
secret_key: impl Into<String>,
session_token: impl Into<String>,
) -> Self
pub fn access_key_with_session( access_key: impl Into<String>, secret_key: impl Into<String>, session_token: impl Into<String>, ) -> Self
Creates access key credentials with session token
Sourcepub fn oauth2_with_refresh(
access_token: impl Into<String>,
refresh_token: impl Into<String>,
) -> Self
pub fn oauth2_with_refresh( access_token: impl Into<String>, refresh_token: impl Into<String>, ) -> Self
Creates OAuth 2.0 credentials with refresh token
Sourcepub fn service_account_from_json(json: impl Into<String>) -> Result<Self>
pub fn service_account_from_json(json: impl Into<String>) -> Result<Self>
Creates service account credentials from JSON
Sourcepub fn service_account_from_file(path: impl AsRef<Path>) -> Result<Self>
pub fn service_account_from_file(path: impl AsRef<Path>) -> Result<Self>
Creates service account credentials from file
Sourcepub fn iam_role(
role_arn: impl Into<String>,
session_name: impl Into<String>,
) -> Self
pub fn iam_role( role_arn: impl Into<String>, session_name: impl Into<String>, ) -> Self
Creates IAM role credentials
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Checks if credentials are expired
Sourcepub fn needs_refresh(&self) -> bool
pub fn needs_refresh(&self) -> bool
Returns true if credentials need refresh
Sourcepub fn variant_name(&self) -> &'static str
pub fn variant_name(&self) -> &'static str
Returns a short, secret-free name for the credentials variant.
Intended for diagnostics/error messages where the full Debug
representation would risk leaking secret material (access keys,
tokens, service account JSON, etc.).
Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more