(r53 *route53.Client, id string)
| 95 | } |
| 96 | |
| 97 | func cleanupDomain(r53 *route53.Client, id string) { |
| 98 | // delete all non-default SOA/NS records |
| 99 | ctx := context.Background() |
| 100 | rrsets, err := cli53.ListAllRecordSets(ctx, r53, id) |
| 101 | fatalIfErr(err) |
| 102 | changes := []route53types.Change{} |
| 103 | for _, rrset := range rrsets { |
| 104 | if rrset.Type != route53types.RRTypeNs && rrset.Type != route53types.RRTypeSoa { |
| 105 | change := route53types.Change{ |
| 106 | Action: route53types.ChangeActionDelete, |
| 107 | ResourceRecordSet: rrset, |
| 108 | } |
| 109 | changes = append(changes, change) |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | if len(changes) > 0 { |
| 114 | req2 := route53.ChangeResourceRecordSetsInput{ |
| 115 | HostedZoneId: &id, |
| 116 | ChangeBatch: &route53types.ChangeBatch{ |
| 117 | Changes: changes, |
| 118 | }, |
| 119 | } |
| 120 | _, err = r53.ChangeResourceRecordSets(ctx, &req2) |
| 121 | if err != nil { |
| 122 | fmt.Printf("Warning: cleanup failed - %s\n", err) |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | req3 := route53.DeleteHostedZoneInput{Id: &id} |
| 127 | _, err = r53.DeleteHostedZone(ctx, &req3) |
| 128 | if err != nil { |
| 129 | fmt.Printf("Warning: cleanup failed - %s\n", err) |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | func cleanupReusableDelegationSet(r53 *route53.Client, id string) { |
| 134 | req := route53.DeleteReusableDelegationSetInput{Id: &id} |
no test coverage detected