5 5 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
6 6 | pub struct PrefixList {
|
7 7 | /// <p>The IP address range of the Amazon Web Services service.</p>
|
8 8 | pub cidrs: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
|
9 9 | /// <p>The ID of the prefix.</p>
|
10 10 | pub prefix_list_id: ::std::option::Option<::std::string::String>,
|
11 11 | /// <p>The name of the prefix.</p>
|
12 12 | pub prefix_list_name: ::std::option::Option<::std::string::String>,
|
13 13 | }
|
14 14 | impl PrefixList {
|
15 15 | /// <p>The IP address range of the Amazon Web Services service.</p>
|
16 16 | ///
|
17 17 | /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.cidrs.is_none()`.
|
18 18 | pub fn cidrs(&self) -> &[::std::string::String] {
|
19 19 | self.cidrs.as_deref().unwrap_or_default()
|
20 20 | }
|
21 21 | /// <p>The ID of the prefix.</p>
|
22 22 | pub fn prefix_list_id(&self) -> ::std::option::Option<&str> {
|
23 23 | self.prefix_list_id.as_deref()
|
24 24 | }
|
25 25 | /// <p>The name of the prefix.</p>
|
26 26 | pub fn prefix_list_name(&self) -> ::std::option::Option<&str> {
|
27 27 | self.prefix_list_name.as_deref()
|
28 28 | }
|
29 29 | }
|
30 30 | static PREFIXLIST_SCHEMA_ID: ::aws_smithy_schema::ShapeId =
|
31 31 | ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.ec2#PrefixList", "com.amazonaws.ec2", "PrefixList");
|
32 32 | static PREFIXLIST_MEMBER_CIDRS: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
33 33 | ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.ec2#PrefixList$Cidrs", "com.amazonaws.ec2", "PrefixList"),
|
34 34 | ::aws_smithy_schema::ShapeType::List,
|
35 - | "cidrs",
|
35 + | "Cidrs",
|
36 36 | 0,
|
37 37 | )
|
38 38 | .with_xml_name("cidrSet");
|
39 39 | static PREFIXLIST_MEMBER_PREFIX_LIST_ID: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
40 40 | ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.ec2#PrefixList$PrefixListId", "com.amazonaws.ec2", "PrefixList"),
|
41 41 | ::aws_smithy_schema::ShapeType::String,
|
42 - | "prefix_list_id",
|
42 + | "PrefixListId",
|
43 43 | 1,
|
44 44 | )
|
45 45 | .with_xml_name("prefixListId");
|
46 46 | static PREFIXLIST_MEMBER_PREFIX_LIST_NAME: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
47 47 | ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.ec2#PrefixList$PrefixListName", "com.amazonaws.ec2", "PrefixList"),
|
48 48 | ::aws_smithy_schema::ShapeType::String,
|
49 - | "prefix_list_name",
|
49 + | "PrefixListName",
|
50 50 | 2,
|
51 51 | )
|
52 52 | .with_xml_name("prefixListName");
|
53 53 | static PREFIXLIST_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
|
54 54 | PREFIXLIST_SCHEMA_ID,
|
55 55 | ::aws_smithy_schema::ShapeType::Structure,
|
56 56 | &[
|
57 57 | &PREFIXLIST_MEMBER_CIDRS,
|
58 58 | &PREFIXLIST_MEMBER_PREFIX_LIST_ID,
|
59 59 | &PREFIXLIST_MEMBER_PREFIX_LIST_NAME,
|
60 60 | ],
|
61 61 | );
|
62 62 | impl PrefixList {
|
63 63 | /// The schema for this shape.
|
64 64 | pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &PREFIXLIST_SCHEMA;
|
65 65 | }
|
66 66 | impl ::aws_smithy_schema::serde::SerializableStruct for PrefixList {
|
67 67 | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
68 68 | fn serialize_members(
|
69 69 | &self,
|
70 70 | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
71 71 | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
72 72 | if let Some(ref val) = self.cidrs {
|
73 73 | ser.write_list(&PREFIXLIST_MEMBER_CIDRS, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
74 74 | for item in val {
|
75 75 | ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
|
76 76 | }
|
77 77 | Ok(())
|
78 78 | })?;
|
79 79 | }
|
80 80 | if let Some(ref val) = self.prefix_list_id {
|
81 81 | ser.write_string(&PREFIXLIST_MEMBER_PREFIX_LIST_ID, val)?;
|
82 82 | }
|
83 83 | if let Some(ref val) = self.prefix_list_name {
|
84 84 | ser.write_string(&PREFIXLIST_MEMBER_PREFIX_LIST_NAME, val)?;
|
85 85 | }
|
86 86 | Ok(())
|
87 87 | }
|
88 88 | }
|
89 89 | impl PrefixList {
|
90 90 | /// Deserializes this structure from a [`ShapeDeserializer`].
|
91 - | pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
|
92 - | deserializer: &mut D,
|
91 + | pub fn deserialize(
|
92 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
93 93 | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
94 94 | #[allow(unused_variables, unused_mut)]
|
95 95 | let mut builder = Self::builder();
|
96 96 | #[allow(
|
97 97 | unused_variables,
|
98 98 | unreachable_code,
|
99 99 | clippy::single_match,
|
100 100 | clippy::match_single_binding,
|
101 101 | clippy::diverging_sub_expression
|
102 102 | )]
|
103 - | deserializer.read_struct(&PREFIXLIST_SCHEMA, (), |_, member, deser| {
|
103 + | deserializer.read_struct(&PREFIXLIST_SCHEMA, &mut |member, deser| {
|
104 104 | match member.member_index() {
|
105 105 | Some(0) => {
|
106 - | builder.cidrs = Some({
|
107 - | let container = if let Some(cap) = deser.container_size() {
|
108 - | Vec::with_capacity(cap)
|
109 - | } else {
|
110 - | Vec::new()
|
111 - | };
|
112 - | deser.read_list(member, container, |mut list, deser| {
|
113 - | list.push(deser.read_string(member)?);
|
114 - | Ok(list)
|
115 - | })?
|
116 - | });
|
106 + | builder.cidrs = Some(deser.read_string_list(member)?);
|
117 107 | }
|
118 108 | Some(1) => {
|
119 109 | builder.prefix_list_id = Some(deser.read_string(member)?);
|
120 110 | }
|
121 111 | Some(2) => {
|
122 112 | builder.prefix_list_name = Some(deser.read_string(member)?);
|
123 113 | }
|
124 114 | _ => {}
|
125 115 | }
|
126 116 | Ok(())
|
127 117 | })?;
|
128 118 | Ok(builder.build())
|
129 119 | }
|
130 120 | }
|
121 + | impl PrefixList {
|
122 + | /// Deserializes this structure from a body deserializer and HTTP response.
|
123 + | pub fn deserialize_with_response(
|
124 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
125 + | _headers: &::aws_smithy_runtime_api::http::Headers,
|
126 + | _status: u16,
|
127 + | _body: &[u8],
|
128 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
129 + | Self::deserialize(deserializer)
|
130 + | }
|
131 + | }
|
131 132 | impl PrefixList {
|
132 133 | /// Creates a new builder-style object to manufacture [`PrefixList`](crate::types::PrefixList).
|
133 134 | pub fn builder() -> crate::types::builders::PrefixListBuilder {
|
134 135 | crate::types::builders::PrefixListBuilder::default()
|
135 136 | }
|
136 137 | }
|
137 138 |
|
138 139 | /// A builder for [`PrefixList`](crate::types::PrefixList).
|
139 140 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
|
140 141 | #[non_exhaustive]
|