mirror of
https://github.com/go-acme/lego.git
synced 2025-03-06 00:43:46 +02:00
Filter Google Cloud DNS List() calls
Make a more efficient API call to only fetch the name of interest.
This commit is contained in:
parent
b12ce5e731
commit
028e412850
@ -121,14 +121,17 @@ func (c *DNSProvider) Timeout() (timeout, interval time.Duration) {
|
||||
|
||||
// getHostedZone returns the managed-zone
|
||||
func (c *DNSProvider) getHostedZone(domain string) (string, error) {
|
||||
|
||||
zones, err := c.client.ManagedZones.List(c.project).Do()
|
||||
dnsName := domain + "."
|
||||
zones, err := c.client.ManagedZones.
|
||||
List(c.project).
|
||||
DnsName(dnsName).
|
||||
Do()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("GoogleCloud API call failed: %v", err)
|
||||
}
|
||||
|
||||
for _, z := range zones.ManagedZones {
|
||||
if strings.HasSuffix(domain+".", z.DnsName) {
|
||||
if strings.HasSuffix(dnsName, z.DnsName) {
|
||||
return z.Name, nil
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user