Skip to content

get_public_access_block async

get_public_access_block(
    account_id: AccountId,
    *,
    config_overrides: Optional[AsyncS3ControlClientConfig] = None,
) -> GetPublicAccessBlockOutput

This operation is not supported by directory buckets.

Retrieves the PublicAccessBlock configuration for an Amazon Web Services account. This operation returns the effective account-level configuration, which may inherit from organization-level policies. For more information, see Using Amazon S3 block public access.

Related actions include:

Parameters:

  • account_id (AccountId) –

    The account ID for the Amazon Web Services account whose PublicAccessBlock configuration you want to retrieve.

Raises:

  • NoSuchPublicAccessBlockConfiguration –

    Amazon S3 throws this exception if you make a GetPublicAccessBlock request against an account that doesn't have a PublicAccessBlockConfiguration set.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_s3_control/_services/async_s3_control.py
async def get_public_access_block(
    self,
    account_id: "capo_s3_control.types.account_id.AccountId",
    *,
    config_overrides: Optional[AsyncS3ControlClientConfig] = None,
) -> "capo_s3_control.types.get_public_access_block_output.GetPublicAccessBlockOutput":
    """<note> <p>This operation is not supported by directory buckets.</p> </note> <p>Retrieves the <code>PublicAccessBlock</code> configuration for an Amazon Web Services account. This operation returns the effective account-level configuration, which may inherit from organization-level policies. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html"> Using Amazon S3 block public access</a>.</p> <p>Related actions include:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeletePublicAccessBlock.html">DeletePublicAccessBlock</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutPublicAccessBlock.html">PutPublicAccessBlock</a> </p> </li> </ul>

    Args:
        account_id: <p>The account ID for the Amazon Web Services account whose <code>PublicAccessBlock</code> configuration you want to retrieve.</p>

    Raises:
        capo_s3_control.errors.no_such_public_access_block_configuration.NoSuchPublicAccessBlockConfiguration: <p>Amazon S3 throws this exception if you make a <code>GetPublicAccessBlock</code> request against an account that doesn't have a <code>PublicAccessBlockConfiguration</code> set.</p>
        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.get_public_access_block_request.GetPublicAccessBlockRequest]",
    ) -> AsyncOperationResponse[
        "capo_s3_control.types.get_public_access_block_output.GetPublicAccessBlockOutput"
    ]:
        import capo_s3_control._operations.awss3_control_service_v20180820.get_public_access_block

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetPublicAccessBlock")
    )
    input_: capo_s3_control.types.get_public_access_block_request.GetPublicAccessBlockRequest = {
        "account_id": account_id
    }

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