aws_sdk_verifiedpermissions/operation/update_policy_template/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_policy_template::_update_policy_template_output::UpdatePolicyTemplateOutputBuilder;
3
4pub use crate::operation::update_policy_template::_update_policy_template_input::UpdatePolicyTemplateInputBuilder;
5
6impl crate::operation::update_policy_template::builders::UpdatePolicyTemplateInputBuilder {
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_template::UpdatePolicyTemplateOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::update_policy_template::UpdatePolicyTemplateError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.update_policy_template();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `UpdatePolicyTemplate`.
24///
25/// <p>Updates the specified policy template. You can update only the description and the some elements of the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyTemplate.html#amazonverifiedpermissions-UpdatePolicyTemplate-request-policyBody">policyBody</a>.</p><important>
26/// <p>Changes you make to the policy template content are immediately (within the constraints of eventual consistency) reflected in authorization decisions that involve all template-linked policies instantiated from this template.</p>
27/// </important> <note>
28/// <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>
29/// </note>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct UpdatePolicyTemplateFluentBuilder {
32 handle: ::std::sync::Arc<crate::client::Handle>,
33 inner: crate::operation::update_policy_template::builders::UpdatePolicyTemplateInputBuilder,
34 config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37 crate::client::customize::internal::CustomizableSend<
38 crate::operation::update_policy_template::UpdatePolicyTemplateOutput,
39 crate::operation::update_policy_template::UpdatePolicyTemplateError,
40 > for UpdatePolicyTemplateFluentBuilder
41{
42 fn send(
43 self,
44 config_override: crate::config::Builder,
45 ) -> crate::client::customize::internal::BoxFuture<
46 crate::client::customize::internal::SendResult<
47 crate::operation::update_policy_template::UpdatePolicyTemplateOutput,
48 crate::operation::update_policy_template::UpdatePolicyTemplateError,
49 >,
50 > {
51 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52 }
53}
54impl UpdatePolicyTemplateFluentBuilder {
55 /// Creates a new `UpdatePolicyTemplateFluentBuilder`.
56 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57 Self {
58 handle,
59 inner: ::std::default::Default::default(),
60 config_override: ::std::option::Option::None,
61 }
62 }
63 /// Access the UpdatePolicyTemplate as a reference.
64 pub fn as_input(&self) -> &crate::operation::update_policy_template::builders::UpdatePolicyTemplateInputBuilder {
65 &self.inner
66 }
67 /// Sends the request and returns the response.
68 ///
69 /// If an error occurs, an `SdkError` will be returned with additional details that
70 /// can be matched against.
71 ///
72 /// By default, any retryable failures will be retried twice. Retry behavior
73 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74 /// set when configuring the client.
75 pub async fn send(
76 self,
77 ) -> ::std::result::Result<
78 crate::operation::update_policy_template::UpdatePolicyTemplateOutput,
79 ::aws_smithy_runtime_api::client::result::SdkError<
80 crate::operation::update_policy_template::UpdatePolicyTemplateError,
81 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82 >,
83 > {
84 let input = self
85 .inner
86 .build()
87 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88 let runtime_plugins = crate::operation::update_policy_template::UpdatePolicyTemplate::operation_runtime_plugins(
89 self.handle.runtime_plugins.clone(),
90 &self.handle.conf,
91 self.config_override,
92 );
93 crate::operation::update_policy_template::UpdatePolicyTemplate::orchestrate(&runtime_plugins, input).await
94 }
95
96 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97 pub fn customize(
98 self,
99 ) -> crate::client::customize::CustomizableOperation<
100 crate::operation::update_policy_template::UpdatePolicyTemplateOutput,
101 crate::operation::update_policy_template::UpdatePolicyTemplateError,
102 Self,
103 > {
104 crate::client::customize::CustomizableOperation::new(self)
105 }
106 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107 self.set_config_override(::std::option::Option::Some(config_override.into()));
108 self
109 }
110
111 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112 self.config_override = config_override;
113 self
114 }
115 /// <p>Specifies the ID of the policy store that contains the policy template that you want to update.</p>
116 pub fn policy_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117 self.inner = self.inner.policy_store_id(input.into());
118 self
119 }
120 /// <p>Specifies the ID of the policy store that contains the policy template that you want to update.</p>
121 pub fn set_policy_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122 self.inner = self.inner.set_policy_store_id(input);
123 self
124 }
125 /// <p>Specifies the ID of the policy store that contains the policy template that you want to update.</p>
126 pub fn get_policy_store_id(&self) -> &::std::option::Option<::std::string::String> {
127 self.inner.get_policy_store_id()
128 }
129 /// <p>Specifies the ID of the policy template that you want to update.</p>
130 pub fn policy_template_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131 self.inner = self.inner.policy_template_id(input.into());
132 self
133 }
134 /// <p>Specifies the ID of the policy template that you want to update.</p>
135 pub fn set_policy_template_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136 self.inner = self.inner.set_policy_template_id(input);
137 self
138 }
139 /// <p>Specifies the ID of the policy template that you want to update.</p>
140 pub fn get_policy_template_id(&self) -> &::std::option::Option<::std::string::String> {
141 self.inner.get_policy_template_id()
142 }
143 /// <p>Specifies a new description to apply to the policy template.</p>
144 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145 self.inner = self.inner.description(input.into());
146 self
147 }
148 /// <p>Specifies a new description to apply to the policy template.</p>
149 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150 self.inner = self.inner.set_description(input);
151 self
152 }
153 /// <p>Specifies a new description to apply to the policy template.</p>
154 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
155 self.inner.get_description()
156 }
157 /// <p>Specifies new statement content written in Cedar policy language to replace the current body of the policy template.</p>
158 /// <p>You can change only the following elements of the policy body:</p>
159 /// <ul>
160 /// <li>
161 /// <p>The <code>action</code> referenced by the policy template.</p></li>
162 /// <li>
163 /// <p>Any conditional clauses, such as <code>when</code> or <code>unless</code> clauses.</p></li>
164 /// </ul>
165 /// <p>You <b>can't</b> change the following elements:</p>
166 /// <ul>
167 /// <li>
168 /// <p>The effect (<code>permit</code> or <code>forbid</code>) of the policy template.</p></li>
169 /// <li>
170 /// <p>The <code>principal</code> referenced by the policy template.</p></li>
171 /// <li>
172 /// <p>The <code>resource</code> referenced by the policy template.</p></li>
173 /// </ul>
174 pub fn statement(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175 self.inner = self.inner.statement(input.into());
176 self
177 }
178 /// <p>Specifies new statement content written in Cedar policy language to replace the current body of the policy template.</p>
179 /// <p>You can change only the following elements of the policy body:</p>
180 /// <ul>
181 /// <li>
182 /// <p>The <code>action</code> referenced by the policy template.</p></li>
183 /// <li>
184 /// <p>Any conditional clauses, such as <code>when</code> or <code>unless</code> clauses.</p></li>
185 /// </ul>
186 /// <p>You <b>can't</b> change the following elements:</p>
187 /// <ul>
188 /// <li>
189 /// <p>The effect (<code>permit</code> or <code>forbid</code>) of the policy template.</p></li>
190 /// <li>
191 /// <p>The <code>principal</code> referenced by the policy template.</p></li>
192 /// <li>
193 /// <p>The <code>resource</code> referenced by the policy template.</p></li>
194 /// </ul>
195 pub fn set_statement(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
196 self.inner = self.inner.set_statement(input);
197 self
198 }
199 /// <p>Specifies new statement content written in Cedar policy language to replace the current body of the policy template.</p>
200 /// <p>You can change only the following elements of the policy body:</p>
201 /// <ul>
202 /// <li>
203 /// <p>The <code>action</code> referenced by the policy template.</p></li>
204 /// <li>
205 /// <p>Any conditional clauses, such as <code>when</code> or <code>unless</code> clauses.</p></li>
206 /// </ul>
207 /// <p>You <b>can't</b> change the following elements:</p>
208 /// <ul>
209 /// <li>
210 /// <p>The effect (<code>permit</code> or <code>forbid</code>) of the policy template.</p></li>
211 /// <li>
212 /// <p>The <code>principal</code> referenced by the policy template.</p></li>
213 /// <li>
214 /// <p>The <code>resource</code> referenced by the policy template.</p></li>
215 /// </ul>
216 pub fn get_statement(&self) -> &::std::option::Option<::std::string::String> {
217 self.inner.get_statement()
218 }
219}