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
/*
* InternetData API
*
* The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
*
* The version of the OpenAPI document: 2026.11.15
* Contact: support@internetdata.io
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// AsnLookupResponse : What every database says about one AS.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AsnLookupResponse {
/// The AS number.
#[serde(rename = "asn")]
pub asn: i32,
/// Its operator.
#[serde(rename = "name")]
pub name: String,
/// The country its registry assigned it to.
#[serde(rename = "country")]
pub country: String,
/// The registry that allocated it.
#[serde(rename = "registry")]
pub registry: String,
/// When.
#[serde(rename = "allocated")]
pub allocated: String,
/// Its operator's domain.
#[serde(rename = "domain")]
pub domain: String,
/// The kind of network it runs. Paid plans and the trial.
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub r#type: Option<String>,
/// IPv4 addresses it announces. Paid plans and the trial.
#[serde(rename = "num_ips", skip_serializing_if = "Option::is_none")]
pub num_ips: Option<i32>,
/// IPv4 prefixes it announces. Paid plans and the trial.
#[serde(rename = "num_prefixes4", skip_serializing_if = "Option::is_none")]
pub num_prefixes4: Option<i32>,
/// IPv6 prefixes it announces. Paid plans and the trial.
#[serde(rename = "num_prefixes6", skip_serializing_if = "Option::is_none")]
pub num_prefixes6: Option<i32>,
/// Its announcements RPKI calls valid. Paid plans and the trial.
#[serde(rename = "rpki_valid", skip_serializing_if = "Option::is_none")]
pub rpki_valid: Option<i32>,
/// Invalid. Paid plans and the trial.
#[serde(rename = "rpki_invalid", skip_serializing_if = "Option::is_none")]
pub rpki_invalid: Option<i32>,
/// With no RPKI record. Paid plans and the trial.
#[serde(rename = "rpki_not_found", skip_serializing_if = "Option::is_none")]
pub rpki_not_found: Option<i32>,
/// Its ASN Whois record, every column, empty where the registry states nothing. Paid plans and the trial.
#[serde(rename = "whois", skip_serializing_if = "Option::is_none")]
pub whois: Option<std::collections::HashMap<String, String>>,
/// What it announces, IPv4 then IPv6, up to 20000 a family. Paid plans and the trial.
#[serde(rename = "prefixes", skip_serializing_if = "Option::is_none")]
pub prefixes: Option<Vec<models::AsnPrefix>>,
/// Its rank in ASN Extended, by customer cone, 1 the largest; `0` for an AS seen in no AS path. Paid plans and the trial.
#[serde(rename = "rank", skip_serializing_if = "Option::is_none")]
pub rank: Option<i32>,
/// Whether it is one of the transit-free networks at the top of the hierarchy, which get transit from no one and peer with each other. Paid plans and the trial.
#[serde(rename = "tier1", skip_serializing_if = "Option::is_none")]
pub tier1: Option<bool>,
/// How many AS numbers it gets transit from. Paid plans and the trial.
#[serde(rename = "num_upstreams", skip_serializing_if = "Option::is_none")]
pub num_upstreams: Option<i32>,
/// Those AS numbers, ascending, up to 20000. Paid plans and the trial.
#[serde(rename = "upstreams", skip_serializing_if = "Option::is_none")]
pub upstreams: Option<Vec<i32>>,
/// How many AS numbers it exchanges its own and its customers' routes with. Paid plans and the trial.
#[serde(rename = "num_peers", skip_serializing_if = "Option::is_none")]
pub num_peers: Option<i32>,
/// Those AS numbers, ascending, up to 20000. Paid plans and the trial.
#[serde(rename = "peers", skip_serializing_if = "Option::is_none")]
pub peers: Option<Vec<i32>>,
/// How many AS numbers it provides transit to. Paid plans and the trial.
#[serde(rename = "num_downstreams", skip_serializing_if = "Option::is_none")]
pub num_downstreams: Option<i32>,
/// Those AS numbers, ascending, up to 20000. Paid plans and the trial.
#[serde(rename = "downstreams", skip_serializing_if = "Option::is_none")]
pub downstreams: Option<Vec<i32>>,
#[serde(rename = "hosted_domains", skip_serializing_if = "Option::is_none")]
pub hosted_domains: Option<Box<models::AsnHostedDomains>>,
/// On every answer to a key on the free plan, and on no other: `false` while the day's trial of every field lasts, `true` once the answer has Unlimited's fields.
#[serde(rename = "trial_expired", skip_serializing_if = "Option::is_none")]
pub trial_expired: Option<bool>,
}
impl AsnLookupResponse {
/// What every database says about one AS.
pub fn new(
asn: i32,
name: String,
country: String,
registry: String,
allocated: String,
domain: String,
) -> AsnLookupResponse {
AsnLookupResponse {
asn,
name,
country,
registry,
allocated,
domain,
r#type: None,
num_ips: None,
num_prefixes4: None,
num_prefixes6: None,
rpki_valid: None,
rpki_invalid: None,
rpki_not_found: None,
whois: None,
prefixes: None,
rank: None,
tier1: None,
num_upstreams: None,
upstreams: None,
num_peers: None,
peers: None,
num_downstreams: None,
downstreams: None,
hosted_domains: None,
trial_expired: None,
}
}
}