GANDI_V5 & OVH: Implement ZoneLister (#1117)

* GANDI_V5: implement ZoneLister

* OVH: implement ZoneLister
This commit is contained in:
nemunaire 2021-04-03 16:31:25 +02:00 committed by GitHub
parent 877d54879e
commit ce6006cce7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View file

@ -98,6 +98,22 @@ func newHelper(m map[string]string, metadata json.RawMessage) (*gandiv5Provider,
// Section 3: Domain Service Provider (DSP) related functions
// ListZones lists the zones on this account.
func (client *gandiv5Provider) ListZones() ([]string, error) {
g := gandi.NewLiveDNSClient(client.apikey, gandi.Config{SharingID: client.sharingid, Debug: client.debug})
listResp, err := g.ListDomains()
if err != nil {
return nil, err
}
zones := make([]string, len(listResp))
for i, zone := range listResp {
zones[i] = zone.FQDN
}
return zones, nil
}
// NB(tal): To future-proof your code, all new providers should
// implement GetDomainCorrections exactly as you see here
// (byte-for-byte the same). In 3.0

View file

@ -85,6 +85,14 @@ func (e errNoExist) Error() string {
return fmt.Sprintf("Domain %s not found in your ovh account", e.domain)
}
// ListZones lists the zones on this account.
func (c *ovhProvider) ListZones() (zones []string, err error) {
for zone := range c.zones {
zones = append(zones, zone)
}
return
}
// GetZoneRecords gets the records of a zone and returns them in RecordConfig format.
func (c *ovhProvider) GetZoneRecords(domain string) (models.Records, error) {
if !c.zones[domain] {