The calls an SQS step makes, for Alternera.Plugins.Sqs. SQS's
JSON protocol: every call is a POST / to the queue URL's origin with
Content-Type: application/x-amz-json-1.0, the action in
X-Amz-Target: AmazonSQS.<Action> and the queue URL in the JSON body:
- send:
SendMessagewithMessageBody,MessageAttributes,MessageGroupId,MessageDeduplicationIdandDelaySeconds, answered with itsMessageId; - receive:
ReceiveMessagewithMaxNumberOfMessages,WaitTimeSecondsandVisibilityTimeout, answered with{"Messages": [...]}, empty or left out when none came; with immediate deletes,DeleteMessageBatchwith an entry per message; - delete:
DeleteMessagewith theReceiptHandle; - release:
ChangeMessageVisibilitywith theReceiptHandleand itsVisibilityTimeout; - counts:
GetQueueAttributeswith the threeApproximateNumberOf…names, answered with anAttributesobject of strings.
Each call is signed with AWS Signature Version 4 (Sqs.SigV4) over its
content-type, host, x-amz-date and x-amz-target headers and its
body, with the access key id and the secret the step reveals
(Plugin.Secret.reveal/3), and goes out through
Plugin.Provisional.Outbound as the step's proxy user, its recording
redacted. A forward pipeline of that proxy user that changes one of
those headers or the body breaks the signature, and SQS answers 403.
The calls end call_reserve_ms/1 before the step's own time, so a slow
queue fails the step timeout with its call recorded rather than the
runner stopping it.
Summary
Functions
An outbound call's result for action, read: {:ok, answer}, the
answer's decoded JSON (nil when empty), or the call's failure, a status
outside 2xx (http_status, with SQS's error) or an answer that is not
JSON (invalid_response).
The entries a batch call's answer (its decoded JSON) says SQS refused, by
their Id, each as "<code>: <message>"; none when it names none.
The Ids of the entries a batch call's answer (its decoded JSON) says
SQS settled; none when it names none.
How long before the step's time is up its calls must be done.
url as a queue URL: http or https, a host, a path naming the queue,
no query or fragment; {:error, message} otherwise.
A release's delay as whole seconds within visibility_timeout_s's
range: {:ok, seconds} or {:error, message}, a message that names
the editor's box and not the value. Sqs.init/1 checks a literal one
with it, the run one a template resolved to.
Whether queue_url names a FIFO queue: its name ends in .fifo, as SQS
requires of one.
The fingerprint of a resolved call: the operation, action, endpoint, body (a receive's wait time, which is cut to the time left, left out) and proxy user, so a dry run and the real run of the same call agree. The date and the signature are not part of it.
value, a whole number SQS sent as a number or as digits, or nil.
The queue's name: the last segment of its URL, or the URL as it is.
The messages of a ReceiveMessage answer (its decoded JSON, nil when
empty), as SQS sent them: none when it carries none, {:error, message}
(a fragment after "SQS's answer to a receive") when it is not a list of
messages each with an id and a receipt handle.
The region an AWS queue URL's host names, or nil.
The secret access key reference names, revealed for context (whose
reveal_keys hold secret_access_key), or auth_failed.
Runs the step's operation: call/3's result.
The region a call to queue_url is signed for: given when it is set,
else the one an AWS queue URL's host names; invalid_config when
neither names one.
The request for action with the JSON fields on target's queue
(%{queue_url:, region:, access_key_id:, secret:}, the secret revealed),
signed now, as Plugin.Provisional.Outbound.call/3 takes it. The queue
URL goes into the body as every call's does. Sqs.Source calls it; a
step builds its calls from its inputs (run/3).
What a preview says the step would do: the call, as whom and its fingerprint, with nothing sent and no secret revealed. A setting that does not resolve is named in place of the call.
Functions
An outbound call's result for action, read: {:ok, answer}, the
answer's decoded JSON (nil when empty), or the call's failure, a status
outside 2xx (http_status, with SQS's error) or an answer that is not
JSON (invalid_response).
The entries a batch call's answer (its decoded JSON) says SQS refused, by
their Id, each as "<code>: <message>"; none when it names none.
The Ids of the entries a batch call's answer (its decoded JSON) says
SQS settled; none when it names none.
@spec call_reserve_ms(non_neg_integer()) :: non_neg_integer()
How long before the step's time is up its calls must be done.
url as a queue URL: http or https, a host, a path naming the queue,
no query or fragment; {:error, message} otherwise.
@spec delay_seconds(String.t()) :: {:ok, non_neg_integer()} | {:error, String.t()}
A release's delay as whole seconds within visibility_timeout_s's
range: {:ok, seconds} or {:error, message}, a message that names
the editor's box and not the value. Sqs.init/1 checks a literal one
with it, the run one a template resolved to.
Whether queue_url names a FIFO queue: its name ends in .fifo, as SQS
requires of one.
The fingerprint of a resolved call: the operation, action, endpoint, body (a receive's wait time, which is cut to the time left, left out) and proxy user, so a dry run and the real run of the same call agree. The date and the signature are not part of it.
value, a whole number SQS sent as a number or as digits, or nil.
The queue's name: the last segment of its URL, or the URL as it is.
The messages of a ReceiveMessage answer (its decoded JSON, nil when
empty), as SQS sent them: none when it carries none, {:error, message}
(a fragment after "SQS's answer to a receive") when it is not a list of
messages each with an id and a receipt handle.
The region an AWS queue URL's host names, or nil.
@spec reveal_secret(map(), String.t()) :: {:ok, Alternera.Plugin.Secret.t()} | {:error, String.t(), String.t()}
The secret access key reference names, revealed for context (whose
reveal_keys hold secret_access_key), or auth_failed.
@spec run(Alternera.Plugin.Inputs.t(), map(), map()) :: tuple()
Runs the step's operation: call/3's result.
@spec settle_region(String.t() | nil, String.t()) :: {:ok, String.t()} | {:error, String.t(), String.t()}
The region a call to queue_url is signed for: given when it is set,
else the one an AWS queue URL's host names; invalid_config when
neither names one.
The request for action with the JSON fields on target's queue
(%{queue_url:, region:, access_key_id:, secret:}, the secret revealed),
signed now, as Plugin.Provisional.Outbound.call/3 takes it. The queue
URL goes into the body as every call's does. Sqs.Source calls it; a
step builds its calls from its inputs (run/3).
@spec would_call(Alternera.Plugin.Inputs.t(), map(), map()) :: map()
What a preview says the step would do: the call, as whom and its fingerprint, with nothing sent and no secret revealed. A setting that does not resolve is named in place of the call.