Macro sts_profile_auth::get_client_sts
source · macro_rules! get_client_sts { ($T:ty) => { ... }; ($T:ty, $region:expr) => { ... }; ($T:ty, $region:expr, $profile:expr) => { ... }; }
Expand description
Macro to return a profile authenticated client
This macro takes two arguments:
- A Rusoto client type (e.g.
Ec2Client
) which has thenew_with_client
method 2. A Rusoto Region (optional) - A Profile Name (optional)
It will return an instance of the provided client (e.g. Ec2Client
) which
will use either the default profile or the profile specified by the
AWS_PROFILE
env variable when authenticating.
The macro get_client_sts_with_profile
accepts a client and a profile name
but no region.
Example usage:
use rusoto_core::Region;
use rusoto_ec2::Ec2Client;
use sts_profile_auth::get_client_sts;
use sts_profile_auth::StsClientError;
let ec2 = get_client_sts!(Ec2Client)?;
let ec2 = get_client_sts!(Ec2Client, Region::default())?;
let ec2 = get_client_sts!(Ec2Client, Region::default(), "default")?;