aws_sdk_verifiedpermissions/operation/batch_is_authorized/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::batch_is_authorized::_batch_is_authorized_output::BatchIsAuthorizedOutputBuilder;
3
4pub use crate::operation::batch_is_authorized::_batch_is_authorized_input::BatchIsAuthorizedInputBuilder;
5
6impl crate::operation::batch_is_authorized::builders::BatchIsAuthorizedInputBuilder {
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::batch_is_authorized::BatchIsAuthorizedOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::batch_is_authorized::BatchIsAuthorizedError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.batch_is_authorized();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `BatchIsAuthorized`.
24///
25/// <p>Makes a series of decisions about multiple authorization requests for one principal or resource. Each request contains the equivalent content of an <code>IsAuthorized</code> request: principal, action, resource, and context. Either the <code>principal</code> or the <code>resource</code> parameter must be identical across all requests. For example, Verified Permissions won't evaluate a pair of requests where <code>bob</code> views <code>photo1</code> and <code>alice</code> views <code>photo2</code>. Authorization of <code>bob</code> to view <code>photo1</code> and <code>photo2</code>, or <code>bob</code> and <code>alice</code> to view <code>photo1</code>, are valid batches.</p>
26/// <p>The request is evaluated against all policies in the specified policy store that match the entities that you declare. The result of the decisions is a series of <code>Allow</code> or <code>Deny</code> responses, along with the IDs of the policies that produced each decision.</p>
27/// <p>The <code>entities</code> of a <code>BatchIsAuthorized</code> API request can contain up to 100 principals and up to 100 resources. The <code>requests</code> of a <code>BatchIsAuthorized</code> API request can contain up to 30 requests.</p><note>
28/// <p>The <code>BatchIsAuthorized</code> operation doesn't have its own IAM permission. To authorize this operation for Amazon Web Services principals, include the permission <code>verifiedpermissions:IsAuthorized</code> in their IAM policies.</p>
29/// </note>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct BatchIsAuthorizedFluentBuilder {
32 handle: ::std::sync::Arc<crate::client::Handle>,
33 inner: crate::operation::batch_is_authorized::builders::BatchIsAuthorizedInputBuilder,
34 config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37 crate::client::customize::internal::CustomizableSend<
38 crate::operation::batch_is_authorized::BatchIsAuthorizedOutput,
39 crate::operation::batch_is_authorized::BatchIsAuthorizedError,
40 > for BatchIsAuthorizedFluentBuilder
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::batch_is_authorized::BatchIsAuthorizedOutput,
48 crate::operation::batch_is_authorized::BatchIsAuthorizedError,
49 >,
50 > {
51 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52 }
53}
54impl BatchIsAuthorizedFluentBuilder {
55 /// Creates a new `BatchIsAuthorizedFluentBuilder`.
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 BatchIsAuthorized as a reference.
64 pub fn as_input(&self) -> &crate::operation::batch_is_authorized::builders::BatchIsAuthorizedInputBuilder {
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::batch_is_authorized::BatchIsAuthorizedOutput,
79 ::aws_smithy_runtime_api::client::result::SdkError<
80 crate::operation::batch_is_authorized::BatchIsAuthorizedError,
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::batch_is_authorized::BatchIsAuthorized::operation_runtime_plugins(
89 self.handle.runtime_plugins.clone(),
90 &self.handle.conf,
91 self.config_override,
92 );
93 crate::operation::batch_is_authorized::BatchIsAuthorized::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::batch_is_authorized::BatchIsAuthorizedOutput,
101 crate::operation::batch_is_authorized::BatchIsAuthorizedError,
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. Policies in this policy store will be used to make the authorization decisions for the input.</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. Policies in this policy store will be used to make the authorization decisions for the input.</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. Policies in this policy store will be used to make the authorization decisions for the input.</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>(Optional) Specifies the list of resources and principals and their associated attributes that Verified Permissions can examine when evaluating the policies. These additional entities and their attributes can be referenced and checked by conditional elements in the policies in the specified policy store.</p><note>
130 /// <p>You can include only principal and resource entities in this parameter; you can't include actions. You must specify actions in the schema.</p>
131 /// </note>
132 pub fn entities(mut self, input: crate::types::EntitiesDefinition) -> Self {
133 self.inner = self.inner.entities(input);
134 self
135 }
136 /// <p>(Optional) Specifies the list of resources and principals and their associated attributes that Verified Permissions can examine when evaluating the policies. These additional entities and their attributes can be referenced and checked by conditional elements in the policies in the specified policy store.</p><note>
137 /// <p>You can include only principal and resource entities in this parameter; you can't include actions. You must specify actions in the schema.</p>
138 /// </note>
139 pub fn set_entities(mut self, input: ::std::option::Option<crate::types::EntitiesDefinition>) -> Self {
140 self.inner = self.inner.set_entities(input);
141 self
142 }
143 /// <p>(Optional) Specifies the list of resources and principals and their associated attributes that Verified Permissions can examine when evaluating the policies. These additional entities and their attributes can be referenced and checked by conditional elements in the policies in the specified policy store.</p><note>
144 /// <p>You can include only principal and resource entities in this parameter; you can't include actions. You must specify actions in the schema.</p>
145 /// </note>
146 pub fn get_entities(&self) -> &::std::option::Option<crate::types::EntitiesDefinition> {
147 self.inner.get_entities()
148 }
149 ///
150 /// Appends an item to `requests`.
151 ///
152 /// To override the contents of this collection use [`set_requests`](Self::set_requests).
153 ///
154 /// <p>An array of up to 30 requests that you want Verified Permissions to evaluate.</p>
155 pub fn requests(mut self, input: crate::types::BatchIsAuthorizedInputItem) -> Self {
156 self.inner = self.inner.requests(input);
157 self
158 }
159 /// <p>An array of up to 30 requests that you want Verified Permissions to evaluate.</p>
160 pub fn set_requests(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::BatchIsAuthorizedInputItem>>) -> Self {
161 self.inner = self.inner.set_requests(input);
162 self
163 }
164 /// <p>An array of up to 30 requests that you want Verified Permissions to evaluate.</p>
165 pub fn get_requests(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::BatchIsAuthorizedInputItem>> {
166 self.inner.get_requests()
167 }
168}