aws_sdk_entityresolution/operation/put_policy/
_put_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 PutPolicyInput {
6    /// <p>The Amazon Resource Name (ARN) of the resource for which the policy needs to be updated.</p>
7    pub arn: ::std::option::Option<::std::string::String>,
8    /// <p>A unique identifier for the current revision of the policy.</p>
9    pub token: ::std::option::Option<::std::string::String>,
10    /// <p>The resource-based policy.</p><important>
11    /// <p>If you set the value of the <code>effect</code> parameter in the <code>policy</code> to <code>Deny</code> for the <code>PutPolicy</code> operation, you must also set the value of the <code>effect</code> parameter to <code>Deny</code> for the <code>AddPolicyStatement</code> operation.</p>
12    /// </important>
13    pub policy: ::std::option::Option<::std::string::String>,
14}
15impl PutPolicyInput {
16    /// <p>The Amazon Resource Name (ARN) of the resource for which the policy needs to be updated.</p>
17    pub fn arn(&self) -> ::std::option::Option<&str> {
18        self.arn.as_deref()
19    }
20    /// <p>A unique identifier for the current revision of the policy.</p>
21    pub fn token(&self) -> ::std::option::Option<&str> {
22        self.token.as_deref()
23    }
24    /// <p>The resource-based policy.</p><important>
25    /// <p>If you set the value of the <code>effect</code> parameter in the <code>policy</code> to <code>Deny</code> for the <code>PutPolicy</code> operation, you must also set the value of the <code>effect</code> parameter to <code>Deny</code> for the <code>AddPolicyStatement</code> operation.</p>
26    /// </important>
27    pub fn policy(&self) -> ::std::option::Option<&str> {
28        self.policy.as_deref()
29    }
30}
31impl PutPolicyInput {
32    /// Creates a new builder-style object to manufacture [`PutPolicyInput`](crate::operation::put_policy::PutPolicyInput).
33    pub fn builder() -> crate::operation::put_policy::builders::PutPolicyInputBuilder {
34        crate::operation::put_policy::builders::PutPolicyInputBuilder::default()
35    }
36}
37
38/// A builder for [`PutPolicyInput`](crate::operation::put_policy::PutPolicyInput).
39#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
40#[non_exhaustive]
41pub struct PutPolicyInputBuilder {
42    pub(crate) arn: ::std::option::Option<::std::string::String>,
43    pub(crate) token: ::std::option::Option<::std::string::String>,
44    pub(crate) policy: ::std::option::Option<::std::string::String>,
45}
46impl PutPolicyInputBuilder {
47    /// <p>The Amazon Resource Name (ARN) of the resource for which the policy needs to be updated.</p>
48    /// This field is required.
49    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
50        self.arn = ::std::option::Option::Some(input.into());
51        self
52    }
53    /// <p>The Amazon Resource Name (ARN) of the resource for which the policy needs to be updated.</p>
54    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
55        self.arn = input;
56        self
57    }
58    /// <p>The Amazon Resource Name (ARN) of the resource for which the policy needs to be updated.</p>
59    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
60        &self.arn
61    }
62    /// <p>A unique identifier for the current revision of the policy.</p>
63    pub fn token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64        self.token = ::std::option::Option::Some(input.into());
65        self
66    }
67    /// <p>A unique identifier for the current revision of the policy.</p>
68    pub fn set_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
69        self.token = input;
70        self
71    }
72    /// <p>A unique identifier for the current revision of the policy.</p>
73    pub fn get_token(&self) -> &::std::option::Option<::std::string::String> {
74        &self.token
75    }
76    /// <p>The resource-based policy.</p><important>
77    /// <p>If you set the value of the <code>effect</code> parameter in the <code>policy</code> to <code>Deny</code> for the <code>PutPolicy</code> operation, you must also set the value of the <code>effect</code> parameter to <code>Deny</code> for the <code>AddPolicyStatement</code> operation.</p>
78    /// </important>
79    /// This field is required.
80    pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
81        self.policy = ::std::option::Option::Some(input.into());
82        self
83    }
84    /// <p>The resource-based policy.</p><important>
85    /// <p>If you set the value of the <code>effect</code> parameter in the <code>policy</code> to <code>Deny</code> for the <code>PutPolicy</code> operation, you must also set the value of the <code>effect</code> parameter to <code>Deny</code> for the <code>AddPolicyStatement</code> operation.</p>
86    /// </important>
87    pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
88        self.policy = input;
89        self
90    }
91    /// <p>The resource-based policy.</p><important>
92    /// <p>If you set the value of the <code>effect</code> parameter in the <code>policy</code> to <code>Deny</code> for the <code>PutPolicy</code> operation, you must also set the value of the <code>effect</code> parameter to <code>Deny</code> for the <code>AddPolicyStatement</code> operation.</p>
93    /// </important>
94    pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
95        &self.policy
96    }
97    /// Consumes the builder and constructs a [`PutPolicyInput`](crate::operation::put_policy::PutPolicyInput).
98    pub fn build(self) -> ::std::result::Result<crate::operation::put_policy::PutPolicyInput, ::aws_smithy_types::error::operation::BuildError> {
99        ::std::result::Result::Ok(crate::operation::put_policy::PutPolicyInput {
100            arn: self.arn,
101            token: self.token,
102            policy: self.policy,
103        })
104    }
105}