AWS removed endpoints
package from Go SDK V2. Is there a way to get a list of AWS regions using Go SDK V2?
In V1 you could write something like this:
import "github.com/aws/aws-sdk-go/aws/endpoints"
...
...
partitions := endpoints.DefaultPartitions()
for _, p := range partitions {
for region := range p.Regions() {
validRegions[region] = struct{}{}
}
}
...
...
However, this seems no longer possible. I did notice an autogenerated json which seems to contain all the partitions, however I can't seem to figure out how to get the list of available regions in the code.
Is there a way to do this in Go SDK V2?
question from:
https://stackoverflow.com/questions/65843812/how-to-get-a-list-of-aws-regions-programmatically-in-go-sdk-v2 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…