Documentation
¶
Overview ¶
Package awsquery implements the AWS Query protocol: form-encoded requests carrying an Action parameter, XML responses in a per-action envelope. STS and SNS speak it exclusively; SQS speaks it for legacy (pre-2023 SDK) clients.
The response envelope is uniform across Query services:
<{Action}Response xmlns="...">
<{Action}Result> ... </{Action}Result> (omitted for result-less actions)
<ResponseMetadata><RequestId>..</RequestId></ResponseMetadata>
</{Action}Response>
and so is the error envelope:
<ErrorResponse xmlns="..."> <Error><Type>Sender</Type><Code>..</Code><Message>..</Message></Error> <RequestId>..</RequestId> </ErrorResponse>
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Members ¶
Members collects the values of a numbered-list parameter in order: prefix.member.1, prefix.member.2, ... (the `member` level is what most Query APIs use; pass memberless=true for APIs that number directly: prefix.1, ...).
func MessageAttrs ¶ added in v0.2.0
func MessageAttrs(vals url.Values, prefix string) map[string]MessageAttr
MessageAttrs decodes the message-attribute list at prefix. Returns nil when the list is absent or empty.
func PairMap ¶ added in v0.2.0
PairMap decodes a flattened key/value entry list into a map: {prefix}.1.{keyName}, {prefix}.1.{valName}, {prefix}.2.{keyName}, ... It covers the Query protocol's map shapes — SQS Attribute.N.Name/Value and Tag.N.Key/Value, SNS Attributes.entry.N.key/value and Tags.member.N.Key/Value. Returns nil when the list is absent or empty.
Types ¶
type API ¶
type API struct {
XMLNS string
// EmptyResult emits an empty {Action}Result element when WriteResult is
// given a nil result. Real SNS always includes the element, and some SDK
// deserializers (e.g. TagResource in aws-sdk-go-v2) require the node.
EmptyResult bool
}
API renders responses for one Query service (its xmlns is per-service).
func (API) WriteError ¶
func (a API) WriteError(w http.ResponseWriter, e *awshttp.APIError)
WriteError writes the standard Query error envelope with e's HTTP status.
func (API) WriteResult ¶
func (a API) WriteResult(w http.ResponseWriter, action string, result any)
WriteResult writes the standard success envelope. result must be a struct whose fields marshal into the {Action}Result element's children; pass nil for actions that have no result element.
type MessageAttr ¶ added in v0.2.0
type MessageAttr struct {
DataType string
StringValue string
BinaryValue []byte // decoded from the wire's base64
}
MessageAttr is one decoded message attribute from a flattened {prefix}.N.Name / {prefix}.N.Value.* list. SQS (MessageAttribute.N) and SNS (MessageAttributes.entry.N) share the shape: a name, a data type, and a string or base64 binary value.