Jump to Content

Class TagResourceCommandProtected

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.

Example

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

import { ECRClient, TagResourceCommand } from "@aws-sdk/client-ecr"; // ES Modules import
// const { ECRClient, TagResourceCommand } = require("@aws-sdk/client-ecr"); // CommonJS import
const client = new ECRClient(config);
const input = { // TagResourceRequest
resourceArn: "STRING_VALUE", // required
tags: [ // TagList // required
{ // Tag
Key: "STRING_VALUE",
Value: "STRING_VALUE",
},
],
};
const command = new TagResourceCommand(input);
const response = await client.send(command);

Param

TagResourceCommandInput

Returns

TagResourceCommandOutput

See

Throws

InvalidParameterException (client fault)

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

Throws

InvalidTagParameterException (client fault)

An invalid parameter has been specified. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

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.

Throws

TooManyTagsException (client fault)

The list of tags on the repository is over the limit. The maximum number of tags that can be applied to a repository is 50.

Hierarchy

Constructors

Properties

middlewareStack: MiddlewareStack<TagResourceCommandInput, TagResourceCommandOutput>

Methods