@@ -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 , rc * cloudflarev0.ResourceContainer , rp cloudflarev0.CreateDNSRecordParams ) (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
@@ -167,8 +167,9 @@ func (z zoneService) UpdateDNSRecord(ctx context.Context, rc *cloudflarev0.Resou
167167 return err
168168}
169169
170- func (z zoneService ) DeleteDNSRecord (ctx context.Context , rc * cloudflarev0.ResourceContainer , recordID string ) error {
171- return z .serviceV0 .DeleteDNSRecord (ctx , rc , recordID )
170+ func (z zoneService ) DeleteDNSRecord (ctx context.Context , recordID string , params dns.RecordDeleteParams ) error {
171+ _ , err := z .service .DNS .Records .Delete (ctx , recordID , params )
172+ return err
172173}
173174
174175func (z zoneService ) ListZones (ctx context.Context , params zones.ZoneListParams ) autoPager [zones.Zone ] {
@@ -302,6 +303,13 @@ func getCreateDNSRecordParam(cfc cloudFlareChange) cloudflarev0.CreateDNSRecordP
302303 return params
303304}
304305
306+ // getDeleteDNSRecordParam is a function that returns the appropriate Record Delete Param based on the zoneID passed in
307+ func getDeleteDNSRecordParam (zoneID string ) dns.RecordDeleteParams {
308+ return dns.RecordDeleteParams {
309+ ZoneID : cloudflare .F (zoneID ),
310+ }
311+ }
312+
305313func convertCloudflareError (err error ) error {
306314 var apiErr * cloudflarev0.Error
307315 if errors .As (err , & apiErr ) {
@@ -675,7 +683,8 @@ func (p *CloudFlareProvider) submitChanges(ctx context.Context, changes []*cloud
675683 log .WithFields (logFields ).Errorf ("failed to find previous record: %v" , change .ResourceRecord )
676684 continue
677685 }
678- err := p .Client .DeleteDNSRecord (ctx , resourceContainer , recordID )
686+ recordParam := getDeleteDNSRecordParam (zoneID )
687+ err := p .Client .DeleteDNSRecord (ctx , recordID , recordParam )
679688 if err != nil {
680689 failedChange = true
681690 log .WithFields (logFields ).Errorf ("failed to delete record: %v" , err )
0 commit comments