API for cognitect.aws.client.api
-
Full namespace name:
cognitect.aws.client.api
Overview
API functions for using a client to interact with AWS services.
Public Variables and Functions
client
function
Usage: (client {:keys [api region region-provider retriable? backoff credentials-provider endpoint-override http-client], :or {endpoint-override {}}})
Given a config map, create a client for specified api. Supported keys:
:api - required, name of the api you want to interact with e.g. s3, cloudformation, etc
:http-client - optional, to share http-clients across aws-clients
Default: cognitect.aws.client.shared/http-client
:region-provider - optional, implementation of aws-clojure.region/RegionProvider
protocol, defaults to cognitect.aws.client.shared/region-provider.
Ignored if :region is also provided
:region - optional, the aws region serving the API endpoints you
want to interact with, defaults to region provided by
the region-provider
:credentials-provider - optional, implementation of
cognitect.aws.credentials/CredentialsProvider protocol
Default: cognitect.aws.client.shared/credentials-provider
:endpoint-override - optional, map to override parts of the endpoint. Supported keys:
:protocol - :http or :https
:hostname - string
:port - int
:path - string
If the hostname includes an AWS region, be sure to use the same
region for the client (either via out of process configuration
or the :region key supplied to this fn).
Also supports a string representing just the hostname, though
support for a string is deprecated and may be removed in the
future.
:retriable? - optional, predicate fn of http-response (see cognitect.aws.http/submit),
which should return a truthy value if the request is
retriable.
Default: cognitect.aws.retry/default-retriable?
:backoff - optional, fn of number of retries so far. Should return
number of milliseconds to wait before the next retry
(if the request is retriable?), or nil if it should stop.
Default: cognitect.aws.retry/default-backoff.
By default, all clients use shared http-client, credentials-provider, and
region-provider instances which use a small collection of daemon threads.
Primarily for debugging, clients support keyword access for :api (String), :region, :endpoint,
:credentials, :service (with :metadata), and :http-client.
Alpha. Subject to change.
default-http-client
function
Usage: (default-http-client)
Returns a new instance of the default type of http client. This function may be used to create a
single http-client instance to share across multiple aws-api clients.
doc
function
Usage: (doc client operation)
Given a client and an operation (keyword), prints documentation
for that operation to the current value of *out*. Returns nil.
See https://github.com/cognitect-labs/aws-api/blob/main/doc/types.md for a
mapping of AWS types to Clojure/java types.
Alpha. Subject to change.
doc-str
function
Usage: (doc-str {:keys [documentation documentationUrl request required response refs], :as doc})
Given data produced by `ops`, returns a string
representation.
Alpha. Subject to change.
invoke
function
Usage: (invoke client op-map)
Packages and sends a request to AWS and returns the result.
Supported keys in op-map:
:op - required, keyword, the op to perform
:request - required only for ops that require them.
:retriable? - optional, defaults to :retriable? on the client.
See client.
:backoff - optional, defaults to :backoff on the client.
See client.
See https://github.com/cognitect-labs/aws-api/blob/main/doc/types.md for a
mapping of AWS types to Clojure/Java types.
Will validate :request after calling (validate-requests client true).
Alpha. Subject to change.
invoke-async
function
Usage: (invoke-async client op-map)
Packages and sends a request to AWS and returns a channel which
will contain the result.
Supported keys in op-map:
:ch - optional, channel to deliver the result
:op - required, keyword, the op to perform
:request - required only for ops that require them.
:retriable? - optional, defaults to :retriable? on the client.
See client.
:backoff - optional, defaults to :backoff on the client.
See client.
See https://github.com/cognitect-labs/aws-api/blob/main/doc/types.md for a
mapping of AWS types to Clojure/Java types.
Will validate :request after calling (validate-requests client true).
Alpha. Subject to change.
ops
function
Usage: (ops client)
Returns a map of operation name to operation data for this client.
Alpha. Subject to change.
request-spec-key
function
Usage: (request-spec-key client op)
Returns the key for the request spec for op.
Alpha. Subject to change.
response-spec-key
function
Usage: (response-spec-key client op)
Returns the key for the response spec for op.
Alpha. Subject to change.
stop
function
Usage: (stop aws-client)
Has no effect when the underlying http-client is the shared
instance.
If you explicitly provided any other instance of http-client, stops
it, releasing resources.
Alpha. Subject to change.
validate-requests
function
Usage: (validate-requests client)
(validate-requests client validate-requests?)
Given true, uses clojure.spec to validate all invoke calls on client.
Alpha. Subject to change.