Skip to main content

Module ec2query

Module ec2query 

Source
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:

  1. No <Result> wrapper. An awsQuery response 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).
  2. 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.
  3. 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 xmlNamespace uri 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 value is None (EC2 omits absent optional members rather than emitting empty tags).
ec2_list
Render a flattened EC2 list. wrapper is the set element name (e.g. instancesSet); each entry in items is the already-rendered inner XML of one <item> (do NOT pre-wrap entries in <item>).
ec2_response
Wrap an operation’s result body in 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 to ec2_response as 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.