list_image_referrers
¶
list_image_referrers(
repository_name: RepositoryName,
subject_id: SubjectIdentifier,
*,
config_overrides: Optional[ECRClientConfig] = None,
registry_id: Optional[RegistryId] = None,
filter: Optional[ListImageReferrersFilter] = None,
next_token: Optional[NextToken] = None,
max_results: Optional[FiftyMaxResults] = None,
) -> ListImageReferrersResponse
Lists the artifacts associated with a specified subject image.
The IAM principal invoking this operation must have the ecr:BatchGetImage permission.
Parameters:
-
registry_id(Optional[RegistryId], default:None) –The Amazon Web Services account ID associated with the registry that contains the repository in which to list image referrers. If you do not specify a registry, the default registry is assumed.
-
repository_name(RepositoryName) –The name of the repository that contains the subject image.
-
subject_id(SubjectIdentifier) –An object containing the image digest of the subject image for which to retrieve associated artifacts.
-
filter(Optional[ListImageReferrersFilter], default:None) –The filter key and value with which to filter your
ListImageReferrersresults. If no filter is specified, only artifacts withACTIVEstatus are returned. -
next_token(Optional[NextToken], default:None) –The
nextTokenvalue returned from a previous paginatedListImageReferrersrequest wheremaxResultswas used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned thenextTokenvalue. This value isnullwhen there are no more results to return.This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.
-
max_results(Optional[FiftyMaxResults], default:None) –The maximum number of image referrer results returned by
ListImageReferrersin paginated output. When this parameter is used,ListImageReferrersonly returnsmaxResultsresults in a single page along with anextTokenresponse element. The remaining results of the initial request can be seen by sending anotherListImageReferrersrequest with the returnednextTokenvalue. This value can be between 1 and 50. If this parameter is not used, thenListImageReferrersreturns up to 20 results and anextTokenvalue, if applicable.
Raises:
-
InvalidParameterException–The specified parameter is invalid. Review the available parameters for the API request.
-
RepositoryNotFoundException–The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.
-
ServerException–These errors are usually caused by a server-side issue.
-
UnableToListUpstreamImageReferrersException–The referrer or referrers were unable to be listed using the pull through cache rule. This is usually caused because of an issue with the Secrets Manager secret containing the credentials for the upstream registry.
-
ValidationException–There was an exception validating this request.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To list both active and archived artifacts This example lists all artifacts including those that have been archived, by specifying the artifactStatus filter as ANY.
>>> client.list_image_referrers(repository_name='sample-repo', subject_id={'imageDigest': 'sha256:943e640159415616581703a53fa4ed87e96740655fd67daf2d2146a35337bce5'}, filter={'artifactStatus': 'ANY'})
To list artifacts associated with a subject image
This example lists all artifacts (such as Sigstore signatures) that reference a specific container image in the sample-repo repository.
>>> client.list_image_referrers(repository_name='sample-repo', subject_id={'imageDigest': 'sha256:943e640159415616581703a53fa4ed87e96740655fd67daf2d2146a35337bce5'})
To list artifacts of a specific type
This example lists only Sigstore bundle artifacts associated with a subject image by filtering on the artifact type.
>>> client.list_image_referrers(repository_name='sample-repo', subject_id={'imageDigest': 'sha256:943e640159415616581703a53fa4ed87e96740655fd67daf2d2146a35337bce5'}, filter={'artifactTypes': ['application/vnd.dev.sigstore.bundle.v0.3+json']})
Source code in docs_src/capo_ecr/_services/ecr.py
2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 | |