put_object_lock_configuration
¶
put_object_lock_configuration(
bucket: BucketName,
*,
config_overrides: Optional[S3ClientConfig] = None,
object_lock_configuration: Optional[ObjectLockConfiguration] = None,
request_payer: Optional[RequestPayer] = None,
token: Optional[ObjectLockToken] = None,
content_md5: Optional[ContentMD5] = None,
checksum_algorithm: Optional[ChecksumAlgorithm] = None,
expected_bucket_owner: Optional[AccountId] = None,
) -> PutObjectLockConfigurationOutput
This operation is not supported for directory buckets.
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.
-
The
DefaultRetentionsettings require both a mode and a period. -
The
DefaultRetentionperiod can be eitherDaysorYearsbut you must select one. You cannot specifyDaysandYearsat the same time. -
You can enable Object Lock for new or existing buckets. For more information, see Configuring Object Lock.
You must URL encode any signed header values that contain spaces. For example, if your header value is my file.txt, containing two spaces after my, you must URL encode this value to my%20%20file.txt.
Parameters:
-
bucket(BucketName) –The bucket whose Object Lock configuration you want to create or replace.
-
object_lock_configuration(Optional[ObjectLockConfiguration], default:None) –The Object Lock configuration that you want to apply to the specified bucket.
-
token(Optional[ObjectLockToken], default:None) –A token to allow Object Lock to be enabled for an existing bucket.
-
content_md5(Optional[ContentMD5], default:None) –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.
-
checksum_algorithm(Optional[ChecksumAlgorithm], default:None) –Indicates the algorithm used to create the checksum for the object when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding
x-amz-checksumorx-amz-trailerheader sent. Otherwise, Amazon S3 fails the request with the HTTP status code400 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
ChecksumAlgorithmparameter. -
expected_bucket_owner(Optional[AccountId], default:None) –The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code
403 Forbidden(access denied).
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_s3/_services/s3.py
8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 | |