pub struct IamProvider { /* private fields */ }Expand description
Exchanges temporary AWS credentials for short-lived Redshift cluster credentials
via redshift:GetClusterCredentials.
Implementations§
Source§impl IamProvider
impl IamProvider
Sourcepub fn new(
user: impl ToString,
database: impl ToString,
cluster: impl ToString,
autocreate: bool,
) -> Self
pub fn new( user: impl ToString, database: impl ToString, cluster: impl ToString, autocreate: bool, ) -> Self
Creates a new IamProvider.
autocreate: Whentrue, the Redshift user is created automatically if it does not already exist.- The AWS region defaults to
"us-east-1"; change it withset_region.
§Examples
use redshift_iam::IamProvider;
let iam = IamProvider::new("alice", "analytics", "my-cluster", false);
assert_eq!(iam.region(), "us-east-1");Sourcepub fn set_region(self, region: impl ToString) -> Self
pub fn set_region(self, region: impl ToString) -> Self
Overrides the AWS region used when calling GetClusterCredentials.
§Examples
use redshift_iam::IamProvider;
let iam = IamProvider::new("alice", "analytics", "my-cluster", false)
.set_region("eu-west-1");
assert_eq!(iam.region(), "eu-west-1");Sourcepub fn auth(&self, aws_credentials: Credentials) -> (String, String)
pub fn auth(&self, aws_credentials: Credentials) -> (String, String)
Calls redshift:GetClusterCredentials with the provided AWS credentials and
returns a (username, password) pair valid for 3600 seconds.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IamProvider
impl RefUnwindSafe for IamProvider
impl Send for IamProvider
impl Sync for IamProvider
impl Unpin for IamProvider
impl UnsafeUnpin for IamProvider
impl UnwindSafe for IamProvider
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.