aws-sdk-appintegrations 1.94.0

AWS SDK for Amazon AppIntegrations Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The configuration of an event that the application subscribes.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Subscription {
    /// <p>The name of the subscription.</p>
    pub event: ::std::string::String,
    /// <p>The description of the subscription.</p>
    pub description: ::std::option::Option<::std::string::String>,
}
impl Subscription {
    /// <p>The name of the subscription.</p>
    pub fn event(&self) -> &str {
        use std::ops::Deref;
        self.event.deref()
    }
    /// <p>The description of the subscription.</p>
    pub fn description(&self) -> ::std::option::Option<&str> {
        self.description.as_deref()
    }
}
impl Subscription {
    /// Creates a new builder-style object to manufacture [`Subscription`](crate::types::Subscription).
    pub fn builder() -> crate::types::builders::SubscriptionBuilder {
        crate::types::builders::SubscriptionBuilder::default()
    }
}

/// A builder for [`Subscription`](crate::types::Subscription).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SubscriptionBuilder {
    pub(crate) event: ::std::option::Option<::std::string::String>,
    pub(crate) description: ::std::option::Option<::std::string::String>,
}
impl SubscriptionBuilder {
    /// <p>The name of the subscription.</p>
    /// This field is required.
    pub fn event(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.event = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the subscription.</p>
    pub fn set_event(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.event = input;
        self
    }
    /// <p>The name of the subscription.</p>
    pub fn get_event(&self) -> &::std::option::Option<::std::string::String> {
        &self.event
    }
    /// <p>The description of the subscription.</p>
    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.description = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The description of the subscription.</p>
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description = input;
        self
    }
    /// <p>The description of the subscription.</p>
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.description
    }
    /// Consumes the builder and constructs a [`Subscription`](crate::types::Subscription).
    /// This method will fail if any of the following fields are not set:
    /// - [`event`](crate::types::builders::SubscriptionBuilder::event)
    pub fn build(self) -> ::std::result::Result<crate::types::Subscription, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Subscription {
            event: self.event.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "event",
                    "event was not specified but it is required when building Subscription",
                )
            })?,
            description: self.description,
        })
    }
}