You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::ECR::Client

Inherits:
Seahorse::Client::Base show all
Includes:
ClientStubs
Defined in:
gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

API Operations collapse

Instance Method Summary collapse

Methods included from ClientStubs

#stub_data, #stub_responses

Methods inherited from Seahorse::Client::Base

add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(*args) ⇒ Client

Returns a new instance of Client

Parameters:

  • options (Hash)

    a customizable set of options



163
164
165
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 163

def initialize(*args)
  super
end

Instance Method Details

#batch_check_layer_availability(params = {}) ⇒ Types::BatchCheckLayerAvailabilityResponse

Check the availability of multiple image layers in a specified registry and repository.

This operation is used by the Amazon ECR proxy, and it is not intended for general use by customers for pulling and pushing images. In most cases, you should use the docker CLI to pull, tag, and push images.

Examples:

Request syntax with placeholder values


resp = client.batch_check_layer_availability({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  layer_digests: ["BatchedOperationLayerDigest"], # required
})

Response structure


resp.layers #=> Array
resp.layers[0].layer_digest #=> String
resp.layers[0].layer_availability #=> String, one of "AVAILABLE", "UNAVAILABLE"
resp.layers[0].layer_size #=> Integer
resp.layers[0].media_type #=> String
resp.failures #=> Array
resp.failures[0].layer_digest #=> String
resp.failures[0].failure_code #=> String, one of "InvalidLayerDigest", "MissingLayerDigest"
resp.failures[0].failure_reason #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The name of the repository that is associated with the image layers to check.

  • :layer_digests (required, Array<String>)

    The digests of the image layers to check.

Returns:

See Also:



219
220
221
222
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 219

def batch_check_layer_availability(params = {}, options = {})
  req = build_request(:batch_check_layer_availability, params)
  req.send_request(options)
end

#batch_delete_image(params = {}) ⇒ Types::BatchDeleteImageResponse

Deletes a list of specified images within a specified repository. Images are specified with either imageTag or imageDigest.

You can remove a tag from an image by specifying the image's tag in your request. When you remove the last tag from an image, the image is deleted from your repository.

You can completely delete an image (and all of its tags) by specifying the image's digest in your request.

Examples:

Example: To delete multiple images


# This example deletes images with the tags precise and trusty in a repository called ubuntu in the default registry for
# an account.

resp = client.batch_delete_image({
  image_ids: [
    {
      image_tag: "precise", 
    }, 
  ], 
  repository_name: "ubuntu", 
})

