Vinayak Shanbhag
Vinayak Shanbhag

Reputation: 902

Multiple TagSet nodes not working in aws cli

As per aws cli put-bucket-tagging doc, I am able to execute following command

aws s3api put-bucket-tagging --bucket my-bucket --tagging file://tagging.json

with tagging.json file (case 1)

{
   "TagSet": [
     {
       "Key": "organization",
       "Value": "marketing"
     }
   ]
}

Suppose my tagging.json file contains multiple TagSet nodes like (case 2)

{  
   "TagSet":[  
      {  
         "Key":"organization",
         "Value":"marketing"
      }
   ],
   "TagSet":[  
      {  
         "Key":"test",
         "Value":"market"
      }
   ]
}

In this case, aws cli parses only first TagSet node which is similar to that of case 1. So the question is

  1. How can I parse multiple TagSet nodes or test such requests with s3.
  2. What is s3 behaviour if there are multiple TagSet nodes in request body. Something like
<Tagging>
  <TagSet>
     <Tag>
       <Key>Tag Name</Key>
       <Value>Tag Value</Value>
     </Tag>
  </TagSet>
  <TagSet>
     <Tag>
       <Key>Tag Name2</Key>
       <Value>Tag Value2</Value>
     </Tag>
  </TagSet>
</Tagging>

Upvotes: 1

Views: 254

Answers (1)

user10775237
user10775237

Reputation:

To answer your question about multiple TagSet nodes, I think the syntax of the file will need to be like so:

{  
   "TagSet":[  
      {  
         "Key":"organization",
         "Value":"marketing"
      },
      {  
         "Key":"test",
         "Value":"market"
      }
   ]
}

TagSet will require to be a Single Key that contains a list of Key/Value tags so that AWS can parse them correctly, having multiple TagSet key's in the JSON Structure looks like AWS accepts the first one and drops anything after.

Upvotes: 1

Related Questions