drasi-bootstrap-http 0.1.8

HTTP bootstrap plugin for Drasi - fetches initial state from REST APIs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
// Copyright 2025 The Drasi Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! Plugin descriptor for the HTTP bootstrap provider.

use std::collections::HashMap;

use drasi_lib::bootstrap::BootstrapProvider;
use drasi_plugin_sdk::prelude::*;
use utoipa::OpenApi;

use crate::config::{
    ApiKeyLocation, AuthConfig, ContentTypeOverride, ElementMappingConfig, ElementTemplate,
    ElementType, EndpointConfig, HttpBootstrapConfig, HttpMethod, OperationType, PaginationConfig,
    ResponseConfig,
};
use crate::provider::HttpBootstrapProvider;

// ── DTO types ────────────────────────────────────────────────────────────────

/// Top-level configuration DTO for the HTTP bootstrap provider.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, utoipa::ToSchema)]
#[schema(as = bootstrap::http::HttpBootstrapConfig)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct HttpBootstrapConfigDto {
    /// Endpoint configurations.
    #[schema(value_type = Vec<bootstrap::http::EndpointConfig>)]
    pub endpoints: Vec<EndpointConfigDto>,

    /// Timeout in seconds.
    #[serde(default = "default_timeout")]
    pub timeout_seconds: ConfigValue<u64>,

    /// Maximum retries.
    #[serde(default = "default_retries")]
    pub max_retries: ConfigValue<u32>,

    /// Retry delay in milliseconds.
    #[serde(default = "default_retry_delay")]
    pub retry_delay_ms: ConfigValue<u64>,

    /// Maximum number of pages to fetch per endpoint (default: 10,000).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub max_pages: Option<ConfigValue<u64>>,
}

fn default_timeout() -> ConfigValue<u64> {
    ConfigValue::Static(30)
}

fn default_retries() -> ConfigValue<u32> {
    ConfigValue::Static(3)
}

fn default_retry_delay() -> ConfigValue<u64> {
    ConfigValue::Static(1000)
}

/// Configuration DTO for a single HTTP endpoint.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, utoipa::ToSchema)]
#[schema(as = bootstrap::http::EndpointConfig)]
#[serde(rename_all = "camelCase")]
pub struct EndpointConfigDto {
    /// The URL to fetch data from.
    pub url: ConfigValue<String>,

    /// HTTP method (default: GET).
    #[serde(default = "default_method")]
    #[schema(value_type = bootstrap::http::HttpMethod)]
    pub method: HttpMethodDto,

    /// Additional HTTP headers to include in requests.
    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
    pub headers: HashMap<String, ConfigValue<String>>,

    /// Optional request body (for POST/PUT methods).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub body: Option<serde_json::Value>,

    /// Authentication configuration.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[schema(value_type = Option<bootstrap::http::AuthConfig>)]
    pub auth: Option<AuthConfigDto>,

    /// Pagination configuration.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[schema(value_type = Option<bootstrap::http::PaginationConfig>)]
    pub pagination: Option<PaginationConfigDto>,

    /// Response parsing and element mapping configuration.
    #[schema(value_type = bootstrap::http::ResponseConfig)]
    pub response: ResponseConfigDto,
}

fn default_method() -> HttpMethodDto {
    HttpMethodDto::Get
}

/// HTTP methods supported for bootstrap requests.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, utoipa::ToSchema)]
#[schema(as = bootstrap::http::HttpMethod)]
#[serde(rename_all = "UPPERCASE")]
pub enum HttpMethodDto {
    Get,
    Post,
    Put,
}

