Skip to content

Commit

Permalink
ec2: add DeleteTags
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Oct 8, 2014
1 parent 58e074b commit a996a83
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ec2/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -1985,6 +1985,28 @@ func (ec2 *EC2) CreateTags(resourceIds []string, tags []Tag) (resp *SimpleResp,
return resp, nil
}

// DeleteTags deletes tags.
func (ec2 *EC2) DeleteTags(resourceIds []string, tags []Tag) (resp *SimpleResp, err error) {
params := makeParams("DeleteTags")
addParamsList(params, "ResourceId", resourceIds)

for j, tag := range tags {
params["Tag."+strconv.Itoa(j+1)+".Key"] = tag.Key

if tag.Value != "" {
params["Tag."+strconv.Itoa(j+1)+".Value"] = tag.Value
}
}

resp = &SimpleResp{}
err = ec2.query(params, resp)
if err != nil {
return nil, err
}

return resp, nil
}

type TagsResp struct {
RequestId string `xml:"requestId"`
Tags []ResourceTag `xml:"tagSet>item"`
Expand Down

0 comments on commit a996a83

Please sign in to comment.