本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/route53.ListHostedZonesInput类的典型用法代码示例。如果您正苦于以下问题:Golang ListHostedZonesInput类的具体用法?Golang ListHostedZonesInput怎么用?Golang ListHostedZonesInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ListHostedZonesInput类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: listZones
func listZones() {
req := route53.ListHostedZonesInput{}
for {
// paginated
resp, err := r53.ListHostedZones(&req)
fatalIfErr(err)
for _, zone := range resp.HostedZones {
fmt.Printf("%+v\n", zone)
}
if *resp.IsTruncated {
req.Marker = resp.NextMarker
} else {
break
}
}
}
示例2: lookupZone
func lookupZone(nameOrId string) *route53.HostedZone {
if isZoneId(nameOrId) {
// lookup by id
id := nameOrId
if !strings.HasPrefix(nameOrId, "/hostedzone/") {
id = "/hostedzone/" + id
}
req := route53.GetHostedZoneInput{
Id: aws.String(id),
}
resp, err := r53.GetHostedZone(&req)
if err, ok := err.(awserr.Error); ok && err.Code() == "NoSuchHostedZone" {
errorAndExit(fmt.Sprintf("Zone '%s' not found", nameOrId))
}
fatalIfErr(err)
return resp.HostedZone
} else {
// lookup by name
matches := []route53.HostedZone{}
req := route53.ListHostedZonesInput{}
for {
resp, err := r53.ListHostedZones(&req)
fatalIfErr(err)
for _, zone := range resp.HostedZones {
if zoneName(*zone.Name) == zoneName(nameOrId) || *zone.Id == nameOrId {
matches = append(matches, *zone)
}
}
if *resp.IsTruncated {
req.Marker = resp.NextMarker
} else {
break
}
}
switch len(matches) {
case 0:
errorAndExit(fmt.Sprintf("Zone '%s' not found", nameOrId))
case 1:
return &matches[0]
default:
errorAndExit("Multiple zones match - you will need to use Zone ID to uniquely identify the zone")
}
}
return nil
}
示例3: listZones
func listZones(formatter Formatter) {
zones := make(chan *route53.HostedZone)
go func() {
req := route53.ListHostedZonesInput{}
for {
// paginated
resp, err := r53.ListHostedZones(&req)
fatalIfErr(err)
for _, zone := range resp.HostedZones {
zones <- zone
}
if *resp.IsTruncated {
req.Marker = resp.NextMarker
} else {
break
}
}
close(zones)
}()
formatter.formatZoneList(zones, os.Stdout)
}