@@ -31,6 +31,7 @@ import (
3131 cloudflarev0 "github.com/cloudflare/cloudflare-go"
3232 "github.com/cloudflare/cloudflare-go/v5"
3333 "github.com/cloudflare/cloudflare-go/v5/addressing"
34+ "github.com/cloudflare/cloudflare-go/v5/custom_hostnames"
3435 "github.com/cloudflare/cloudflare-go/v5/dns"
3536 "github.com/cloudflare/cloudflare-go/v5/option"
3637 "github.com/cloudflare/cloudflare-go/v5/zones"
@@ -124,7 +125,7 @@ type cloudFlareDNS interface {
124125 UpdateDataLocalizationRegionalHostname (ctx context.Context , hostname string , params addressing.RegionalHostnameEditParams ) error
125126 DeleteDataLocalizationRegionalHostname (ctx context.Context , hostname string , params addressing.RegionalHostnameDeleteParams ) error
126127 CustomHostnames (ctx context.Context , zoneID string , page int , filter cloudflarev0.CustomHostname ) ([]cloudflarev0.CustomHostname , cloudflarev0.ResultInfo , error )
127- DeleteCustomHostname (ctx context.Context , zoneID string , customHostnameID string ) error
128+ DeleteCustomHostname (ctx context.Context , customHostnameID string , params custom_hostnames. CustomHostnameDeleteParams ) error
128129 CreateCustomHostname (ctx context.Context , zoneID string , ch cloudflarev0.CustomHostname ) (* cloudflarev0.CustomHostnameResponse , error )
129130}
130131
@@ -182,8 +183,9 @@ func (z zoneService) CustomHostnames(ctx context.Context, zoneID string, page in
182183 return z .serviceV0 .CustomHostnames (ctx , zoneID , page , filter )
183184}
184185
185- func (z zoneService ) DeleteCustomHostname (ctx context.Context , zoneID string , customHostnameID string ) error {
186- return z .serviceV0 .DeleteCustomHostname (ctx , zoneID , customHostnameID )
186+ func (z zoneService ) DeleteCustomHostname (ctx context.Context , customHostnameID string , params custom_hostnames.CustomHostnameDeleteParams ) error {
187+ _ , err := z .service .CustomHostnames .Delete (ctx , customHostnameID , params )
188+ return err
187189}
188190
189191func (z zoneService ) CreateCustomHostname (ctx context.Context , zoneID string , ch cloudflarev0.CustomHostname ) (* cloudflarev0.CustomHostnameResponse , error ) {
@@ -552,7 +554,8 @@ func (p *CloudFlareProvider) submitCustomHostnameChanges(ctx context.Context, zo
552554 prevChID := prevCh .ID
553555 if prevChID != "" {
554556 log .WithFields (logFields ).Infof ("Removing previous custom hostname %q/%q" , prevChID , changeCH )
555- chErr := p .Client .DeleteCustomHostname (ctx , zoneID , prevChID )
557+ params := custom_hostnames.CustomHostnameDeleteParams {ZoneID : cloudflare .F (zoneID )}
558+ chErr := p .Client .DeleteCustomHostname (ctx , prevChID , params )
556559 if chErr != nil {
557560 failedChange = true
558561 log .WithFields (logFields ).Errorf ("failed to remove previous custom hostname %q/%q: %v" , prevChID , changeCH , chErr )
@@ -575,7 +578,8 @@ func (p *CloudFlareProvider) submitCustomHostnameChanges(ctx context.Context, zo
575578 log .WithFields (logFields ).Infof ("Deleting custom hostname %q" , changeCH .Hostname )
576579 if ch , err := getCustomHostname (chs , changeCH .Hostname ); err == nil {
577580 chID := ch .ID
578- chErr := p .Client .DeleteCustomHostname (ctx , zoneID , chID )
581+ params := custom_hostnames.CustomHostnameDeleteParams {ZoneID : cloudflare .F (zoneID )}
582+ chErr := p .Client .DeleteCustomHostname (ctx , chID , params )
579583 if chErr != nil {
580584 failedChange = true
581585 log .WithFields (logFields ).Errorf ("failed to delete custom hostname %q/%q: %v" , chID , changeCH .Hostname , chErr )
0 commit comments