This operation is not supported by directory buckets.
Creates or modifies the PublicAccessBlock configuration for an Amazon Web Services account. This operation may be restricted when the account is managed by organization-level Block Public Access policies. You might get an Access Denied (403) error when the account is managed by organization-level Block Public Access policies. Organization-level policies override account-level settings, preventing direct account-level modifications. For this operation, users must have the s3:PutAccountPublicAccessBlock permission. For more information, see Using Amazon S3 block public access.
Related actions include:
Parameters:
-
public_access_block_configuration
(PublicAccessBlockConfiguration)
–
The PublicAccessBlock configuration that you want to apply to the specified Amazon Web Services account.
-
account_id
(AccountId)
–
The account ID for the Amazon Web Services account whose PublicAccessBlock configuration you want to set.
Raises:
Source code in docs_src/capo_s3_control/_services/async_s3_control.py
| async def put_public_access_block(
self,
public_access_block_configuration: "capo_s3_control.types.public_access_block_configuration.PublicAccessBlockConfiguration",
account_id: "capo_s3_control.types.account_id.AccountId",
*,
config_overrides: Optional[AsyncS3ControlClientConfig] = None,
) -> None:
"""<note> <p>This operation is not supported by directory buckets.</p> </note> <p>Creates or modifies the <code>PublicAccessBlock</code> configuration for an Amazon Web Services account. This operation may be restricted when the account is managed by organization-level Block Public Access policies. You might get an Access Denied (403) error when the account is managed by organization-level Block Public Access policies. Organization-level policies override account-level settings, preventing direct account-level modifications. For this operation, users must have the <code>s3:PutAccountPublicAccessBlock</code> permission. 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_GetPublicAccessBlock.html">GetPublicAccessBlock</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeletePublicAccessBlock.html">DeletePublicAccessBlock</a> </p> </li> </ul>
Args:
public_access_block_configuration: <p>The <code>PublicAccessBlock</code> configuration that you want to apply to the specified Amazon Web Services account.</p>
account_id: <p>The account ID for the Amazon Web Services account whose <code>PublicAccessBlock</code> configuration you want to set.</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.put_public_access_block_request.PutPublicAccessBlockRequest]",
) -> AsyncOperationResponse[None]:
import capo_s3_control._operations.awss3_control_service_v20180820.put_public_access_block
(
output,
http_response,
) = await capo_s3_control._operations.awss3_control_service_v20180820.put_public_access_block.async_put_public_access_block(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutPublicAccessBlock")
)
input_: capo_s3_control.types.put_public_access_block_request.PutPublicAccessBlockRequest = {
"public_access_block_configuration": public_access_block_configuration,
"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
|