Comments (2)
// DeleteHost deletes a Hosted zone with record types.
// Works with https://github.com/mitchellh/goamz/pull/162
func DeleteHost(
client *route53.Route53,
domain string,
recordType string,
) (changeID string, deleteID string, ERR error) {
log.Println("Deleting:", domain)
id, err := GetHostedZoneID(client, domain)
if err != nil {
changeID = ""
deleteID = ""
ERR = err
return
}
listOpt := route53.ListOpts{
Name: domain,
}
resp0, err := client.ListResourceRecordSets(id, &listOpt)
if err != nil {
changeID = ""
deleteID = ""
ERR = err
return
}
changes := []route53.Change{}
for _, record := range resp0.Records {
if record.Type != recordType {
continue
}
change := route53.Change{
Action: "DELETE",
Record: route53.ResourceRecordSet{
Name: record.Name,
Type: record.Type,
TTL: record.TTL,
Records: record.Records,
SetIdentifier: record.SetIdentifier,
Weight: record.Weight,
HealthCheckId: record.HealthCheckId,
Region: record.Region,
Failover: record.Failover,
AliasTarget: record.AliasTarget,
// RecordsXML: recordsXML,
},
}
changes = append(changes, change)
}
resp1, err := changeRecordSets(client, id, "Delete", changes)
if err != nil {
changeID = ""
deleteID = ""
ERR = err
return
}
resp2, err := client.DeleteHostedZone(id)
if err != nil {
changeID = ""
deleteID = ""
ERR = err
return
}
changeID = route53.CleanChangeID(resp1.ChangeInfo.ID)
deleteID = route53.CleanChangeID(resp2.ChangeInfo.ID)
ERR = nil
log.Println("Deleted:", domain)
return
}
from goamz.
Actually doesn't need to be deleted one by one. Just need to omit RecordsXML: recordsXML
from goamz.
Related Issues (20)
- Throwing away original error messages
- IAM role credentials support HOT 1
- Unstable "No valid AWS authentication found" error using IAM roles
- Create RDS db snapshot feature
- s3 partial get HOT 3
- Expose ec2test package
- When running concurrently, s3testserver never unlocks mutex
- Get https:/bucket/file: net/http: TLS handshake timeout HOT 4
- The aws http client doesn't seem to be working very well with the S3 client on retry
- DynamoDB support
- Make MaxTries configurable
- ec2.CreateImage with NoDevice return InvalidBlockDeviceMapping
- AWS_ACCESS_KEY should be optional
- Add a note that this is not supported anymore HOT 4
- PutPart returning wrong size
- Trying to add a method to initiate a glacier restore, getting an incorrect signature
- S3 versioning
- ceph s3 compatible api, multipart complete fail
- it seems that Multi.PutPart won't close the response body and it will lead resource leak.
- change s3key acl
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goamz.