1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Notification medium for users to get alerted for events that occur in application profile. We support SNS topic as a notification channel.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Channel {
/// <p>Unique identifier for each <code>Channel</code> in the notification configuration of a Profiling Group. A random UUID for channelId is used when adding a channel to the notification configuration if not specified in the request.</p>
pub id: ::std::option::Option<::std::string::String>,
/// <p>Unique arn of the resource to be used for notifications. We support a valid SNS topic arn as a channel uri.</p>
pub uri: ::std::string::String,
/// <p>List of publishers for different type of events that may be detected in an application from the profile. Anomaly detection is the only event publisher in Profiler.</p>
pub event_publishers: ::std::vec::Vec<crate::types::EventPublisher>,
}
impl Channel {
/// <p>Unique identifier for each <code>Channel</code> in the notification configuration of a Profiling Group. A random UUID for channelId is used when adding a channel to the notification configuration if not specified in the request.</p>
pub fn id(&self) -> ::std::option::Option<&str> {
self.id.as_deref()
}
/// <p>Unique arn of the resource to be used for notifications. We support a valid SNS topic arn as a channel uri.</p>
pub fn uri(&self) -> &str {
use std::ops::Deref;
self.uri.deref()
}
/// <p>List of publishers for different type of events that may be detected in an application from the profile. Anomaly detection is the only event publisher in Profiler.</p>
pub fn event_publishers(&self) -> &[crate::types::EventPublisher] {
use std::ops::Deref;
self.event_publishers.deref()
}
}
impl Channel {
/// Creates a new builder-style object to manufacture [`Channel`](crate::types::Channel).
pub fn builder() -> crate::types::builders::ChannelBuilder {
crate::types::builders::ChannelBuilder::default()
}
}
/// A builder for [`Channel`](crate::types::Channel).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ChannelBuilder {
pub(crate) id: ::std::option::Option<::std::string::String>,
pub(crate) uri: ::std::option::Option<::std::string::String>,
pub(crate) event_publishers: ::std::option::Option<::std::vec::Vec<crate::types::EventPublisher>>,
}
impl ChannelBuilder {
/// <p>Unique identifier for each <code>Channel</code> in the notification configuration of a Profiling Group. A random UUID for channelId is used when adding a channel to the notification configuration if not specified in the request.</p>
pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.id = ::std::option::Option::Some(input.into());
self
}
/// <p>Unique identifier for each <code>Channel</code> in the notification configuration of a Profiling Group. A random UUID for channelId is used when adding a channel to the notification configuration if not specified in the request.</p>
pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.id = input;
self
}
/// <p>Unique identifier for each <code>Channel</code> in the notification configuration of a Profiling Group. A random UUID for channelId is used when adding a channel to the notification configuration if not specified in the request.</p>
pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
&self.id
}
/// <p>Unique arn of the resource to be used for notifications. We support a valid SNS topic arn as a channel uri.</p>
/// This field is required.
pub fn uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.uri = ::std::option::Option::Some(input.into());
self
}
/// <p>Unique arn of the resource to be used for notifications. We support a valid SNS topic arn as a channel uri.</p>
pub fn set_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.uri = input;
self
}
/// <p>Unique arn of the resource to be used for notifications. We support a valid SNS topic arn as a channel uri.</p>
pub fn get_uri(&self) -> &::std::option::Option<::std::string::String> {
&self.uri
}
/// Appends an item to `event_publishers`.
///
/// To override the contents of this collection use [`set_event_publishers`](Self::set_event_publishers).
///
/// <p>List of publishers for different type of events that may be detected in an application from the profile. Anomaly detection is the only event publisher in Profiler.</p>
pub fn event_publishers(mut self, input: crate::types::EventPublisher) -> Self {
let mut v = self.event_publishers.unwrap_or_default();
v.push(input);
self.event_publishers = ::std::option::Option::Some(v);
self
}
/// <p>List of publishers for different type of events that may be detected in an application from the profile. Anomaly detection is the only event publisher in Profiler.</p>
pub fn set_event_publishers(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::EventPublisher>>) -> Self {
self.event_publishers = input;
self
}
/// <p>List of publishers for different type of events that may be detected in an application from the profile. Anomaly detection is the only event publisher in Profiler.</p>
pub fn get_event_publishers(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::EventPublisher>> {
&self.event_publishers
}
/// Consumes the builder and constructs a [`Channel`](crate::types::Channel).
/// This method will fail if any of the following fields are not set:
/// - [`uri`](crate::types::builders::ChannelBuilder::uri)
/// - [`event_publishers`](crate::types::builders::ChannelBuilder::event_publishers)
pub fn build(self) -> ::std::result::Result<crate::types::Channel, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Channel {
id: self.id,
uri: self.uri.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"uri",
"uri was not specified but it is required when building Channel",
)
})?,
event_publishers: self.event_publishers.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"event_publishers",
"event_publishers was not specified but it is required when building Channel",
)
})?,
})
}
}