/// Authentication configuration DTO.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, utoipa::ToSchema)]
#[schema(as = bootstrap::http::AuthConfig)]
#[serde(tag = "type", rename_all = "kebab-case")]
pub enum AuthConfigDto {
    /// Bearer token authentication.
    Bearer {
        /// Environment variable containing the token.
        token_env: ConfigValue<String>,
    },
    /// API key authentication (in header or query parameter).
    ApiKey {
        /// Where to send the API key.
        #[schema(value_type = bootstrap::http::ApiKeyLocation)]
        location: ApiKeyLocationDto,
        /// Header name or query parameter name.
        name: ConfigValue<String>,
        /// Environment variable containing the API key value.
        value_env: ConfigValue<String>,
    },
    /// HTTP Basic authentication.
    Basic {
        /// Environment variable containing the username.
        username_env: ConfigValue<String>,
        /// Environment variable containing the password.
        #[serde(default, skip_serializing_if = "Option::is_none")]
        password_env: Option<ConfigValue<String>>,
    },
    /// OAuth2 Client Credentials flow.
    #[serde(rename = "oauth2-client-credentials")]
    OAuth2ClientCredentials {
        /// Token endpoint URL.
        token_url: ConfigValue<String>,
        /// Environment variable containing the client ID.
        client_id_env: ConfigValue<String>,
        /// Environment variable containing the client secret.
        client_secret_env: ConfigValue<String>,
        /// Optional scopes to request.
        #[serde(default, skip_serializing_if = "Vec::is_empty")]
        scopes: Vec<ConfigValue<String>>,
    },
}

/// Where to place an API key.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, utoipa::ToSchema)]
#[schema(as = bootstrap::http::ApiKeyLocation)]
#[serde(rename_all = "kebab-case")]
pub enum ApiKeyLocationDto {
    Header,
    Query,
}

/// Pagination configuration DTO.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, utoipa::ToSchema)]
#[schema(as = bootstrap::http::PaginationConfig)]
#[serde(tag = "type", rename_all = "kebab-case")]
pub enum PaginationConfigDto {
    /// Offset/limit pagination.
    OffsetLimit {
        #[serde(default = "default_offset_param")]
        offset_param: ConfigValue<String>,
        #[serde(default = "default_limit_param")]
        limit_param: ConfigValue<String>,
        page_size: ConfigValue<u64>,
        #[serde(default, skip_serializing_if = "Option::is_none")]
        total_path: Option<ConfigValue<String>>,
    },
    /// Page number pagination.
    PageNumber {
        #[serde(default = "default_page_param")]
        page_param: ConfigValue<String>,
        #[serde(default = "default_per_page_param")]
        page_size_param: ConfigValue<String>,
        page_size: ConfigValue<u64>,
        #[serde(default, skip_serializing_if = "Option::is_none")]
        total_pages_path: Option<ConfigValue<String>>,
    },
    /// Cursor-based pagination.
    Cursor {
        cursor_param: ConfigValue<String>,
        cursor_path: ConfigValue<String>,
        #[serde(default, skip_serializing_if = "Option::is_none")]
        has_more_path: Option<ConfigValue<String>>,
        #[serde(default, skip_serializing_if = "Option::is_none")]
        page_size_param: Option<ConfigValue<String>>,
        #[serde(default, skip_serializing_if = "Option::is_none")]
        page_size: Option<ConfigValue<u64>>,
    },
    /// Link header pagination (RFC 5988).
    LinkHeader {
        #[serde(default, skip_serializing_if = "Option::is_none")]
        page_size_param: Option<ConfigValue<String>>,
        #[serde(default, skip_serializing_if = "Option::is_none")]
        page_size: Option<ConfigValue<u64>>,
    },
    /// Next URL from response body.
    NextUrl {
        next_url_path: ConfigValue<String>,
        #[serde(default, skip_serializing_if = "Option::is_none")]
        base_url: Option<ConfigValue<String>>,
    },
}

fn default_offset_param() -> ConfigValue<String> {
    ConfigValue::Static("offset".to_string())
}

fn default_limit_param() -> ConfigValue<String> {
    ConfigValue::Static("limit".to_string())
}

fn default_page_param() -> ConfigValue<String> {
    ConfigValue::Static("page".to_string())
}

fn default_per_page_param() -> ConfigValue<String> {
    ConfigValue::Static("per_page".to_string())
}

/// Response parsing configuration DTO.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, utoipa::ToSchema)]
#[schema(as = bootstrap::http::ResponseConfig)]
#[serde(rename_all = "camelCase")]
pub struct ResponseConfigDto {
    /// JSONPath expression to locate the array of items in the response.
    #[serde(default = "default_items_path")]
    pub items_path: ConfigValue<String>,

    /// Content type override.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[schema(value_type = Option<bootstrap::http::ContentTypeOverride>)]
    pub content_type: Option<ContentTypeOverrideDto>,

