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

Function cleanupDomain

internal/features/step_definitions.go:97–131  ·  view source on GitHub ↗
(r53 *route53.Client, id string)

Source from the content-addressed store, hash-verified

95}
96
97func 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
133func cleanupReusableDelegationSet(r53 *route53.Client, id string) {
134 req := route53.DeleteReusableDelegationSetInput{Id: &id}

Callers 1

initFunction · 0.85

Calls 2

ListAllRecordSetsFunction · 0.92
fatalIfErrFunction · 0.70

Tested by

no test coverage detected