本文整理匯總了Golang中github.com/aws/aws-sdk-go/service/route53.Route53.ChangeTagsForResource方法的典型用法代碼示例。如果您正苦於以下問題:Golang Route53.ChangeTagsForResource方法的具體用法?Golang Route53.ChangeTagsForResource怎麽用?Golang Route53.ChangeTagsForResource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/aws/aws-sdk-go/service/route53.Route53
的用法示例。
在下文中一共展示了Route53.ChangeTagsForResource方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: setTagsR53
// setTags is a helper to set the tags for a resource. It expects the
// tags field to be named "tags"
func setTagsR53(conn *route53.Route53, d *schema.ResourceData, resourceType string) error {
if d.HasChange("tags") {
oraw, nraw := d.GetChange("tags")
o := oraw.(map[string]interface{})
n := nraw.(map[string]interface{})
create, remove := diffTagsR53(tagsFromMapR53(o), tagsFromMapR53(n))
// Set tags
r := make([]*string, len(remove))
for i, t := range remove {
r[i] = t.Key
}
log.Printf("[DEBUG] Changing tags: \n\tadding: %#v\n\tremoving:%#v", create, remove)
req := &route53.ChangeTagsForResourceInput{
ResourceId: aws.String(d.Id()),
ResourceType: aws.String(resourceType),
}
if len(create) > 0 {
req.AddTags = create
}
if len(r) > 0 {
req.RemoveTagKeys = r
}
_, err := conn.ChangeTagsForResource(req)
if err != nil {
return err
}
}
return nil
}