Amazon EC2 Container Registry

2018/12/17 - Amazon EC2 Container Registry - 3 new 4 updated api methods

Changes  This release adds support for ECR repository tagging.

ListTagsForResource (new) Link ¶

List the tags for an Amazon ECR resource.

See also: AWS API Documentation

Request Syntax

client.list_tags_for_resource(
    resourceArn='string'
)
type resourceArn

string

param resourceArn

[REQUIRED]

The Amazon Resource Name (ARN) that identifies the resource for which to list the tags. Currently, the only supported resource is an Amazon ECR repository.

rtype

dict

returns

Response Syntax

{
    'tags': [
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • tags (list) --

      The tags for the resource.

      • (dict) --

        The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

        • Key (string) --

          One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

        • Value (string) --

          The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).

UntagResource (new) Link ¶

Deletes specified tags from a resource.

See also: AWS API Documentation

Request Syntax

client.untag_resource(
    resourceArn='string',
    tagKeys=[
        'string',
    ]
)
type resourceArn

string

param resourceArn

[REQUIRED]

The Amazon Resource Name (ARN) of the resource from which to remove tags. Currently, the only supported resource is an Amazon ECR repository.

type tagKeys

list

param tagKeys

[REQUIRED]

The keys of the tags to be removed.

  • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

TagResource (new) Link ¶

Adds specified tags to a resource with the specified ARN. Existing tags on a resource are not changed if they are not specified in the request parameters.

See also: AWS API Documentation

Request Syntax

client.tag_resource(
    resourceArn='string',
    tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type resourceArn

string

param resourceArn

[REQUIRED]

The Amazon Resource Name (ARN) of the the resource to which to add tags. Currently, the only supported resource is an Amazon ECR repository.

type tags

list

param tags

[REQUIRED]

The tags to add to the resource. A tag is an array of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

  • (dict) --

    The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

    • Key (string) --

      One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

    • Value (string) --

      The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

CreateRepository (updated) Link ¶
Changes (request)
{'tags': [{'Key': 'string', 'Value': 'string'}]}

Creates an image repository.

See also: AWS API Documentation

Request Syntax

client.create_repository(
    repositoryName='string',
    tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type repositoryName

string

param repositoryName

[REQUIRED]

The name to use for the repository. The repository name may be specified on its own (such as nginx-web-app ) or it can be prepended with a namespace to group the repository into a category (such as project-a/nginx-web-app ).

type tags

list

param tags
  • (dict) --

    The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

    • Key (string) --

      One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

    • Value (string) --

      The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).

rtype

dict

returns

Response Syntax

{
    'repository': {
        'repositoryArn': 'string',
        'registryId': 'string',
        'repositoryName': 'string',
        'repositoryUri': 'string',
        'createdAt': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • repository (dict) --

      The repository that was created.

      • repositoryArn (string) --

        The Amazon Resource Name (ARN) that identifies the repository. The ARN contains the arn:aws:ecr namespace, followed by the region of the repository, AWS account ID of the repository owner, repository namespace, and repository name. For example, arn:aws:ecr:region:012345678910:repository/test .

      • registryId (string) --

        The AWS account ID associated with the registry that contains the repository.

      • repositoryName (string) --

        The name of the repository.

      • repositoryUri (string) --

        The URI for the repository. You can use this URI for Docker push or pull operations.

      • createdAt (datetime) --

        The date and time, in JavaScript date format, when the repository was created.

DescribeImages (updated) Link ¶
Changes (request)
{'filter': {'tagStatus': {'ANY'}}}

Returns metadata about the images in a repository, including image size, image tags, and creation date.

Note

Beginning with Docker version 1.9, the Docker client compresses image layers before pushing them to a V2 Docker registry. The output of the docker images command shows the uncompressed image size, so it may return a larger image size than the image sizes returned by DescribeImages.

See also: AWS API Documentation

Request Syntax

client.describe_images(
    registryId='string',
    repositoryName='string',
    imageIds=[
        {
            'imageDigest': 'string',
            'imageTag': 'string'
        },
    ],
    nextToken='string',
    maxResults=123,
    filter={
        'tagStatus': 'TAGGED'|'UNTAGGED'|'ANY'
    }
)
type registryId

string

param registryId

The AWS account ID associated with the registry that contains the repository in which to describe images. If you do not specify a registry, the default registry is assumed.

type repositoryName

string

param repositoryName

[REQUIRED]

A list of repositories to describe.

type imageIds

list

param imageIds

The list of image IDs for the requested repository.

  • (dict) --

    An object with identifying information for an Amazon ECR image.

    • imageDigest (string) --

      The sha256 digest of the image manifest.

    • imageTag (string) --

      The tag used for the image.

type nextToken

string

param nextToken

The nextToken value returned from a previous paginated DescribeImages 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 option cannot be used when you specify images with imageIds .

type maxResults

integer

param maxResults

The maximum number of repository results returned by DescribeImages in paginated output. When this parameter is used, DescribeImages 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 DescribeImages request with the returned nextToken value. This value can be between 1 and 1000. If this parameter is not used, then DescribeImages returns up to 100 results and a nextToken value, if applicable. This option cannot be used when you specify images with imageIds .

type filter

dict

param filter

The filter key and value with which to filter your DescribeImages results.

  • tagStatus (string) --

    The tag status with which to filter your DescribeImages results. You can filter results based on whether they are TAGGED or UNTAGGED .

rtype

dict

returns

Response Syntax

{
    'imageDetails': [
        {
            'registryId': 'string',
            'repositoryName': 'string',
            'imageDigest': 'string',
            'imageTags': [
                'string',
            ],
            'imageSizeInBytes': 123,
            'imagePushedAt': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • imageDetails (list) --

      A list of ImageDetail objects that contain data about the image.

      • (dict) --

        An object that describes an image returned by a DescribeImages operation.

        • registryId (string) --

          The AWS account ID associated with the registry to which this image belongs.

        • repositoryName (string) --

          The name of the repository to which this image belongs.

        • imageDigest (string) --

          The sha256 digest of the image manifest.

        • imageTags (list) --

          The list of tags associated with this image.

          • (string) --

        • imageSizeInBytes (integer) --

          The size, in bytes, of the image in the repository.

          Note

          Beginning with Docker version 1.9, the Docker client compresses image layers before pushing them to a V2 Docker registry. The output of the docker images command shows the uncompressed image size, so it may return a larger image size than the image sizes returned by DescribeImages.

        • imagePushedAt (datetime) --

          The date and time, expressed in standard JavaScript date format, at which the current image was pushed to the repository.

    • nextToken (string) --

      The nextToken value to include in a future DescribeImages request. When the results of a DescribeImages request exceed maxResults , this value can be used to retrieve the next page of results. This value is null when there are no more results to return.

GetLifecyclePolicyPreview (updated) Link ¶
Changes (request)
{'filter': {'tagStatus': {'ANY'}}}

Retrieves the results of the specified lifecycle policy preview request.

See also: AWS API Documentation

Request Syntax

client.get_lifecycle_policy_preview(
    registryId='string',
    repositoryName='string',
    imageIds=[
        {
            'imageDigest': 'string',
            'imageTag': 'string'
        },
    ],
    nextToken='string',
    maxResults=123,
    filter={
        'tagStatus': 'TAGGED'|'UNTAGGED'|'ANY'
    }
)
type registryId

string

param registryId

The AWS account ID associated with the registry that contains the repository. If you do not specify a registry, the default registry is assumed.

type repositoryName

string

param repositoryName

[REQUIRED]

The name of the repository.

type imageIds

list

param imageIds

The list of imageIDs to be included.

  • (dict) --

    An object with identifying information for an Amazon ECR image.

    • imageDigest (string) --

      The sha256 digest of the image manifest.

    • imageTag (string) --

      The tag used for the image.

type nextToken

string

param nextToken

The nextToken value returned from a previous paginated GetLifecyclePolicyPreviewRequest 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 option cannot be used when you specify images with imageIds .

type maxResults

integer

param maxResults

The maximum number of repository results returned by GetLifecyclePolicyPreviewRequest in paginated output. When this parameter is used, GetLifecyclePolicyPreviewRequest 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 GetLifecyclePolicyPreviewRequest request with the returned nextToken value. This value can be between 1 and 1000. If this parameter is not used, then GetLifecyclePolicyPreviewRequest returns up to 100 results and a nextToken value, if applicable. This option cannot be used when you specify images with imageIds .

type filter

dict

param filter

An optional parameter that filters results based on image tag status and all tags, if tagged.

  • tagStatus (string) --

    The tag status of the image.

rtype

dict

returns

Response Syntax

{
    'registryId': 'string',
    'repositoryName': 'string',
    'lifecyclePolicyText': 'string',
    'status': 'IN_PROGRESS'|'COMPLETE'|'EXPIRED'|'FAILED',
    'nextToken': 'string',
    'previewResults': [
        {
            'imageTags': [
                'string',
            ],
            'imageDigest': 'string',
            'imagePushedAt': datetime(2015, 1, 1),
            'action': {
                'type': 'EXPIRE'
            },
            'appliedRulePriority': 123
        },
    ],
    'summary': {
        'expiringImageTotalCount': 123
    }
}

Response Structure

  • (dict) --

    • registryId (string) --

      The registry ID associated with the request.

    • repositoryName (string) --

      The repository name associated with the request.

    • lifecyclePolicyText (string) --

      The JSON lifecycle policy text.

    • status (string) --

      The status of the lifecycle policy preview request.

    • nextToken (string) --

      The nextToken value to include in a future GetLifecyclePolicyPreview request. When the results of a GetLifecyclePolicyPreview request exceed maxResults , this value can be used to retrieve the next page of results. This value is null when there are no more results to return.

    • previewResults (list) --

      The results of the lifecycle policy preview request.

      • (dict) --

        The result of the lifecycle policy preview.

        • imageTags (list) --

          The list of tags associated with this image.

          • (string) --

        • imageDigest (string) --

          The sha256 digest of the image manifest.

        • imagePushedAt (datetime) --

          The date and time, expressed in standard JavaScript date format, at which the current image was pushed to the repository.

        • action (dict) --

          The type of action to be taken.

          • type (string) --

            The type of action to be taken.

        • appliedRulePriority (integer) --

          The priority of the applied rule.

    • summary (dict) --

      The list of images that is returned as a result of the action.

      • expiringImageTotalCount (integer) --

        The number of expiring images.

ListImages (updated) Link ¶
Changes (request)
{'filter': {'tagStatus': {'ANY'}}}

Lists all the image IDs for a given repository.

You can filter images based on whether or not they are tagged by setting the tagStatus parameter to TAGGED or UNTAGGED . For example, you can filter your results to return only UNTAGGED images and then pipe that result to a BatchDeleteImage operation to delete them. Or, you can filter your results to return only TAGGED images to list all of the tags in your repository.

See also: AWS API Documentation

Request Syntax

client.list_images(
    registryId='string',
    repositoryName='string',
    nextToken='string',
    maxResults=123,
    filter={
        'tagStatus': 'TAGGED'|'UNTAGGED'|'ANY'
    }
)
type registryId

string

param registryId

The AWS account ID associated with the registry that contains the repository in which to list images. If you do not specify a registry, the default registry is assumed.

type repositoryName

string

param repositoryName

[REQUIRED]

The repository with image IDs to be listed.

type nextToken

string

param nextToken

The nextToken value returned from a previous paginated ListImages 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.

Note

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.

type maxResults

integer

param maxResults

The maximum number of image results returned by ListImages in paginated output. When this parameter is used, ListImages 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 ListImages request with the returned nextToken value. This value can be between 1 and 1000. If this parameter is not used, then ListImages returns up to 100 results and a nextToken value, if applicable.

type filter

dict

param filter

The filter key and value with which to filter your ListImages results.

  • tagStatus (string) --

    The tag status with which to filter your ListImages results. You can filter results based on whether they are TAGGED or UNTAGGED .

rtype

dict

returns

Response Syntax

{
    'imageIds': [
        {
            'imageDigest': 'string',
            'imageTag': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • imageIds (list) --

      The list of image IDs for the requested repository.

      • (dict) --

        An object with identifying information for an Amazon ECR image.

        • imageDigest (string) --

          The sha256 digest of the image manifest.

        • imageTag (string) --

          The tag used for the image.

    • nextToken (string) --

      The nextToken value to include in a future ListImages request. When the results of a ListImages request exceed maxResults , this value can be used to retrieve the next page of results. This value is null when there are no more results to return.