(ctx context.Context, name string, match string, rtype string, wait bool, identifier string)
| 694 | } |
| 695 | |
| 696 | func deleteRecord(ctx context.Context, name string, match string, rtype string, wait bool, identifier string) { |
| 697 | zone := lookupZone(ctx, name) |
| 698 | rrsets, err := ListAllRecordSets(ctx, r53, *zone.Id) |
| 699 | fatalIfErr(err) |
| 700 | |
| 701 | match = qualifyName(match, *zone.Name) |
| 702 | changes := []route53types.Change{} |
| 703 | for _, rrset := range rrsets { |
| 704 | if *rrset.Name == match && rrset.Type == route53types.RRType(rtype) && (identifier == "" || (rrset.SetIdentifier != nil && *rrset.SetIdentifier == identifier)) { |
| 705 | change := route53types.Change{ |
| 706 | Action: route53types.ChangeActionDelete, |
| 707 | ResourceRecordSet: rrset, |
| 708 | } |
| 709 | changes = append(changes, change) |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | if len(changes) > 0 { |
| 714 | req2 := route53.ChangeResourceRecordSetsInput{ |
| 715 | HostedZoneId: zone.Id, |
| 716 | ChangeBatch: &route53types.ChangeBatch{ |
| 717 | Changes: changes, |
| 718 | }, |
| 719 | } |
| 720 | resp, err := r53.ChangeResourceRecordSets(ctx, &req2) |
| 721 | fatalIfErr(err) |
| 722 | fmt.Printf("%d record sets deleted\n", len(changes)) |
| 723 | if wait { |
| 724 | waitForChange(ctx, resp.ChangeInfo) |
| 725 | } |
| 726 | } else { |
| 727 | fmt.Println("Warning: no records matched - nothing deleted") |
| 728 | } |
| 729 | } |
| 730 | |
| 731 | func purgeRecords(ctx context.Context, name string, wait bool) { |
| 732 | zone := lookupZone(ctx, name) |
no test coverage detected