aws-sdk-iot 1.112.0

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

/// <p>The input for the AttachThingPrincipal operation.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct AttachThingPrincipalInput {
    /// <p>The name of the thing.</p>
    pub thing_name: ::std::option::Option<::std::string::String>,
    /// <p>The principal, which can be a certificate ARN (as returned from the CreateCertificate operation) or an Amazon Cognito ID.</p>
    pub principal: ::std::option::Option<::std::string::String>,
    /// <p>The type of the relation you want to specify when you attach a principal to a thing.</p>
    /// <ul>
    /// <li>
    /// <p><code>EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal.</p></li>
    /// </ul>
    /// <ul>
    /// <li>
    /// <p><code>NON_EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.</p></li>
    /// </ul>
    pub thing_principal_type: ::std::option::Option<crate::types::ThingPrincipalType>,
}
impl AttachThingPrincipalInput {
    /// <p>The name of the thing.</p>
    pub fn thing_name(&self) -> ::std::option::Option<&str> {
        self.thing_name.as_deref()
    }
    /// <p>The principal, which can be a certificate ARN (as returned from the CreateCertificate operation) or an Amazon Cognito ID.</p>
    pub fn principal(&self) -> ::std::option::Option<&str> {
        self.principal.as_deref()
    }
    /// <p>The type of the relation you want to specify when you attach a principal to a thing.</p>
    /// <ul>
    /// <li>
    /// <p><code>EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal.</p></li>
    /// </ul>
    /// <ul>
    /// <li>
    /// <p><code>NON_EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.</p></li>
    /// </ul>
    pub fn thing_principal_type(&self) -> ::std::option::Option<&crate::types::ThingPrincipalType> {
        self.thing_principal_type.as_ref()
    }
}
impl AttachThingPrincipalInput {
    /// Creates a new builder-style object to manufacture [`AttachThingPrincipalInput`](crate::operation::attach_thing_principal::AttachThingPrincipalInput).
    pub fn builder() -> crate::operation::attach_thing_principal::builders::AttachThingPrincipalInputBuilder {
        crate::operation::attach_thing_principal::builders::AttachThingPrincipalInputBuilder::default()
    }
}

/// A builder for [`AttachThingPrincipalInput`](crate::operation::attach_thing_principal::AttachThingPrincipalInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct AttachThingPrincipalInputBuilder {
    pub(crate) thing_name: ::std::option::Option<::std::string::String>,
    pub(crate) principal: ::std::option::Option<::std::string::String>,
    pub(crate) thing_principal_type: ::std::option::Option<crate::types::ThingPrincipalType>,
}
impl AttachThingPrincipalInputBuilder {
    /// <p>The name of the thing.</p>
    /// This field is required.
    pub fn thing_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.thing_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the thing.</p>
    pub fn set_thing_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.thing_name = input;
        self
    }
    /// <p>The name of the thing.</p>
    pub fn get_thing_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.thing_name
    }
    /// <p>The principal, which can be a certificate ARN (as returned from the CreateCertificate operation) or an Amazon Cognito ID.</p>
    /// This field is required.
    pub fn principal(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.principal = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The principal, which can be a certificate ARN (as returned from the CreateCertificate operation) or an Amazon Cognito ID.</p>
    pub fn set_principal(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.principal = input;
        self
    }
    /// <p>The principal, which can be a certificate ARN (as returned from the CreateCertificate operation) or an Amazon Cognito ID.</p>
    pub fn get_principal(&self) -> &::std::option::Option<::std::string::String> {
        &self.principal
    }
    /// <p>The type of the relation you want to specify when you attach a principal to a thing.</p>
    /// <ul>
    /// <li>
    /// <p><code>EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal.</p></li>
    /// </ul>
    /// <ul>
    /// <li>
    /// <p><code>NON_EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.</p></li>
    /// </ul>
    pub fn thing_principal_type(mut self, input: crate::types::ThingPrincipalType) -> Self {
        self.thing_principal_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of the relation you want to specify when you attach a principal to a thing.</p>
    /// <ul>
    /// <li>
    /// <p><code>EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal.</p></li>
    /// </ul>
    /// <ul>
    /// <li>
    /// <p><code>NON_EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.</p></li>
    /// </ul>
    pub fn set_thing_principal_type(mut self, input: ::std::option::Option<crate::types::ThingPrincipalType>) -> Self {
        self.thing_principal_type = input;
        self
    }
    /// <p>The type of the relation you want to specify when you attach a principal to a thing.</p>
    /// <ul>
    /// <li>
    /// <p><code>EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal.</p></li>
    /// </ul>
    /// <ul>
    /// <li>
    /// <p><code>NON_EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.</p></li>
    /// </ul>
    pub fn get_thing_principal_type(&self) -> &::std::option::Option<crate::types::ThingPrincipalType> {
        &self.thing_principal_type
    }
    /// Consumes the builder and constructs a [`AttachThingPrincipalInput`](crate::operation::attach_thing_principal::AttachThingPrincipalInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::attach_thing_principal::AttachThingPrincipalInput, ::aws_smithy_types::error::operation::BuildError>
    {
        ::std::result::Result::Ok(crate::operation::attach_thing_principal::AttachThingPrincipalInput {
            thing_name: self.thing_name,
            principal: self.principal,
            thing_principal_type: self.thing_principal_type,
        })
    }
}