aws-sdk-codeguruprofiler 1.99.0

AWS SDK for Amazon CodeGuru Profiler
Documentation
// 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",
                )
            })?,
        })
    }
}