aws_sdk_verifiedpermissions/operation/update_policy/_update_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 UpdatePolicyInput {
6 /// <p>Specifies the ID of the policy store that contains the policy that you want to update.</p>
7 pub policy_store_id: ::std::option::Option<::std::string::String>,
8 /// <p>Specifies the ID of the policy that you want to update. To find this value, you can use <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_ListPolicies.html">ListPolicies</a>.</p>
9 pub policy_id: ::std::option::Option<::std::string::String>,
10 /// <p>Specifies the updated policy content that you want to replace on the specified policy. The content must be valid Cedar policy language text.</p>
11 /// <p>You can change only the following elements from the policy definition:</p>
12 /// <ul>
13 /// <li>
14 /// <p>The <code>action</code> referenced by the policy.</p></li>
15 /// <li>
16 /// <p>Any conditional clauses, such as <code>when</code> or <code>unless</code> clauses.</p></li>
17 /// </ul>
18 /// <p>You <b>can't</b> change the following elements:</p>
19 /// <ul>
20 /// <li>
21 /// <p>Changing from <code>static</code> to <code>templateLinked</code>.</p></li>
22 /// <li>
23 /// <p>Changing the effect of the policy from <code>permit</code> or <code>forbid</code>.</p></li>
24 /// <li>
25 /// <p>The <code>principal</code> referenced by the policy.</p></li>
26 /// <li>
27 /// <p>The <code>resource</code> referenced by the policy.</p></li>
28 /// </ul>
29 pub definition: ::std::option::Option<crate::types::UpdatePolicyDefinition>,
30}
31impl UpdatePolicyInput {
32 /// <p>Specifies the ID of the policy store that contains the policy that you want to update.</p>
33 pub fn policy_store_id(&self) -> ::std::option::Option<&str> {
34 self.policy_store_id.as_deref()
35 }
36 /// <p>Specifies the ID of the policy that you want to update. To find this value, you can use <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_ListPolicies.html">ListPolicies</a>.</p>
37 pub fn policy_id(&self) -> ::std::option::Option<&str> {
38 self.policy_id.as_deref()
39 }
40 /// <p>Specifies the updated policy content that you want to replace on the specified policy. The content must be valid Cedar policy language text.</p>
41 /// <p>You can change only the following elements from the policy definition:</p>
42 /// <ul>
43 /// <li>
44 /// <p>The <code>action</code> referenced by the policy.</p></li>
45 /// <li>
46 /// <p>Any conditional clauses, such as <code>when</code> or <code>unless</code> clauses.</p></li>
47 /// </ul>
48 /// <p>You <b>can't</b> change the following elements:</p>
49 /// <ul>
50 /// <li>
51 /// <p>Changing from <code>static</code> to <code>templateLinked</code>.</p></li>
52 /// <li>
53 /// <p>Changing the effect of the policy from <code>permit</code> or <code>forbid</code>.</p></li>
54 /// <li>
55 /// <p>The <code>principal</code> referenced by the policy.</p></li>
56 /// <li>
57 /// <p>The <code>resource</code> referenced by the policy.</p></li>
58 /// </ul>
59 pub fn definition(&self) -> ::std::option::Option<&crate::types::UpdatePolicyDefinition> {
60 self.definition.as_ref()
61 }
62}
63impl UpdatePolicyInput {
64 /// Creates a new builder-style object to manufacture [`UpdatePolicyInput`](crate::operation::update_policy::UpdatePolicyInput).
65 pub fn builder() -> crate::operation::update_policy::builders::UpdatePolicyInputBuilder {
66 crate::operation::update_policy::builders::UpdatePolicyInputBuilder::default()
67 }
68}
69
70/// A builder for [`UpdatePolicyInput`](crate::operation::update_policy::UpdatePolicyInput).
71#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
72#[non_exhaustive]
73pub struct UpdatePolicyInputBuilder {
74 pub(crate) policy_store_id: ::std::option::Option<::std::string::String>,
75 pub(crate) policy_id: ::std::option::Option<::std::string::String>,
76 pub(crate) definition: ::std::option::Option<crate::types::UpdatePolicyDefinition>,
77}
78impl UpdatePolicyInputBuilder {
79 /// <p>Specifies the ID of the policy store that contains the policy that you want to update.</p>
80 /// This field is required.
81 pub fn policy_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
82 self.policy_store_id = ::std::option::Option::Some(input.into());
83 self
84 }
85 /// <p>Specifies the ID of the policy store that contains the policy that you want to update.</p>
86 pub fn set_policy_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
87 self.policy_store_id = input;
88 self
89 }
90 /// <p>Specifies the ID of the policy store that contains the policy that you want to update.</p>
91 pub fn get_policy_store_id(&self) -> &::std::option::Option<::std::string::String> {
92 &self.policy_store_id
93 }
94 /// <p>Specifies the ID of the policy that you want to update. To find this value, you can use <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_ListPolicies.html">ListPolicies</a>.</p>
95 /// This field is required.
96 pub fn policy_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97 self.policy_id = ::std::option::Option::Some(input.into());
98 self
99 }
100 /// <p>Specifies the ID of the policy that you want to update. To find this value, you can use <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_ListPolicies.html">ListPolicies</a>.</p>
101 pub fn set_policy_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102 self.policy_id = input;
103 self
104 }
105 /// <p>Specifies the ID of the policy that you want to update. To find this value, you can use <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_ListPolicies.html">ListPolicies</a>.</p>
106 pub fn get_policy_id(&self) -> &::std::option::Option<::std::string::String> {
107 &self.policy_id
108 }
109 /// <p>Specifies the updated policy content that you want to replace on the specified policy. The content must be valid Cedar policy language text.</p>
110 /// <p>You can change only the following elements from the policy definition:</p>
111 /// <ul>
112 /// <li>
113 /// <p>The <code>action</code> referenced by the policy.</p></li>
114 /// <li>
115 /// <p>Any conditional clauses, such as <code>when</code> or <code>unless</code> clauses.</p></li>
116 /// </ul>
117 /// <p>You <b>can't</b> change the following elements:</p>
118 /// <ul>
119 /// <li>
120 /// <p>Changing from <code>static</code> to <code>templateLinked</code>.</p></li>
121 /// <li>
122 /// <p>Changing the effect of the policy from <code>permit</code> or <code>forbid</code>.</p></li>
123 /// <li>
124 /// <p>The <code>principal</code> referenced by the policy.</p></li>
125 /// <li>
126 /// <p>The <code>resource</code> referenced by the policy.</p></li>
127 /// </ul>
128 /// This field is required.
129 pub fn definition(mut self, input: crate::types::UpdatePolicyDefinition) -> Self {
130 self.definition = ::std::option::Option::Some(input);
131 self
132 }
133 /// <p>Specifies the updated policy content that you want to replace on the specified policy. The content must be valid Cedar policy language text.</p>
134 /// <p>You can change only the following elements from the policy definition:</p>
135 /// <ul>
136 /// <li>
137 /// <p>The <code>action</code> referenced by the policy.</p></li>
138 /// <li>
139 /// <p>Any conditional clauses, such as <code>when</code> or <code>unless</code> clauses.</p></li>
140 /// </ul>
141 /// <p>You <b>can't</b> change the following elements:</p>
142 /// <ul>
143 /// <li>
144 /// <p>Changing from <code>static</code> to <code>templateLinked</code>.</p></li>
145 /// <li>
146 /// <p>Changing the effect of the policy from <code>permit</code> or <code>forbid</code>.</p></li>
147 /// <li>
148 /// <p>The <code>principal</code> referenced by the policy.</p></li>
149 /// <li>
150 /// <p>The <code>resource</code> referenced by the policy.</p></li>
151 /// </ul>
152 pub fn set_definition(mut self, input: ::std::option::Option<crate::types::UpdatePolicyDefinition>) -> Self {
153 self.definition = input;
154 self
155 }
156 /// <p>Specifies the updated policy content that you want to replace on the specified policy. The content must be valid Cedar policy language text.</p>
157 /// <p>You can change only the following elements from the policy definition:</p>
158 /// <ul>
159 /// <li>
160 /// <p>The <code>action</code> referenced by the policy.</p></li>
161 /// <li>
162 /// <p>Any conditional clauses, such as <code>when</code> or <code>unless</code> clauses.</p></li>
163 /// </ul>
164 /// <p>You <b>can't</b> change the following elements:</p>
165 /// <ul>
166 /// <li>
167 /// <p>Changing from <code>static</code> to <code>templateLinked</code>.</p></li>
168 /// <li>
169 /// <p>Changing the effect of the policy from <code>permit</code> or <code>forbid</code>.</p></li>
170 /// <li>
171 /// <p>The <code>principal</code> referenced by the policy.</p></li>
172 /// <li>
173 /// <p>The <code>resource</code> referenced by the policy.</p></li>
174 /// </ul>
175 pub fn get_definition(&self) -> &::std::option::Option<crate::types::UpdatePolicyDefinition> {
176 &self.definition
177 }
178 /// Consumes the builder and constructs a [`UpdatePolicyInput`](crate::operation::update_policy::UpdatePolicyInput).
179 pub fn build(
180 self,
181 ) -> ::std::result::Result<crate::operation::update_policy::UpdatePolicyInput, ::aws_smithy_types::error::operation::BuildError> {
182 ::std::result::Result::Ok(crate::operation::update_policy::UpdatePolicyInput {
183 policy_store_id: self.policy_store_id,
184 policy_id: self.policy_id,
185 definition: self.definition,
186 })
187 }
188}