Skip to main content

dnslib/vendors/pangolin/
responses.rs

1//! Pangolin API response types.
2//!
3//! These structs model the JSON responses from Pangolin's API endpoints
4//! (`/org/{orgId}/domains`, `/org/{orgId}/domain/{domainId}/dns-records`,
5//! `/org/{orgId}/domain/{domainId}/resources`).
6
7use serde::{Deserialize, Serialize};
8
9#[derive(Debug, Clone, Deserialize)]
10#[serde(rename_all = "camelCase")]
11pub struct PangolinDomain {
12    pub domain_id: String,
13    pub base_domain: String,
14    #[serde(rename = "type")]
15    pub domain_type: String,
16    pub verified: bool,
17    pub failed: bool,
18}
19
20#[derive(Debug, Clone, Deserialize, Serialize)]
21#[serde(rename_all = "camelCase")]
22pub struct PangolinTarget {
23    pub target_id: u64,
24    pub resource_id: u64,
25    pub site_id: u64,
26    pub ip: String,
27    pub port: u16,
28    pub enabled: bool,
29    pub health_status: String,
30    pub site_name: String,
31    pub site_online: bool,
32}
33
34#[derive(Debug, Clone, Deserialize, Serialize)]
35#[serde(rename_all = "camelCase")]
36pub struct PangolinSite {
37    pub site_id: u64,
38    pub site_name: String,
39    pub online: bool,
40}
41
42#[derive(Debug, Clone, Deserialize)]
43#[serde(rename_all = "camelCase")]
44pub struct PangolinResource {
45    pub resource_id: u64,
46    pub name: String,
47    pub full_domain: String,
48    pub http: bool,
49    pub protocol: String,
50    pub enabled: bool,
51    pub domain_id: String,
52    pub health: String,
53    #[serde(default)]
54    pub targets: Vec<PangolinTarget>,
55    #[serde(default)]
56    pub sites: Vec<PangolinSite>,
57}
58
59#[derive(Debug, Clone, Deserialize)]
60#[serde(rename_all = "camelCase")]
61pub struct PangolinDnsRecord {
62    pub id: u64,
63    pub domain_id: String,
64    pub record_type: String,
65    pub base_domain: String,
66    pub value: String,
67    pub verified: bool,
68}