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

Function deleteRecordSets

commands.go:87–116  ·  view source on GitHub ↗
(ctx context.Context, zone *route53types.HostedZone, rrsets []*route53types.ResourceRecordSet, wait bool)

Source from the content-addressed store, hash-verified

85}
86
87func deleteRecordSets(ctx context.Context, zone *route53types.HostedZone, rrsets []*route53types.ResourceRecordSet, wait bool) (int, error) {
88 // delete all non-default SOA/NS records
89 changes := []route53types.Change{}
90 for _, rrset := range rrsets {
91 if !isAuthRecord(zone, rrset) {
92 change := route53types.Change{
93 Action: route53types.ChangeActionDelete,
94 ResourceRecordSet: rrset,
95 }
96 changes = append(changes, change)
97 }
98 }
99
100 if len(changes) > 0 {
101 req := route53.ChangeResourceRecordSetsInput{
102 HostedZoneId: zone.Id,
103 ChangeBatch: &route53types.ChangeBatch{
104 Changes: changes,
105 },
106 }
107 resp, err := r53.ChangeResourceRecordSets(ctx, &req)
108 if err != nil {
109 return 0, err
110 }
111 if wait {
112 waitForChange(ctx, resp.ChangeInfo)
113 }
114 }
115 return len(changes), nil
116}
117
118func purgeZoneRecords(ctx context.Context, zone *route53types.HostedZone, wait bool) {
119 total := 0

Callers 1

purgeZoneRecordsFunction · 0.85

Calls 2

isAuthRecordFunction · 0.85
waitForChangeFunction · 0.85

Tested by

no test coverage detected