Expand description
Serialization helpers for the AWS ec2Query protocol.
EC2 uses a variant of the AWS Query protocol whose XML responses differ
from awsQuery (SQS/SNS/RDS/IAM) in three load-bearing ways:
- No
<Result>wrapper. AnawsQueryresponse nests the body under<{Action}Result>. EC2 places the result members directly inside<{Action}Response>, preceded by a lowercase<requestId>element (NOT the<ResponseMetadata><RequestId>block awsQuery uses). - Flattened lists. Lists serialize as a wrapper element whose repeated
children are literally named
<item>— e.g.<instancesSet><item>…</item><item>…</item></instancesSet>— with no intermediate<member>tag. - lowerCamelCase tags. Response element names are lower-camel
(
<reservationId>,<tagSet>,<groupSet>), unlike the UpperCamel member names awsQuery echoes.
The real AWS SDKs deserialize strictly against these shapes, so the unit
tests below round-trip the rendered XML through a minimal parser to lock the
structure in. See crate::xml::xml_escape for content escaping.
Constants§
- EC2_
NAMESPACE - The EC2 response namespace. Note the trailing slash — EC2 emits it on the
wire even though the Smithy model’s
xmlNamespaceuri omits it.
Functions§
- ec2_
bool - Render a boolean as EC2’s lowercase
true/false:<name>true</name>. - ec2_
elem - Render a leaf element with escaped text content:
<name>value</name>. - ec2_
elem_ opt - Render an optional leaf element. Returns the empty string when
valueisNone(EC2 omits absent optional members rather than emitting empty tags). - ec2_
list - Render a flattened EC2 list.
wrapperis the set element name (e.g.instancesSet); each entry initemsis the already-rendered inner XML of one<item>(do NOT pre-wrap entries in<item>). - ec2_
response - Wrap an operation’s result
bodyin the ec2Query response envelope. - ec2_
return - Render the canonical
<return>true</return>body emitted by EC2’s many mutate-and-acknowledge operations (DeleteVpc, AuthorizeSecurityGroupIngress, …). Pass toec2_responseas the body. - ec2_
scalar_ list - Render a flattened list of scalar leaf values, e.g. a
<groupSet>of bare strings:<groupSet><item>sg-1</item><item>sg-2</item></groupSet>. - ec2_
tag_ set - Render an EC2
<tagSet>from(key, value)pairs. Each tag becomes<item><key>…</key><value>…</value></item>. Emits<tagSet/>when empty.