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.

/home/runner/work/aws/aws/src/config.qz:47

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).

/home/runner/work/aws/aws/src/config.qz:70

Methods

def region -> String

The region: ap-northeast-1.

/home/runner/work/aws/aws/src/config.qz:14

def credentials -> AWS::Credentials::Provider

Where the keys come from.

/home/runner/work/aws/aws/src/config.qz:16

def endpoint -> URI?

Where to send every service's requests (a local emulator), nil for AWS's endpoints.

/home/runner/work/aws/aws/src/config.qz:19

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).

/home/runner/work/aws/aws/src/config.qz:23

def retries -> Int

How many times a request is tried again after a failure that may pass: throttling, a 5xx, a transport error.

/home/runner/work/aws/aws/src/config.qz:26

def timeout -> Duration

The longest one attempt may take.

/home/runner/work/aws/aws/src/config.qz:28

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).

/home/runner/work/aws/aws/src/config.qz:31

def retry_cap -> Duration

The longest backoff.

/home/runner/work/aws/aws/src/config.qz:33

def service_endpoints -> Hash[String, URI]

Endpoints for one service each (kms => URI), before endpoint: what AWS_ENDPOINT_URL_KMS gives.

/home/runner/work/aws/aws/src/config.qz:36

def to_h -> Hash[Symbol, Object]

The fields as a Hash, by name.

/home/runner/work/aws/aws/src/config.qz:47

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.

/home/runner/work/aws/aws/src/config.qz:47

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/.

/home/runner/work/aws/aws/src/config.qz:86

def inspect -> String

#<AWS::Config ap-northeast-1>: not the credentials' state.

/home/runner/work/aws/aws/src/config.qz:94

def to_s -> String

As inspect.

/home/runner/work/aws/aws/src/config.qz:97