34 34 | 0,
|
35 35 | )
|
36 36 | .with_http_header("x-foo");
|
37 37 | static HTTPPREFIXHEADERSINPUT_MEMBER_FOO_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
38 38 | ::aws_smithy_schema::ShapeId::from_static(
|
39 39 | "aws.protocoltests.restxml.synthetic#HttpPrefixHeadersInput$fooMap",
|
40 40 | "aws.protocoltests.restxml.synthetic",
|
41 41 | "HttpPrefixHeadersInput",
|
42 42 | ),
|
43 43 | ::aws_smithy_schema::ShapeType::Map,
|
44 - | "foo_map",
|
44 + | "fooMap",
|
45 45 | 1,
|
46 46 | )
|
47 47 | .with_http_prefix_headers("x-foo-");
|
48 48 | static HTTPPREFIXHEADERSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
|
49 49 | HTTPPREFIXHEADERSINPUT_SCHEMA_ID,
|
50 50 | ::aws_smithy_schema::ShapeType::Structure,
|
51 51 | &[&HTTPPREFIXHEADERSINPUT_MEMBER_FOO, &HTTPPREFIXHEADERSINPUT_MEMBER_FOO_MAP],
|
52 - | );
|
52 + | )
|
53 + | .with_http(aws_smithy_schema::traits::HttpTrait::new("GET", "/HttpPrefixHeaders", None));
|
53 54 | impl HttpPrefixHeadersInput {
|
54 55 | /// The schema for this shape.
|
55 56 | pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPPREFIXHEADERSINPUT_SCHEMA;
|
56 57 | }
|
57 58 | impl ::aws_smithy_schema::serde::SerializableStruct for HttpPrefixHeadersInput {
|
58 59 | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
59 60 | fn serialize_members(
|
60 61 | &self,
|
61 62 | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
62 63 | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
63 64 | if let Some(ref val) = self.foo {
|
64 65 | ser.write_string(&HTTPPREFIXHEADERSINPUT_MEMBER_FOO, val)?;
|
65 66 | }
|
66 67 | if let Some(ref val) = self.foo_map {
|
67 68 | ser.write_map(
|
68 69 | &HTTPPREFIXHEADERSINPUT_MEMBER_FOO_MAP,
|
69 70 | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
70 71 | for (key, value) in val {
|
71 72 | ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
|
72 73 | ser.write_string(&::aws_smithy_schema::prelude::STRING, value)?;
|
73 74 | }
|
74 75 | Ok(())
|
75 76 | },
|
76 77 | )?;
|
77 78 | }
|
78 79 | Ok(())
|
79 80 | }
|
80 81 | }
|
81 82 | impl HttpPrefixHeadersInput {
|
82 83 | /// Deserializes this structure from a [`ShapeDeserializer`].
|
83 - | pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
|
84 - | deserializer: &mut D,
|
84 + | pub fn deserialize(
|
85 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
85 86 | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
86 87 | #[allow(unused_variables, unused_mut)]
|
87 88 | let mut builder = Self::builder();
|
88 89 | #[allow(
|
89 90 | unused_variables,
|
90 91 | unreachable_code,
|
91 92 | clippy::single_match,
|
92 93 | clippy::match_single_binding,
|
93 94 | clippy::diverging_sub_expression
|
94 95 | )]
|
95 - | deserializer.read_struct(&HTTPPREFIXHEADERSINPUT_SCHEMA, (), |_, member, deser| {
|
96 + | deserializer.read_struct(&HTTPPREFIXHEADERSINPUT_SCHEMA, &mut |member, deser| {
|
96 97 | match member.member_index() {
|
97 98 | Some(0) => {
|
98 99 | builder.foo = Some(deser.read_string(member)?);
|
99 100 | }
|
100 101 | Some(1) => {
|
101 - | builder.foo_map = Some({
|
102 - | let container = if let Some(cap) = deser.container_size() {
|
103 - | std::collections::HashMap::with_capacity(cap)
|
104 - | } else {
|
105 - | std::collections::HashMap::new()
|
106 - | };
|
107 - | deser.read_map(member, container, |mut map, key, deser| {
|
108 - | map.insert(key, deser.read_string(member)?);
|
109 - | Ok(map)
|
110 - | })?
|
111 - | });
|
102 + | builder.foo_map = Some(deser.read_string_string_map(member)?);
|
112 103 | }
|
113 104 | _ => {}
|
114 105 | }
|
115 106 | Ok(())
|
116 107 | })?;
|
117 108 | builder
|
118 109 | .build()
|
119 110 | .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
|
120 111 | }
|
121 112 | }
|
113 + | impl HttpPrefixHeadersInput {
|
114 + | /// Deserializes this structure from a body deserializer and HTTP response headers.
|
115 + | /// Header-bound members are read directly from headers, avoiding runtime
|
116 + | /// member iteration overhead. Body members are read via the deserializer.
|
117 + | pub fn deserialize_with_response(
|
118 + | _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
119 + | headers: &::aws_smithy_runtime_api::http::Headers,
|
120 + | _status: u16,
|
121 + | _body: &[u8],
|
122 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
123 + | #[allow(unused_variables, unused_mut)]
|
124 + | let mut builder = Self::builder();
|
125 + | if let Some(val) = headers.get("x-foo") {
|
126 + | builder.foo = Some(val.to_string());
|
127 + | }
|
128 + | {
|
129 + | let mut map = ::std::collections::HashMap::new();
|
130 + | for (key, val) in headers.iter() {
|
131 + | if let Some(suffix) = key.strip_prefix("x-foo-") {
|
132 + | map.insert(suffix.to_string(), val.to_string());
|
133 + | }
|
134 + | }
|
135 + | if !map.is_empty() {
|
136 + | builder.foo_map = Some(map);
|
137 + | }
|
138 + | }
|
139 + | builder
|
140 + | .build()
|
141 + | .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
|
142 + | }
|
143 + | }
|
122 144 | impl HttpPrefixHeadersInput {
|
123 145 | /// Creates a new builder-style object to manufacture [`HttpPrefixHeadersInput`](crate::operation::http_prefix_headers::HttpPrefixHeadersInput).
|
124 146 | pub fn builder() -> crate::operation::http_prefix_headers::builders::HttpPrefixHeadersInputBuilder {
|
125 147 | crate::operation::http_prefix_headers::builders::HttpPrefixHeadersInputBuilder::default()
|
126 148 | }
|
127 149 | }
|
128 150 |
|
129 151 | /// A builder for [`HttpPrefixHeadersInput`](crate::operation::http_prefix_headers::HttpPrefixHeadersInput).
|
130 152 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
|
131 153 | #[non_exhaustive]
|