GCORE: Implement ListZones to allow auto create zones (#3588)

This commit is contained in:
Yuhui Xu 2025-05-29 06:56:33 -07:00 committed by GitHub
parent 1d148f430b
commit 113c1ac13b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 39 additions and 6 deletions

View file

@ -1131,7 +1131,13 @@ declare function DefaultTTL(ttl: Duration): DomainModifier;
declare function DnsProvider(name: string, nsCount?: number): DomainModifier;
/**
* Documentation needed.
* This is provider specific type of record and not a DNS standard. It may behave differently for each provider that handles it.
*
* ### Namecheap
*
* This is a URL Redirect record with a type of "Masked", it creates a framed HTML page to the target.
*
* You can read more at the [Namecheap documentation](https://www.namecheap.com/support/knowledgebase/article.aspx/385/2237/how-to-set-up-a-url-redirect-for-a-domain/).
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/frame
*/
@ -3256,18 +3262,30 @@ declare function TTL(ttl: Duration): RecordModifier;
declare function TXT(name: string, contents: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* Documentation needed.
* This is provider specific type of record and not a DNS standard. It may behave differently for each provider that handles it.
*
* ### Namecheap
*
* This is a URL Redirect record with a type of "Unmasked", it creates a 302 redirect to the target.
*
* You can read more at the [Namecheap documentation](https://www.namecheap.com/support/knowledgebase/article.aspx/385/2237/how-to-set-up-a-url-redirect-for-a-domain/)
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/url
*/
declare function URL(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* Documentation needed.
* This is provider specific type of record and not a DNS standard. It may behave differently for each provider that handles it.
*
* ### Namecheap
*
* This is a URL Redirect record with a type of "Permanent", it creates a 301 redirect to the target.
*
* You can read more at the [Namecheap documentation](https://www.namecheap.com/support/knowledgebase/article.aspx/385/2237/how-to-set-up-a-url-redirect-for-a-domain/).
*
* @see https://docs.dnscontrol.org/language-reference/domain-modifiers/url301
*/
declare function URL301(name: string, ...modifiers: RecordModifier[]): DomainModifier;
declare function URL301(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier;
/**
* `getConfiguredDomains` getConfiguredDomains is a helper function that returns the domain names

View file

@ -36,7 +36,7 @@ If a feature is definitively not supported for whatever reason, we would also li
| [`EXOSCALE`](exoscale.md) | ❌ | ✅ | ❌ | ❔ | ✅ | ✅ | ❔ | ❔ | ❌ | ❔ | ✅ | ❔ | ✅ | ❔ | ❔ | ❌ | ❔ | ❔ | ❔ | ❔ | ❌ | ❌ | ❔ |
| [`GANDI_V5`](gandi_v5.md) | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | ❌ | ❔ | ✅ | ❔ | ✅ | ✅ | ❔ | ✅ | ❌ | ❔ | ❔ | ❔ | ❔ | ❌ | ✅ |
| [`GCLOUD`](gcloud.md) | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ❔ | ✅ | ❌ | ❔ | ✅ | ❔ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | ❔ | ❔ | ✅ | ✅ | ✅ |
| [`GCORE`](gcore.md) | ❌ | ✅ | ❌ | | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ❔ | ✅ | ❌ | ✅ | ❌ | ❌ | ❔ | ❔ | ❔ | ✅ | ✅ | ✅ |
| [`GCORE`](gcore.md) | ❌ | ✅ | ❌ | | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ❔ | ✅ | ❌ | ✅ | ❌ | ❌ | ❔ | ❔ | ❔ | ✅ | ✅ | ✅ |
| [`HEDNS`](hedns.md) | ❌ | ✅ | ❌ | ❔ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | ❔ | ❔ | ❔ | ✅ | ✅ | ✅ |
| [`HETZNER`](hetzner.md) | ❌ | ✅ | ❌ | ✅ | ❌ | ✅ | ❌ | ❔ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❔ | ✅ | ✅ | ❔ | ❔ | ❔ | ✅ | ✅ | ✅ |
| [`HEXONET`](hexonet.md) | ❌ | ✅ | ✅ | ❔ | ❌ | ✅ | ❔ | ❔ | ❔ | ❔ | ✅ | ❔ | ✅ | ❔ | ❔ | ✅ | ❔ | ❔ | ❔ | ❔ | ✅ | ✅ | ❔ |

View file

@ -46,7 +46,7 @@ var features = providers.DocumentationNotes{
// See providers/capabilities.go for the entire list of capabilities.
providers.CanAutoDNSSEC: providers.Can(),
providers.CanGetZones: providers.Can(),
providers.CanConcur: providers.Unimplemented(),
providers.CanConcur: providers.Can(),
providers.CanUseAlias: providers.Can(),
providers.CanUseCAA: providers.Can(),
providers.CanUseDS: providers.Cannot(),
@ -227,6 +227,21 @@ func (c *gcoreProvider) GetZoneRecordsCorrections(dc *models.DomainConfig, exist
return result, actualChangeCount, nil
}
// ListZones return all the zones in the account
func (c *gcoreProvider) ListZones() ([]string, error) {
zones, err := c.provider.Zones(c.ctx)
if err != nil {
return nil, err
}
var zoneList []string
for _, zone := range zones {
zoneList = append(zoneList, zone.Name)
}
return zoneList, nil
}
func comparableFunc(rec *models.RecordConfig) string {
if len(rec.Metadata) == 0 {
return ""