|
1 | 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
2 | 2 |
|
3 | | -import { APIResource } from '../../../resource'; |
4 | | -import { isRequestOptions } from '../../../core'; |
5 | | -import * as Core from '../../../core'; |
6 | | - |
7 | | -export class IPs extends APIResource { |
8 | | - /** |
9 | | - * Retrieves time series data for the announced IP space count, represented as the |
10 | | - * number of IPv4 /24s and IPv6 /48s, for a given ASN. |
11 | | - * |
12 | | - * @example |
13 | | - * ```ts |
14 | | - * const response = await client.radar.bgp.ips.timeseries(); |
15 | | - * ``` |
16 | | - */ |
17 | | - timeseries( |
18 | | - query?: IPTimeseriesParams, |
19 | | - options?: Core.RequestOptions, |
20 | | - ): Core.APIPromise<IPTimeseriesResponse>; |
21 | | - timeseries(options?: Core.RequestOptions): Core.APIPromise<IPTimeseriesResponse>; |
22 | | - timeseries( |
23 | | - query: IPTimeseriesParams | Core.RequestOptions = {}, |
24 | | - options?: Core.RequestOptions, |
25 | | - ): Core.APIPromise<IPTimeseriesResponse> { |
26 | | - if (isRequestOptions(query)) { |
27 | | - return this.timeseries({}, query); |
28 | | - } |
29 | | - return ( |
30 | | - this._client.get('/radar/bgp/ips/timeseries', { query, ...options }) as Core.APIPromise<{ |
31 | | - result: IPTimeseriesResponse; |
32 | | - }> |
33 | | - )._thenUnwrap((obj) => obj.result); |
34 | | - } |
35 | | -} |
36 | | - |
37 | | -export interface IPTimeseriesResponse { |
38 | | - /** |
39 | | - * Metadata for the results. |
40 | | - */ |
41 | | - meta: IPTimeseriesResponse.Meta; |
42 | | - |
43 | | - serie_0: IPTimeseriesResponse.Serie0; |
44 | | -} |
45 | | - |
46 | | -export namespace IPTimeseriesResponse { |
47 | | - /** |
48 | | - * Metadata for the results. |
49 | | - */ |
50 | | - export interface Meta { |
51 | | - /** |
52 | | - * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). |
53 | | - * Refer to |
54 | | - * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). |
55 | | - */ |
56 | | - aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; |
57 | | - |
58 | | - confidenceInfo: Meta.ConfidenceInfo; |
59 | | - |
60 | | - dateRange: Array<Meta.DateRange>; |
61 | | - |
62 | | - /** |
63 | | - * Timestamp of the last dataset update. |
64 | | - */ |
65 | | - lastUpdated: string; |
66 | | - |
67 | | - /** |
68 | | - * Normalization method applied to the results. Refer to |
69 | | - * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). |
70 | | - */ |
71 | | - normalization: |
72 | | - | 'PERCENTAGE' |
73 | | - | 'MIN0_MAX' |
74 | | - | 'MIN_MAX' |
75 | | - | 'RAW_VALUES' |
76 | | - | 'PERCENTAGE_CHANGE' |
77 | | - | 'ROLLING_AVERAGE' |
78 | | - | 'OVERLAPPED_PERCENTAGE' |
79 | | - | 'RATIO'; |
80 | | - |
81 | | - /** |
82 | | - * Measurement units for the results. |
83 | | - */ |
84 | | - units: Array<Meta.Unit>; |
85 | | - |
86 | | - delay?: Meta.Delay; |
87 | | - } |
88 | | - |
89 | | - export namespace Meta { |
90 | | - export interface ConfidenceInfo { |
91 | | - annotations: Array<ConfidenceInfo.Annotation>; |
92 | | - |
93 | | - /** |
94 | | - * Provides an indication of how much confidence Cloudflare has in the data. |
95 | | - */ |
96 | | - level: number; |
97 | | - } |
98 | | - |
99 | | - export namespace ConfidenceInfo { |
100 | | - /** |
101 | | - * Annotation associated with the result (e.g. outage or other type of event). |
102 | | - */ |
103 | | - export interface Annotation { |
104 | | - /** |
105 | | - * Data source for annotations. |
106 | | - */ |
107 | | - dataSource: |
108 | | - | 'ALL' |
109 | | - | 'AI_BOTS' |
110 | | - | 'AI_GATEWAY' |
111 | | - | 'BGP' |
112 | | - | 'BOTS' |
113 | | - | 'CONNECTION_ANOMALY' |
114 | | - | 'CT' |
115 | | - | 'DNS' |
116 | | - | 'DNS_MAGNITUDE' |
117 | | - | 'DNS_AS112' |
118 | | - | 'DOS' |
119 | | - | 'EMAIL_ROUTING' |
120 | | - | 'EMAIL_SECURITY' |
121 | | - | 'FW' |
122 | | - | 'FW_PG' |
123 | | - | 'HTTP' |
124 | | - | 'HTTP_CONTROL' |
125 | | - | 'HTTP_CRAWLER_REFERER' |
126 | | - | 'HTTP_ORIGINS' |
127 | | - | 'IQI' |
128 | | - | 'LEAKED_CREDENTIALS' |
129 | | - | 'NET' |
130 | | - | 'ROBOTS_TXT' |
131 | | - | 'SPEED' |
132 | | - | 'WORKERS_AI'; |
133 | | - |
134 | | - description: string; |
135 | | - |
136 | | - endDate: string; |
137 | | - |
138 | | - /** |
139 | | - * Event type for annotations. |
140 | | - */ |
141 | | - eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; |
142 | | - |
143 | | - /** |
144 | | - * Whether event is a single point in time or a time range. |
145 | | - */ |
146 | | - isInstantaneous: boolean; |
147 | | - |
148 | | - linkedUrl: string; |
149 | | - |
150 | | - startDate: string; |
151 | | - } |
152 | | - } |
153 | | - |
154 | | - export interface DateRange { |
155 | | - /** |
156 | | - * Adjusted end of date range. |
157 | | - */ |
158 | | - endTime: string; |
159 | | - |
160 | | - /** |
161 | | - * Adjusted start of date range. |
162 | | - */ |
163 | | - startTime: string; |
164 | | - } |
165 | | - |
166 | | - export interface Unit { |
167 | | - name: string; |
168 | | - |
169 | | - value: string; |
170 | | - } |
171 | | - |
172 | | - export interface Delay { |
173 | | - asn_data: Delay.ASNData; |
174 | | - |
175 | | - country_data: Delay.CountryData; |
176 | | - |
177 | | - healthy: boolean; |
178 | | - |
179 | | - nowTs: number; |
180 | | - } |
181 | | - |
182 | | - export namespace Delay { |
183 | | - export interface ASNData { |
184 | | - delaySecs: number; |
185 | | - |
186 | | - delayStr: string; |
187 | | - |
188 | | - healthy: boolean; |
189 | | - |
190 | | - latest: ASNData.Latest; |
191 | | - } |
192 | | - |
193 | | - export namespace ASNData { |
194 | | - export interface Latest { |
195 | | - entries_count: number; |
196 | | - |
197 | | - path: string; |
198 | | - |
199 | | - timestamp: number; |
200 | | - } |
201 | | - } |
202 | | - |
203 | | - export interface CountryData { |
204 | | - delaySecs: number; |
205 | | - |
206 | | - delayStr: string; |
207 | | - |
208 | | - healthy: boolean; |
209 | | - |
210 | | - latest: CountryData.Latest; |
211 | | - } |
212 | | - |
213 | | - export namespace CountryData { |
214 | | - export interface Latest { |
215 | | - count: number; |
216 | | - |
217 | | - timestamp: number; |
218 | | - } |
219 | | - } |
220 | | - } |
221 | | - } |
222 | | - |
223 | | - export interface Serie0 { |
224 | | - ipv4: Array<string>; |
225 | | - |
226 | | - ipv6: Array<string>; |
227 | | - |
228 | | - timestamps: Array<string>; |
229 | | - } |
230 | | -} |
231 | | - |
232 | | -export interface IPTimeseriesParams { |
233 | | - /** |
234 | | - * Filters results by Autonomous System. Specify one or more Autonomous System |
235 | | - * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from |
236 | | - * results. For example, `-174, 3356` excludes results from AS174, but includes |
237 | | - * results from AS3356. |
238 | | - */ |
239 | | - asn?: Array<string>; |
240 | | - |
241 | | - /** |
242 | | - * End of the date range (inclusive). |
243 | | - */ |
244 | | - dateEnd?: Array<string>; |
245 | | - |
246 | | - /** |
247 | | - * Filters results by date range. For example, use `7d` and `7dcontrol` to compare |
248 | | - * this week with the previous week. Use this parameter or set specific start and |
249 | | - * end dates (`dateStart` and `dateEnd` parameters). |
250 | | - */ |
251 | | - dateRange?: Array<string>; |
252 | | - |
253 | | - /** |
254 | | - * Start of the date range. |
255 | | - */ |
256 | | - dateStart?: Array<string>; |
257 | | - |
258 | | - /** |
259 | | - * Format in which results will be returned. |
260 | | - */ |
261 | | - format?: 'JSON' | 'CSV'; |
262 | | - |
263 | | - /** |
264 | | - * Includes data delay meta information. |
265 | | - */ |
266 | | - includeDelay?: boolean; |
267 | | - |
268 | | - /** |
269 | | - * Filters results by IP version (Ipv4 vs. IPv6). |
270 | | - */ |
271 | | - ipVersion?: Array<'IPv4' | 'IPv6'>; |
272 | | - |
273 | | - /** |
274 | | - * Filters results by location. Specify a comma-separated list of alpha-2 location |
275 | | - * codes. |
276 | | - */ |
277 | | - location?: Array<string>; |
278 | | - |
279 | | - /** |
280 | | - * Array of names used to label the series in the response. |
281 | | - */ |
282 | | - name?: Array<string>; |
283 | | -} |
284 | | - |
285 | | -export declare namespace IPs { |
286 | | - export { type IPTimeseriesResponse as IPTimeseriesResponse, type IPTimeseriesParams as IPTimeseriesParams }; |
287 | | -} |
| 3 | +export * from './ips/index'; |
0 commit comments