Jump to Content

Class DeleteRepositoryCommandProtected

Deletes a repository. If the repository contains images, you must either delete all images in the repository or use the force option to delete the repository.

Example

Use a bare-bones client and the command you need to make an API call.

import { ECRClient, DeleteRepositoryCommand } from "@aws-sdk/client-ecr"; // ES Modules import
// const { ECRClient, DeleteRepositoryCommand } = require("@aws-sdk/client-ecr"); // CommonJS import
const client = new ECRClient(config);
const input = { // DeleteRepositoryRequest
registryId: "STRING_VALUE",
repositoryName: "STRING_VALUE", // required
force: true || false,
};
const command = new DeleteRepositoryCommand(input);
const response = await client.send(command);

Param

DeleteRepositoryCommandInput

Returns

DeleteRepositoryCommandOutput

See

Throws

InvalidParameterException (client fault)

The specified parameter is invalid. Review the available parameters for the API request.

Throws

KmsException (client fault)

The operation failed due to a KMS exception.

Throws

RepositoryNotEmptyException (client fault)

The specified repository contains images. To delete a repository that contains images, you must force the deletion with the force parameter.

Throws

RepositoryNotFoundException (client fault)

The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.

Throws

ServerException (server fault)

These errors are usually caused by a server-side issue.

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.
const input = {
"force": true,
"repositoryName": "ubuntu"
};
const command = new DeleteRepositoryCommand(input);
const response = await client.send(command);
/* response ==
{
"repository": {
"registryId": "012345678901",
"repositoryArn": "arn:aws:ecr:us-west-2:012345678901:repository/ubuntu",
"repositoryName": "ubuntu"
}
}
*/
// example id: deleterepository-example-1470863805703

Hierarchy

Constructors

Properties

Methods