aws_sdk_verifiedpermissions/operation/update_policy/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_policy::_update_policy_output::UpdatePolicyOutputBuilder;
3
4pub use crate::operation::update_policy::_update_policy_input::UpdatePolicyInputBuilder;
5
6impl crate::operation::update_policy::builders::UpdatePolicyInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::update_policy::UpdatePolicyOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::update_policy::UpdatePolicyError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.update_policy();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `UpdatePolicy`.
24///
25/// <p>Modifies a Cedar static policy in the specified policy store. You can change only certain elements of the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyInput.html#amazonverifiedpermissions-UpdatePolicy-request-UpdatePolicyDefinition">UpdatePolicyDefinition</a> parameter. You can directly update only static policies. To change a template-linked policy, you must update the template instead, using <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyTemplate.html">UpdatePolicyTemplate</a>.</p><note>
26/// <ul>
27/// <li>
28/// <p>If policy validation is enabled in the policy store, then updating a static policy causes Verified Permissions to validate the policy against the schema in the policy store. If the updated static policy doesn't pass validation, the operation fails and the update isn't stored.</p></li>
29/// <li>
30/// <p>When you edit a static policy, you can change only certain elements of a static policy:</p>
31/// <ul>
32/// <li>
33/// <p>The action referenced by the policy.</p></li>
34/// <li>
35/// <p>A condition clause, such as when and unless.</p></li>
36/// </ul>
37/// <p>You can't change these elements of a static policy:</p>
38/// <ul>
39/// <li>
40/// <p>Changing a policy from a static policy to a template-linked policy.</p></li>
41/// <li>
42/// <p>Changing the effect of a static policy from permit or forbid.</p></li>
43/// <li>
44/// <p>The principal referenced by a static policy.</p></li>
45/// <li>
46/// <p>The resource referenced by a static policy.</p></li>
47/// </ul></li>
48/// <li>
49/// <p>To update a template-linked policy, you must update the template instead.</p></li>
50/// </ul>
51/// </note> <note>
52/// <p>Verified Permissions is <i> <a href="https://wikipedia.org/wiki/Eventual_consistency">eventually consistent</a> </i>. It can take a few seconds for a new or changed element to propagate through the service and be visible in the results of other Verified Permissions operations.</p>
53/// </note>
54#[derive(::std::clone::Clone, ::std::fmt::Debug)]
55pub struct UpdatePolicyFluentBuilder {
56 handle: ::std::sync::Arc<crate::client::Handle>,
57 inner: crate::operation::update_policy::builders::UpdatePolicyInputBuilder,
58 config_override: ::std::option::Option<crate::config::Builder>,
59}
60impl
61 crate::client::customize::internal::CustomizableSend<
62 crate::operation::update_policy::UpdatePolicyOutput,
63 crate::operation::update_policy::UpdatePolicyError,
64 > for UpdatePolicyFluentBuilder
65{
66 fn send(
67 self,
68 config_override: crate::config::Builder,
69 ) -> crate::client::customize::internal::BoxFuture<
70 crate::client::customize::internal::SendResult<
71 crate::operation::update_policy::UpdatePolicyOutput,
72 crate::operation::update_policy::UpdatePolicyError,
73 >,
74 > {
75 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
76 }
77}
78impl UpdatePolicyFluentBuilder {
79 /// Creates a new `UpdatePolicyFluentBuilder`.
80 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
81 Self {
82 handle,
83 inner: ::std::default::Default::default(),
84 config_override: ::std::option::Option::None,
85 }
86 }
87 /// Access the UpdatePolicy as a reference.
88 pub fn as_input(&self) -> &crate::operation::update_policy::builders::UpdatePolicyInputBuilder {
89 &self.inner
90 }
91 /// Sends the request and returns the response.
92 ///
93 /// If an error occurs, an `SdkError` will be returned with additional details that
94 /// can be matched against.
95 ///
96 /// By default, any retryable failures will be retried twice. Retry behavior
97 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
98 /// set when configuring the client.
99 pub async fn send(
100 self,
101 ) -> ::std::result::Result<
102 crate::operation::update_policy::UpdatePolicyOutput,
103 ::aws_smithy_runtime_api::client::result::SdkError<
104 crate::operation::update_policy::UpdatePolicyError,
105 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
106 >,
107 > {
108 let input = self
109 .inner
110 .build()
111 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
112 let runtime_plugins = crate::operation::update_policy::UpdatePolicy::operation_runtime_plugins(
113 self.handle.runtime_plugins.clone(),
114 &self.handle.conf,
115 self.config_override,
116 );
117 crate::operation::update_policy::UpdatePolicy::orchestrate(&runtime_plugins, input).await
118 }
119
120 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
121 pub fn customize(
122 self,
123 ) -> crate::client::customize::CustomizableOperation<
124 crate::operation::update_policy::UpdatePolicyOutput,
125 crate::operation::update_policy::UpdatePolicyError,
126 Self,
127 > {
128 crate::client::customize::CustomizableOperation::new(self)
129 }
130 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
131 self.set_config_override(::std::option::Option::Some(config_override.into()));
132 self
133 }
134
135 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
136 self.config_override = config_override;
137 self
138 }
139 /// <p>Specifies the ID of the policy store that contains the policy that you want to update.</p>
140 pub fn policy_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141 self.inner = self.inner.policy_store_id(input.into());
142 self
143 }
144 /// <p>Specifies the ID of the policy store that contains the policy that you want to update.</p>
145 pub fn set_policy_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146 self.inner = self.inner.set_policy_store_id(input);
147 self
148 }
149 /// <p>Specifies the ID of the policy store that contains the policy that you want to update.</p>
150 pub fn get_policy_store_id(&self) -> &::std::option::Option<::std::string::String> {
151 self.inner.get_policy_store_id()
152 }
153 /// <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>
154 pub fn policy_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
155 self.inner = self.inner.policy_id(input.into());
156 self
157 }
158 /// <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>
159 pub fn set_policy_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
160 self.inner = self.inner.set_policy_id(input);
161 self
162 }
163 /// <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>
164 pub fn get_policy_id(&self) -> &::std::option::Option<::std::string::String> {
165 self.inner.get_policy_id()
166 }
167 /// <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>
168 /// <p>You can change only the following elements from the policy definition:</p>
169 /// <ul>
170 /// <li>
171 /// <p>The <code>action</code> referenced by the policy.</p></li>
172 /// <li>
173 /// <p>Any conditional clauses, such as <code>when</code> or <code>unless</code> clauses.</p></li>
174 /// </ul>
175 /// <p>You <b>can't</b> change the following elements:</p>
176 /// <ul>
177 /// <li>
178 /// <p>Changing from <code>static</code> to <code>templateLinked</code>.</p></li>
179 /// <li>
180 /// <p>Changing the effect of the policy from <code>permit</code> or <code>forbid</code>.</p></li>
181 /// <li>
182 /// <p>The <code>principal</code> referenced by the policy.</p></li>
183 /// <li>
184 /// <p>The <code>resource</code> referenced by the policy.</p></li>
185 /// </ul>
186 pub fn definition(mut self, input: crate::types::UpdatePolicyDefinition) -> Self {
187 self.inner = self.inner.definition(input);
188 self
189 }
190 /// <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>
191 /// <p>You can change only the following elements from the policy definition:</p>
192 /// <ul>
193 /// <li>
194 /// <p>The <code>action</code> referenced by the policy.</p></li>
195 /// <li>
196 /// <p>Any conditional clauses, such as <code>when</code> or <code>unless</code> clauses.</p></li>
197 /// </ul>
198 /// <p>You <b>can't</b> change the following elements:</p>
199 /// <ul>
200 /// <li>
201 /// <p>Changing from <code>static</code> to <code>templateLinked</code>.</p></li>
202 /// <li>
203 /// <p>Changing the effect of the policy from <code>permit</code> or <code>forbid</code>.</p></li>
204 /// <li>
205 /// <p>The <code>principal</code> referenced by the policy.</p></li>
206 /// <li>
207 /// <p>The <code>resource</code> referenced by the policy.</p></li>
208 /// </ul>
209 pub fn set_definition(mut self, input: ::std::option::Option<crate::types::UpdatePolicyDefinition>) -> Self {
210 self.inner = self.inner.set_definition(input);
211 self
212 }
213 /// <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>
214 /// <p>You can change only the following elements from the policy definition:</p>
215 /// <ul>
216 /// <li>
217 /// <p>The <code>action</code> referenced by the policy.</p></li>
218 /// <li>
219 /// <p>Any conditional clauses, such as <code>when</code> or <code>unless</code> clauses.</p></li>
220 /// </ul>
221 /// <p>You <b>can't</b> change the following elements:</p>
222 /// <ul>
223 /// <li>
224 /// <p>Changing from <code>static</code> to <code>templateLinked</code>.</p></li>
225 /// <li>
226 /// <p>Changing the effect of the policy from <code>permit</code> or <code>forbid</code>.</p></li>
227 /// <li>
228 /// <p>The <code>principal</code> referenced by the policy.</p></li>
229 /// <li>
230 /// <p>The <code>resource</code> referenced by the policy.</p></li>
231 /// </ul>
232 pub fn get_definition(&self) -> &::std::option::Option<crate::types::UpdatePolicyDefinition> {
233 self.inner.get_definition()
234 }
235}