MCPcopy Create free account
hub / github.com/barnybug/cli53 / ExportBindToWriter

Function ExportBindToWriter

commands.go:446–469  ·  view source on GitHub ↗
(ctx context.Context, r53 *route53.Client, zone *route53types.HostedZone, full bool, out io.Writer)

Source from the content-addressed store, hash-verified

444}
445
446func ExportBindToWriter(ctx context.Context, r53 *route53.Client, zone *route53types.HostedZone, full bool, out io.Writer) {
447 rrsets, err := ListAllRecordSets(ctx, r53, *zone.Id)
448 fatalIfErr(err)
449
450 sort.Sort(exportSorter{rrsets, *zone.Name})
451 dnsname := *zone.Name
452 fmt.Fprintf(out, "$ORIGIN %s\n", dnsname)
453 for _, rrset := range rrsets {
454 rrs := ConvertRRSetToBind(rrset)
455 UnexpandSelfAliases(rrs, zone, full)
456 for _, rr := range rrs {
457 line := rr.String()
458 if !full {
459 parts := strings.Split(line, "\t")
460 parts[0] = shortenName(parts[0], dnsname)
461 if parts[3] == "CNAME" {
462 parts[4] = shortenName(parts[4], dnsname)
463 }
464 line = strings.Join(parts, "\t")
465 }
466 fmt.Fprintln(out, line)
467 }
468 }
469}
470
471type createArgs struct {
472 name string

Callers 2

initFunction · 0.92
exportBindFunction · 0.85

Calls 6

ListAllRecordSetsFunction · 0.85
ConvertRRSetToBindFunction · 0.85
UnexpandSelfAliasesFunction · 0.85
shortenNameFunction · 0.85
fatalIfErrFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected