Use this API to list the access grants that grant the caller access to Amazon S3 data through S3 Access Grants. The caller (grantee) can be an Identity and Access Management (IAM) identity or a corporate directory identity from IAM Identity Center or IAM federation. You must pass the Amazon Web Services account of the S3 data owner (grantor) in the request. By default, S3 Access Grants returns grants from the instance of the Amazon Web Services account ID in the request. To return grants from all instances shared with the caller's account through Amazon Web Services Resource Access Manager (RAM), set the InstanceScope parameter to ALL. You can, optionally, narrow the results by GrantScope, using a fragment of the data's S3 path, and S3 Access Grants will return only the grants with a path that contains the path fragment. You can also pass the AllowedByApplication filter in the request, which returns only the grants authorized for applications, whether the application is the caller's Identity Center application or any other application (ALL). For more information, see List the caller's access grants in the Amazon S3 User Guide.
For a corporate user, the results include grants for the IAM role, the user, and the user's groups. For users who sign in through IAM federation, they also include grants for the user's attributes. S3 Access Grants denies the request if it can't find the user in IAM Identity Center. This applies when your IAM identity provider is configured for group-based access, or when your IAM Identity Center instance uses the simplified experience.
Some sessions come from IAM federation or from an IAM Identity Center instance that uses the simplified experience for trusted identity propagation. The results for these sessions don't include grants with an application ARN, because those grants don't match them. For these sessions, the AllowedByApplication filter doesn't change the results.
- Permissions
-
You must have the s3:ListCallerAccessGrants permission to use this operation.
Parameters:
-
account_id
(AccountId)
–
The Amazon Web Services account ID of the S3 Access Grants instance.
-
grant_scope
(Optional[S3Prefix], default:
None
)
–
The S3 path of the data that you would like to access. Must start with s3://. You can optionally pass only the beginning characters of a path, and S3 Access Grants will search for all applicable grants for the path fragment.
-
next_token
(Optional[ContinuationToken], default:
None
)
–
A pagination token to request the next page of results. Pass this value into a subsequent List Caller Access Grants request in order to retrieve the next page of results.
If the caller's identity changes between requests, the request fails with an InvalidNextToken error. For example, this happens when the user is renamed. Start a new request without NextToken.
-
max_results
(Optional[MaxResults], default:
None
)
–
The maximum number of access grants that you would like returned in the List Caller Access Grants response. If the results include the pagination token NextToken, make another call using the NextToken to determine if there are more results.
-
allowed_by_application
(Optional[Boolean], default:
None
)
–
If this optional parameter is passed in the request, a filter is applied to the results. The results will include only the access grants for the caller's Identity Center application or for any other applications (ALL).
Some sessions come from IAM federation or from an IAM Identity Center instance that uses the simplified experience for trusted identity propagation. The results for these sessions never include grants with an application ARN, so this filter doesn't change them.
-
instance_scope
(Optional[InstanceScope], default:
None
)
–
The scope of S3 Access Grants instances to list grants from.
-
SELF – Lists grants from the instance of the Amazon Web Services account ID in the request.
-
ALL – Lists grants from the instance of the Amazon Web Services account ID in the request and all instances shared with the caller's account through Amazon Web Services Resource Access Manager (RAM).
Raises:
Source code in docs_src/capo_s3_control/_services/async_s3_control.py
| async def list_caller_access_grants(
self,
account_id: "capo_s3_control.types.account_id.AccountId",
*,
config_overrides: Optional[AsyncS3ControlClientConfig] = None,
grant_scope: Optional["capo_s3_control.types.s3_prefix.S3Prefix"] = None,
next_token: Optional[
"capo_s3_control.types.continuation_token.ContinuationToken"
] = None,
max_results: Optional["capo_s3_control.types.max_results.MaxResults"] = None,
allowed_by_application: Optional[
"capo_s3_control.types.boolean.Boolean"
] = None,
instance_scope: Optional[
"capo_s3_control.types.instance_scope.InstanceScope"
] = None,
) -> "capo_s3_control.types.list_caller_access_grants_result.ListCallerAccessGrantsResult":
"""<p>Use this API to list the access grants that grant the caller access to Amazon S3 data through S3 Access Grants. The caller (grantee) can be an Identity and Access Management (IAM) identity or a corporate directory identity from IAM Identity Center or IAM federation. You must pass the Amazon Web Services account of the S3 data owner (grantor) in the request. By default, S3 Access Grants returns grants from the instance of the Amazon Web Services account ID in the request. To return grants from all instances shared with the caller's account through Amazon Web Services Resource Access Manager (RAM), set the <code>InstanceScope</code> parameter to <code>ALL</code>. You can, optionally, narrow the results by <code>GrantScope</code>, using a fragment of the data's S3 path, and S3 Access Grants will return only the grants with a path that contains the path fragment. You can also pass the <code>AllowedByApplication</code> filter in the request, which returns only the grants authorized for applications, whether the application is the caller's Identity Center application or any other application (<code>ALL</code>). For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-grants-list-grants.html">List the caller's access grants</a> in the <i>Amazon S3 User Guide</i>.</p> <p>For a corporate user, the results include grants for the IAM role, the user, and the user's groups. For users who sign in through IAM federation, they also include grants for the user's attributes. S3 Access Grants denies the request if it can't find the user in IAM Identity Center. This applies when your IAM identity provider is configured for <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_tip_federation_configure_group_access.html">group-based access</a>, or when your IAM Identity Center instance uses the simplified experience.</p> <p>Some sessions come from IAM federation or from an IAM Identity Center instance that uses the simplified experience for trusted identity propagation. The results for these sessions don't include grants with an application ARN, because those grants don't match them. For these sessions, the <code>AllowedByApplication</code> filter doesn't change the results.</p> <dl> <dt>Permissions</dt> <dd> <p>You must have the <code>s3:ListCallerAccessGrants</code> permission to use this operation. </p> </dd> </dl>
Args:
account_id: <p>The Amazon Web Services account ID of the S3 Access Grants instance.</p>
grant_scope: <p>The S3 path of the data that you would like to access. Must start with <code>s3://</code>. You can optionally pass only the beginning characters of a path, and S3 Access Grants will search for all applicable grants for the path fragment. </p>
next_token: <p>A pagination token to request the next page of results. Pass this value into a subsequent <code>List Caller Access Grants</code> request in order to retrieve the next page of results.</p> <p>If the caller's identity changes between requests, the request fails with an <code>InvalidNextToken</code> error. For example, this happens when the user is renamed. Start a new request without <code>NextToken</code>.</p>
max_results: <p>The maximum number of access grants that you would like returned in the <code>List Caller Access Grants</code> response. If the results include the pagination token <code>NextToken</code>, make another call using the <code>NextToken</code> to determine if there are more results.</p>
allowed_by_application: <p>If this optional parameter is passed in the request, a filter is applied to the results. The results will include only the access grants for the caller's Identity Center application or for any other applications (<code>ALL</code>).</p> <p>Some sessions come from IAM federation or from an IAM Identity Center instance that uses the simplified experience for trusted identity propagation. The results for these sessions never include grants with an application ARN, so this filter doesn't change them.</p>
instance_scope: <p>The scope of S3 Access Grants instances to list grants from.</p> <ul> <li> <p> <code>SELF</code> – Lists grants from the instance of the Amazon Web Services account ID in the request.</p> </li> <li> <p> <code>ALL</code> – Lists grants from the instance of the Amazon Web Services account ID in the request and all instances shared with the caller's account through Amazon Web Services Resource Access Manager (RAM).</p> </li> </ul>
Raises:
capo_s3_control.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_s3_control.types.list_caller_access_grants_request.ListCallerAccessGrantsRequest]",
) -> AsyncOperationResponse[
"capo_s3_control.types.list_caller_access_grants_result.ListCallerAccessGrantsResult"
]:
import capo_s3_control._operations.awss3_control_service_v20180820.list_caller_access_grants
(
output,
http_response,
) = await capo_s3_control._operations.awss3_control_service_v20180820.list_caller_access_grants.async_list_caller_access_grants(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ListCallerAccessGrants")
)
input_: capo_s3_control.types.list_caller_access_grants_request.ListCallerAccessGrantsRequest = {
"account_id": account_id
}
if grant_scope is not None:
input_["grant_scope"] = grant_scope
if next_token is not None:
input_["next_token"] = next_token
if max_results is not None:
input_["max_results"] = max_results
if allowed_by_application is not None:
input_["allowed_by_application"] = allowed_by_application
if instance_scope is not None:
input_["instance_scope"] = instance_scope
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|