1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + |
|
3 + | /// <p>An SSM document required by the current document.</p>
|
4 + | #[non_exhaustive]
|
5 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
6 + | pub struct DocumentRequires {
|
7 + | /// <p>The name of the required SSM document. The name can be an Amazon Resource Name (ARN).</p>
|
8 + | pub name: ::std::string::String,
|
9 + | /// <p>The document version required by the current document.</p>
|
10 + | pub version: ::std::option::Option<::std::string::String>,
|
11 + | /// <p>The document type of the required SSM document.</p>
|
12 + | pub require_type: ::std::option::Option<::std::string::String>,
|
13 + | /// <p>An optional field specifying the version of the artifact associated with the document. For example, 12.6. This value is unique across all versions of a document, and can't be changed.</p>
|
14 + | pub version_name: ::std::option::Option<::std::string::String>,
|
15 + | }
|
16 + | impl DocumentRequires {
|
17 + | /// <p>The name of the required SSM document. The name can be an Amazon Resource Name (ARN).</p>
|
18 + | pub fn name(&self) -> &str {
|
19 + | use std::ops::Deref;
|
20 + | self.name.deref()
|
21 + | }
|
22 + | /// <p>The document version required by the current document.</p>
|
23 + | pub fn version(&self) -> ::std::option::Option<&str> {
|
24 + | self.version.as_deref()
|
25 + | }
|
26 + | /// <p>The document type of the required SSM document.</p>
|
27 + | pub fn require_type(&self) -> ::std::option::Option<&str> {
|
28 + | self.require_type.as_deref()
|
29 + | }
|
30 + | /// <p>An optional field specifying the version of the artifact associated with the document. For example, 12.6. This value is unique across all versions of a document, and can't be changed.</p>
|
31 + | pub fn version_name(&self) -> ::std::option::Option<&str> {
|
32 + | self.version_name.as_deref()
|
33 + | }
|
34 + | }
|
35 + | static DOCUMENTREQUIRES_MEMBER_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
36 + | ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#DocumentRequires$Name", "com.amazonaws.ssm", "DocumentRequires"),
|
37 + | ::aws_smithy_schema::ShapeType::String,
|
38 + | "Name",
|
39 + | 0,
|
40 + | );
|
41 + | static DOCUMENTREQUIRES_MEMBER_VERSION: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
42 + | ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#DocumentRequires$Version", "com.amazonaws.ssm", "DocumentRequires"),
|
43 + | ::aws_smithy_schema::ShapeType::String,
|
44 + | "Version",
|
45 + | 1,
|
46 + | );
|
47 + | static DOCUMENTREQUIRES_MEMBER_REQUIRE_TYPE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
48 + | ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#DocumentRequires$RequireType", "com.amazonaws.ssm", "DocumentRequires"),
|
49 + | ::aws_smithy_schema::ShapeType::String,
|
50 + | "RequireType",
|
51 + | 2,
|
52 + | );
|
53 + | static DOCUMENTREQUIRES_MEMBER_VERSION_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
54 + | ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#DocumentRequires$VersionName", "com.amazonaws.ssm", "DocumentRequires"),
|
55 + | ::aws_smithy_schema::ShapeType::String,
|
56 + | "VersionName",
|
57 + | 3,
|
58 + | );
|
59 + | static DOCUMENTREQUIRES_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
|
60 + | ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#DocumentRequires", "com.amazonaws.ssm", "DocumentRequires"),
|
61 + | ::aws_smithy_schema::ShapeType::Structure,
|
62 + | &[
|
63 + | &DOCUMENTREQUIRES_MEMBER_NAME,
|
64 + | &DOCUMENTREQUIRES_MEMBER_VERSION,
|
65 + | &DOCUMENTREQUIRES_MEMBER_REQUIRE_TYPE,
|
66 + | &DOCUMENTREQUIRES_MEMBER_VERSION_NAME,
|
67 + | ],
|
68 + | );
|
69 + | impl DocumentRequires {
|
70 + | /// The schema for this shape.
|
71 + | pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &DOCUMENTREQUIRES_SCHEMA;
|
72 + | }
|
73 + | impl ::aws_smithy_schema::serde::SerializableStruct for DocumentRequires {
|
74 + | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
75 + | fn serialize_members(
|
76 + | &self,
|
77 + | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
78 + | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
79 + | {
|
80 + | let val = &self.name;
|
81 + | ser.write_string(&DOCUMENTREQUIRES_MEMBER_NAME, val)?;
|
82 + | }
|
83 + | if let Some(ref val) = self.version {
|
84 + | ser.write_string(&DOCUMENTREQUIRES_MEMBER_VERSION, val)?;
|
85 + | }
|
86 + | if let Some(ref val) = self.require_type {
|
87 + | ser.write_string(&DOCUMENTREQUIRES_MEMBER_REQUIRE_TYPE, val)?;
|
88 + | }
|
89 + | if let Some(ref val) = self.version_name {
|
90 + | ser.write_string(&DOCUMENTREQUIRES_MEMBER_VERSION_NAME, val)?;
|
91 + | }
|
92 + | Ok(())
|
93 + | }
|
94 + | }
|
95 + | impl DocumentRequires {
|
96 + | /// Deserializes this structure from a [`ShapeDeserializer`].
|
97 + | pub fn deserialize(
|
98 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
99 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
100 + | #[allow(unused_variables, unused_mut)]
|
101 + | let mut builder = Self::builder();
|
102 + | #[allow(
|
103 + | unused_variables,
|
104 + | unreachable_code,
|
105 + | clippy::single_match,
|
106 + | clippy::match_single_binding,
|
107 + | clippy::diverging_sub_expression
|
108 + | )]
|
109 + | deserializer.read_struct(&DOCUMENTREQUIRES_SCHEMA, &mut |member, deser| {
|
110 + | match member.member_index() {
|
111 + | Some(0) => {
|
112 + | builder.name = Some(deser.read_string(member)?);
|
113 + | }
|
114 + | Some(1) => {
|
115 + | if deser.is_null() {
|
116 + | deser.read_null()?;
|
117 + | } else {
|
118 + | builder.version = Some(deser.read_string(member)?);
|
119 + | }
|
120 + | }
|
121 + | Some(2) => {
|
122 + | if deser.is_null() {
|
123 + | deser.read_null()?;
|
124 + | } else {
|
125 + | builder.require_type = Some(deser.read_string(member)?);
|
126 + | }
|
127 + | }
|
128 + | Some(3) => {
|
129 + | if deser.is_null() {
|
130 + | deser.read_null()?;
|
131 + | } else {
|
132 + | builder.version_name = Some(deser.read_string(member)?);
|
133 + | }
|
134 + | }
|
135 + | _ => {}
|
136 + | }
|
137 + | Ok(())
|
138 + | })?;
|
139 + | builder.name = builder.name.or(Some(String::new()));
|
140 + | builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
|
141 + | }
|
142 + | }
|
143 + | impl DocumentRequires {
|
144 + | /// Deserializes this structure from a body deserializer and HTTP response.
|
145 + | pub fn deserialize_with_response(
|
146 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
147 + | _headers: &::aws_smithy_runtime_api::http::Headers,
|
148 + | _status: u16,
|
149 + | _body: &[u8],
|
150 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
151 + | Self::deserialize(deserializer)
|
152 + | }
|
153 + | }
|
154 + | impl DocumentRequires {
|
155 + | /// Creates a new builder-style object to manufacture [`DocumentRequires`](crate::types::DocumentRequires).
|
156 + | pub fn builder() -> crate::types::builders::DocumentRequiresBuilder {
|
157 + | crate::types::builders::DocumentRequiresBuilder::default()
|
158 + | }
|
159 + | }
|
160 + |
|
161 + | /// A builder for [`DocumentRequires`](crate::types::DocumentRequires).
|
162 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
|
163 + | #[non_exhaustive]
|
164 + | pub struct DocumentRequiresBuilder {
|
165 + | pub(crate) name: ::std::option::Option<::std::string::String>,
|
166 + | pub(crate) version: ::std::option::Option<::std::string::String>,
|
167 + | pub(crate) require_type: ::std::option::Option<::std::string::String>,
|
168 + | pub(crate) version_name: ::std::option::Option<::std::string::String>,
|
169 + | }
|
170 + | impl DocumentRequiresBuilder {
|
171 + | /// <p>The name of the required SSM document. The name can be an Amazon Resource Name (ARN).</p>
|
172 + | /// This field is required.
|
173 + | pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
174 + | self.name = ::std::option::Option::Some(input.into());
|
175 + | self
|
176 + | }
|
177 + | /// <p>The name of the required SSM document. The name can be an Amazon Resource Name (ARN).</p>
|
178 + | pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
179 + | self.name = input;
|
180 + | self
|
181 + | }
|
182 + | /// <p>The name of the required SSM document. The name can be an Amazon Resource Name (ARN).</p>
|
183 + | pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
|
184 + | &self.name
|
185 + | }
|
186 + | /// <p>The document version required by the current document.</p>
|
187 + | pub fn version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
188 + | self.version = ::std::option::Option::Some(input.into());
|
189 + | self
|
190 + | }
|
191 + | /// <p>The document version required by the current document.</p>
|
192 + | pub fn set_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
193 + | self.version = input;
|
194 + | self
|
195 + | }
|
196 + | /// <p>The document version required by the current document.</p>
|
197 + | pub fn get_version(&self) -> &::std::option::Option<::std::string::String> {
|
198 + | &self.version
|
199 + | }
|
200 + | /// <p>The document type of the required SSM document.</p>
|
201 + | pub fn require_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
202 + | self.require_type = ::std::option::Option::Some(input.into());
|
203 + | self
|
204 + | }
|
205 + | /// <p>The document type of the required SSM document.</p>
|
206 + | pub fn set_require_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
207 + | self.require_type = input;
|
208 + | self
|
209 + | }
|
210 + | /// <p>The document type of the required SSM document.</p>
|
211 + | pub fn get_require_type(&self) -> &::std::option::Option<::std::string::String> {
|
212 + | &self.require_type
|
213 + | }
|
214 + | /// <p>An optional field specifying the version of the artifact associated with the document. For example, 12.6. This value is unique across all versions of a document, and can't be changed.</p>
|
215 + | pub fn version_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
216 + | self.version_name = ::std::option::Option::Some(input.into());
|
217 + | self
|
218 + | }
|
219 + | /// <p>An optional field specifying the version of the artifact associated with the document. For example, 12.6. This value is unique across all versions of a document, and can't be changed.</p>
|
220 + | pub fn set_version_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
221 + | self.version_name = input;
|
222 + | self
|
223 + | }
|
224 + | /// <p>An optional field specifying the version of the artifact associated with the document. For example, 12.6. This value is unique across all versions of a document, and can't be changed.</p>
|
225 + | pub fn get_version_name(&self) -> &::std::option::Option<::std::string::String> {
|
226 + | &self.version_name
|
227 + | }
|
228 + | /// Consumes the builder and constructs a [`DocumentRequires`](crate::types::DocumentRequires).
|
229 + | /// This method will fail if any of the following fields are not set:
|
230 + | /// - [`name`](crate::types::builders::DocumentRequiresBuilder::name)
|
231 + | pub fn build(self) -> ::std::result::Result<crate::types::DocumentRequires, ::aws_smithy_types::error::operation::BuildError> {
|
232 + | ::std::result::Result::Ok(crate::types::DocumentRequires {
|
233 + | name: self.name.ok_or_else(|| {
|
234 + | ::aws_smithy_types::error::operation::BuildError::missing_field(
|
235 + | "name",
|
236 + | "name was not specified but it is required when building DocumentRequires",
|
237 + | )
|
238 + | })?,
|
239 + | version: self.version,
|
240 + | require_type: self.require_type,
|
241 + | version_name: self.version_name,
|
242 + | })
|
243 + | }
|
244 + | }
|