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