Skip to main content

rdap_types/
asn.rs

1//! Normalised RDAP Autonomous System Number response type.
2//!
3//! Follows RFC 9083 ยง5.5 (Autonomous System Number Object Class).
4
5use serde::{Deserialize, Serialize};
6
7use crate::common::{RdapEntity, RdapEvent, RdapLink, RdapRemark, RdapStatus, ResponseMeta};
8
9/// Normalised RDAP response for an ASN query.
10#[derive(Debug, Clone, Serialize, Deserialize)]
11#[serde(rename_all = "camelCase")]
12pub struct AsnResponse {
13    /// The original query value (numeric ASN).
14    pub query: u32,
15
16    /// Registry handle.
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub handle: Option<String>,
19
20    /// First ASN in the assigned range.
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub start_autnum: Option<u32>,
23
24    /// Last ASN in the assigned range.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub end_autnum: Option<u32>,
27
28    /// Human-readable name of the AS (e.g., "GOOGLE").
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub name: Option<String>,
31
32    /// Type of the autonomous system number assignment.
33    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
34    pub autnum_type: Option<String>,
35
36    /// ISO 3166-1 alpha-2 country code of the registrant.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub country: Option<String>,
39
40    #[serde(default, skip_serializing_if = "Vec::is_empty")]
41    pub status: Vec<RdapStatus>,
42
43    #[serde(default, skip_serializing_if = "Vec::is_empty")]
44    pub entities: Vec<RdapEntity>,
45
46    #[serde(default, skip_serializing_if = "Vec::is_empty")]
47    pub events: Vec<RdapEvent>,
48
49    #[serde(default, skip_serializing_if = "Vec::is_empty")]
50    pub links: Vec<RdapLink>,
51
52    #[serde(default, skip_serializing_if = "Vec::is_empty")]
53    pub remarks: Vec<RdapRemark>,
54
55    pub meta: ResponseMeta,
56}