Amazon EC2 Container Registry

2017/10/11 - Amazon EC2 Container Registry - 5 new api methods

Changes  Update ecr client to latest version

PutLifecyclePolicy (new) Link ¶

Creates or updates a lifecycle policy.

See also: AWS API Documentation

Request Syntax

client.put_lifecycle_policy(
    registryId='string',
    repositoryName='string',
    lifecyclePolicyText='string'
)
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 to receive the policy.

type lifecyclePolicyText:

string

param lifecyclePolicyText:

[REQUIRED]

The JSON repository policy text to apply to the repository.

rtype:

dict

returns:

Response Syntax

{
    'registryId': 'string',
    'repositoryName': 'string',
    'lifecyclePolicyText': 'string'
}

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 repository policy text.

GetLifecyclePolicy (new) Link ¶

Retrieves the specified lifecycle policy.

See also: AWS API Documentation

Request Syntax

client.get_lifecycle_policy(
    registryId='string',
    repositoryName='string'
)
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 with the policy to retrieve.

rtype:

dict

returns:

Response Syntax

{
    'registryId': 'string',
    'repositoryName': 'string',
    'lifecyclePolicyText': 'string',
    'lastEvaluatedAt': datetime(2015, 1, 1)
}

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 repository policy text.

    • lastEvaluatedAt (datetime) --

      The time stamp of the last time that the lifecycle policy was run.

DeleteLifecyclePolicy (new) Link ¶

Deletes the specified lifecycle policy.

See also: AWS API Documentation

Request Syntax

client.delete_lifecycle_policy(
    registryId='string',
    repositoryName='string'
)
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 that is associated with the repository policy to delete.

rtype:

dict

returns:

Response Syntax

{
    'registryId': 'string',
    'repositoryName': 'string',
    'lifecyclePolicyText': 'string',
    'lastEvaluatedAt': datetime(2015, 1, 1)
}

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 repository policy text.

    • lastEvaluatedAt (datetime) --

      The time stamp of the last time that the lifecycle policy was run.

GetLifecyclePolicyPreview (new) Link ¶

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'
    }
)
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 with the policy to retrieve.

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.

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 100. If this parameter is not used, then GetLifecyclePolicyPreviewRequest returns up to 100 results and a nextToken value, if applicable.

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 repository 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.

StartLifecyclePolicyPreview (new) Link ¶

Starts a preview of the specified lifecycle policy. This allows you to see the results before creating the lifecycle policy.

See also: AWS API Documentation

Request Syntax

client.start_lifecycle_policy_preview(
    registryId='string',
    repositoryName='string',
    lifecyclePolicyText='string'
)
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 to be evaluated.

type lifecyclePolicyText:

string

param lifecyclePolicyText:

The policy to be evaluated against. If you do not specify a policy, the current policy for the repository is used.

rtype:

dict

returns:

Response Syntax

{
    'registryId': 'string',
    'repositoryName': 'string',
    'lifecyclePolicyText': 'string',
    'status': 'IN_PROGRESS'|'COMPLETE'|'EXPIRED'|'FAILED'
}

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 repository policy text.

    • status (string) --

      The status of the lifecycle policy preview request.