pub struct AwsCredentials {
pub access_key_id: String,
pub secret_access_key: String,
pub session_token: Option<String>,
}Expand description
AWS credentials used for SigV4 signing of Bedrock requests.
Typically constructed via AwsCredentials::from_environment rather than
directly, so that env vars and the shared credentials file are both
respected.
§Examples
use codetether_agent::provider::bedrock::AwsCredentials;
let creds = AwsCredentials {
access_key_id: "AKIA...".to_string(),
secret_access_key: "secret".to_string(),
session_token: None,
};
assert_eq!(creds.access_key_id, "AKIA...");
assert!(creds.session_token.is_none());Fields§
§access_key_id: StringAWS access key ID (e.g. AKIA...).
secret_access_key: StringAWS secret access key (keep confidential).
session_token: Option<String>Optional session token (present for STS / assumed-role credentials).
Implementations§
Source§impl AwsCredentials
impl AwsCredentials
Sourcepub fn from_environment() -> Option<Self>
pub fn from_environment() -> Option<Self>
Load credentials from AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY
env vars, then fall back to ~/.aws/credentials (default or named
profile via AWS_PROFILE).
§Returns
Some(creds) on success, None if neither env vars nor a readable
credentials file yielded a complete key pair.
§Examples
use codetether_agent::provider::bedrock::AwsCredentials;
match AwsCredentials::from_environment() {
Some(c) => println!("loaded key id: {}", c.access_key_id),
None => eprintln!("no AWS credentials available"),
}Sourcepub fn detect_region() -> Option<String>
pub fn detect_region() -> Option<String>
Detect the target AWS region.
Precedence: AWS_REGION → AWS_DEFAULT_REGION → ~/.aws/config
(default or [profile NAME] per AWS_PROFILE).
§Returns
Some(region) on success, None if no region could be determined.
§Examples
use codetether_agent::provider::bedrock::AwsCredentials;
let region = AwsCredentials::detect_region()
.unwrap_or_else(|| "us-east-1".to_string());
assert!(!region.is_empty());Trait Implementations§
Source§impl Clone for AwsCredentials
impl Clone for AwsCredentials
Source§fn clone(&self) -> AwsCredentials
fn clone(&self) -> AwsCredentials
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AwsCredentials
impl RefUnwindSafe for AwsCredentials
impl Send for AwsCredentials
impl Sync for AwsCredentials
impl Unpin for AwsCredentials
impl UnsafeUnpin for AwsCredentials
impl UnwindSafe for AwsCredentials
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request