aws_sdk_s3control/operation/create_access_grant/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_access_grant::_create_access_grant_output::CreateAccessGrantOutputBuilder;
3
4pub use crate::operation::create_access_grant::_create_access_grant_input::CreateAccessGrantInputBuilder;
5
6impl crate::operation::create_access_grant::builders::CreateAccessGrantInputBuilder {
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::create_access_grant::CreateAccessGrantOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_access_grant::CreateAccessGrantError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_access_grant();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateAccessGrant`.
24///
25/// <p>Creates an access grant that gives a grantee access to your S3 data. The grantee can be an IAM user or role or a directory user, or group. Before you can create a grant, you must have an S3 Access Grants instance in the same Region as the S3 data. You can create an S3 Access Grants instance using the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessGrantsInstance.html">CreateAccessGrantsInstance</a>. You must also have registered at least one S3 data location in your S3 Access Grants instance using <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessGrantsLocation.html">CreateAccessGrantsLocation</a>.</p>
26/// <dl>
27/// <dt>
28/// Permissions
29/// </dt>
30/// <dd>
31/// <p>You must have the <code>s3:CreateAccessGrant</code> permission to use this operation.</p>
32/// </dd>
33/// <dt>
34/// Additional Permissions
35/// </dt>
36/// <dd>
37/// <p>For any directory identity - <code>sso:DescribeInstance</code> and <code>sso:DescribeApplication</code></p>
38/// <p>For directory users - <code>identitystore:DescribeUser</code></p>
39/// <p>For directory groups - <code>identitystore:DescribeGroup</code></p>
40/// </dd>
41/// </dl><important>
42/// <p>You must URL encode any signed header values that contain spaces. For example, if your header value is <code>my file.txt</code>, containing two spaces after <code>my</code>, you must URL encode this value to <code>my%20%20file.txt</code>.</p>
43/// </important>
44#[derive(::std::clone::Clone, ::std::fmt::Debug)]
45pub struct CreateAccessGrantFluentBuilder {
46    handle: ::std::sync::Arc<crate::client::Handle>,
47    inner: crate::operation::create_access_grant::builders::CreateAccessGrantInputBuilder,
48    config_override: ::std::option::Option<crate::config::Builder>,
49}
50impl
51    crate::client::customize::internal::CustomizableSend<
52        crate::operation::create_access_grant::CreateAccessGrantOutput,
53        crate::operation::create_access_grant::CreateAccessGrantError,
54    > for CreateAccessGrantFluentBuilder
55{
56    fn send(
57        self,
58        config_override: crate::config::Builder,
59    ) -> crate::client::customize::internal::BoxFuture<
60        crate::client::customize::internal::SendResult<
61            crate::operation::create_access_grant::CreateAccessGrantOutput,
62            crate::operation::create_access_grant::CreateAccessGrantError,
63        >,
64    > {
65        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
66    }
67}
68impl CreateAccessGrantFluentBuilder {
69    /// Creates a new `CreateAccessGrantFluentBuilder`.
70    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
71        Self {
72            handle,
73            inner: ::std::default::Default::default(),
74            config_override: ::std::option::Option::None,
75        }
76    }
77    /// Access the CreateAccessGrant as a reference.
78    pub fn as_input(&self) -> &crate::operation::create_access_grant::builders::CreateAccessGrantInputBuilder {
79        &self.inner
80    }
81    /// Sends the request and returns the response.
82    ///
83    /// If an error occurs, an `SdkError` will be returned with additional details that
84    /// can be matched against.
85    ///
86    /// By default, any retryable failures will be retried twice. Retry behavior
87    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
88    /// set when configuring the client.
89    pub async fn send(
90        self,
91    ) -> ::std::result::Result<
92        crate::operation::create_access_grant::CreateAccessGrantOutput,
93        ::aws_smithy_runtime_api::client::result::SdkError<
94            crate::operation::create_access_grant::CreateAccessGrantError,
95            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
96        >,
97    > {
98        let input = self
99            .inner
100            .build()
101            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
102        let runtime_plugins = crate::operation::create_access_grant::CreateAccessGrant::operation_runtime_plugins(
103            self.handle.runtime_plugins.clone(),
104            &self.handle.conf,
105            self.config_override,
106        );
107        crate::operation::create_access_grant::CreateAccessGrant::orchestrate(&runtime_plugins, input).await
108    }
109
110    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
111    pub fn customize(
112        self,
113    ) -> crate::client::customize::CustomizableOperation<
114        crate::operation::create_access_grant::CreateAccessGrantOutput,
115        crate::operation::create_access_grant::CreateAccessGrantError,
116        Self,
117    > {
118        crate::client::customize::CustomizableOperation::new(self)
119    }
120    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
121        self.set_config_override(::std::option::Option::Some(config_override.into()));
122        self
123    }
124
125    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
126        self.config_override = config_override;
127        self
128    }
129    /// <p>The Amazon Web Services account ID of the S3 Access Grants instance.</p>
130    pub fn account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.account_id(input.into());
132        self
133    }
134    /// <p>The Amazon Web Services account ID of the S3 Access Grants instance.</p>
135    pub fn set_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_account_id(input);
137        self
138    }
139    /// <p>The Amazon Web Services account ID of the S3 Access Grants instance.</p>
140    pub fn get_account_id(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_account_id()
142    }
143    /// <p>The ID of the registered location to which you are granting access. S3 Access Grants assigns this ID when you register the location. S3 Access Grants assigns the ID <code>default</code> to the default location <code>s3://</code> and assigns an auto-generated ID to other locations that you register.</p>
144    /// <p>If you are passing the <code>default</code> location, you cannot create an access grant for the entire default location. You must also specify a bucket or a bucket and prefix in the <code>Subprefix</code> field.</p>
145    pub fn access_grants_location_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.inner = self.inner.access_grants_location_id(input.into());
147        self
148    }
149    /// <p>The ID of the registered location to which you are granting access. S3 Access Grants assigns this ID when you register the location. S3 Access Grants assigns the ID <code>default</code> to the default location <code>s3://</code> and assigns an auto-generated ID to other locations that you register.</p>
150    /// <p>If you are passing the <code>default</code> location, you cannot create an access grant for the entire default location. You must also specify a bucket or a bucket and prefix in the <code>Subprefix</code> field.</p>
151    pub fn set_access_grants_location_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.inner = self.inner.set_access_grants_location_id(input);
153        self
154    }
155    /// <p>The ID of the registered location to which you are granting access. S3 Access Grants assigns this ID when you register the location. S3 Access Grants assigns the ID <code>default</code> to the default location <code>s3://</code> and assigns an auto-generated ID to other locations that you register.</p>
156    /// <p>If you are passing the <code>default</code> location, you cannot create an access grant for the entire default location. You must also specify a bucket or a bucket and prefix in the <code>Subprefix</code> field.</p>
157    pub fn get_access_grants_location_id(&self) -> &::std::option::Option<::std::string::String> {
158        self.inner.get_access_grants_location_id()
159    }
160    /// <p>The configuration options of the grant location. The grant location is the S3 path to the data to which you are granting access. It contains the <code>S3SubPrefix</code> field. The grant scope is the result of appending the subprefix to the location scope of the registered location.</p>
161    pub fn access_grants_location_configuration(mut self, input: crate::types::AccessGrantsLocationConfiguration) -> Self {
162        self.inner = self.inner.access_grants_location_configuration(input);
163        self
164    }
165    /// <p>The configuration options of the grant location. The grant location is the S3 path to the data to which you are granting access. It contains the <code>S3SubPrefix</code> field. The grant scope is the result of appending the subprefix to the location scope of the registered location.</p>
166    pub fn set_access_grants_location_configuration(mut self, input: ::std::option::Option<crate::types::AccessGrantsLocationConfiguration>) -> Self {
167        self.inner = self.inner.set_access_grants_location_configuration(input);
168        self
169    }
170    /// <p>The configuration options of the grant location. The grant location is the S3 path to the data to which you are granting access. It contains the <code>S3SubPrefix</code> field. The grant scope is the result of appending the subprefix to the location scope of the registered location.</p>
171    pub fn get_access_grants_location_configuration(&self) -> &::std::option::Option<crate::types::AccessGrantsLocationConfiguration> {
172        self.inner.get_access_grants_location_configuration()
173    }
174    /// <p>The user, group, or role to which you are granting access. You can grant access to an IAM user or role. If you have added your corporate directory to Amazon Web Services IAM Identity Center and associated your Identity Center instance with your S3 Access Grants instance, the grantee can also be a corporate directory user or group.</p>
175    pub fn grantee(mut self, input: crate::types::Grantee) -> Self {
176        self.inner = self.inner.grantee(input);
177        self
178    }
179    /// <p>The user, group, or role to which you are granting access. You can grant access to an IAM user or role. If you have added your corporate directory to Amazon Web Services IAM Identity Center and associated your Identity Center instance with your S3 Access Grants instance, the grantee can also be a corporate directory user or group.</p>
180    pub fn set_grantee(mut self, input: ::std::option::Option<crate::types::Grantee>) -> Self {
181        self.inner = self.inner.set_grantee(input);
182        self
183    }
184    /// <p>The user, group, or role to which you are granting access. You can grant access to an IAM user or role. If you have added your corporate directory to Amazon Web Services IAM Identity Center and associated your Identity Center instance with your S3 Access Grants instance, the grantee can also be a corporate directory user or group.</p>
185    pub fn get_grantee(&self) -> &::std::option::Option<crate::types::Grantee> {
186        self.inner.get_grantee()
187    }
188    /// <p>The type of access that you are granting to your S3 data, which can be set to one of the following values:</p>
189    /// <ul>
190    /// <li>
191    /// <p><code>READ</code> – Grant read-only access to the S3 data.</p></li>
192    /// <li>
193    /// <p><code>WRITE</code> – Grant write-only access to the S3 data.</p></li>
194    /// <li>
195    /// <p><code>READWRITE</code> – Grant both read and write access to the S3 data.</p></li>
196    /// </ul>
197    pub fn permission(mut self, input: crate::types::Permission) -> Self {
198        self.inner = self.inner.permission(input);
199        self
200    }
201    /// <p>The type of access that you are granting to your S3 data, which can be set to one of the following values:</p>
202    /// <ul>
203    /// <li>
204    /// <p><code>READ</code> – Grant read-only access to the S3 data.</p></li>
205    /// <li>
206    /// <p><code>WRITE</code> – Grant write-only access to the S3 data.</p></li>
207    /// <li>
208    /// <p><code>READWRITE</code> – Grant both read and write access to the S3 data.</p></li>
209    /// </ul>
210    pub fn set_permission(mut self, input: ::std::option::Option<crate::types::Permission>) -> Self {
211        self.inner = self.inner.set_permission(input);
212        self
213    }
214    /// <p>The type of access that you are granting to your S3 data, which can be set to one of the following values:</p>
215    /// <ul>
216    /// <li>
217    /// <p><code>READ</code> – Grant read-only access to the S3 data.</p></li>
218    /// <li>
219    /// <p><code>WRITE</code> – Grant write-only access to the S3 data.</p></li>
220    /// <li>
221    /// <p><code>READWRITE</code> – Grant both read and write access to the S3 data.</p></li>
222    /// </ul>
223    pub fn get_permission(&self) -> &::std::option::Option<crate::types::Permission> {
224        self.inner.get_permission()
225    }
226    /// <p>The Amazon Resource Name (ARN) of an Amazon Web Services IAM Identity Center application associated with your Identity Center instance. If an application ARN is included in the request to create an access grant, the grantee can only access the S3 data through this application.</p>
227    pub fn application_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
228        self.inner = self.inner.application_arn(input.into());
229        self
230    }
231    /// <p>The Amazon Resource Name (ARN) of an Amazon Web Services IAM Identity Center application associated with your Identity Center instance. If an application ARN is included in the request to create an access grant, the grantee can only access the S3 data through this application.</p>
232    pub fn set_application_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
233        self.inner = self.inner.set_application_arn(input);
234        self
235    }
236    /// <p>The Amazon Resource Name (ARN) of an Amazon Web Services IAM Identity Center application associated with your Identity Center instance. If an application ARN is included in the request to create an access grant, the grantee can only access the S3 data through this application.</p>
237    pub fn get_application_arn(&self) -> &::std::option::Option<::std::string::String> {
238        self.inner.get_application_arn()
239    }
240    /// <p>The type of <code>S3SubPrefix</code>. The only possible value is <code>Object</code>. Pass this value if the access grant scope is an object. Do not pass this value if the access grant scope is a bucket or a bucket and a prefix.</p>
241    pub fn s3_prefix_type(mut self, input: crate::types::S3PrefixType) -> Self {
242        self.inner = self.inner.s3_prefix_type(input);
243        self
244    }
245    /// <p>The type of <code>S3SubPrefix</code>. The only possible value is <code>Object</code>. Pass this value if the access grant scope is an object. Do not pass this value if the access grant scope is a bucket or a bucket and a prefix.</p>
246    pub fn set_s3_prefix_type(mut self, input: ::std::option::Option<crate::types::S3PrefixType>) -> Self {
247        self.inner = self.inner.set_s3_prefix_type(input);
248        self
249    }
250    /// <p>The type of <code>S3SubPrefix</code>. The only possible value is <code>Object</code>. Pass this value if the access grant scope is an object. Do not pass this value if the access grant scope is a bucket or a bucket and a prefix.</p>
251    pub fn get_s3_prefix_type(&self) -> &::std::option::Option<crate::types::S3PrefixType> {
252        self.inner.get_s3_prefix_type()
253    }
254    ///
255    /// Appends an item to `Tags`.
256    ///
257    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
258    ///
259    /// <p>The Amazon Web Services resource tags that you are adding to the access grant. Each tag is a label consisting of a user-defined key and value. Tags can help you manage, identify, organize, search for, and filter resources.</p>
260    pub fn tags(mut self, input: crate::types::Tag) -> Self {
261        self.inner = self.inner.tags(input);
262        self
263    }
264    /// <p>The Amazon Web Services resource tags that you are adding to the access grant. Each tag is a label consisting of a user-defined key and value. Tags can help you manage, identify, organize, search for, and filter resources.</p>
265    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
266        self.inner = self.inner.set_tags(input);
267        self
268    }
269    /// <p>The Amazon Web Services resource tags that you are adding to the access grant. Each tag is a label consisting of a user-defined key and value. Tags can help you manage, identify, organize, search for, and filter resources.</p>
270    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
271        self.inner.get_tags()
272    }
273}