Skip to content

Commit

Permalink
remove type_name in favor of owner
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Calcavecchia committed Jan 11, 2025
1 parent f67e76f commit 3642186
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 1 addition & 3 deletions docs/scaleway.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ If something is unclear in the documentation below, please refer to the [scalewa
"secret_key": "<SECRET_KEY>",
"ip_version": "ipv4",
"ipv6_suffix": "",
"field_name": "www",
"ttl": 450
}
]
Expand All @@ -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
Expand Down
7 changes: 3 additions & 4 deletions internal/provider/providers/scaleway/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type Provider struct {
ipVersion ipversion.IPVersion
ipv6Suffix netip.Prefix
secretKey string
field_name string
ttl uint16
}

Expand All @@ -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)
Expand All @@ -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
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 3642186

Please sign in to comment.