plugin/clouddns: add endpoint directive (#8618)

Brings clouddns to parity with route53, which already exposes
aws_endpoint for overriding the API endpoint (useful for pointing at a
local emulator or test environment). clouddns has no equivalent - its
client constructor only ever accepts a credentials option.

Changes f's single option.ClientOption parameter to variadic
...option.ClientOption so credentials and endpoint can be combined, and
adds the endpoint case wired to option.WithEndpoint, Google's own
client option for this exact purpose.

Extends TestSetupCloudDNS with endpoint coverage (valid value, missing
arg). Verified it fails without the setup.go change (unknown property
error) and passes with it.

Signed-off-by: stackedbyaradhya <aradhyaj736@gmail.com>
This commit is contained in:
Aradhya Jain
2026-10-09 13:58:35 +05:30
committed by GitHub
parent ef18404448
commit 123829d3b3
3 changed files with 34 additions and 14 deletions

View File

@@ -13,7 +13,7 @@ import (
)
func TestSetupCloudDNS(t *testing.T) {
f = func(_ctx context.Context, _opt option.ClientOption) (gcpDNS, error) {
f = func(_ctx context.Context, _opts ...option.ClientOption) (gcpDNS, error) {
return fakeGCPClient{}, nil
}
@@ -73,6 +73,12 @@ func TestSetupCloudDNS(t *testing.T) {
}`, true},
{`clouddns example.org.:example-project:zone-name {
refresh -5m
}`, true},
{`clouddns example.org.:example-project:zone-name {
endpoint https://dns.googleapis.com
}`, false},
{`clouddns example.org.:example-project:zone-name {
endpoint
}`, true},
{`clouddns example.org.:example-project:zone-name example.org.:example-project:zone-name {
}`, true},