aws_sdk_dynamodb/operation/put_resource_policy/_put_resource_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 PutResourcePolicyInput {
6 /// <p>The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams.</p>
7 /// <p>You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the <code>Resource</code> field of a given <code>Statement</code> in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple <code>Statement</code> fields in your policy document.</p>
8 pub resource_arn: ::std::option::Option<::std::string::String>,
9 /// <p>An Amazon Web Services resource-based policy document in JSON format.</p>
10 /// <ul>
11 /// <li>
12 /// <p>The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit.</p></li>
13 /// <li>
14 /// <p>Within a resource-based policy, if the action for a DynamoDB service-linked role (SLR) to replicate data for a global table is denied, adding or deleting a replica will fail with an error.</p></li>
15 /// </ul>
16 /// <p>For a full list of all considerations that apply while attaching a resource-based policy, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html">Resource-based policy considerations</a>.</p>
17 pub policy: ::std::option::Option<::std::string::String>,
18 /// <p>A string value that you can use to conditionally update your policy. You can provide the revision ID of your existing policy to make mutating requests against that policy.</p><note>
19 /// <p>When you provide an expected revision ID, if the revision ID of the existing policy on the resource doesn't match or if there's no policy attached to the resource, your request will be rejected with a <code>PolicyNotFoundException</code>.</p>
20 /// </note>
21 /// <p>To conditionally attach a policy when no policy exists for the resource, specify <code>NO_POLICY</code> for the revision ID.</p>
22 pub expected_revision_id: ::std::option::Option<::std::string::String>,
23 /// <p>Set this parameter to <code>true</code> to confirm that you want to remove your permissions to change the policy of this resource in the future.</p>
24 pub confirm_remove_self_resource_access: ::std::option::Option<bool>,
25}
26impl PutResourcePolicyInput {
27 /// <p>The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams.</p>
28 /// <p>You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the <code>Resource</code> field of a given <code>Statement</code> in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple <code>Statement</code> fields in your policy document.</p>
29 pub fn resource_arn(&self) -> ::std::option::Option<&str> {
30 self.resource_arn.as_deref()
31 }
32 /// <p>An Amazon Web Services resource-based policy document in JSON format.</p>
33 /// <ul>
34 /// <li>
35 /// <p>The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit.</p></li>
36 /// <li>
37 /// <p>Within a resource-based policy, if the action for a DynamoDB service-linked role (SLR) to replicate data for a global table is denied, adding or deleting a replica will fail with an error.</p></li>
38 /// </ul>
39 /// <p>For a full list of all considerations that apply while attaching a resource-based policy, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html">Resource-based policy considerations</a>.</p>
40 pub fn policy(&self) -> ::std::option::Option<&str> {
41 self.policy.as_deref()
42 }
43 /// <p>A string value that you can use to conditionally update your policy. You can provide the revision ID of your existing policy to make mutating requests against that policy.</p><note>
44 /// <p>When you provide an expected revision ID, if the revision ID of the existing policy on the resource doesn't match or if there's no policy attached to the resource, your request will be rejected with a <code>PolicyNotFoundException</code>.</p>
45 /// </note>
46 /// <p>To conditionally attach a policy when no policy exists for the resource, specify <code>NO_POLICY</code> for the revision ID.</p>
47 pub fn expected_revision_id(&self) -> ::std::option::Option<&str> {
48 self.expected_revision_id.as_deref()
49 }
50 /// <p>Set this parameter to <code>true</code> to confirm that you want to remove your permissions to change the policy of this resource in the future.</p>
51 pub fn confirm_remove_self_resource_access(&self) -> ::std::option::Option<bool> {
52 self.confirm_remove_self_resource_access
53 }
54}
55impl PutResourcePolicyInput {
56 /// Creates a new builder-style object to manufacture [`PutResourcePolicyInput`](crate::operation::put_resource_policy::PutResourcePolicyInput).
57 pub fn builder() -> crate::operation::put_resource_policy::builders::PutResourcePolicyInputBuilder {
58 crate::operation::put_resource_policy::builders::PutResourcePolicyInputBuilder::default()
59 }
60}
61
62/// A builder for [`PutResourcePolicyInput`](crate::operation::put_resource_policy::PutResourcePolicyInput).
63#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
64#[non_exhaustive]
65pub struct PutResourcePolicyInputBuilder {
66 pub(crate) resource_arn: ::std::option::Option<::std::string::String>,
67 pub(crate) policy: ::std::option::Option<::std::string::String>,
68 pub(crate) expected_revision_id: ::std::option::Option<::std::string::String>,
69 pub(crate) confirm_remove_self_resource_access: ::std::option::Option<bool>,
70}
71impl PutResourcePolicyInputBuilder {
72 /// <p>The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams.</p>
73 /// <p>You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the <code>Resource</code> field of a given <code>Statement</code> in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple <code>Statement</code> fields in your policy document.</p>
74 /// This field is required.
75 pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76 self.resource_arn = ::std::option::Option::Some(input.into());
77 self
78 }
79 /// <p>The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams.</p>
80 /// <p>You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the <code>Resource</code> field of a given <code>Statement</code> in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple <code>Statement</code> fields in your policy document.</p>
81 pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
82 self.resource_arn = input;
83 self
84 }
85 /// <p>The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams.</p>
86 /// <p>You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the <code>Resource</code> field of a given <code>Statement</code> in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple <code>Statement</code> fields in your policy document.</p>
87 pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
88 &self.resource_arn
89 }
90 /// <p>An Amazon Web Services resource-based policy document in JSON format.</p>
91 /// <ul>
92 /// <li>
93 /// <p>The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit.</p></li>
94 /// <li>
95 /// <p>Within a resource-based policy, if the action for a DynamoDB service-linked role (SLR) to replicate data for a global table is denied, adding or deleting a replica will fail with an error.</p></li>
96 /// </ul>
97 /// <p>For a full list of all considerations that apply while attaching a resource-based policy, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html">Resource-based policy considerations</a>.</p>
98 /// This field is required.
99 pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
100 self.policy = ::std::option::Option::Some(input.into());
101 self
102 }
103 /// <p>An Amazon Web Services resource-based policy document in JSON format.</p>
104 /// <ul>
105 /// <li>
106 /// <p>The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit.</p></li>
107 /// <li>
108 /// <p>Within a resource-based policy, if the action for a DynamoDB service-linked role (SLR) to replicate data for a global table is denied, adding or deleting a replica will fail with an error.</p></li>
109 /// </ul>
110 /// <p>For a full list of all considerations that apply while attaching a resource-based policy, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html">Resource-based policy considerations</a>.</p>
111 pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
112 self.policy = input;
113 self
114 }
115 /// <p>An Amazon Web Services resource-based policy document in JSON format.</p>
116 /// <ul>
117 /// <li>
118 /// <p>The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit.</p></li>
119 /// <li>
120 /// <p>Within a resource-based policy, if the action for a DynamoDB service-linked role (SLR) to replicate data for a global table is denied, adding or deleting a replica will fail with an error.</p></li>
121 /// </ul>
122 /// <p>For a full list of all considerations that apply while attaching a resource-based policy, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html">Resource-based policy considerations</a>.</p>
123 pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
124 &self.policy
125 }
126 /// <p>A string value that you can use to conditionally update your policy. You can provide the revision ID of your existing policy to make mutating requests against that policy.</p><note>
127 /// <p>When you provide an expected revision ID, if the revision ID of the existing policy on the resource doesn't match or if there's no policy attached to the resource, your request will be rejected with a <code>PolicyNotFoundException</code>.</p>
128 /// </note>
129 /// <p>To conditionally attach a policy when no policy exists for the resource, specify <code>NO_POLICY</code> for the revision ID.</p>
130 pub fn expected_revision_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131 self.expected_revision_id = ::std::option::Option::Some(input.into());
132 self
133 }
134 /// <p>A string value that you can use to conditionally update your policy. You can provide the revision ID of your existing policy to make mutating requests against that policy.</p><note>
135 /// <p>When you provide an expected revision ID, if the revision ID of the existing policy on the resource doesn't match or if there's no policy attached to the resource, your request will be rejected with a <code>PolicyNotFoundException</code>.</p>
136 /// </note>
137 /// <p>To conditionally attach a policy when no policy exists for the resource, specify <code>NO_POLICY</code> for the revision ID.</p>
138 pub fn set_expected_revision_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139 self.expected_revision_id = input;
140 self
141 }
142 /// <p>A string value that you can use to conditionally update your policy. You can provide the revision ID of your existing policy to make mutating requests against that policy.</p><note>
143 /// <p>When you provide an expected revision ID, if the revision ID of the existing policy on the resource doesn't match or if there's no policy attached to the resource, your request will be rejected with a <code>PolicyNotFoundException</code>.</p>
144 /// </note>
145 /// <p>To conditionally attach a policy when no policy exists for the resource, specify <code>NO_POLICY</code> for the revision ID.</p>
146 pub fn get_expected_revision_id(&self) -> &::std::option::Option<::std::string::String> {
147 &self.expected_revision_id
148 }
149 /// <p>Set this parameter to <code>true</code> to confirm that you want to remove your permissions to change the policy of this resource in the future.</p>
150 pub fn confirm_remove_self_resource_access(mut self, input: bool) -> Self {
151 self.confirm_remove_self_resource_access = ::std::option::Option::Some(input);
152 self
153 }
154 /// <p>Set this parameter to <code>true</code> to confirm that you want to remove your permissions to change the policy of this resource in the future.</p>
155 pub fn set_confirm_remove_self_resource_access(mut self, input: ::std::option::Option<bool>) -> Self {
156 self.confirm_remove_self_resource_access = input;
157 self
158 }
159 /// <p>Set this parameter to <code>true</code> to confirm that you want to remove your permissions to change the policy of this resource in the future.</p>
160 pub fn get_confirm_remove_self_resource_access(&self) -> &::std::option::Option<bool> {
161 &self.confirm_remove_self_resource_access
162 }
163 /// Consumes the builder and constructs a [`PutResourcePolicyInput`](crate::operation::put_resource_policy::PutResourcePolicyInput).
164 pub fn build(
165 self,
166 ) -> ::std::result::Result<crate::operation::put_resource_policy::PutResourcePolicyInput, ::aws_smithy_types::error::operation::BuildError> {
167 ::std::result::Result::Ok(crate::operation::put_resource_policy::PutResourcePolicyInput {
168 resource_arn: self.resource_arn,
169 policy: self.policy,
170 expected_revision_id: self.expected_revision_id,
171 confirm_remove_self_resource_access: self.confirm_remove_self_resource_access,
172 })
173 }
174}