TagResource

Description

This function adds tags to a DynamoDB resource.

For more information, see TagResource.

Category

History

ColdFusion (2021 release): Added this function.

Syntax

serviceHandle.tagResource(requestParameters)

Parameters

See request parameters of TagResource.

Example

<cfscript> 
  cred = { 
    "credentialAlias" : "myalias", 
    "vendorName" : "AWS", 
    "region" : "us-east-2", 
    "secretAccessKey" : "xxxxx", 
    "accessKeyId" : "xxxx" 
  } 
  config = { 
    "serviceName" = "DYNAMODB" 
  } 
  dynamo = getCloudService(cred, config) 
  tableName="YearlyProductCatalog" 
  // Get table ARN 
  describeStruct={ 
    "TableName":"#tableName#" 
  } 
  describeStructResponse=dynamo.describeTable(describeStruct) 
  ARN=describeStructResponse.Table.TableArn 
  // tag resource 
  tagResourceStrct={ 
    "ResourceArn":ARN, 
    "Tags":[ 
      {"Key":"Key001","Value":"Value001"}, 
      {"Key":"Key002","Value":"Value002"}, 
      {"Key":"Key003","Value":"Value003"}, 
      {"Key":"Key004","Value":"Value004"} 
    ] 
  } 
  try{ 
    tagResourceResponse=dynamo.tagResource(tagResourceStrct) 
    writeOutput("Resource tagged successfully") 
    writeDump(tagResourceResponse) 
  } 
  catch(any e){ 
    writeDump(e) 
  } 
</cfscript> 

Output

TagResource output
TagResource output

Adobe logo

Sign in to your account