put_object_lock_configuration
(**kwargs)¶Places an Object Lock configuration on the specified bucket. The rule specified in the Object Lock configuration will be applied by default to every new object placed in the specified bucket. For more information, see Locking Objects.
Note
DefaultRetention
settings require both a mode and a period.DefaultRetention
period can be either Days
or Years
but you must select one. You cannot specify Days
and Years
at the same time.See also: AWS API Documentation
Request Syntax
response = client.put_object_lock_configuration(
Bucket='string',
ObjectLockConfiguration={
'ObjectLockEnabled': 'Enabled',
'Rule': {
'DefaultRetention': {
'Mode': 'GOVERNANCE'|'COMPLIANCE',
'Days': 123,
'Years': 123
}
}
},
RequestPayer='requester',
Token='string',
ContentMD5='string',
ChecksumAlgorithm='CRC32'|'CRC32C'|'SHA1'|'SHA256',
ExpectedBucketOwner='string'
)
[REQUIRED]
The bucket whose Object Lock configuration you want to create or replace.
The Object Lock configuration that you want to apply to the specified bucket.
Indicates whether this bucket has an Object Lock configuration enabled. Enable ObjectLockEnabled
when you apply ObjectLockConfiguration
to a bucket.
Specifies the Object Lock rule for the specified object. Enable the this rule when you apply ObjectLockConfiguration
to a bucket. Bucket settings require both a mode and a period. The period can be either Days
or Years
but you must select one. You cannot specify Days
and Years
at the same time.
The default Object Lock retention mode and period that you want to apply to new objects placed in the specified bucket. Bucket settings require both a mode and a period. The period can be either Days
or Years
but you must select one. You cannot specify Days
and Years
at the same time.
The default Object Lock retention mode you want to apply to new objects placed in the specified bucket. Must be used with either Days
or Years
.
The number of days that you want to specify for the default retention period. Must be used with Mode
.
The number of years that you want to specify for the default retention period. Must be used with Mode
.
The MD5 hash for the request body.
For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.
Indicates the algorithm used to create the checksum for the object when using the SDK. This header will not provide any additional functionality if not using the SDK. When sending this header, there must be a corresponding x-amz-checksum
or x-amz-trailer
header sent. Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad Request
. For more information, see Checking object integrity in the Amazon S3 User Guide .
If you provide an individual checksum, Amazon S3 ignores any provided ChecksumAlgorithm
parameter.
403 Forbidden
(access denied).dict
Response Syntax
{
'RequestCharged': 'requester'
}
Response Structure
(dict) --
RequestCharged (string) --
If present, indicates that the requester was successfully charged for the request.