Skip to content

list_access_grants async

list_access_grants(
    account_id: AccountId,
    *,
    config_overrides: Optional[AsyncS3ControlClientConfig] = None,
    next_token: Optional[ContinuationToken] = None,
    max_results: Optional[MaxResults] = None,
    grantee_type: Optional[GranteeType] = None,
    grantee_identifier: Optional[GranteeIdentifier] = None,
    permission: Optional[Permission] = None,
    grant_scope: Optional[S3Prefix] = None,
    application_arn: Optional[IdentityCenterApplicationArn] = None,
) -> ListAccessGrantsResult

Returns the list of access grants in your S3 Access Grants instance.

Permissions

You must have the s3:ListAccessGrants permission to use this operation.

Parameters:

  • account_id (AccountId) –

    The Amazon Web Services account ID of the S3 Access Grants instance.

  • next_token (Optional[ContinuationToken], default: None ) –

    A pagination token to request the next page of results. Pass this value into a subsequent List Access Grants request in order to retrieve the next page of results.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of access grants that you would like returned in the List Access Grants response. If the results include the pagination token NextToken, make another call using the NextToken to determine if there are more results.

  • grantee_type (Optional[GranteeType], default: None ) –

    The type of the grantee to which access has been granted. It can be one of the following values:

    • IAM - An IAM user or role.

    • DIRECTORY_USER - A user from your corporate directory. The user can sign in through IAM Identity Center or through IAM federation with your external identity provider.

    • DIRECTORY_GROUP - A group from your corporate directory. Group grants match users who sign in through IAM Identity Center. They also match users who sign in through IAM federation when the IAM identity provider is configured for group-based access.

    • ATTRIBUTE - A runtime claim that you map on your IAM identity provider, such as a department. The grant matches every user who signs in through IAM federation with this runtime claim and value.

  • grantee_identifier (Optional[GranteeIdentifier], default: None ) –

    The unique identifier of the Grantee. The format depends on the grantee type:

    • IAM - The IAM Amazon Resource Name (ARN) of the user or role.

    • DIRECTORY_USER - The user's name, or the ID that IAM Identity Center uses for the user, for example, a1b2c3d4-5678-90ab-cdef-EXAMPLE11111. For IAM federation, the name is the subject that IAM sets from your identity provider token, for example, the user ID 00u1a2b3c4EXAMPLE. For IAM Identity Center, the name is the user's username.

    • DIRECTORY_GROUP - The group's display name in IAM Identity Center, for example, finance-analysts, or the group's IAM Identity Center ID.

    • ATTRIBUTE - One runtime claim and its value, in the form aws:TransactionContext/IdentityProvider/key=value , for example, aws:TransactionContext/IdentityProvider/department=Finance. Each attribute grant contains one key and one value.

    S3 Access Grants stores the identifier exactly as you enter it. It compares identifiers exactly, and the comparison is case sensitive. S3 Access Grants doesn't check that the user, group, or attribute exists when you create the grant.

    User names can be up to 128 characters long. They can contain letters, numbers, spaces, and the characters _ . : / = + - @. Group names can be up to 128 characters long. They can contain any character that IAM Identity Center allows in a group display name, such as R&D or Finance (EU). Attribute keys and values can each be up to 128 characters long. Both can contain letters, numbers, and the characters _ . : / + - @. Values can also contain spaces and =. As a best practice, use an immutable user ID from your identity provider instead of an email address.

    The filter matches the identifier stored in the grant. A grant for a user's name and a grant for the same user's IAM Identity Center user ID are separate grants.

  • permission (Optional[Permission], default: None ) –

    The type of permission granted to your S3 data, which can be set to one of the following values:

    • READ – Grant read-only access to the S3 data.

    • WRITE – Grant write-only access to the S3 data.

    • READWRITE – Grant both read and write access to the S3 data.

  • grant_scope (Optional[S3Prefix], default: None ) –

    The S3 path of the data to which you are granting access. It is the result of appending the Subprefix to the location scope.

  • application_arn (Optional[IdentityCenterApplicationArn], default: None ) –

    The Amazon Resource Name (ARN) of an Amazon Web Services IAM Identity Center application associated with your Identity Center instance. If the grant includes an application ARN, the grantee can only access the S3 data through this application.

    Grants with an application ARN match only users who sign in through an IAM Identity Center instance that uses the legacy experience, not the simplified experience for trusted identity propagation.

Raises:

