1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + |
|
3 + | /// <p>Configurations for sending notifications.</p>
|
4 + | #[non_exhaustive]
|
5 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
6 + | pub struct NotificationConfig {
|
7 + | /// <p>An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command pushes notifications about command status changes to this topic.</p>
|
8 + | pub notification_arn: ::std::option::Option<::std::string::String>,
|
9 + | /// <p>The different events for which you can receive notifications. To learn more about these events, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/monitoring-sns-notifications.html">Monitoring Systems Manager status changes using Amazon SNS notifications</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
|
10 + | pub notification_events: ::std::option::Option<::std::vec::Vec<crate::types::NotificationEvent>>,
|
11 + | /// <p>The type of notification.</p>
|
12 + | /// <ul>
|
13 + | /// <li>
|
14 + | /// <p><code>Command</code>: Receive notification when the status of a command changes.</p></li>
|
15 + | /// <li>
|
16 + | /// <p><code>Invocation</code>: For commands sent to multiple managed nodes, receive notification on a per-node basis when the status of a command changes.</p></li>
|
17 + | /// </ul>
|
18 + | pub notification_type: ::std::option::Option<crate::types::NotificationType>,
|
19 + | }
|
20 + | impl NotificationConfig {
|
21 + | /// <p>An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command pushes notifications about command status changes to this topic.</p>
|
22 + | pub fn notification_arn(&self) -> ::std::option::Option<&str> {
|
23 + | self.notification_arn.as_deref()
|
24 + | }
|
25 + | /// <p>The different events for which you can receive notifications. To learn more about these events, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/monitoring-sns-notifications.html">Monitoring Systems Manager status changes using Amazon SNS notifications</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
|
26 + | ///
|
27 + | /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.notification_events.is_none()`.
|
28 + | pub fn notification_events(&self) -> &[crate::types::NotificationEvent] {
|
29 + | self.notification_events.as_deref().unwrap_or_default()
|
30 + | }
|
31 + | /// <p>The type of notification.</p>
|
32 + | /// <ul>
|
33 + | /// <li>
|
34 + | /// <p><code>Command</code>: Receive notification when the status of a command changes.</p></li>
|
35 + | /// <li>
|
36 + | /// <p><code>Invocation</code>: For commands sent to multiple managed nodes, receive notification on a per-node basis when the status of a command changes.</p></li>
|
37 + | /// </ul>
|
38 + | pub fn notification_type(&self) -> ::std::option::Option<&crate::types::NotificationType> {
|
39 + | self.notification_type.as_ref()
|
40 + | }
|
41 + | }
|
42 + | static NOTIFICATIONCONFIG_MEMBER_NOTIFICATION_ARN: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
43 + | ::aws_smithy_schema::ShapeId::from_parts(
|
44 + | "com.amazonaws.ssm#NotificationConfig$NotificationArn",
|
45 + | "com.amazonaws.ssm",
|
46 + | "NotificationConfig",
|
47 + | ),
|
48 + | ::aws_smithy_schema::ShapeType::String,
|
49 + | "NotificationArn",
|
50 + | 0,
|
51 + | );
|
52 + | static NOTIFICATIONCONFIG_MEMBER_NOTIFICATION_EVENTS_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
53 + | ::aws_smithy_schema::ShapeId::from_parts(
|
54 + | "com.amazonaws.ssm#NotificationEventList$member",
|
55 + | "com.amazonaws.ssm",
|
56 + | "NotificationEventList",
|
57 + | ),
|
58 + | ::aws_smithy_schema::ShapeType::String,
|
59 + | "member",
|
60 + | 0,
|
61 + | );
|
62 + | static NOTIFICATIONCONFIG_MEMBER_NOTIFICATION_EVENTS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
63 + | ::aws_smithy_schema::ShapeId::from_parts(
|
64 + | "com.amazonaws.ssm#NotificationConfig$NotificationEvents",
|
65 + | "com.amazonaws.ssm",
|
66 + | "NotificationConfig",
|
67 + | ),
|
68 + | ::aws_smithy_schema::ShapeType::List,
|
69 + | "NotificationEvents",
|
70 + | 1,
|
71 + | )
|
72 + | .with_list_member(&NOTIFICATIONCONFIG_MEMBER_NOTIFICATION_EVENTS_MEMBER);
|
73 + | static NOTIFICATIONCONFIG_MEMBER_NOTIFICATION_TYPE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
74 + | ::aws_smithy_schema::ShapeId::from_parts(
|
75 + | "com.amazonaws.ssm#NotificationConfig$NotificationType",
|
76 + | "com.amazonaws.ssm",
|
77 + | "NotificationConfig",
|
78 + | ),
|
79 + | ::aws_smithy_schema::ShapeType::String,
|
80 + | "NotificationType",
|
81 + | 2,
|
82 + | );
|
83 + | static NOTIFICATIONCONFIG_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
|
84 + | ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#NotificationConfig", "com.amazonaws.ssm", "NotificationConfig"),
|
85 + | ::aws_smithy_schema::ShapeType::Structure,
|
86 + | &[
|
87 + | &NOTIFICATIONCONFIG_MEMBER_NOTIFICATION_ARN,
|
88 + | &NOTIFICATIONCONFIG_MEMBER_NOTIFICATION_EVENTS,
|
89 + | &NOTIFICATIONCONFIG_MEMBER_NOTIFICATION_TYPE,
|
90 + | ],
|
91 + | );
|
92 + | impl NotificationConfig {
|
93 + | /// The schema for this shape.
|
94 + | pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &NOTIFICATIONCONFIG_SCHEMA;
|
95 + | }
|
96 + | impl ::aws_smithy_schema::serde::SerializableStruct for NotificationConfig {
|
97 + | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
98 + | fn serialize_members(
|
99 + | &self,
|
100 + | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
101 + | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
102 + | if let Some(ref val) = self.notification_arn {
|
103 + | ser.write_string(&NOTIFICATIONCONFIG_MEMBER_NOTIFICATION_ARN, val)?;
|
104 + | }
|
105 + | if let Some(ref val) = self.notification_events {
|
106 + | ser.write_list(
|
107 + | &NOTIFICATIONCONFIG_MEMBER_NOTIFICATION_EVENTS,
|
108 + | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
109 + | for item in val {
|
110 + | ser.write_string(&aws_smithy_schema::prelude::STRING, item.as_str())?;
|
111 + | }
|
112 + | Ok(())
|
113 + | },
|
114 + | )?;
|
115 + | }
|
116 + | if let Some(ref val) = self.notification_type {
|
117 + | ser.write_string(&NOTIFICATIONCONFIG_MEMBER_NOTIFICATION_TYPE, val.as_str())?;
|
118 + | }
|
119 + | Ok(())
|
120 + | }
|
121 + | }
|
122 + | impl NotificationConfig {
|
123 + | /// Deserializes this structure from a [`ShapeDeserializer`].
|
124 + | pub fn deserialize(
|
125 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
126 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
127 + | #[allow(unused_variables, unused_mut)]
|
128 + | let mut builder = Self::builder();
|
129 + | #[allow(
|
130 + | unused_variables,
|
131 + | unreachable_code,
|
132 + | clippy::single_match,
|
133 + | clippy::match_single_binding,
|
134 + | clippy::diverging_sub_expression
|
135 + | )]
|
136 + | deserializer.read_struct(&NOTIFICATIONCONFIG_SCHEMA, &mut |member, deser| {
|
137 + | match member.member_index() {
|
138 + | Some(0) => {
|
139 + | if deser.is_null() {
|
140 + | deser.read_null()?;
|
141 + | } else {
|
142 + | builder.notification_arn = Some(deser.read_string(member)?);
|
143 + | }
|
144 + | }
|
145 + | Some(1) => {
|
146 + | if deser.is_null() {
|
147 + | deser.read_null()?;
|
148 + | } else {
|
149 + | builder.notification_events = Some({
|
150 + | let mut container = Vec::new();
|
151 + | deser.read_list(member, &mut |deser| {
|
152 + | container.push(crate::types::NotificationEvent::from(
|
153 + | deser.read_string(&::aws_smithy_schema::prelude::STRING)?.as_str(),
|
154 + | ));
|
155 + | Ok(())
|
156 + | })?;
|
157 + | container
|
158 + | });
|
159 + | }
|
160 + | }
|
161 + | Some(2) => {
|
162 + | if deser.is_null() {
|
163 + | deser.read_null()?;
|
164 + | } else {
|
165 + | builder.notification_type = Some(crate::types::NotificationType::from(deser.read_string(member)?.as_str()));
|
166 + | }
|
167 + | }
|
168 + | _ => {}
|
169 + | }
|
170 + | Ok(())
|
171 + | })?;
|
172 + | Ok(builder.build())
|
173 + | }
|
174 + | }
|
175 + | impl NotificationConfig {
|
176 + | /// Deserializes this structure from a body deserializer and HTTP response.
|
177 + | pub fn deserialize_with_response(
|
178 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
179 + | _headers: &::aws_smithy_runtime_api::http::Headers,
|
180 + | _status: u16,
|
181 + | _body: &[u8],
|
182 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
183 + | Self::deserialize(deserializer)
|
184 + | }
|
185 + | }
|
186 + | impl NotificationConfig {
|
187 + | /// Creates a new builder-style object to manufacture [`NotificationConfig`](crate::types::NotificationConfig).
|
188 + | pub fn builder() -> crate::types::builders::NotificationConfigBuilder {
|
189 + | crate::types::builders::NotificationConfigBuilder::default()
|
190 + | }
|
191 + | }
|
192 + |
|
193 + | /// A builder for [`NotificationConfig`](crate::types::NotificationConfig).
|
194 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
|
195 + | #[non_exhaustive]
|
196 + | pub struct NotificationConfigBuilder {
|
197 + | pub(crate) notification_arn: ::std::option::Option<::std::string::String>,
|
198 + | pub(crate) notification_events: ::std::option::Option<::std::vec::Vec<crate::types::NotificationEvent>>,
|
199 + | pub(crate) notification_type: ::std::option::Option<crate::types::NotificationType>,
|
200 + | }
|
201 + | impl NotificationConfigBuilder {
|
202 + | /// <p>An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command pushes notifications about command status changes to this topic.</p>
|
203 + | pub fn notification_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
204 + | self.notification_arn = ::std::option::Option::Some(input.into());
|
205 + | self
|
206 + | }
|
207 + | /// <p>An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command pushes notifications about command status changes to this topic.</p>
|
208 + | pub fn set_notification_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
209 + | self.notification_arn = input;
|
210 + | self
|
211 + | }
|
212 + | /// <p>An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command pushes notifications about command status changes to this topic.</p>
|
213 + | pub fn get_notification_arn(&self) -> &::std::option::Option<::std::string::String> {
|
214 + | &self.notification_arn
|
215 + | }
|
216 + | /// Appends an item to `notification_events`.
|
217 + | ///
|
218 + | /// To override the contents of this collection use [`set_notification_events`](Self::set_notification_events).
|
219 + | ///
|
220 + | /// <p>The different events for which you can receive notifications. To learn more about these events, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/monitoring-sns-notifications.html">Monitoring Systems Manager status changes using Amazon SNS notifications</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
|
221 + | pub fn notification_events(mut self, input: crate::types::NotificationEvent) -> Self {
|
222 + | let mut v = self.notification_events.unwrap_or_default();
|
223 + | v.push(input);
|
224 + | self.notification_events = ::std::option::Option::Some(v);
|
225 + | self
|
226 + | }
|
227 + | /// <p>The different events for which you can receive notifications. To learn more about these events, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/monitoring-sns-notifications.html">Monitoring Systems Manager status changes using Amazon SNS notifications</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
|
228 + | pub fn set_notification_events(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::NotificationEvent>>) -> Self {
|
229 + | self.notification_events = input;
|
230 + | self
|
231 + | }
|
232 + | /// <p>The different events for which you can receive notifications. To learn more about these events, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/monitoring-sns-notifications.html">Monitoring Systems Manager status changes using Amazon SNS notifications</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
|
233 + | pub fn get_notification_events(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::NotificationEvent>> {
|
234 + | &self.notification_events
|
235 + | }
|
236 + | /// <p>The type of notification.</p>
|
237 + | /// <ul>
|
238 + | /// <li>
|
239 + | /// <p><code>Command</code>: Receive notification when the status of a command changes.</p></li>
|
240 + | /// <li>
|
241 + | /// <p><code>Invocation</code>: For commands sent to multiple managed nodes, receive notification on a per-node basis when the status of a command changes.</p></li>
|
242 + | /// </ul>
|
243 + | pub fn notification_type(mut self, input: crate::types::NotificationType) -> Self {
|
244 + | self.notification_type = ::std::option::Option::Some(input);
|
245 + | self
|
246 + | }
|
247 + | /// <p>The type of notification.</p>
|
248 + | /// <ul>
|
249 + | /// <li>
|
250 + | /// <p><code>Command</code>: Receive notification when the status of a command changes.</p></li>
|
251 + | /// <li>
|
252 + | /// <p><code>Invocation</code>: For commands sent to multiple managed nodes, receive notification on a per-node basis when the status of a command changes.</p></li>
|
253 + | /// </ul>
|
254 + | pub fn set_notification_type(mut self, input: ::std::option::Option<crate::types::NotificationType>) -> Self {
|
255 + | self.notification_type = input;
|
256 + | self
|
257 + | }
|
258 + | /// <p>The type of notification.</p>
|
259 + | /// <ul>
|
260 + | /// <li>
|
261 + | /// <p><code>Command</code>: Receive notification when the status of a command changes.</p></li>
|
262 + | /// <li>
|
263 + | /// <p><code>Invocation</code>: For commands sent to multiple managed nodes, receive notification on a per-node basis when the status of a command changes.</p></li>
|
264 + | /// </ul>
|
265 + | pub fn get_notification_type(&self) -> &::std::option::Option<crate::types::NotificationType> {
|
266 + | &self.notification_type
|
267 + | }
|
268 + | /// Consumes the builder and constructs a [`NotificationConfig`](crate::types::NotificationConfig).
|
269 + | pub fn build(self) -> crate::types::NotificationConfig {
|
270 + | crate::types::NotificationConfig {
|
271 + | notification_arn: self.notification_arn,
|
272 + | notification_events: self.notification_events,
|
273 + | notification_type: self.notification_type,
|
274 + | }
|
275 + | }
|
276 + | }
|