Skip to main content

AmazonBuilder

Struct AmazonBuilder 

Source
pub struct AmazonBuilder { /* private fields */ }
Expand description

Configure AWS authentication credentials.

§Example

let config = AmazonBuilder::new()
 .with_region(REGION)
 .with_access_key_id(ACCESS_KEY_ID)
 .with_secret_access_key(SECRET_KEY)
 .build(None);

Implementations§

Source§

impl AmazonBuilder

Source

pub fn new() -> Self

Create a new AmazonBuilder with default values.

Source

pub fn from_env() -> Self

Fill the AmazonBuilder with regular AWS environment variables

Variables extracted from environment:

Source

pub fn with_config( self, key: AmazonS3ConfigKey, value: impl Into<String>, ) -> Self

Set an option on the builder via a key - value pair.

Source

pub fn get_config_value(&self, key: &AmazonS3ConfigKey) -> Option<String>

Get config value via a AmazonS3ConfigKey.

Source

pub fn with_access_key_id(self, access_key_id: impl Into<String>) -> Self

Set the AWS Access Key

Source

pub fn with_secret_access_key( self, secret_access_key: impl Into<String>, ) -> Self

Set the AWS Secret Access Key

Source

pub fn with_token(self, token: impl Into<String>) -> Self

Set the AWS Session Token to use for requests

Source

pub fn with_region(self, region: impl Into<String>) -> Self

Set the region, defaults to us-east-1

Source

pub fn with_credentials(self, credentials: AwsCredentialProvider) -> Self

Set the credential provider overriding any other options

Source

pub fn with_allow_http(self, allow_http: bool) -> Self

Sets what protocol is allowed. If allow_http is :

  • false (default): Only HTTPS are allowed
  • true: HTTP and HTTPS are allowed
Source

pub fn with_retry(self, retry_config: RetryConfig) -> Self

Set the retry configuration

Source

pub fn with_imdsv1_fallback(self) -> Self

By default instance credentials will only be fetched over IMDSv2, as AWS recommends against having IMDSv1 enabled on EC2 instances as it is vulnerable to SSRF attack

However, certain deployment environments, such as those running old versions of kube2iam, may not support IMDSv2. This option will enable automatic fallback to using IMDSv1 if the token endpoint returns a 403 error indicating that IMDSv2 is not supported.

Source

pub fn with_skip_signature(self, skip_signature: bool) -> Self

If enabled, requests will not be signed.

Source

pub fn with_metadata_endpoint(self, endpoint: impl Into<String>) -> Self

Set the instance metadata endpoint, used primarily within AWS EC2.

This defaults to the IPv4 endpoint: http://169.254.169.254. One can alternatively use the IPv6 endpoint http://fd00:ec2::254.

Source

pub fn with_role_arn(self, role_arn: impl Into<String>) -> Self

Assume the given IAM role via STS AssumeRole after obtaining base credentials.

When set, the builder resolves base credentials (static, IMDS, or WebIdentity) and then exchanges them for temporary credentials scoped to role_arn.

§References
Source

pub fn with_role_session_name(self, session_name: impl Into<String>) -> Self

Set the session name used in AssumeRole requests (defaults to "AssumeRoleSession").

Source

pub fn with_sts_endpoint(self, endpoint: impl Into<String>) -> Self

Override the STS endpoint used for AssumeRole (defaults to the regional endpoint).

Source

pub fn with_proxy_url(self, proxy_url: impl Into<String>) -> Self

Set the proxy_url to be used by the underlying client

Source

pub fn with_proxy_ca_certificate( self, proxy_ca_certificate: impl Into<String>, ) -> Self

Set a trusted proxy CA certificate

Source

pub fn with_proxy_excludes(self, proxy_excludes: impl Into<String>) -> Self

Set a list of hosts to exclude from proxy connections

Source

pub fn with_client_options(self, options: ClientOptions) -> Self

Sets the client options, overriding any already set

Source

pub fn build(self, runtime: Option<&Handle>) -> Result<AmazonConfig>

Build an AmazonConfig from the provided values, consuming self.

If runtime is provided, all HTTP I/O (including credential refresh) will be spawned on the given runtime handle.

Trait Implementations§

Source§

impl Clone for AmazonBuilder

Source§

fn clone(&self) -> AmazonBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AmazonBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AmazonBuilder

Source§

fn default() -> AmazonBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more