put_object_retention
¶
put_object_retention(
bucket: BucketName,
key: ObjectKey,
*,
config_overrides: Optional[S3ClientConfig] = None,
retention: Optional[ObjectLockRetention] = None,
request_payer: Optional[RequestPayer] = None,
version_id: Optional[ObjectVersionId] = None,
bypass_governance_retention: Optional[BypassGovernanceRetention] = None,
content_md5: Optional[ContentMD5] = None,
checksum_algorithm: Optional[ChecksumAlgorithm] = None,
expected_bucket_owner: Optional[AccountId] = None,
) -> PutObjectRetentionOutput
This operation is not supported for directory buckets.
Places an Object Retention configuration on an object. For more information, see Locking Objects. Users or accounts require the s3:PutObjectRetention permission in order to place an Object Retention configuration on objects. Bypassing a Governance Retention configuration requires the s3:BypassGovernanceRetention permission.
This functionality is not supported for Amazon S3 on Outposts.
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 name that contains the object you want to apply this Object Retention configuration to.
Access points - When you use this action with an access point for general purpose buckets, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When you use this action with an access point for directory buckets, you must provide the access point name in place of the bucket name. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
-
key(ObjectKey) –The key name for the object that you want to apply this Object Retention configuration to.
-
retention(Optional[ObjectLockRetention], default:None) –The container element for the Object Retention configuration.
-
version_id(Optional[ObjectVersionId], default:None) –The version ID for the object that you want to apply this Object Retention configuration to.
-
bypass_governance_retention(Optional[BypassGovernanceRetention], default:None) –Indicates whether this action should bypass Governance-mode restrictions.
-
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
8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 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 | |