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
2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 | |