本文整理匯總了Golang中github.com/aws/aws-sdk-go/service/ec2.Instance.PublicDNSName方法的典型用法代碼示例。如果您正苦於以下問題:Golang Instance.PublicDNSName方法的具體用法?Golang Instance.PublicDNSName怎麽用?Golang Instance.PublicDNSName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/aws/aws-sdk-go/service/ec2.Instance
的用法示例。
在下文中一共展示了Instance.PublicDNSName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: waitForDnsName
func (i *EC2IaaS) waitForDnsName(ec2Inst *ec2.EC2, instance *ec2.Instance) (*ec2.Instance, error) {
rawWait, _ := i.base.GetConfigString("wait-timeout")
maxWaitTime, _ := strconv.Atoi(rawWait)
if maxWaitTime == 0 {
maxWaitTime = 300
}
q, err := queue.Queue()
if err != nil {
return nil, err
}
taskName := fmt.Sprintf("ec2-wait-machine-%s", i.base.IaaSName)
waitDuration := time.Duration(maxWaitTime) * time.Second
job, err := q.EnqueueWait(taskName, monsterqueue.JobParams{
"region": ec2Inst.Config.Region,
"endpoint": ec2Inst.Config.Endpoint,
"machineId": *instance.InstanceID,
"timeout": maxWaitTime,
}, waitDuration)
if err != nil {
if err == monsterqueue.ErrQueueWaitTimeout {
return nil, fmt.Errorf("ec2: time out after %v waiting for instance %s to start", waitDuration, *instance.InstanceID)
}
return nil, err
}
result, err := job.Result()
if err != nil {
return nil, err
}
instance.PublicDNSName = aws.String(result.(string))
return instance, nil
}