    /// Element mapping configurations.
    #[schema(value_type = Vec<bootstrap::http::ElementMappingConfig>)]
    pub mappings: Vec<ElementMappingConfigDto>,
}

fn default_items_path() -> ConfigValue<String> {
    ConfigValue::Static("$".to_string())
}

/// Content type override DTO.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, utoipa::ToSchema)]
#[schema(as = bootstrap::http::ContentTypeOverride)]
#[serde(rename_all = "lowercase")]
pub enum ContentTypeOverrideDto {
    Json,
    Xml,
    Yaml,
}

/// Element mapping configuration DTO.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, utoipa::ToSchema)]
#[schema(as = bootstrap::http::ElementMappingConfig)]
#[serde(rename_all = "camelCase")]
pub struct ElementMappingConfigDto {
    /// Type of element to create.
    #[schema(value_type = bootstrap::http::ElementType)]
    pub element_type: ElementTypeDto,

    /// Operation type for the source change (default: update for idempotent bootstrap).
    #[serde(default)]
    #[schema(value_type = bootstrap::http::OperationType)]
    pub operation: OperationTypeDto,

    /// Template for element creation.
    #[schema(value_type = bootstrap::http::ElementTemplate)]
    pub template: ElementTemplateDto,
}

/// Operation type DTO.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default, utoipa::ToSchema)]
#[schema(as = bootstrap::http::OperationType)]
#[serde(rename_all = "lowercase")]
pub enum OperationTypeDto {
    Insert,
    #[default]
    Update,
    Delete,
}

/// Element type DTO.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, utoipa::ToSchema)]
#[schema(as = bootstrap::http::ElementType)]
#[serde(rename_all = "lowercase")]
pub enum ElementTypeDto {
    Node,
    Relation,
}

/// Element template DTO using Handlebars expressions.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, utoipa::ToSchema)]
#[schema(as = bootstrap::http::ElementTemplate)]
#[serde(rename_all = "camelCase")]
pub struct ElementTemplateDto {
    /// Handlebars template for element ID.
    pub id: ConfigValue<String>,

    /// Handlebars templates for element labels.
    pub labels: Vec<ConfigValue<String>>,

    /// Properties mapping (each value is a Handlebars template or literal).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub properties: Option<serde_json::Value>,

    /// Template for relation source node ID (relations only).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub from: Option<ConfigValue<String>>,

    /// Template for relation target node ID (relations only).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub to: Option<ConfigValue<String>>,
}

// ── Mapping functions ────────────────────────────────────────────────────────

fn map_http_method(dto: &HttpMethodDto) -> HttpMethod {
    match dto {
        HttpMethodDto::Get => HttpMethod::Get,
        HttpMethodDto::Post => HttpMethod::Post,
        HttpMethodDto::Put => HttpMethod::Put,
    }
}

fn map_api_key_location(dto: &ApiKeyLocationDto) -> ApiKeyLocation {
    match dto {
        ApiKeyLocationDto::Header => ApiKeyLocation::Header,
        ApiKeyLocationDto::Query => ApiKeyLocation::Query,
    }
}

fn map_element_type(dto: &ElementTypeDto) -> ElementType {
    match dto {
        ElementTypeDto::Node => ElementType::Node,
        ElementTypeDto::Relation => ElementType::Relation,
    }
}

fn map_operation_type(dto: &OperationTypeDto) -> OperationType {
    match dto {
        OperationTypeDto::Insert => OperationType::Insert,
        OperationTypeDto::Update => OperationType::Update,
        OperationTypeDto::Delete => OperationType::Delete,
    }
}

fn map_content_type_override(dto: &ContentTypeOverrideDto) -> ContentTypeOverride {
    match dto {
        ContentTypeOverrideDto::Json => ContentTypeOverride::Json,
        ContentTypeOverrideDto::Xml => ContentTypeOverride::Xml,
        ContentTypeOverrideDto::Yaml => ContentTypeOverride::Yaml,
    }
}

