put_object_annotation
¶
put_object_annotation(
bucket: BucketName,
key: ObjectKey,
annotation_name: AnnotationName,
annotation_payload: Body[Iterator[bytes]] | Iterator[bytes] | bytes,
*,
config_overrides: Optional[S3ClientConfig] = None,
version_id: Optional[ObjectVersionId] = None,
object_if_match: Optional[ObjectIfMatch] = None,
checksum_algorithm: Optional[ChecksumAlgorithm] = None,
checksum_crc32: Optional[ChecksumCRC32] = None,
checksum_crc32_c: Optional[ChecksumCRC32C] = None,
checksum_crc64_nvme: Optional[ChecksumCRC64NVME] = None,
checksum_sha1: Optional[ChecksumSHA1] = None,
checksum_sha256: Optional[ChecksumSHA256] = None,
checksum_sha512: Optional[ChecksumSHA512] = None,
checksum_md5: Optional[ChecksumMD5] = None,
checksum_xxhash64: Optional[ChecksumXXHASH64] = None,
checksum_xxhash3: Optional[ChecksumXXHASH3] = None,
checksum_xxhash128: Optional[ChecksumXXHASH128] = None,
content_md5: Optional[ContentMD5] = None,
request_payer: Optional[RequestPayer] = None,
expected_bucket_owner: Optional[AccountId] = None,
) -> PutObjectAnnotationOutput
Attaches an annotation to an Amazon S3 object. An annotation is a named payload of 1 byte to 1 MiB that you can associate with a specific object or object version. Each object can have up to 1,000 annotations.
For annotation naming rules and restrictions, see Annotation naming guidelines in the Amazon S3 User Guide.
Annotations inherit the encryption of their parent object. For objects without server-side encryption, annotations are encrypted with SSE-S3 (the default for new objects). Objects encrypted with SSE-C cannot have annotations.
To use this operation, you must have the s3:PutObjectAnnotation permission. If the bucket has Requester Pays enabled, you must include the x-amz-request-payer header.
Annotations are not supported by the following features: S3 Inventory Reports, API Gateway, S3 Storage Lens, Amazon S3 File Gateway, Amazon FSx, S3 on Outposts, and S3 Express One Zone (directory buckets).
The following operations are related to PutObjectAnnotation:
Parameters:
-
bucket(BucketName) –The name of the bucket that contains the object.
-
key(ObjectKey) –The object key.
-
version_id(Optional[ObjectVersionId], default:None) –The version ID of the object to attach the annotation to.
-
annotation_name(AnnotationName) –The name of the annotation.
Length Constraints: Minimum length of 1. Maximum length of 512 bytes.
-
annotation_payload(Body[Iterator[bytes]] | Iterator[bytes] | bytes) –The annotation payload. Must be between 1 byte and 1 MiB in size, and must be valid UTF-8 encoded text. If the payload contains invalid UTF-8 bytes, the request fails with HTTP 415 (Unsupported Media Type). To store binary data, encode the payload using Base64 before uploading.
-
object_if_match(Optional[ObjectIfMatch], default:None) –If specified, the operation only succeeds if the object's ETag matches the provided value.
-
checksum_algorithm(Optional[ChecksumAlgorithm], default:None) –The checksum algorithm to use. Supported values:
CRC32,CRC32C,CRC64NVME,SHA1,SHA256,SHA512,MD5,XXHASH64,XXHASH3,XXHASH128. -
checksum_crc32(Optional[ChecksumCRC32], default:None) –Base64-encoded CRC32 checksum of the annotation payload.
-
checksum_crc32_c(Optional[ChecksumCRC32C], default:None) –Base64-encoded CRC32C checksum of the annotation payload.
-
checksum_crc64_nvme(Optional[ChecksumCRC64NVME], default:None) –Base64-encoded CRC64NVME checksum of the annotation payload.
-
checksum_sha1(Optional[ChecksumSHA1], default:None) –Base64-encoded SHA1 checksum of the annotation payload.
-
checksum_sha256(Optional[ChecksumSHA256], default:None) –Base64-encoded SHA256 checksum of the annotation payload.
-
checksum_sha512(Optional[ChecksumSHA512], default:None) –Base64-encoded SHA512 checksum of the annotation payload.
-
checksum_md5(Optional[ChecksumMD5], default:None) –Base64-encoded MD5 checksum of the annotation payload.
-
checksum_xxhash64(Optional[ChecksumXXHASH64], default:None) –Base64-encoded XXHASH64 checksum of the annotation payload.
-
checksum_xxhash3(Optional[ChecksumXXHASH3], default:None) –Base64-encoded XXHASH3 checksum of the annotation payload.
-
checksum_xxhash128(Optional[ChecksumXXHASH128], default:None) –Base64-encoded XXHASH128 checksum of the annotation payload.
-
content_md5(Optional[ContentMD5], default:None) –Base64-encoded MD5 digest of the message.
-
expected_bucket_owner(Optional[AccountId], default:None) –The account ID of the expected bucket owner. If the bucket is owned by a different account, the request fails with an HTTP 403 (Access Denied) error.
Raises:
-
AnnotationLimitExceeded–The request would exceed the maximum number of annotations allowed per object.
-
AnnotationNameTooLong–The annotation name exceeds 512 bytes.
-
InvalidAnnotationName–The annotation name you provided is invalid.
-
InvalidRequest–A parameter or header in your request isn't valid. For details, see the description of this API operation.
-
NoSuchBucket–The specified bucket does not exist.
-
NoSuchKey–The specified key does not exist.
-
UnsupportedMediaType–The annotation payload is not valid UTF-8 encoded text.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_s3/_services/s3.py
8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 | |