generate_record_wrapper

Macro generate_record_wrapper 

Source
macro_rules! generate_record_wrapper {
    ($wrapper_fn:ident, $record_type:ty, $reconcile_fn:path, $kind_const:path, $display_name:expr) => { ... };
}
Expand description

Macro to generate record reconciliation wrapper functions.

This eliminates ~900 lines of duplicate code by generating identical wrappers for all 8 DNS record types with only the type and constant names changing.

§Generated Function Pattern

For each record type, generates an async function that:

  1. Tracks reconciliation timing
  2. Calls the type-specific reconcile function
  3. Records metrics (success/error)
  4. Checks resource readiness status
  5. Returns appropriate requeue action

§Example

generate_record_wrapper!(
    reconcile_arecord_wrapper,  // Function name
    ARecord,                     // Record type
    reconcile_a_record,          // Reconcile function
    KIND_A_RECORD,               // Metrics constant
    "ARecord"                    // Display name
);