aws_sdk_iot/operation/attach_policy/
_attach_policy_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct AttachPolicyInput {
6    /// <p>The name of the policy to attach.</p>
7    pub policy_name: ::std::option::Option<::std::string::String>,
8    /// <p>The <a href="https://docs.aws.amazon.com/iot/latest/developerguide/security-iam.html">identity</a> to which the policy is attached. For example, a thing group or a certificate.</p>
9    pub target: ::std::option::Option<::std::string::String>,
10}
11impl AttachPolicyInput {
12    /// <p>The name of the policy to attach.</p>
13    pub fn policy_name(&self) -> ::std::option::Option<&str> {
14        self.policy_name.as_deref()
15    }
16    /// <p>The <a href="https://docs.aws.amazon.com/iot/latest/developerguide/security-iam.html">identity</a> to which the policy is attached. For example, a thing group or a certificate.</p>
17    pub fn target(&self) -> ::std::option::Option<&str> {
18        self.target.as_deref()
19    }
20}
21impl AttachPolicyInput {
22    /// Creates a new builder-style object to manufacture [`AttachPolicyInput`](crate::operation::attach_policy::AttachPolicyInput).
23    pub fn builder() -> crate::operation::attach_policy::builders::AttachPolicyInputBuilder {
24        crate::operation::attach_policy::builders::AttachPolicyInputBuilder::default()
25    }
26}
27
28/// A builder for [`AttachPolicyInput`](crate::operation::attach_policy::AttachPolicyInput).
29#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
30#[non_exhaustive]
31pub struct AttachPolicyInputBuilder {
32    pub(crate) policy_name: ::std::option::Option<::std::string::String>,
33    pub(crate) target: ::std::option::Option<::std::string::String>,
34}
35impl AttachPolicyInputBuilder {
36    /// <p>The name of the policy to attach.</p>
37    /// This field is required.
38    pub fn policy_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
39        self.policy_name = ::std::option::Option::Some(input.into());
40        self
41    }
42    /// <p>The name of the policy to attach.</p>
43    pub fn set_policy_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
44        self.policy_name = input;
45        self
46    }
47    /// <p>The name of the policy to attach.</p>
48    pub fn get_policy_name(&self) -> &::std::option::Option<::std::string::String> {
49        &self.policy_name
50    }
51    /// <p>The <a href="https://docs.aws.amazon.com/iot/latest/developerguide/security-iam.html">identity</a> to which the policy is attached. For example, a thing group or a certificate.</p>
52    /// This field is required.
53    pub fn target(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
54        self.target = ::std::option::Option::Some(input.into());
55        self
56    }
57    /// <p>The <a href="https://docs.aws.amazon.com/iot/latest/developerguide/security-iam.html">identity</a> to which the policy is attached. For example, a thing group or a certificate.</p>
58    pub fn set_target(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
59        self.target = input;
60        self
61    }
62    /// <p>The <a href="https://docs.aws.amazon.com/iot/latest/developerguide/security-iam.html">identity</a> to which the policy is attached. For example, a thing group or a certificate.</p>
63    pub fn get_target(&self) -> &::std::option::Option<::std::string::String> {
64        &self.target
65    }
66    /// Consumes the builder and constructs a [`AttachPolicyInput`](crate::operation::attach_policy::AttachPolicyInput).
67    pub fn build(
68        self,
69    ) -> ::std::result::Result<crate::operation::attach_policy::AttachPolicyInput, ::aws_smithy_types::error::operation::BuildError> {
70        ::std::result::Result::Ok(crate::operation::attach_policy::AttachPolicyInput {
71            policy_name: self.policy_name,
72            target: self.target,
73        })
74    }
75}