本文整理匯總了Golang中github.com/mitchellh/goamz/ec2.EC2.AttachInternetGateway方法的典型用法代碼示例。如果您正苦於以下問題:Golang EC2.AttachInternetGateway方法的具體用法?Golang EC2.AttachInternetGateway怎麽用?Golang EC2.AttachInternetGateway使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/mitchellh/goamz/ec2.EC2
的用法示例。
在下文中一共展示了EC2.AttachInternetGateway方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: resource_aws_internet_gateway_attach
func resource_aws_internet_gateway_attach(
ec2conn *ec2.EC2,
s *terraform.ResourceState,
vpcId string) error {
log.Printf(
"[INFO] Attaching Internet Gateway '%s' to VPC '%s'",
s.ID,
vpcId)
_, err := ec2conn.AttachInternetGateway(s.ID, vpcId)
if err != nil {
return err
}
// Wait for it to be fully attached before continuing
log.Printf("[DEBUG] Waiting for internet gateway (%s) to attach", s.ID)
stateConf := &resource.StateChangeConf{
Pending: []string{"detached", "attaching"},
Target: "available",
Refresh: IGAttachStateRefreshFunc(ec2conn, s.ID, "available"),
Timeout: 1 * time.Minute,
}
if _, err := stateConf.WaitForState(); err != nil {
return fmt.Errorf(
"Error waiting for internet gateway (%s) to attach: %s",
s.ID, err)
}
return nil
}