TagResourceCommand

Applies a tag to an Amazon Web Services resource. Tags are key-value pairs that can help you manage, filter, and search for your resources.

These include DataSync resources, such as locations, tasks, and task executions.

Example Syntax

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

import { DataSyncClient, TagResourceCommand } from "@aws-sdk/client-datasync"; // ES Modules import
// const { DataSyncClient, TagResourceCommand } = require("@aws-sdk/client-datasync"); // CommonJS import
const client = new DataSyncClient(config);
const input = { // TagResourceRequest
  ResourceArn: "STRING_VALUE", // required
  Tags: [ // InputTagList // required
    { // TagListEntry
      Key: "STRING_VALUE", // required
      Value: "STRING_VALUE",
    },
  ],
};
const command = new TagResourceCommand(input);
const response = await client.send(command);
// {};

TagResourceCommand Input

See TagResourceCommandInput for more details

Parameter
Type
Description
ResourceArn
Required
string | undefined

Specifies the Amazon Resource Name (ARN) of the resource to apply the tag to.

Tags
Required
TagListEntry[] | undefined

Specifies the tags that you want to apply to the resource.

TagResourceCommand Output

See TagResourceCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
InternalException
server

This exception is thrown when an error occurs in the DataSync service.

InvalidRequestException
client

This exception is thrown when the client submits a malformed request.

DataSyncServiceException
Base exception class for all service exceptions from DataSync service.