class

Amazonite::Core::Config

Inherits Reference < Object

Resolves credentials, region, and endpoint for a Client.

region resolves from the constructor argument, then AWS_REGION/AWS_DEFAULT_REGION, then the AWS profile's region.

access_key_id/secret_access_key/session_token resolve together: if both a key and secret are given (via constructor arguments, AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY, or a static profile), those are used as-is. Otherwise credentials come from the dynamic provider chain - AssumeRole, SSO cached token, ECS container, then EC2 instance metadata (see the README's "Credentials" section) - and are refreshed automatically as they near expiry.

dns_timeout/connect_timeout/read_timeout/write_timeout accept either a Number (seconds) or a Time::Span, matching the overloads HTTP::Client itself accepts, and default to nil (the underlying socket library's defaults) when not given.

validate_input controls whether a generated Client calls an operation's input's #validate! before sending the request (default true) - set it to false to skip that check, e.g. to save the extra pass over a large input that's already known-good.

Constants

Log = ::Log.for(self)

Constructors

new(access_key_id : String | Nil = nil, secret_access_key : String | Nil = nil, region : String | Nil = nil, profile : String | Nil = nil, base_url : String | Nil = nil, user_agent : String | Nil = nil, env : Fetcher = EnvFetcher.new, session_token : String | Nil = nil, dns_timeout : Number | Time::Span | Nil = nil, connect_timeout : Number | Time::Span | Nil = nil, read_timeout : Number | Time::Span | Nil = nil, write_timeout : Number | Time::Span | Nil = nil, validate_input : Bool = true)
Source

Instance methods

access_key_id
Source
aws_profile

The resolved AWS profile name (constructor profile, then AWS_PROFILE), or nil if none was found.

Source
base_url
Source
connect_timeout
Source
dns_timeout
Source
endpoint_url(endpoint_prefix) : String

The base URL for endpoint_prefix (e.g. "dynamodb") - the constructor's base_url if given, else the AMAZONITE_<ENDPOINT_PREFIX>_URL environment variable (handy for pointing at a local stack like LocalStack), else https://<endpoint_prefix>.<region>.amazonaws.com.

Source
expiration

When the current credentials expire, or nil if they don't (a static access key/secret, or a chain provider that returned none).

Source
read_timeout
Source
region
Source
secret_access_key
Source
session_token

nil unless the current credentials are temporary (from the dynamic provider chain).

Source
user_agent

Yields the User-Agent string to send with a request - the constructor's user_agent if given, else one built from the amazonite/Crystal/LLVM versions and target architecture (cached after the first call).

Source
validate_input?
Source
write_timeout
Source