- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
TagResourceCommand
Adds or updates tags for a resource in CodeCommit. For a list of valid resources in CodeCommit, see CodeCommit Resources and Operations in the CodeCommit User Guide.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { CodeCommitClient, TagResourceCommand } from "@aws-sdk/client-codecommit"; // ES Modules import
// const { CodeCommitClient, TagResourceCommand } = require("@aws-sdk/client-codecommit"); // CommonJS import
const client = new CodeCommitClient(config);
const input = { // TagResourceInput
resourceArn: "STRING_VALUE", // required
tags: { // TagsMap // required
"<keys>": "STRING_VALUE",
},
};
const command = new TagResourceCommand(input);
const response = await client.send(command);
// {};
TagResourceCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
resourceArn Required | string | undefined | The Amazon Resource Name (ARN) of the resource to which you want to add or update tags. |
tags Required | Record<string, string> | undefined | The key-value pair to use when tagging this repository. |
TagResourceCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
InvalidRepositoryNameException | client | A specified repository name is not valid. This exception occurs only when a specified repository name is not valid. Other exceptions occur when a required repository parameter is missing, or when a specified repository does not exist. |
InvalidResourceArnException | client | The value for the resource ARN is not valid. For more information about resources in CodeCommit, see CodeCommit Resources and Operations in the CodeCommit User Guide. |
InvalidSystemTagUsageException | client | The specified tag is not valid. Key names cannot be prefixed with aws:. |
InvalidTagsMapException | client | The map of tags is not valid. |
RepositoryDoesNotExistException | client | The specified repository does not exist. |
ResourceArnRequiredException | client | A valid Amazon Resource Name (ARN) for an CodeCommit resource is required. For a list of valid resources in CodeCommit, see CodeCommit Resources and Operations in the CodeCommit User Guide. |
TagPolicyException | client | The tag policy is not valid. |
TagsMapRequiredException | client | A map of tags is required. |
TooManyTagsException | client | The maximum number of tags for an CodeCommit resource has been exceeded. |
CodeCommitServiceException | Base exception class for all service exceptions from CodeCommit service. |