Skip to content

list_object_annotations

list_object_annotations(
    bucket: BucketName,
    key: ObjectKey,
    *,
    config_overrides: Optional[S3ClientConfig] = None,
    version_id: Optional[ObjectVersionId] = None,
    max_annotation_results: Optional[MaxAnnotationResults] = None,
    annotation_prefix: Optional[AnnotationPrefix] = None,
    continuation_token: Optional[Token] = None,
    request_payer: Optional[RequestPayer] = None,
    expected_bucket_owner: Optional[AccountId] = None,
) -> ListObjectAnnotationsOutput

Lists the annotations attached to an Amazon S3 object. Results are paginated, with a maximum of 1,000 annotations per object. Use the AnnotationPrefix parameter to filter the results by name prefix.

To use this operation, you must have the s3:ListObjectAnnotations permission.

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 ListObjectAnnotations:

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.

  • max_annotation_results (Optional[MaxAnnotationResults], default: None ) –

    The maximum number of annotations to return in the response. Maximum is 1,000.

  • annotation_prefix (Optional[AnnotationPrefix], default: None ) –

    Filter results to annotations whose name begins with the specified prefix.

  • continuation_token (Optional[Token], default: None ) –

    Continuation token returned by a previous request to retrieve the next page.

  • expected_bucket_owner (Optional[AccountId], default: None ) –

    The account ID of the expected bucket owner.

Raises:

Source code in docs_src/capo_s3/_services/s3.py
def list_object_annotations(
    self,
    bucket: "capo_s3.types.bucket_name.BucketName",
    key: "capo_s3.types.object_key.ObjectKey",
    *,
    config_overrides: Optional[S3ClientConfig] = None,
    version_id: Optional["capo_s3.types.object_version_id.ObjectVersionId"] = None,
    max_annotation_results: Optional[
        "capo_s3.types.max_annotation_results.MaxAnnotationResults"
    ] = None,
    annotation_prefix: Optional[
        "capo_s3.types.annotation_prefix.AnnotationPrefix"
    ] = None,
    continuation_token: Optional["capo_s3.types.token.Token"] = None,
    request_payer: Optional["capo_s3.types.request_payer.RequestPayer"] = None,
    expected_bucket_owner: Optional["capo_s3.types.account_id.AccountId"] = None,
) -> "capo_s3.types.list_object_annotations_output.ListObjectAnnotationsOutput":
    """<p>Lists the annotations attached to an Amazon S3 object. Results are paginated, with a maximum of 1,000 annotations per object. Use the <code>AnnotationPrefix</code> parameter to filter the results by name prefix.</p> <p>To use this operation, you must have the <code>s3:ListObjectAnnotations</code> permission.</p> <note> <p>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).</p> </note> <p>The following operations are related to <code>ListObjectAnnotations</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectAnnotation.html">PutObjectAnnotation</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAnnotation.html">GetObjectAnnotation</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjectAnnotation.html">DeleteObjectAnnotation</a> </p> </li> </ul>

    Args:
        bucket: <p>The name of the bucket that contains the object.</p>
        key: <p>The object key.</p>
        version_id: <p>The version ID of the object.</p>
        max_annotation_results: <p>The maximum number of annotations to return in the response. Maximum is 1,000.</p>
        annotation_prefix: <p>Filter results to annotations whose name begins with the specified prefix.</p>
        continuation_token: <p>Continuation token returned by a previous request to retrieve the next page.</p>
        expected_bucket_owner: <p>The account ID of the expected bucket owner.</p>

    Raises:
        capo_s3.errors.invalid_prefix.InvalidPrefix: <p>The annotation prefix you provided is invalid.</p>
        capo_s3.errors.no_such_bucket.NoSuchBucket: <p>The specified bucket does not exist.</p>
        capo_s3.errors.no_such_key.NoSuchKey: <p>The specified key does not exist.</p>
        capo_s3.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_s3.types.list_object_annotations_request.ListObjectAnnotationsRequest]",
    ) -> OperationResponse[
        "capo_s3.types.list_object_annotations_output.ListObjectAnnotationsOutput"
    ]:
        import capo_s3._operations.amazon_s3.list_object_annotations

        output, http_response = (
            capo_s3._operations.amazon_s3.list_object_annotations.list_object_annotations(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListObjectAnnotations")
    )
    input_: capo_s3.types.list_object_annotations_request.ListObjectAnnotationsRequest = {
        "bucket": bucket,
        "key": key,
    }
    if version_id is not None:
        input_["version_id"] = version_id
    if max_annotation_results is not None:
        input_["max_annotation_results"] = max_annotation_results
    if annotation_prefix is not None:
        input_["annotation_prefix"] = annotation_prefix
    if continuation_token is not None:
        input_["continuation_token"] = continuation_token
    if request_payer is not None:
        input_["request_payer"] = request_payer
    if expected_bucket_owner is not None:
        input_["expected_bucket_owner"] = expected_bucket_owner

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output