scaleway: add cname support (#2075)

This commit is contained in:
Patrik 2024-01-06 13:02:10 +01:00 committed by GitHub
parent 6da922047a
commit e98dea02de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

2
go.mod
View file

@ -62,7 +62,7 @@ require (
github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2 github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2
github.com/sacloud/api-client-go v0.2.8 github.com/sacloud/api-client-go v0.2.8
github.com/sacloud/iaas-api-go v1.11.1 github.com/sacloud/iaas-api-go v1.11.1
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17 github.com/scaleway/scaleway-sdk-go v1.0.0-beta.22
github.com/softlayer/softlayer-go v1.1.2 github.com/softlayer/softlayer-go v1.1.2
github.com/stretchr/testify v1.8.4 github.com/stretchr/testify v1.8.4
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.490 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.490

4
go.sum
View file

@ -539,8 +539,8 @@ github.com/sacloud/iaas-api-go v1.11.1 h1:2MsFZ4H1uRdRVx2nVXuERWQ3swoFc3XreIV5hJ
github.com/sacloud/iaas-api-go v1.11.1/go.mod h1:uBDSa06F/V0OnoR66jGdbH0PVnCJw+NeE9RVbVgMfss= github.com/sacloud/iaas-api-go v1.11.1/go.mod h1:uBDSa06F/V0OnoR66jGdbH0PVnCJw+NeE9RVbVgMfss=
github.com/sacloud/packages-go v0.0.9 h1:GbinkBLC/eirFhHpLjoDW6JV7+95Rnd2d8RWj7Afeks= github.com/sacloud/packages-go v0.0.9 h1:GbinkBLC/eirFhHpLjoDW6JV7+95Rnd2d8RWj7Afeks=
github.com/sacloud/packages-go v0.0.9/go.mod h1:k+EEUMF2LlncjbNIJNOqLyZ9wjTESPIWIk1OA7x9j2Q= github.com/sacloud/packages-go v0.0.9/go.mod h1:k+EEUMF2LlncjbNIJNOqLyZ9wjTESPIWIk1OA7x9j2Q=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17 h1:1WuWJu7/e8SqK+uQl7lfk/N/oMZTL2NE/TJsNKRNMc4= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.22 h1:wJrcTdddKOI8TFxs8cemnhKP2EmKy3yfUKHj3ZdfzYo=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.22/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=

View file

@ -121,13 +121,13 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
Comment: scw.StringPtr("used by lego"), Comment: scw.StringPtr("used by lego"),
}} }}
// TODO(ldez) replace domain by FQDN to follow CNAME.
req := &scwdomain.UpdateDNSZoneRecordsRequest{ req := &scwdomain.UpdateDNSZoneRecordsRequest{
DNSZone: domain, DNSZone: info.EffectiveFQDN,
Changes: []*scwdomain.RecordChange{{ Changes: []*scwdomain.RecordChange{{
Add: &scwdomain.RecordChangeAdd{Records: records}, Add: &scwdomain.RecordChangeAdd{Records: records},
}}, }},
ReturnAllRecords: scw.BoolPtr(false), ReturnAllRecords: scw.BoolPtr(false),
DisallowNewZoneCreation: true,
} }
_, err := d.client.UpdateDNSZoneRecords(req) _, err := d.client.UpdateDNSZoneRecords(req)
@ -148,13 +148,13 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
Data: scw.StringPtr(fmt.Sprintf(`%q`, info.Value)), Data: scw.StringPtr(fmt.Sprintf(`%q`, info.Value)),
} }
// TODO(ldez) replace domain by FQDN to follow CNAME.
req := &scwdomain.UpdateDNSZoneRecordsRequest{ req := &scwdomain.UpdateDNSZoneRecordsRequest{
DNSZone: domain, DNSZone: info.EffectiveFQDN,
Changes: []*scwdomain.RecordChange{{ Changes: []*scwdomain.RecordChange{{
Delete: &scwdomain.RecordChangeDelete{IDFields: recordIdentifier}, Delete: &scwdomain.RecordChangeDelete{IDFields: recordIdentifier},
}}, }},
ReturnAllRecords: scw.BoolPtr(false), ReturnAllRecords: scw.BoolPtr(false),
DisallowNewZoneCreation: true,
} }
_, err := d.client.UpdateDNSZoneRecords(req) _, err := d.client.UpdateDNSZoneRecords(req)