Source code in docs_src/capo_s3_control/_services/async_s3_control.py
async def list_access_grants(
    self,
    account_id: "capo_s3_control.types.account_id.AccountId",
    *,
    config_overrides: Optional[AsyncS3ControlClientConfig] = None,
    next_token: Optional[
        "capo_s3_control.types.continuation_token.ContinuationToken"
    ] = None,
    max_results: Optional["capo_s3_control.types.max_results.MaxResults"] = None,
    grantee_type: Optional["capo_s3_control.types.grantee_type.GranteeType"] = None,
    grantee_identifier: Optional[
        "capo_s3_control.types.grantee_identifier.GranteeIdentifier"
    ] = None,
    permission: Optional["capo_s3_control.types.permission.Permission"] = None,
    grant_scope: Optional["capo_s3_control.types.s3_prefix.S3Prefix"] = None,
    application_arn: Optional[
        "capo_s3_control.types.identity_center_application_arn.IdentityCenterApplicationArn"
    ] = None,
) -> "capo_s3_control.types.list_access_grants_result.ListAccessGrantsResult":
    """<p>Returns the list of access grants in your S3 Access Grants instance.</p> <dl> <dt>Permissions</dt> <dd> <p>You must have the <code>s3:ListAccessGrants</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>
        next_token: <p>A pagination token to request the next page of results. Pass this value into a subsequent <code>List Access Grants</code> request in order to retrieve the next page of results.</p>
        max_results: <p>The maximum number of access grants that you would like returned in the <code>List 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>
        grantee_type: <p>The type of the grantee to which access has been granted. It can be one of the following values:</p> <ul> <li> <p> <code>IAM</code> - An IAM user or role.</p> </li> <li> <p> <code>DIRECTORY_USER</code> - A user from your corporate directory. The user can sign in through IAM Identity Center or through IAM federation with your external identity provider.</p> </li> <li> <p> <code>DIRECTORY_GROUP</code> - A group from your corporate directory. Group grants match users who sign in through IAM Identity Center. They also match users who sign in through IAM federation when the 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>.</p> </li> <li> <p> <code>ATTRIBUTE</code> - A runtime claim that you map on your IAM identity provider, such as a department. The grant matches every user who signs in through IAM federation with this runtime claim and value.</p> </li> </ul>
        grantee_identifier: <p>The unique identifier of the <code>Grantee</code>. The format depends on the grantee type:</p> <ul> <li> <p> <code>IAM</code> - The IAM Amazon Resource Name (ARN) of the user or role.</p> </li> <li> <p> <code>DIRECTORY_USER</code> - The user's name, or the ID that IAM Identity Center uses for the user, for example, <code>a1b2c3d4-5678-90ab-cdef-EXAMPLE11111</code>. For IAM federation, the name is the subject that IAM sets from your identity provider token, for example, the user ID <code>00u1a2b3c4EXAMPLE</code>. For IAM Identity Center, the name is the user's username.</p> </li> <li> <p> <code>DIRECTORY_GROUP</code> - The group's display name in IAM Identity Center, for example, <code>finance-analysts</code>, or the group's IAM Identity Center ID.</p> </li> <li> <p> <code>ATTRIBUTE</code> - One runtime claim and its value, in the form <code>aws:TransactionContext/IdentityProvider/<i>key</i>=<i>value</i> </code>, for example, <code>aws:TransactionContext/IdentityProvider/department=Finance</code>. Each attribute grant contains one key and one value.</p> </li> </ul> <p>S3 Access Grants stores the identifier exactly as you enter it. It compares identifiers exactly, and the comparison is case sensitive. S3 Access Grants doesn't check that the user, group, or attribute exists when you create the grant.</p> <p>User names can be up to 128 characters long. They can contain letters, numbers, spaces, and the characters <code>_ . : / = + - @</code>. Group names can be up to 128 characters long. They can contain any character that IAM Identity Center allows in a group display name, such as <code>R&D</code> or <code>Finance (EU)</code>. Attribute keys and values can each be up to 128 characters long. Both can contain letters, numbers, and the characters <code>_ . : / + - @</code>. Values can also contain spaces and <code>=</code>. As a best practice, use an immutable user ID from your identity provider instead of an email address.</p> <p>The filter matches the identifier stored in the grant. A grant for a user's name and a grant for the same user's IAM Identity Center user ID are separate grants.</p>
        permission: <p>The type of permission granted to your S3 data, which can be set to one of the following values:</p> <ul> <li> <p> <code>READ</code> – Grant read-only access to the S3 data.</p> </li> <li> <p> <code>WRITE</code> – Grant write-only access to the S3 data.</p> </li> <li> <p> <code>READWRITE</code> – Grant both read and write access to the S3 data.</p> </li> </ul>
        grant_scope: <p>The S3 path of the data to which you are granting access. It is the result of appending the <code>Subprefix</code> to the location scope.</p>
        application_arn: <p>The Amazon Resource Name (ARN) of an Amazon Web Services IAM Identity Center application associated with your Identity Center instance. If the grant includes an application ARN, the grantee can only access the S3 data through this application. </p> <p>Grants with an application ARN match only users who sign in through an IAM Identity Center instance that uses the legacy experience, not the simplified experience for trusted identity propagation.</p>

    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_access_grants_request.ListAccessGrantsRequest]",
    ) -> AsyncOperationResponse[
        "capo_s3_control.types.list_access_grants_result.ListAccessGrantsResult"
    ]:
        import capo_s3_control._operations.awss3_control_service_v20180820.list_access_grants

        (
            output,
            http_response,
        ) = await capo_s3_control._operations.awss3_control_service_v20180820.list_access_grants.async_list_access_grants(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListAccessGrants")
    )
    input_: capo_s3_control.types.list_access_grants_request.ListAccessGrantsRequest = {
        "account_id": account_id
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if grantee_type is not None:
        input_["grantee_type"] = grantee_type
    if grantee_identifier is not None:
        input_["grantee_identifier"] = grantee_identifier
    if permission is not None:
        input_["permission"] = permission
    if grant_scope is not None:
        input_["grant_scope"] = grant_scope
    if application_arn is not None:
        input_["application_arn"] = application_arn

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output