Skip to content

put_bucket_lifecycle_configuration

put_bucket_lifecycle_configuration(
    account_id: AccountId,
    bucket: BucketName,
    *,
    config_overrides: Optional[S3ControlClientConfig] = None,
    lifecycle_configuration: Optional[LifecycleConfiguration] = None,
) -> None

This action puts a lifecycle configuration to an Amazon S3 on Outposts bucket. To put a lifecycle configuration to an S3 bucket, see PutBucketLifecycleConfiguration in the Amazon S3 API Reference.

Creates a new lifecycle configuration for the S3 on Outposts bucket or replaces an existing lifecycle configuration. Outposts buckets only support lifecycle configurations that delete/expire objects after a certain period of time and abort incomplete multipart uploads.

All Amazon S3 on Outposts REST API requests for this action require an additional parameter of x-amz-outpost-id to be passed with the request. In addition, you must use an S3 on Outposts endpoint hostname prefix instead of s3-control. For an example of the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and the x-amz-outpost-id derived by using the access point ARN, see the Examples section.

The following actions are related to PutBucketLifecycleConfiguration:

Parameters:

  • account_id (AccountId) –

    The Amazon Web Services account ID of the Outposts bucket.

  • bucket (BucketName) –

    The name of the bucket for which to set the configuration.

  • lifecycle_configuration (Optional[LifecycleConfiguration], default: None ) –

    Container for lifecycle rules. You can add as many as 1,000 rules.

Raises:

Source code in docs_src/capo_s3_control/_services/s3_control.py
def put_bucket_lifecycle_configuration(
    self,
    account_id: "capo_s3_control.types.account_id.AccountId",
    bucket: "capo_s3_control.types.bucket_name.BucketName",
    *,
    config_overrides: Optional[S3ControlClientConfig] = None,
    lifecycle_configuration: Optional[
        "capo_s3_control.types.lifecycle_configuration.LifecycleConfiguration"
    ] = None,
) -> None:
    """<note> <p>This action puts a lifecycle configuration to an Amazon S3 on Outposts bucket. To put a lifecycle configuration to an S3 bucket, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycleConfiguration.html">PutBucketLifecycleConfiguration</a> in the <i>Amazon S3 API Reference</i>. </p> </note> <p>Creates a new lifecycle configuration for the S3 on Outposts bucket or replaces an existing lifecycle configuration. Outposts buckets only support lifecycle configurations that delete/expire objects after a certain period of time and abort incomplete multipart uploads.</p> <p></p> <p>All Amazon S3 on Outposts REST API requests for this action require an additional parameter of <code>x-amz-outpost-id</code> to be passed with the request. In addition, you must use an S3 on Outposts endpoint hostname prefix instead of <code>s3-control</code>. For an example of the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and the <code>x-amz-outpost-id</code> derived by using the access point ARN, see the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketLifecycleConfiguration.html#API_control_PutBucketLifecycleConfiguration_Examples">Examples</a> section.</p> <p>The following actions are related to <code>PutBucketLifecycleConfiguration</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketLifecycleConfiguration.html">GetBucketLifecycleConfiguration</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucketLifecycleConfiguration.html">DeleteBucketLifecycleConfiguration</a> </p> </li> </ul>

    Args:
        account_id: <p>The Amazon Web Services account ID of the Outposts bucket.</p>
        bucket: <p>The name of the bucket for which to set the configuration.</p>
        lifecycle_configuration: <p>Container for lifecycle rules. You can add as many as 1,000 rules.</p>

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

    def _handler(
        req: "OperationRequest[capo_s3_control.types.put_bucket_lifecycle_configuration_request.PutBucketLifecycleConfigurationRequest]",
    ) -> OperationResponse[None]:
        import capo_s3_control._operations.awss3_control_service_v20180820.put_bucket_lifecycle_configuration

        output, http_response = (
            capo_s3_control._operations.awss3_control_service_v20180820.put_bucket_lifecycle_configuration.put_bucket_lifecycle_configuration(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutBucketLifecycleConfiguration")
    )
    input_: capo_s3_control.types.put_bucket_lifecycle_configuration_request.PutBucketLifecycleConfigurationRequest = {
        "account_id": account_id,
        "bucket": bucket,
    }
    if lifecycle_configuration is not None:
        input_["lifecycle_configuration"] = lifecycle_configuration

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