From 4d641bdecf84c84328b3603fe9b75b1f66eb7180 Mon Sep 17 00:00:00 2001 From: deoxxa Date: Sun, 10 Aug 2014 13:04:48 +1000 Subject: [PATCH] add DeleteTags function --- ec2/ec2.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ec2/ec2.go b/ec2/ec2.go index 6042aa61..ce2ae103 100644 --- a/ec2/ec2.go +++ b/ec2/ec2.go @@ -1834,6 +1834,26 @@ func (ec2 *EC2) CreateTags(resourceIds []string, tags []Tag) (resp *SimpleResp, return resp, nil } +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{} + if err = ec2.query(params, resp); err != nil { + return nil, err + } + + return resp, nil +} + // Response to a StartInstances request. // // See http://goo.gl/awKeF for more details.