From 3642186801ff652a9c619adfb8d25c2194e81e97 Mon Sep 17 00:00:00 2001 From: Francesco Calcavecchia Date: Sat, 11 Jan 2025 15:57:36 +0100 Subject: [PATCH] remove type_name in favor of owner --- docs/scaleway.md | 4 +--- internal/provider/providers/scaleway/provider.go | 7 +++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/scaleway.md b/docs/scaleway.md index 02616bcdb..319f9ffea 100644 --- a/docs/scaleway.md +++ b/docs/scaleway.md @@ -15,7 +15,6 @@ If something is unclear in the documentation below, please refer to the [scalewa "secret_key": "", "ip_version": "ipv4", "ipv6_suffix": "", - "field_name": "www", "ttl": 450 } ] @@ -24,14 +23,13 @@ If something is unclear in the documentation below, please refer to the [scalewa ### Compulsory parameters -- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard. This field corresponds to the `dns-zone` in the scaleway API documentation. +- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard. This field is used to extract the `dns-zone`, `id_fields.name`, and `records.name`, and used to make the scaleway API call. For example. if your domain is `example.com`, and you set as `"domain`" `sub.example.com`, then the API call will be made with `dns-zone = example.com`, `id_fields.name = sub`, and `records.name = sub`. - `"secret_key"` ### Optional parameters - `"ip_version"` can be `"ipv4"` or `"ipv6"`. It defaults to `"ipv4"`. - `"ipv6_suffix"` is the suffix to append to the IPv6 address. It defaults to `""`. -- `"field_name"` is the name of the DNS record to update. For example, it could be `"www"`, `"@"` or `"*"` for the wildcard. It defaults to to `""` (equivalent to `"@"`). - `"ttl"` is the TTL of the DNS record to update. It defaults to `3600`. ## Domain setup diff --git a/internal/provider/providers/scaleway/provider.go b/internal/provider/providers/scaleway/provider.go index eef4ccf0c..2d49b6bb4 100644 --- a/internal/provider/providers/scaleway/provider.go +++ b/internal/provider/providers/scaleway/provider.go @@ -23,7 +23,6 @@ type Provider struct { ipVersion ipversion.IPVersion ipv6Suffix netip.Prefix secretKey string - field_name string ttl uint16 } @@ -33,7 +32,6 @@ func New(data json.RawMessage, domain, owner string, ) { var providerSpecificSettings struct { SecretKey string `json:"secret_key"` - FieldName string `json:"field_name"` TTL uint16 `json:"ttl"` } err = json.Unmarshal(data, &providerSpecificSettings) @@ -57,7 +55,6 @@ func New(data json.RawMessage, domain, owner string, ipVersion: ipVersion, ipv6Suffix: ipv6Suffix, secretKey: providerSpecificSettings.SecretKey, - field_name: providerSpecificSettings.FieldName, ttl: providerSpecificSettings.TTL, }, nil } @@ -127,6 +124,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add } type recordJSON struct { Data string `json:"data"` + Name string `json:"name"` TTL uint16 `json:"ttl"` } type changeJSON struct { @@ -139,10 +137,11 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add } `json:"set"` } var change changeJSON - change.Set.IDFields.Name = p.field_name + change.Set.IDFields.Name = p.owner change.Set.IDFields.Type = fieldType change.Set.Records = []recordJSON{{ Data: ip.String(), + Name: p.owner, TTL: p.ttl, }} requestBody := struct {