put_object_lock_configuration
async
¶
put_object_lock_configuration(
bucket: BucketName,
*,
config_overrides: Optional[AsyncS3ClientConfig] = 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/async_s3.py
8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 | |