Skip to content

/AWS1/IF_ECR=>LISTIMAGEREFERRERS()

About ListImageReferrers

Lists the artifacts associated with a specified subject image.

Method Signature

METHODS /AWS1/IF_ECR~LISTIMAGEREFERRERS
  IMPORTING
    !IV_REGISTRYID TYPE /AWS1/ECRREGISTRYID OPTIONAL
    !IV_REPOSITORYNAME TYPE /AWS1/ECRREPOSITORYNAME OPTIONAL
    !IO_SUBJECTID TYPE REF TO /AWS1/CL_ECRSUBJECTIDENTIFIER OPTIONAL
    !IO_FILTER TYPE REF TO /AWS1/CL_ECRLSTIMAGEREFERRER01 OPTIONAL
    !IV_NEXTTOKEN TYPE /AWS1/ECRNEXTTOKEN OPTIONAL
    !IV_MAXRESULTS TYPE /AWS1/ECRFIFTYMAXRESULTS OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ecrlstimagereferrer02
  RAISING
    /AWS1/CX_ECRINVALIDPARAMETEREX
    /AWS1/CX_ECRREPOSITORYNOTFNDEX
    /AWS1/CX_ECRSERVEREXCEPTION
    /AWS1/CX_ECRVALIDATIONEX
    /AWS1/CX_ECRCLIENTEXC
    /AWS1/CX_ECRSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_repositoryname TYPE /AWS1/ECRREPOSITORYNAME /AWS1/ECRREPOSITORYNAME

The name of the repository that contains the subject image.

io_subjectid TYPE REF TO /AWS1/CL_ECRSUBJECTIDENTIFIER /AWS1/CL_ECRSUBJECTIDENTIFIER

An object containing the image digest of the subject image for which to retrieve associated artifacts.

Optional arguments:

iv_registryid TYPE /AWS1/ECRREGISTRYID /AWS1/ECRREGISTRYID

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.

io_filter TYPE REF TO /AWS1/CL_ECRLSTIMAGEREFERRER01 /AWS1/CL_ECRLSTIMAGEREFERRER01

The filter key and value with which to filter your ListImageReferrers results. If no filter is specified, only artifacts with ACTIVE status are returned.

iv_nexttoken TYPE /AWS1/ECRNEXTTOKEN /AWS1/ECRNEXTTOKEN

The nextToken value returned from a previous paginated ListImageReferrers request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when 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.

iv_maxresults TYPE /AWS1/ECRFIFTYMAXRESULTS /AWS1/ECRFIFTYMAXRESULTS

The maximum number of image referrer results returned by ListImageReferrers in paginated output. When this parameter is used, ListImageReferrers only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListImageReferrers request with the returned nextToken value. This value can be between 1 and 50. If this parameter is not used, then ListImageReferrers returns up to 50 results and a nextToken value, if applicable.

RETURNING

oo_output TYPE REF TO /aws1/cl_ecrlstimagereferrer02 /AWS1/CL_ECRLSTIMAGEREFERRER02

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->listimagereferrers(
  io_filter = new /aws1/cl_ecrlstimagereferrer01(
    it_artifacttypes = VALUE /aws1/cl_ecrartifacttypelist_w=>tt_artifacttypelist(
      ( new /aws1/cl_ecrartifacttypelist_w( |string| ) )
    )
    iv_artifactstatus = |string|
  )
  io_subjectid = new /aws1/cl_ecrsubjectidentifier( |string| )
  iv_maxresults = 123
  iv_nexttoken = |string|
  iv_registryid = |string|
  iv_repositoryname = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_referrers( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_imagedigest = lo_row_1->get_digest( ).
      lv_mediatype = lo_row_1->get_mediatype( ).
      lv_artifacttype = lo_row_1->get_artifacttype( ).
      lv_imagesizeinbytes = lo_row_1->get_size( ).
      LOOP AT lo_row_1->get_annotations( ) into ls_row_2.
        lv_key = ls_row_2-key.
        lo_value = ls_row_2-value.
        IF lo_value IS NOT INITIAL.
          lv_string = lo_value->get_value( ).
        ENDIF.
      ENDLOOP.
      lv_artifactstatus = lo_row_1->get_artifactstatus( ).
    ENDIF.
  ENDLOOP.
  lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.

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.

DATA(lo_result) = lo_client->listimagereferrers(
  io_filter = new /aws1/cl_ecrlstimagereferrer01( iv_artifactstatus = |ANY| )
  io_subjectid = new /aws1/cl_ecrsubjectidentifier( |sha256:943e640159415616581703a53fa4ed87e96740655fd67daf2d2146a35337bce5| )
  iv_repositoryname = |sample-repo|
).

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.

DATA(lo_result) = lo_client->listimagereferrers(
  io_subjectid = new /aws1/cl_ecrsubjectidentifier( |sha256:943e640159415616581703a53fa4ed87e96740655fd67daf2d2146a35337bce5| )
  iv_repositoryname = |sample-repo|
).

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.

DATA(lo_result) = lo_client->listimagereferrers(
  io_filter = new /aws1/cl_ecrlstimagereferrer01(
    it_artifacttypes = VALUE /aws1/cl_ecrartifacttypelist_w=>tt_artifacttypelist(
      ( new /aws1/cl_ecrartifacttypelist_w( |application/vnd.dev.sigstore.bundle.v0.3+json| ) )
    )
  )
  io_subjectid = new /aws1/cl_ecrsubjectidentifier( |sha256:943e640159415616581703a53fa4ed87e96740655fd67daf2d2146a35337bce5| )
  iv_repositoryname = |sample-repo|
).