data AWS::Config(region: String, credentials: AWS::Credentials::Provider, endpoint: URI?, http: HTTP::Client, retries: Int, timeout: Duration, retry_base: Duration, retry_cap: Duration, service_endpoints: Hash[String, URI])
What a service client needs: the region, the credentials, where to send requests, the HTTP client, and the retry rules.
creds = AWS::Credentials.static(access_key_id: "AKIDEXAMPLE", secret_access_key: "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY")
config = AWS::Config.new(region: "ap-northeast-1", credentials: creds)
config.endpoint_for("kms").to_s # => "https://kms.ap-northeast-1.amazonaws.com"
/home/runner/work/aws/aws/src/config.qz:12
Class methods
def self.default(env: Hash[String, String] = …) -> AWS::Config
The configuration of the environment: the region of AWS_REGION,
AWS_DEFAULT_REGION or the profile's region, the credentials of
Credentials.default, the endpoints of AWS_ENDPOINT_URL and
AWS_ENDPOINT_URL_<SERVICE> (KMS: AWS_ENDPOINT_URL_KMS).
Raises
AWS::Error when no region is set, ArgumentError for an endpoint
that is not a URL.
def self.client -> HTTP::Client
The client service clients use unless given another: the defaults of
HTTP::Client, but no redirect followed. Made on first use, with the
proxy the process's environment names then (HTTP::Proxy.from_env).
Methods
def region -> String
The region: ap-northeast-1.
def credentials -> AWS::Credentials::Provider
Where the keys come from.
def endpoint -> URI?
Where to send every service's requests (a local emulator), nil for AWS's endpoints.
def http -> HTTP::Client
The client the requests go through (Config.client by default: one
that follows no redirect, which would take a request's body
elsewhere).
def retries -> Int
How many times a request is tried again after a failure that may pass: throttling, a 5xx, a transport error.
def timeout -> Duration
The longest one attempt may take.
def retry_base -> Duration
The backoff before the n-th retry is a random time up to
min(retry_cap, retry_base * 2**n) (full jitter).
def retry_cap -> Duration
The longest backoff.
def service_endpoints -> Hash[String, URI]
Endpoints for one service each (kms => URI), before endpoint:
what AWS_ENDPOINT_URL_KMS gives.
def to_h -> Hash[Symbol, Object]
The fields as a Hash, by name.
def with(*, region: String = …, credentials: AWS::Credentials::Provider = …, endpoint: URI? = …, http: HTTP::Client = …, retries: Int = …, timeout: Duration = …, retry_base: Duration = …, retry_cap: Duration = …, service_endpoints: Hash[String, URI] = …) -> AWS::Config
A copy with the fields given replaced.
def endpoint_for(service: String) -> URI
Where service's requests go (kms): its own endpoint, else
endpoint, else https://<service>.<region>.amazonaws.com.
Raises
ArgumentError for a region that is not a host label (it would name
another host): us-east-1, not x.example/.
def inspect -> String
#<AWS::Config ap-northeast-1>: not the credentials' state.
def to_s -> String
As inspect.