aws-sdk-appintegrations 1.104.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 publishes.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Publication {
    /// <p>The name of the publication.</p>
    pub event: ::std::string::String,
    /// <p>The JSON schema of the publication event.</p>
    pub schema: ::std::string::String,
    /// <p>The description of the publication.</p>
    pub description: ::std::option::Option<::std::string::String>,
}
impl Publication {
    /// <p>The name of the publication.</p>
    pub fn event(&self) -> &str {
        use std::ops::Deref;
        self.event.deref()
    }
    /// <p>The JSON schema of the publication event.</p>
    pub fn schema(&self) -> &str {
        use std::ops::Deref;
        self.schema.deref()
    }
    /// <p>The description of the publication.</p>
    pub fn description(&self) -> ::std::option::Option<&str> {
        self.description.as_deref()
    }
}
impl Publication {
    /// Creates a new builder-style object to manufacture [`Publication`](crate::types::Publication).
    pub fn builder() -> crate::types::builders::PublicationBuilder {
        crate::types::builders::PublicationBuilder::default()
    }
}

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