@@ -112,7 +112,7 @@ type cloudFlareDNS interface {
112112 GetZone (ctx context.Context , zoneID string ) (* zones.Zone , error )
113113 ListDNSRecords (ctx context.Context , rc * cloudflarev0.ResourceContainer , rp cloudflarev0.ListDNSRecordsParams ) ([]dns.RecordResponse , * cloudflarev0.ResultInfo , error )
114114 CreateDNSRecord (ctx context.Context , params dns.RecordNewParams ) (* dns.RecordResponse , error )
115- DeleteDNSRecord (ctx context.Context , rc * cloudflarev0. ResourceContainer , recordID string ) error
115+ DeleteDNSRecord (ctx context.Context , recordID string , params dns. RecordDeleteParams ) error
116116 UpdateDNSRecord (ctx context.Context , rc * cloudflarev0.ResourceContainer , rp cloudflarev0.UpdateDNSRecordParams ) error
117117 ListDataLocalizationRegionalHostnames (ctx context.Context , params addressing.RegionalHostnameListParams ) autoPager [addressing.RegionalHostnameListResponse ]
118118 CreateDataLocalizationRegionalHostname (ctx context.Context , params addressing.RegionalHostnameNewParams ) error
@@ -166,8 +166,9 @@ func (z zoneService) UpdateDNSRecord(ctx context.Context, rc *cloudflarev0.Resou
166166 return err
167167}
168168
169- func (z zoneService ) DeleteDNSRecord (ctx context.Context , rc * cloudflarev0.ResourceContainer , recordID string ) error {
170- return z .serviceV0 .DeleteDNSRecord (ctx , rc , recordID )
169+ func (z zoneService ) DeleteDNSRecord (ctx context.Context , recordID string , params dns.RecordDeleteParams ) error {
170+ _ , err := z .service .DNS .Records .Delete (ctx , recordID , params )
171+ return err
171172}
172173
173174func (z zoneService ) ListZones (ctx context.Context , params zones.ZoneListParams ) autoPager [zones.Zone ] {
@@ -300,6 +301,13 @@ func getCreateDNSRecordParam(zoneID string, cfc *cloudFlareChange) dns.RecordNew
300301 }
301302}
302303
304+ // getDeleteDNSRecordParam is a function that returns the appropriate Record Delete Param based on the zoneID passed in
305+ func getDeleteDNSRecordParam (zoneID string ) dns.RecordDeleteParams {
306+ return dns.RecordDeleteParams {
307+ ZoneID : cloudflare .F (zoneID ),
308+ }
309+ }
310+
303311func convertCloudflareError (err error ) error {
304312 var apiErr * cloudflarev0.Error
305313 if errors .As (err , & apiErr ) {
@@ -673,7 +681,7 @@ func (p *CloudFlareProvider) submitChanges(ctx context.Context, changes []*cloud
673681 log .WithFields (logFields ).Errorf ("failed to find previous record: %v" , change .ResourceRecord )
674682 continue
675683 }
676- err := p .Client .DeleteDNSRecord (ctx , resourceContainer , recordID )
684+ err := p .Client .DeleteDNSRecord (ctx , recordID , getDeleteDNSRecordParam ( zoneID ) )
677685 if err != nil {
678686 failedChange = true
679687 log .WithFields (logFields ).Errorf ("failed to delete record: %v" , err )
0 commit comments