Method: Aws::ECR::Client#delete_repository

Defined in:
lib/aws-sdk-ecr/client.rb

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

Deletes a repository. If the repository isn’t empty, you must either delete the contents of the repository or use the ‘force` option to delete the repository and have Amazon ECR delete all of its contents on your behalf.

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
resp.repository.image_tag_mutability #=> String, one of "MUTABLE", "IMMUTABLE"
resp.repository.image_scanning_configuration.scan_on_push #=> Boolean
resp.repository.encryption_configuration.encryption_type #=> String, one of "AES256", "KMS", "KMS_DSSE"
resp.repository.encryption_configuration.kms_key #=> String

Parameters:

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

    ({})

Options Hash (params):

  • :registry_id (String)

    The Amazon Web Services 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 true, deleting the repository force deletes the contents of the repository. If false, the repository must be empty before attempting to delete it.

Returns:

See Also:



1367
1368
1369
1370
# File 'lib/aws-sdk-ecr/client.rb', line 1367

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