aws-sdk-datazone 1.136.0

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

/// <p>The topic of the notification.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Topic {
    /// <p>The subject of the resource mentioned in a notification.</p>
    pub subject: ::std::string::String,
    /// <p>The details of the resource mentioned in a notification.</p>
    pub resource: ::std::option::Option<crate::types::NotificationResource>,
    /// <p>The role of the resource mentioned in a notification.</p>
    pub role: crate::types::NotificationRole,
}
impl Topic {
    /// <p>The subject of the resource mentioned in a notification.</p>
    pub fn subject(&self) -> &str {
        use std::ops::Deref;
        self.subject.deref()
    }
    /// <p>The details of the resource mentioned in a notification.</p>
    pub fn resource(&self) -> ::std::option::Option<&crate::types::NotificationResource> {
        self.resource.as_ref()
    }
    /// <p>The role of the resource mentioned in a notification.</p>
    pub fn role(&self) -> &crate::types::NotificationRole {
        &self.role
    }
}
impl Topic {
    /// Creates a new builder-style object to manufacture [`Topic`](crate::types::Topic).
    pub fn builder() -> crate::types::builders::TopicBuilder {
        crate::types::builders::TopicBuilder::default()
    }
}

/// A builder for [`Topic`](crate::types::Topic).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct TopicBuilder {
    pub(crate) subject: ::std::option::Option<::std::string::String>,
    pub(crate) resource: ::std::option::Option<crate::types::NotificationResource>,
    pub(crate) role: ::std::option::Option<crate::types::NotificationRole>,
}
impl TopicBuilder {
    /// <p>The subject of the resource mentioned in a notification.</p>
    /// This field is required.
    pub fn subject(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.subject = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The subject of the resource mentioned in a notification.</p>
    pub fn set_subject(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.subject = input;
        self
    }
    /// <p>The subject of the resource mentioned in a notification.</p>
    pub fn get_subject(&self) -> &::std::option::Option<::std::string::String> {
        &self.subject
    }
    /// <p>The details of the resource mentioned in a notification.</p>
    /// This field is required.
    pub fn resource(mut self, input: crate::types::NotificationResource) -> Self {
        self.resource = ::std::option::Option::Some(input);
        self
    }
    /// <p>The details of the resource mentioned in a notification.</p>
    pub fn set_resource(mut self, input: ::std::option::Option<crate::types::NotificationResource>) -> Self {
        self.resource = input;
        self
    }
    /// <p>The details of the resource mentioned in a notification.</p>
    pub fn get_resource(&self) -> &::std::option::Option<crate::types::NotificationResource> {
        &self.resource
    }
    /// <p>The role of the resource mentioned in a notification.</p>
    /// This field is required.
    pub fn role(mut self, input: crate::types::NotificationRole) -> Self {
        self.role = ::std::option::Option::Some(input);
        self
    }
    /// <p>The role of the resource mentioned in a notification.</p>
    pub fn set_role(mut self, input: ::std::option::Option<crate::types::NotificationRole>) -> Self {
        self.role = input;
        self
    }
    /// <p>The role of the resource mentioned in a notification.</p>
    pub fn get_role(&self) -> &::std::option::Option<crate::types::NotificationRole> {
        &self.role
    }
    /// Consumes the builder and constructs a [`Topic`](crate::types::Topic).
    /// This method will fail if any of the following fields are not set:
    /// - [`subject`](crate::types::builders::TopicBuilder::subject)
    /// - [`role`](crate::types::builders::TopicBuilder::role)
    pub fn build(self) -> ::std::result::Result<crate::types::Topic, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Topic {
            subject: self.subject.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "subject",
                    "subject was not specified but it is required when building Topic",
                )
            })?,
            resource: self.resource,
            role: self.role.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "role",
                    "role was not specified but it is required when building Topic",
                )
            })?,
        })
    }
}