本文整理汇总了Golang中github.com/mitchellh/goamz/ec2.ModifyInstance类的典型用法代码示例。如果您正苦于以下问题:Golang ModifyInstance类的具体用法?Golang ModifyInstance怎么用?Golang ModifyInstance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModifyInstance类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: resource_aws_instance_update
func resource_aws_instance_update(
s *terraform.ResourceState,
d *terraform.ResourceDiff,
meta interface{}) (*terraform.ResourceState, error) {
p := meta.(*ResourceProvider)
ec2conn := p.ec2conn
rs := s.MergeDiff(d)
modify := false
opts := new(ec2.ModifyInstance)
if attr, ok := d.Attributes["source_dest_check"]; ok {
modify = true
opts.SourceDestCheck = attr.New != "" && attr.New != "false"
opts.SetSourceDestCheck = true
rs.Attributes["source_dest_check"] = strconv.FormatBool(
opts.SourceDestCheck)
}
if modify {
log.Printf("[INFO] Modifing instance %s: %#v", s.ID, opts)
if _, err := ec2conn.ModifyInstance(s.ID, opts); err != nil {
return s, err
}
// TODO(mitchellh): wait for the attributes we modified to
// persist the change...
}
return rs, nil
}
示例2: resourceAwsInstanceUpdate
func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error {
p := meta.(*ResourceProvider)
ec2conn := p.ec2conn
modify := false
opts := new(ec2.ModifyInstance)
if v, ok := d.GetOk("source_dest_check"); ok {
opts.SourceDestCheck = v.(bool)
opts.SetSourceDestCheck = true
modify = true
}
if modify {
log.Printf("[INFO] Modifing instance %s: %#v", d.Id(), opts)
if _, err := ec2conn.ModifyInstance(d.Id(), opts); err != nil {
return err
}
// TODO(mitchellh): wait for the attributes we modified to
// persist the change...
}
return nil
}