async fn map_auth_config(
    dto: &AuthConfigDto,
    resolver: &DtoMapper,
) -> Result<AuthConfig, MappingError> {
    match dto {
        AuthConfigDto::Bearer { token_env } => Ok(AuthConfig::Bearer {
            token_env: resolver.resolve_string(token_env).await?,
        }),
        AuthConfigDto::ApiKey {
            location,
            name,
            value_env,
        } => Ok(AuthConfig::ApiKey {
            location: map_api_key_location(location),
            name: resolver.resolve_string(name).await?,
            value_env: resolver.resolve_string(value_env).await?,
        }),
        AuthConfigDto::Basic {
            username_env,
            password_env,
        } => Ok(AuthConfig::Basic {
            username_env: resolver.resolve_string(username_env).await?,
            password_env: resolver.resolve_optional_string(password_env).await?,
        }),
        AuthConfigDto::OAuth2ClientCredentials {
            token_url,
            client_id_env,
            client_secret_env,
            scopes,
        } => Ok(AuthConfig::OAuth2ClientCredentials {
            token_url: resolver.resolve_string(token_url).await?,
            client_id_env: resolver.resolve_string(client_id_env).await?,
            client_secret_env: resolver.resolve_string(client_secret_env).await?,
            scopes: resolver.resolve_string_vec(scopes).await?,
        }),
    }
}

async fn map_pagination_config(
    dto: &PaginationConfigDto,
    resolver: &DtoMapper,
) -> Result<PaginationConfig, MappingError> {
    match dto {
        PaginationConfigDto::OffsetLimit {
            offset_param,
            limit_param,
            page_size,
            total_path,
        } => Ok(PaginationConfig::OffsetLimit {
            offset_param: resolver.resolve_string(offset_param).await?,
            limit_param: resolver.resolve_string(limit_param).await?,
            page_size: resolver.resolve_typed(page_size).await?,
            total_path: resolver.resolve_optional_string(total_path).await?,
        }),
        PaginationConfigDto::PageNumber {
            page_param,
            page_size_param,
            page_size,
            total_pages_path,
        } => Ok(PaginationConfig::PageNumber {
            page_param: resolver.resolve_string(page_param).await?,
            page_size_param: resolver.resolve_string(page_size_param).await?,
            page_size: resolver.resolve_typed(page_size).await?,
            total_pages_path: resolver.resolve_optional_string(total_pages_path).await?,
        }),
        PaginationConfigDto::Cursor {
            cursor_param,
            cursor_path,
            has_more_path,
            page_size_param,
            page_size,
        } => Ok(PaginationConfig::Cursor {
            cursor_param: resolver.resolve_string(cursor_param).await?,
            cursor_path: resolver.resolve_string(cursor_path).await?,
            has_more_path: resolver.resolve_optional_string(has_more_path).await?,
            page_size_param: resolver.resolve_optional_string(page_size_param).await?,
            page_size: resolver.resolve_optional(page_size).await?,
        }),
        PaginationConfigDto::LinkHeader {
            page_size_param,
            page_size,
        } => Ok(PaginationConfig::LinkHeader {
            page_size_param: resolver.resolve_optional_string(page_size_param).await?,
            page_size: resolver.resolve_optional(page_size).await?,
        }),
        PaginationConfigDto::NextUrl {
            next_url_path,
            base_url,
        } => Ok(PaginationConfig::NextUrl {
            next_url_path: resolver.resolve_string(next_url_path).await?,
            base_url: resolver.resolve_optional_string(base_url).await?,
        }),
    }
}

async fn map_element_template(
    dto: &ElementTemplateDto,
    resolver: &DtoMapper,
) -> Result<ElementTemplate, MappingError> {
    Ok(ElementTemplate {
        id: resolver.resolve_string(&dto.id).await?,
        labels: resolver.resolve_string_vec(&dto.labels).await?,
        properties: dto.properties.clone(),
        from: resolver.resolve_optional_string(&dto.from).await?,
        to: resolver.resolve_optional_string(&dto.to).await?,
    })
}

async fn map_element_mapping(
    dto: &ElementMappingConfigDto,
    resolver: &DtoMapper,
) -> Result<ElementMappingConfig, MappingError> {
    Ok(ElementMappingConfig {
        element_type: map_element_type(&dto.element_type),
        operation: map_operation_type(&dto.operation),
        template: map_element_template(&dto.template, resolver).await?,
    })
}

