本文整理匯總了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
}