resp.to_h outputs the following:
{
  failures: [
  ], 
  image_ids: [
    {
      image_digest: "sha256:examplee6d1e504117a17000003d3753086354a38375961f2e665416ef4b1b2f", 
      image_tag: "precise", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.batch_delete_image({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  image_ids: [ # required
    {
      image_digest: "ImageDigest",
      image_tag: "ImageTag",
    },
  ],
})

Response structure


resp.image_ids #=> Array
resp.image_ids[0].image_digest #=> String
resp.image_ids[0].image_tag #=> String
resp.failures #=> Array
resp.failures[0].image_id.image_digest #=> String
resp.failures[0].image_id.image_tag #=> String
resp.failures[0].failure_code #=> String, one of "InvalidImageDigest", "InvalidImageTag", "ImageTagDoesNotMatchDigest", "ImageNotFound", "MissingDigestAndTag"
resp.failures[0].failure_reason #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The repository that contains the image to delete.

  • :image_ids (required, Array<Types::ImageIdentifier>)

    A list of image ID references that correspond to images to delete. The format of the imageIds reference is imageTag=tag or imageDigest=digest.

Returns:

See Also:



307
308
309
310
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 307

def batch_delete_image(params = {}, options = {})
  req = build_request(:batch_delete_image, params)
  req.send_request(options)
end

#batch_get_image(params = {}) ⇒ Types::BatchGetImageResponse

Gets detailed information for specified images within a specified repository. Images are specified with either imageTag or imageDigest.

Examples:

Example: To obtain multiple images in a single request


# This example obtains information for an image with a specified image digest ID from the repository named ubuntu in the
# current account.

resp = client.batch_get_image({
  image_ids: [
    {
      image_tag: "precise", 
    }, 
  ], 
  repository_name: "ubuntu", 
})

resp.to_h outputs the following:
{
  failures: [
  ], 
  images: [
    {
      image_id: {
        image_digest: "sha256:example76bdff6d83a09ba2a818f0d00000063724a9ac3ba5019c56f74ebf42a", 
        image_tag: "precise", 
      }, 
      image_manifest: "{\n \"schemaVersion\": 1,\n \"name\": \"ubuntu\",\n \"tag\": \"precise\",\n...", 
      registry_id: "244698725403", 
      repository_name: "ubuntu", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.batch_get_image({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  image_ids: [ # required
    {
      image_digest: "ImageDigest",
      image_tag: "ImageTag",
    },
  ],
  accepted_media_types: ["MediaType"],
})

Response structure


resp.images #=> Array
resp.images[0].registry_id #=> String
resp.images[0].repository_name #=> String
resp.images[0].image_id.image_digest #=> String
resp.images[0].image_id.image_tag #=> String
resp.images[0].image_manifest #=> String
resp.failures #=> Array
resp.failures[0].image_id.image_digest #=> String
resp.failures[0].image_id.image_tag #=> String
resp.failures[0].failure_code #=> String, one of "InvalidImageDigest", "InvalidImageTag", "ImageTagDoesNotMatchDigest", "ImageNotFound", "MissingDigestAndTag"
resp.failures[0].failure_reason #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The repository that contains the images to describe.

  • :image_ids (required, Array<Types::ImageIdentifier>)

    A list of image ID references that correspond to images to describe. The format of the imageIds reference is imageTag=tag or imageDigest=digest.

  • :accepted_media_types (Array<String>)

    The accepted media types for the request.

    Valid values: application/vnd.docker.distribution.manifest.v1+json | application/vnd.docker.distribution.manifest.v2+json | application/vnd.oci.image.manifest.v1+json

Returns:

See Also:



405
406
407
408
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 405

def batch_get_image(params = {}, options = {})
  req = build_request(:batch_get_image, params)
  req.send_request(options)
end

#complete_layer_upload(params = {}) ⇒ Types::CompleteLayerUploadResponse

Informs Amazon ECR that the image layer upload has completed for a specified registry, repository name, and upload ID. You can optionally provide a sha256 digest of the image layer for data validation purposes.

This operation is used by the Amazon ECR proxy, and it is not intended for general use by customers for pulling and pushing images. In most cases, you should use the docker CLI to pull, tag, and push images.

Examples:

Request syntax with placeholder values


resp = client.complete_layer_upload({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  upload_id: "UploadId", # required
  layer_digests: ["LayerDigest"], # required
})

Response structure


resp.registry_id #=> String
resp.repository_name #=> String
resp.upload_id #=> String
resp.layer_digest #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

    The AWS account ID associated with the registry to which to upload layers. If you do not specify a registry, the default registry is assumed.

  • :repository_name (required, String)

    The name of the repository to associate with the image layer.

  • :upload_id (required, String)

    The upload ID from a previous InitiateLayerUpload operation to associate with the image layer.

  • :layer_digests (required, Array<String>)

    The sha256 digest of the image layer.

Returns:

See Also:



463
464
465
466
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 463

def complete_layer_upload(params = {}, options = {})
  req = build_request(:complete_layer_upload, params)
  req.send_request(options)
end

#create_repository(params = {}) ⇒ Types::CreateRepositoryResponse

Creates an image repository.

Examples:

Example: To create a new repository


# This example creates a repository called nginx-web-app inside the project-a namespace in the default registry for an
# account.

resp = client.create_repository({
  repository_name: "project-a/nginx-web-app", 
})

resp.to_h outputs the following:
{
  repository: {
    registry_id: "012345678901", 
    repository_arn: "arn:aws:ecr:us-west-2:012345678901:repository/project-a/nginx-web-app", 
    repository_name: "project-a/nginx-web-app", 
  }, 
}

Request syntax with placeholder values


resp = client.create_repository({
  repository_name: "RepositoryName", # required
})

Response structure


resp.repository.repository_arn #=> String
resp.repository.registry_id #=> String
resp.repository.repository_name #=> String
resp.repository.repository_uri #=> String
resp.repository.created_at #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :repository_name (required, String)

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

Returns:

See Also:



517
518
519
520
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 517

def create_repository(params = {}, options = {})
  req = build_request(:create_repository, params)
  req.send_request(options)
end

#delete_lifecycle_policy(params = {}) ⇒ Types::DeleteLifecyclePolicyResponse

Deletes the specified lifecycle policy.

Examples:

Request syntax with placeholder values


resp = client.delete_lifecycle_policy({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
})

Response structure


resp.registry_id #=> String
resp.repository_name #=> String
resp.lifecycle_policy_text #=> String
resp.last_evaluated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The name of the repository.

Returns:

See Also:



557
558
559
560
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 557

def delete_lifecycle_policy(params = {}, options = {})
  req = build_request(:delete_lifecycle_policy, params)
  req.send_request(options)
end

#delete_repository(params = {}) ⇒ Types::DeleteRepositoryResponse

Deletes an existing image repository. If a repository contains images, you must use the force option to delete it.

Examples:

Example: To force delete a repository


# This example force deletes a repository named ubuntu in the default registry for an account. The force parameter is
# required if the repository contains images.

resp = client.delete_repository({
  force: true, 
  repository_name: "ubuntu", 
})

resp.to_h outputs the following:
{
  repository: {
    registry_id: "012345678901", 
    repository_arn: "arn:aws:ecr:us-west-2:012345678901:repository/ubuntu", 
    repository_name: "ubuntu", 
  }, 
}

Request syntax with placeholder values


resp = client.delete_repository({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  force: false,
})

Response structure


resp.repository.repository_arn #=> String
resp.repository.registry_id #=> String
resp.repository.repository_name #=> String
resp.repository.repository_uri #=> String
resp.repository.created_at #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The name of the repository to delete.

  • :force (Boolean)

    If a repository contains images, forces the deletion.

Returns:

See Also:



620
621
622
623
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 620

def delete_repository(params = {}, options = {})
  req = build_request(:delete_repository, params)
  req.send_request(options)
end

#delete_repository_policy(params = {}) ⇒ Types::DeleteRepositoryPolicyResponse

Deletes the repository policy from a specified repository.

Examples:

Example: To delete the policy associated with a repository


# This example deletes the policy associated with the repository named ubuntu in the current account.

resp = client.delete_repository_policy({
  repository_name: "ubuntu", 
})

resp.to_h outputs the following:
{
  policy_text: "{ ... }", 
  registry_id: "012345678901", 
  repository_name: "ubuntu", 
}

Request syntax with placeholder values


resp = client.delete_repository_policy({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
})

Response structure


resp.registry_id #=> String
resp.repository_name #=> String
resp.policy_text #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The name of the repository that is associated with the repository policy to delete.

Returns:

See Also:



675
676
677
678
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 675

def delete_repository_policy(params = {}, options = {})
  req = build_request(:delete_repository_policy, params)
  req.send_request(options)
end

#describe_images(params = {}) ⇒ Types::DescribeImagesResponse

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

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.

Examples:

Request syntax with placeholder values


resp = client.describe_images({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  image_ids: [
    {
      image_digest: "ImageDigest",
      image_tag: "ImageTag",
    },
  ],
  next_token: "NextToken",
  max_results: 1,
  filter: {
    tag_status: "TAGGED", # accepts TAGGED, UNTAGGED
  },
})

Response structure


resp.image_details #=> Array
resp.image_details[0].registry_id #=> String
resp.image_details[0].repository_name #=> String
resp.image_details[0].image_digest #=> String
resp.image_details[0].image_tags #=> Array
resp.image_details[0].image_tags[0] #=> String
resp.image_details[0].image_size_in_bytes #=> Integer
resp.image_details[0].image_pushed_at #=> Time
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

    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.

  • :repository_name (required, String)

    A list of repositories to describe. If this parameter is omitted, then all repositories in a registry are described.

  • :image_ids (Array<Types::ImageIdentifier>)

    The list of image IDs for the requested repository.

  • :next_token (String)

    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.

  • :max_results (Integer)

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

  • :filter (Types::DescribeImagesFilter)

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

Returns:

See Also:



765
766
767
768
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 765

def describe_images(params = {}, options = {})
  req = build_request(:describe_images, params)
  req.send_request(options)
end

#describe_repositories(params = {}) ⇒ Types::DescribeRepositoriesResponse

Describes image repositories in a registry.

Examples:

Example: To describe all repositories in the current account


# The following example obtains a list and description of all repositories in the default registry to which the current
# user has access.

resp = client.describe_repositories({
})

resp.to_h outputs the following:
{
  repositories: [
    {
      registry_id: "012345678910", 
      repository_arn: "arn:aws:ecr:us-west-2:012345678910:repository/ubuntu", 
      repository_name: "ubuntu", 
    }, 
    {
      registry_id: "012345678910", 
      repository_arn: "arn:aws:ecr:us-west-2:012345678910:repository/test", 
      repository_name: "test", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_repositories({
  registry_id: "RegistryId",
  repository_names: ["RepositoryName"],
  next_token: "NextToken",
  max_results: 1,
})

Response structure


resp.repositories #=> Array
resp.repositories[0].repository_arn #=> String
resp.repositories[0].registry_id #=> String
resp.repositories[0].repository_name #=> String
resp.repositories[0].repository_uri #=> String
resp.repositories[0].created_at #=> Time
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_names (Array<String>)

    A list of repositories to describe. If this parameter is omitted, then all repositories in a registry are described.

  • :next_token (String)

    The nextToken value returned from a previous paginated DescribeRepositories 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 repositories with repositoryNames.

    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 (Integer)

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

Returns:

See Also:



861
862
863
864
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 861

def describe_repositories(params = {}, options = {})
  req = build_request(:describe_repositories, params)
  req.send_request(options)
end

#get_authorization_token(params = {}) ⇒ Types::GetAuthorizationTokenResponse

Retrieves a token that is valid for a specified registry for 12 hours. This command allows you to use the docker CLI to push and pull images with Amazon ECR. If you do not specify a registry, the default registry is assumed.

The authorizationToken returned for each registry specified is a base64 encoded string that can be decoded and used in a docker login command to authenticate to a registry. The AWS CLI offers an aws ecr get-login command that simplifies the login process.

Examples:

Example: To obtain an authorization token


# This example gets an authorization token for your default registry.

resp = client.get_authorization_token({
})

resp.to_h outputs the following:
{
  authorization_data: [
    {
      authorization_token: "QVdTOkN...", 
      expires_at: Time.parse("1470951892432"), 
      proxy_endpoint: "https://012345678901.dkr.ecr.us-west-2.amazonaws.com", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.get_authorization_token({
  registry_ids: ["RegistryId"],
})

Response structure


resp.authorization_data #=> Array
resp.authorization_data[0].authorization_token #=> String
resp.authorization_data[0].expires_at #=> Time
resp.authorization_data[0].proxy_endpoint #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_ids (Array<String>)

    A list of AWS account IDs that are associated with the registries for which to get authorization tokens. If you do not specify a registry, the default registry is assumed.

Returns:

See Also:



921
922
923
924
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 921

def get_authorization_token(params = {}, options = {})
  req = build_request(:get_authorization_token, params)
  req.send_request(options)
end

#get_download_url_for_layer(params = {}) ⇒ Types::GetDownloadUrlForLayerResponse

Retrieves the pre-signed Amazon S3 download URL corresponding to an image layer. You can only get URLs for image layers that are referenced in an image.

This operation is used by the Amazon ECR proxy, and it is not intended for general use by customers for pulling and pushing images. In most cases, you should use the docker CLI to pull, tag, and push images.

Examples:

Request syntax with placeholder values


resp = client.get_download_url_for_layer({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  layer_digest: "LayerDigest", # required
})

Response structure


resp.download_url #=> String
resp.layer_digest #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The name of the repository that is associated with the image layer to download.

  • :layer_digest (required, String)

    The digest of the image layer to download.

Returns:

See Also:



970
971
972
973
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 970

def get_download_url_for_layer(params = {}, options = {})
  req = build_request(:get_download_url_for_layer, params)
  req.send_request(options)
end

#get_lifecycle_policy(params = {}) ⇒ Types::GetLifecyclePolicyResponse

Retrieves the specified lifecycle policy.

Examples:

Request syntax with placeholder values


resp = client.get_lifecycle_policy({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
})

Response structure


resp.registry_id #=> String
resp.repository_name #=> String
resp.lifecycle_policy_text #=> String
resp.last_evaluated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The name of the repository.

Returns:

See Also:



1010
1011
1012
1013
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 1010

def get_lifecycle_policy(params = {}, options = {})
  req = build_request(:get_lifecycle_policy, params)
  req.send_request(options)
end

#get_lifecycle_policy_preview(params = {}) ⇒ Types::GetLifecyclePolicyPreviewResponse

Retrieves the results of the specified lifecycle policy preview request.

Examples:

Request syntax with placeholder values


resp = client.get_lifecycle_policy_preview({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  image_ids: [
    {
      image_digest: "ImageDigest",
      image_tag: "ImageTag",
    },
  ],
  next_token: "NextToken",
  max_results: 1,
  filter: {
    tag_status: "TAGGED", # accepts TAGGED, UNTAGGED
  },
})

Response structure


resp.registry_id #=> String
resp.repository_name #=> String
resp.lifecycle_policy_text #=> String
resp.status #=> String, one of "IN_PROGRESS", "COMPLETE", "EXPIRED", "FAILED"
resp.next_token #=> String
resp.preview_results #=> Array
resp.preview_results[0].image_tags #=> Array
resp.preview_results[0].image_tags[0] #=> String
resp.preview_results[0].image_digest #=> String
resp.preview_results[0].image_pushed_at #=> Time
resp.preview_results[0].action.type #=> String, one of "EXPIRE"
resp.preview_results[0].applied_rule_priority #=> Integer
resp.summary.expiring_image_total_count #=> Integer

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The name of the repository.

  • :image_ids (Array<Types::ImageIdentifier>)

    The list of imageIDs to be included.

  • :next_token (String)

    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.

  • :max_results (Integer)

    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. This option cannot be used when you specify images with imageIds.

  • :filter (Types::LifecyclePolicyPreviewFilter)

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

Returns:

See Also:



1103
1104
1105
1106
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 1103

def get_lifecycle_policy_preview(params = {}, options = {})
  req = build_request(:get_lifecycle_policy_preview, params)
  req.send_request(options)
end

#get_repository_policy(params = {}) ⇒ Types::GetRepositoryPolicyResponse

Retrieves the repository policy for a specified repository.

Examples:

Example: To get the current policy for a repository


# This example obtains the repository policy for the repository named ubuntu.

resp = client.get_repository_policy({
  repository_name: "ubuntu", 
})

resp.to_h outputs the following:
{
  policy_text: "{\n  \"Version\" : \"2008-10-17\",\n  \"Statement\" : [ {\n    \"Sid\" : \"new statement\",\n    \"Effect\" : \"Allow\",\n    \"Principal\" : {\n     \"AWS\" : \"arn:aws:iam::012345678901:role/CodeDeployDemo\"\n    },\n\"Action\" : [ \"ecr:GetDownloadUrlForLayer\", \"ecr:BatchGetImage\", \"ecr:BatchCheckLayerAvailability\" ]\n } ]\n}", 
  registry_id: "012345678901", 
  repository_name: "ubuntu", 
}

Request syntax with placeholder values


resp = client.get_repository_policy({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
})

Response structure


resp.registry_id #=> String
resp.repository_name #=> String
resp.policy_text #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The name of the repository with the policy to retrieve.

Returns:

See Also:



1157
1158
1159
1160
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 1157

def get_repository_policy(params = {}, options = {})
  req = build_request(:get_repository_policy, params)
  req.send_request(options)
end

#initiate_layer_upload(params = {}) ⇒ Types::InitiateLayerUploadResponse

Notify Amazon ECR that you intend to upload an image layer.

This operation is used by the Amazon ECR proxy, and it is not intended for general use by customers for pulling and pushing images. In most cases, you should use the docker CLI to pull, tag, and push images.

Examples:

Request syntax with placeholder values


resp = client.initiate_layer_upload({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
})

Response structure


resp.upload_id #=> String
resp.part_size #=> Integer

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

    The AWS account ID associated with the registry to which you intend to upload layers. If you do not specify a registry, the default registry is assumed.

  • :repository_name (required, String)

    The name of the repository to which you intend to upload layers.

Returns:

See Also:



1199
1200
1201
1202
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 1199

def initiate_layer_upload(params = {}, options = {})
  req = build_request(:initiate_layer_upload, params)
  req.send_request(options)
end

#list_images(params = {}) ⇒ Types::ListImagesResponse

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.

Examples:

Example: To list all images in a repository


# This example lists all of the images in the repository named ubuntu in the default registry in the current account. 

resp = client.list_images({
  repository_name: "ubuntu", 
})

resp.to_h outputs the following:
{
  image_ids: [
    {
      image_digest: "sha256:764f63476bdff6d83a09ba2a818f0d35757063724a9ac3ba5019c56f74ebf42a", 
      image_tag: "precise", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_images({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  next_token: "NextToken",
  max_results: 1,
  filter: {
    tag_status: "TAGGED", # accepts TAGGED, UNTAGGED
  },
})

Response structure


resp.image_ids #=> Array
resp.image_ids[0].image_digest #=> String
resp.image_ids[0].image_tag #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

    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.

  • :repository_name (required, String)

    The repository with image IDs to be listed.

  • :next_token (String)

    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.

    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 (Integer)

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

  • :filter (Types::ListImagesFilter)

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

Returns:

See Also:



1295
1296
1297
1298
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 1295

def list_images(params = {}, options = {})
  req = build_request(:list_images, params)
  req.send_request(options)
end

#put_image(params = {}) ⇒ Types::PutImageResponse

Creates or updates the image manifest and tags associated with an image.

This operation is used by the Amazon ECR proxy, and it is not intended for general use by customers for pulling and pushing images. In most cases, you should use the docker CLI to pull, tag, and push images.

Examples:

Request syntax with placeholder values


resp = client.put_image({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  image_manifest: "ImageManifest", # required
  image_tag: "ImageTag",
})

Response structure


resp.image.registry_id #=> String
resp.image.repository_name #=> String
resp.image.image_id.image_digest #=> String
resp.image.image_id.image_tag #=> String
resp.image.image_manifest #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The name of the repository in which to put the image.

  • :image_manifest (required, String)

    The image manifest corresponding to the image to be uploaded.

  • :image_tag (String)

    The tag to associate with the image. This parameter is required for images that use the Docker Image Manifest V2 Schema 2 or OCI formats.

Returns:

See Also:



1349
1350
1351
1352
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 1349

def put_image(params = {}, options = {})
  req = build_request(:put_image, params)
  req.send_request(options)
end

#put_lifecycle_policy(params = {}) ⇒ Types::PutLifecyclePolicyResponse

Creates or updates a lifecycle policy. For information about lifecycle policy syntax, see Lifecycle Policy Template.

Examples:

Request syntax with placeholder values


resp = client.put_lifecycle_policy({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  lifecycle_policy_text: "LifecyclePolicyText", # required
})

Response structure


resp.registry_id #=> String
resp.repository_name #=> String
resp.lifecycle_policy_text #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The name of the repository to receive the policy.

  • :lifecycle_policy_text (required, String)

    The JSON repository policy text to apply to the repository.

Returns:

See Also:



1396
1397
1398
1399
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 1396

def put_lifecycle_policy(params = {}, options = {})
  req = build_request(:put_lifecycle_policy, params)
  req.send_request(options)
end

#set_repository_policy(params = {}) ⇒ Types::SetRepositoryPolicyResponse

Applies a repository policy on a specified repository to control access permissions.

Examples:

Request syntax with placeholder values


resp = client.set_repository_policy({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  policy_text: "RepositoryPolicyText", # required
  force: false,
})

Response structure


resp.registry_id #=> String
resp.repository_name #=> String
resp.policy_text #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The name of the repository to receive the policy.

  • :policy_text (required, String)

    The JSON repository policy text to apply to the repository.

  • :force (Boolean)

    If the policy you are attempting to set on a repository policy would prevent you from setting another policy in the future, you must force the SetRepositoryPolicy operation. This is intended to prevent accidental repository lock outs.

Returns:

See Also:



1446
1447
1448
1449
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 1446

def set_repository_policy(params = {}, options = {})
  req = build_request(:set_repository_policy, params)
  req.send_request(options)
end

#start_lifecycle_policy_preview(params = {}) ⇒ Types::StartLifecyclePolicyPreviewResponse

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

Examples:

Request syntax with placeholder values


resp = client.start_lifecycle_policy_preview({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  lifecycle_policy_text: "LifecyclePolicyText",
})

Response structure


resp.registry_id #=> String
resp.repository_name #=> String
resp.lifecycle_policy_text #=> String
resp.status #=> String, one of "IN_PROGRESS", "COMPLETE", "EXPIRED", "FAILED"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

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

  • :repository_name (required, String)

    The name of the repository to be evaluated.

  • :lifecycle_policy_text (String)

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

Returns:

See Also:



1492
1493
1494
1495
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 1492

def start_lifecycle_policy_preview(params = {}, options = {})
  req = build_request(:start_lifecycle_policy_preview, params)
  req.send_request(options)
end

#upload_layer_part(params = {}) ⇒ Types::UploadLayerPartResponse

Uploads an image layer part to Amazon ECR.

This operation is used by the Amazon ECR proxy, and it is not intended for general use by customers for pulling and pushing images. In most cases, you should use the docker CLI to pull, tag, and push images.

Examples:

Request syntax with placeholder values


resp = client.upload_layer_part({
  registry_id: "RegistryId",
  repository_name: "RepositoryName", # required
  upload_id: "UploadId", # required
  part_first_byte: 1, # required
  part_last_byte: 1, # required
  layer_part_blob: "data", # required
})

Response structure


resp.registry_id #=> String
resp.repository_name #=> String
resp.upload_id #=> String
resp.last_byte_received #=> Integer

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :registry_id (String)

    The AWS account ID associated with the registry to which you are uploading layer parts. If you do not specify a registry, the default registry is assumed.

  • :repository_name (required, String)

    The name of the repository to which you are uploading layer parts.

  • :upload_id (required, String)

    The upload ID from a previous InitiateLayerUpload operation to associate with the layer part upload.

  • :part_first_byte (required, Integer)

    The integer value of the first byte of the layer part.

  • :part_last_byte (required, Integer)

    The integer value of the last byte of the layer part.

  • :layer_part_blob (required, String, IO)

    The base64-encoded layer part payload.

Returns:

See Also:



1555
1556
1557
1558
# File 'gems/aws-sdk-ecr/lib/aws-sdk-ecr/client.rb', line 1555

def upload_layer_part(params = {}, options = {})
  req = build_request(:upload_layer_part, params)
  req.send_request(options)
end