async fn map_response_config(
    dto: &ResponseConfigDto,
    resolver: &DtoMapper,
) -> Result<ResponseConfig, MappingError> {
    let mut mappings = Vec::with_capacity(dto.mappings.len());
    for mapping in &dto.mappings {
        mappings.push(map_element_mapping(mapping, resolver).await?);
    }

    Ok(ResponseConfig {
        items_path: resolver.resolve_string(&dto.items_path).await?,
        content_type: dto.content_type.as_ref().map(map_content_type_override),
        mappings,
    })
}

async fn map_endpoint_config(
    dto: &EndpointConfigDto,
    resolver: &DtoMapper,
) -> Result<EndpointConfig, MappingError> {
    let mut headers = HashMap::with_capacity(dto.headers.len());
    for (key, value) in &dto.headers {
        headers.insert(key.clone(), resolver.resolve_string(value).await?);
    }

    let auth = match &dto.auth {
        Some(auth) => Some(map_auth_config(auth, resolver).await?),
        None => None,
    };

    let pagination = match &dto.pagination {
        Some(pagination) => Some(map_pagination_config(pagination, resolver).await?),
        None => None,
    };

    Ok(EndpointConfig {
        url: resolver.resolve_string(&dto.url).await?,
        method: map_http_method(&dto.method),
        headers,
        body: dto.body.clone(),
        auth,
        pagination,
        response: map_response_config(&dto.response, resolver).await?,
    })
}

async fn map_config(
    dto: &HttpBootstrapConfigDto,
    resolver: &DtoMapper,
) -> Result<HttpBootstrapConfig, MappingError> {
    let mut endpoints = Vec::with_capacity(dto.endpoints.len());
    for endpoint in &dto.endpoints {
        endpoints.push(map_endpoint_config(endpoint, resolver).await?);
    }

    let max_pages = match &dto.max_pages {
        Some(value) => Some(resolver.resolve_typed(value).await?),
        None => None,
    };

    Ok(HttpBootstrapConfig {
        endpoints,
        timeout_seconds: resolver.resolve_typed(&dto.timeout_seconds).await?,
        max_retries: resolver.resolve_typed(&dto.max_retries).await?,
        retry_delay_ms: resolver.resolve_typed(&dto.retry_delay_ms).await?,
        max_pages,
    })
}

// ── OpenAPI schema registration ─────────────────────────────────────────────

#[derive(OpenApi)]
#[openapi(components(schemas(
    HttpBootstrapConfigDto,
    EndpointConfigDto,
    HttpMethodDto,
    AuthConfigDto,
    ApiKeyLocationDto,
    PaginationConfigDto,
    ResponseConfigDto,
    ContentTypeOverrideDto,
    ElementMappingConfigDto,
    ElementTypeDto,
    ElementTemplateDto,
)))]
struct HttpBootstrapSchemas;

// ── Descriptor ──────────────────────────────────────────────────────────────

/// Plugin descriptor for the HTTP bootstrap provider.
pub struct HttpBootstrapDescriptor;

#[async_trait]
impl BootstrapPluginDescriptor for HttpBootstrapDescriptor {
    fn kind(&self) -> &str {
        "http"
    }

    fn config_version(&self) -> &str {
        "1.0.0"
    }

    fn config_schema_name(&self) -> &str {
        "bootstrap.http.HttpBootstrapConfig"
    }

    fn config_schema_json(&self) -> String {
        let api = HttpBootstrapSchemas::openapi();
        serde_json::to_string(
            &api.components
                .as_ref()
                .expect("OpenAPI components missing")
                .schemas,
        )
        .expect("Failed to serialize config schema")
    }

    async fn create_bootstrap_provider(
        &self,
        config_json: &serde_json::Value,
        _source_config_json: &serde_json::Value,
    ) -> anyhow::Result<Box<dyn BootstrapProvider>> {
        let dto: HttpBootstrapConfigDto = serde_json::from_value(config_json.clone())
            .map_err(|e| anyhow::anyhow!("Failed to parse HTTP bootstrap config: {e}"))?;

        let mapper = DtoMapper::new();
        let config = map_config(&dto, &mapper)
            .await
            .map_err(|e| anyhow::anyhow!("Failed to resolve HTTP bootstrap config: {e}"))?;

        config.validate()?;

        let provider = HttpBootstrapProvider::new(config)?;
        Ok(Box::new(provider))
    }
}