Skip to content

put_bucket_abac

put_bucket_abac(
    bucket: BucketName,
    abac_status: AbacStatus,
    *,
    config_overrides: Optional[S3ClientConfig] = None,
    content_md5: Optional[ContentMD5] = None,
    checksum_algorithm: Optional[ChecksumAlgorithm] = None,
    expected_bucket_owner: Optional[AccountId] = None,
) -> None

Sets the attribute-based access control (ABAC) property of the general purpose bucket. You must have s3:PutBucketABAC permission to perform this action. When you enable ABAC, you can use tags for access control on your buckets. Additionally, when ABAC is enabled, you must use the TagResource and UntagResource actions to manage tags on your buckets. You can nolonger use the PutBucketTagging and DeleteBucketTagging actions to tag your bucket. For more information, see Enabling ABAC in general purpose buckets.

Parameters:

  • bucket (BucketName) –

    The name of the general purpose bucket.

  • content_md5 (Optional[ContentMD5], default: None ) –

    The MD5 hash of the PutBucketAbac request body.

    For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.

  • checksum_algorithm (Optional[ChecksumAlgorithm], default: None ) –

    Indicates the algorithm that you want Amazon S3 to use to create the checksum. For more information, see Checking object integrity in the Amazon S3 User Guide.

  • expected_bucket_owner (Optional[AccountId], default: None ) –

    The Amazon Web Services account ID of the general purpose bucket's owner.

  • abac_status (AbacStatus) –

    The ABAC status of the general purpose bucket. When ABAC is enabled for the general purpose bucket, you can use tags to manage access to the general purpose buckets as well as for cost tracking purposes. When ABAC is disabled for the general purpose buckets, you can only use tags for cost tracking purposes. For more information, see Using tags with S3 general purpose buckets.

Raises:

Source code in docs_src/capo_s3/_services/s3.py
def put_bucket_abac(
    self,
    bucket: "capo_s3.types.bucket_name.BucketName",
    abac_status: "capo_s3.types.abac_status.AbacStatus",
    *,
    config_overrides: Optional[S3ClientConfig] = None,
    content_md5: Optional["capo_s3.types.content_md5.ContentMD5"] = None,
    checksum_algorithm: Optional[
        "capo_s3.types.checksum_algorithm.ChecksumAlgorithm"
    ] = None,
    expected_bucket_owner: Optional["capo_s3.types.account_id.AccountId"] = None,
) -> None:
    """<p>Sets the attribute-based access control (ABAC) property of the general purpose bucket. You must have <code>s3:PutBucketABAC</code> permission to perform this action. When you enable ABAC, you can use tags for access control on your buckets. Additionally, when ABAC is enabled, you must use the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_TagResource.html">TagResource</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_UntagResource.html">UntagResource</a> actions to manage tags on your buckets. You can nolonger use the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketTagging.html">PutBucketTagging</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketTagging.html">DeleteBucketTagging</a> actions to tag your bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/buckets-tagging-enable-abac.html">Enabling ABAC in general purpose buckets</a>. </p>

    Args:
        bucket: <p>The name of the general purpose bucket.</p>
        content_md5: <p>The MD5 hash of the <code>PutBucketAbac</code> request body. </p> <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
        checksum_algorithm: <p>Indicates the algorithm that you want Amazon S3 to use to create the checksum. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html"> Checking object integrity</a> in the <i>Amazon S3 User Guide</i>.</p>
        expected_bucket_owner: <p>The Amazon Web Services account ID of the general purpose bucket's owner. </p>
        abac_status: <p>The ABAC status of the general purpose bucket. When ABAC is enabled for the general purpose bucket, you can use tags to manage access to the general purpose buckets as well as for cost tracking purposes. When ABAC is disabled for the general purpose buckets, you can only use tags for cost tracking purposes. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/buckets-tagging.html">Using tags with S3 general purpose buckets</a>. </p>

    Raises:
        capo_s3.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_s3.types.put_bucket_abac_request.PutBucketAbacRequest]",
    ) -> OperationResponse[None]:
        import capo_s3._operations.amazon_s3.put_bucket_abac

        output, http_response = (
            capo_s3._operations.amazon_s3.put_bucket_abac.put_bucket_abac(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutBucketAbac")
    )
    input_: capo_s3.types.put_bucket_abac_request.PutBucketAbacRequest = {
        "bucket": bucket,
        "abac_status": abac_status,
    }
    if content_md5 is not None:
        input_["content_md5"] = content_md5
    if checksum_algorithm is not None:
        input_["checksum_algorithm"] = checksum_algorithm
    if expected_bucket_owner is not None:
        input_["expected_bucket_owner"] = expected_bucket_owner

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output