@@ -107,6 +107,21 @@ public async Task<bool> CreateRecordAsync(string recordName, string txtValue)
107107 Console . WriteLine ( $ "[Infoblox] Status: { response . StatusCode } ") ;
108108 Console . WriteLine ( $ "[Infoblox] Response: { result } ") ;
109109
110+ if ( response . IsSuccessStatusCode )
111+ {
112+ // Verify the record was created by searching for it
113+ await Task . Delay ( 1000 ) ; // Brief delay to ensure record is committed
114+ var verifySuccess = await VerifyRecordExists ( cleanName , txtValue ) ;
115+ if ( verifySuccess )
116+ {
117+ Console . WriteLine ( $ "[Infoblox] ✓ Verified TXT record exists: { cleanName } ") ;
118+ }
119+ else
120+ {
121+ Console . WriteLine ( $ "[Infoblox] ⚠ WARNING: Record creation returned success, but verification failed for { cleanName } ") ;
122+ }
123+ }
124+
110125 return response . IsSuccessStatusCode ;
111126 }
112127 catch ( Exception ex )
@@ -199,6 +214,39 @@ private async Task<bool> VerifyZoneExistsAsync(string zoneName)
199214 }
200215 }
201216
217+ private async Task < bool > VerifyRecordExists ( string recordName , string expectedValue )
218+ {
219+ try
220+ {
221+ var searchUrl = $ "./record:txt?name={ Uri . EscapeDataString ( recordName ) } ";
222+ var response = await _httpClient . GetAsync ( searchUrl ) ;
223+
224+ if ( ! response . IsSuccessStatusCode )
225+ {
226+ return false ;
227+ }
228+
229+ var json = await response . Content . ReadAsStringAsync ( ) ;
230+ var records = JsonDocument . Parse ( json ) . RootElement ;
231+
232+ foreach ( var record in records . EnumerateArray ( ) )
233+ {
234+ var text = record . GetProperty ( "text" ) . GetString ( ) ;
235+ if ( text == expectedValue )
236+ {
237+ return true ;
238+ }
239+ }
240+
241+ return false ;
242+ }
243+ catch ( Exception ex )
244+ {
245+ Console . WriteLine ( $ "[Infoblox] Error verifying record: { ex . Message } ") ;
246+ return false ;
247+ }
248+ }
249+
202250 public void Dispose ( )
203251 {
204252 _httpClient ? . Dispose ( ) ;
0 commit comments