-
Notifications
You must be signed in to change notification settings - Fork 541
/
bgproute.go
765 lines (654 loc) · 27 KB
/
bgproute.go
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
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package radar
import (
"context"
"net/http"
"net/url"
"time"
"github.com/cloudflare/cloudflare-go/v2/internal/apijson"
"github.com/cloudflare/cloudflare-go/v2/internal/apiquery"
"github.com/cloudflare/cloudflare-go/v2/internal/param"
"github.com/cloudflare/cloudflare-go/v2/internal/requestconfig"
"github.com/cloudflare/cloudflare-go/v2/option"
)
// BGPRouteService contains methods and other services that help with interacting
// with the cloudflare API. Note, unlike clients, this service does not read
// variables from the environment automatically. You should not instantiate this
// service directly, and instead use the [NewBGPRouteService] method instead.
type BGPRouteService struct {
Options []option.RequestOption
}
// NewBGPRouteService generates a new service that applies the given options to
// each request. These options are applied after the parent client's options (if
// there is one), and before any request-specific options.
func NewBGPRouteService(opts ...option.RequestOption) (r *BGPRouteService) {
r = &BGPRouteService{}
r.Options = opts
return
}
// List all Multi-origin AS (MOAS) prefixes on the global routing tables.
func (r *BGPRouteService) Moas(ctx context.Context, query BGPRouteMoasParams, opts ...option.RequestOption) (res *BGPRouteMoasResponse, err error) {
opts = append(r.Options[:], opts...)
var env BGPRouteMoasResponseEnvelope
path := "radar/bgp/routes/moas"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}
// Lookup prefix-to-ASN mapping on global routing tables.
func (r *BGPRouteService) Pfx2as(ctx context.Context, query BGPRoutePfx2asParams, opts ...option.RequestOption) (res *BGPRoutePfx2asResponse, err error) {
opts = append(r.Options[:], opts...)
var env BGPRoutePfx2asResponseEnvelope
path := "radar/bgp/routes/pfx2as"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}
// Get the BGP routing table stats (Beta).
func (r *BGPRouteService) Stats(ctx context.Context, query BGPRouteStatsParams, opts ...option.RequestOption) (res *BGPRouteStatsResponse, err error) {
opts = append(r.Options[:], opts...)
var env BGPRouteStatsResponseEnvelope
path := "radar/bgp/routes/stats"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}
// Gets time-series data for the announced IP space count, represented as the
// number of IPv4 /24s and IPv6 /48s, for a given ASN.
func (r *BGPRouteService) Timeseries(ctx context.Context, query BGPRouteTimeseriesParams, opts ...option.RequestOption) (res *BGPRouteTimeseriesResponse, err error) {
opts = append(r.Options[:], opts...)
var env BGPRouteTimeseriesResponseEnvelope
path := "radar/bgp/routes/timeseries"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}
type BGPRouteMoasResponse struct {
Meta BGPRouteMoasResponseMeta `json:"meta,required"`
Moas []BGPRouteMoasResponseMoa `json:"moas,required"`
JSON bgpRouteMoasResponseJSON `json:"-"`
}
// bgpRouteMoasResponseJSON contains the JSON metadata for the struct
// [BGPRouteMoasResponse]
type bgpRouteMoasResponseJSON struct {
Meta apijson.Field
Moas apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteMoasResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteMoasResponseJSON) RawJSON() string {
return r.raw
}
type BGPRouteMoasResponseMeta struct {
DataTime string `json:"data_time,required"`
QueryTime string `json:"query_time,required"`
TotalPeers int64 `json:"total_peers,required"`
JSON bgpRouteMoasResponseMetaJSON `json:"-"`
}
// bgpRouteMoasResponseMetaJSON contains the JSON metadata for the struct
// [BGPRouteMoasResponseMeta]
type bgpRouteMoasResponseMetaJSON struct {
DataTime apijson.Field
QueryTime apijson.Field
TotalPeers apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteMoasResponseMeta) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteMoasResponseMetaJSON) RawJSON() string {
return r.raw
}
type BGPRouteMoasResponseMoa struct {
Origins []BGPRouteMoasResponseMoasOrigin `json:"origins,required"`
Prefix string `json:"prefix,required"`
JSON bgpRouteMoasResponseMoaJSON `json:"-"`
}
// bgpRouteMoasResponseMoaJSON contains the JSON metadata for the struct
// [BGPRouteMoasResponseMoa]
type bgpRouteMoasResponseMoaJSON struct {
Origins apijson.Field
Prefix apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteMoasResponseMoa) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteMoasResponseMoaJSON) RawJSON() string {
return r.raw
}
type BGPRouteMoasResponseMoasOrigin struct {
Origin int64 `json:"origin,required"`
PeerCount int64 `json:"peer_count,required"`
RPKIValidation string `json:"rpki_validation,required"`
JSON bgpRouteMoasResponseMoasOriginJSON `json:"-"`
}
// bgpRouteMoasResponseMoasOriginJSON contains the JSON metadata for the struct
// [BGPRouteMoasResponseMoasOrigin]
type bgpRouteMoasResponseMoasOriginJSON struct {
Origin apijson.Field
PeerCount apijson.Field
RPKIValidation apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteMoasResponseMoasOrigin) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteMoasResponseMoasOriginJSON) RawJSON() string {
return r.raw
}
type BGPRoutePfx2asResponse struct {
Meta BGPRoutePfx2asResponseMeta `json:"meta,required"`
PrefixOrigins []BGPRoutePfx2asResponsePrefixOrigin `json:"prefix_origins,required"`
JSON bgpRoutePfx2asResponseJSON `json:"-"`
}
// bgpRoutePfx2asResponseJSON contains the JSON metadata for the struct
// [BGPRoutePfx2asResponse]
type bgpRoutePfx2asResponseJSON struct {
Meta apijson.Field
PrefixOrigins apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRoutePfx2asResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRoutePfx2asResponseJSON) RawJSON() string {
return r.raw
}
type BGPRoutePfx2asResponseMeta struct {
DataTime string `json:"data_time,required"`
QueryTime string `json:"query_time,required"`
TotalPeers int64 `json:"total_peers,required"`
JSON bgpRoutePfx2asResponseMetaJSON `json:"-"`
}
// bgpRoutePfx2asResponseMetaJSON contains the JSON metadata for the struct
// [BGPRoutePfx2asResponseMeta]
type bgpRoutePfx2asResponseMetaJSON struct {
DataTime apijson.Field
QueryTime apijson.Field
TotalPeers apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRoutePfx2asResponseMeta) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRoutePfx2asResponseMetaJSON) RawJSON() string {
return r.raw
}
type BGPRoutePfx2asResponsePrefixOrigin struct {
Origin int64 `json:"origin,required"`
PeerCount int64 `json:"peer_count,required"`
Prefix string `json:"prefix,required"`
RPKIValidation string `json:"rpki_validation,required"`
JSON bgpRoutePfx2asResponsePrefixOriginJSON `json:"-"`
}
// bgpRoutePfx2asResponsePrefixOriginJSON contains the JSON metadata for the struct
// [BGPRoutePfx2asResponsePrefixOrigin]
type bgpRoutePfx2asResponsePrefixOriginJSON struct {
Origin apijson.Field
PeerCount apijson.Field
Prefix apijson.Field
RPKIValidation apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRoutePfx2asResponsePrefixOrigin) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRoutePfx2asResponsePrefixOriginJSON) RawJSON() string {
return r.raw
}
type BGPRouteStatsResponse struct {
Meta BGPRouteStatsResponseMeta `json:"meta,required"`
Stats BGPRouteStatsResponseStats `json:"stats,required"`
JSON bgpRouteStatsResponseJSON `json:"-"`
}
// bgpRouteStatsResponseJSON contains the JSON metadata for the struct
// [BGPRouteStatsResponse]
type bgpRouteStatsResponseJSON struct {
Meta apijson.Field
Stats apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteStatsResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteStatsResponseJSON) RawJSON() string {
return r.raw
}
type BGPRouteStatsResponseMeta struct {
DataTime string `json:"data_time,required"`
QueryTime string `json:"query_time,required"`
TotalPeers int64 `json:"total_peers,required"`
JSON bgpRouteStatsResponseMetaJSON `json:"-"`
}
// bgpRouteStatsResponseMetaJSON contains the JSON metadata for the struct
// [BGPRouteStatsResponseMeta]
type bgpRouteStatsResponseMetaJSON struct {
DataTime apijson.Field
QueryTime apijson.Field
TotalPeers apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteStatsResponseMeta) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteStatsResponseMetaJSON) RawJSON() string {
return r.raw
}
type BGPRouteStatsResponseStats struct {
DistinctOrigins int64 `json:"distinct_origins,required"`
DistinctOriginsIPV4 int64 `json:"distinct_origins_ipv4,required"`
DistinctOriginsIPV6 int64 `json:"distinct_origins_ipv6,required"`
DistinctPrefixes int64 `json:"distinct_prefixes,required"`
DistinctPrefixesIPV4 int64 `json:"distinct_prefixes_ipv4,required"`
DistinctPrefixesIPV6 int64 `json:"distinct_prefixes_ipv6,required"`
RoutesInvalid int64 `json:"routes_invalid,required"`
RoutesInvalidIPV4 int64 `json:"routes_invalid_ipv4,required"`
RoutesInvalidIPV6 int64 `json:"routes_invalid_ipv6,required"`
RoutesTotal int64 `json:"routes_total,required"`
RoutesTotalIPV4 int64 `json:"routes_total_ipv4,required"`
RoutesTotalIPV6 int64 `json:"routes_total_ipv6,required"`
RoutesUnknown int64 `json:"routes_unknown,required"`
RoutesUnknownIPV4 int64 `json:"routes_unknown_ipv4,required"`
RoutesUnknownIPV6 int64 `json:"routes_unknown_ipv6,required"`
RoutesValid int64 `json:"routes_valid,required"`
RoutesValidIPV4 int64 `json:"routes_valid_ipv4,required"`
RoutesValidIPV6 int64 `json:"routes_valid_ipv6,required"`
JSON bgpRouteStatsResponseStatsJSON `json:"-"`
}
// bgpRouteStatsResponseStatsJSON contains the JSON metadata for the struct
// [BGPRouteStatsResponseStats]
type bgpRouteStatsResponseStatsJSON struct {
DistinctOrigins apijson.Field
DistinctOriginsIPV4 apijson.Field
DistinctOriginsIPV6 apijson.Field
DistinctPrefixes apijson.Field
DistinctPrefixesIPV4 apijson.Field
DistinctPrefixesIPV6 apijson.Field
RoutesInvalid apijson.Field
RoutesInvalidIPV4 apijson.Field
RoutesInvalidIPV6 apijson.Field
RoutesTotal apijson.Field
RoutesTotalIPV4 apijson.Field
RoutesTotalIPV6 apijson.Field
RoutesUnknown apijson.Field
RoutesUnknownIPV4 apijson.Field
RoutesUnknownIPV6 apijson.Field
RoutesValid apijson.Field
RoutesValidIPV4 apijson.Field
RoutesValidIPV6 apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteStatsResponseStats) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteStatsResponseStatsJSON) RawJSON() string {
return r.raw
}
type BGPRouteTimeseriesResponse struct {
Meta BGPRouteTimeseriesResponseMeta `json:"meta,required"`
SerieIPV4_24s BGPRouteTimeseriesResponseSerieIPV4_24s `json:"serie_ipv4_24s,required"`
SerieIPV6_48s BGPRouteTimeseriesResponseSerieIPV6_48s `json:"serie_ipv6_48s,required"`
JSON bgpRouteTimeseriesResponseJSON `json:"-"`
}
// bgpRouteTimeseriesResponseJSON contains the JSON metadata for the struct
// [BGPRouteTimeseriesResponse]
type bgpRouteTimeseriesResponseJSON struct {
Meta apijson.Field
SerieIPV4_24s apijson.Field
SerieIPV6_48s apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteTimeseriesResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteTimeseriesResponseJSON) RawJSON() string {
return r.raw
}
type BGPRouteTimeseriesResponseMeta struct {
DateRange []BGPRouteTimeseriesResponseMetaDateRange `json:"dateRange,required"`
JSON bgpRouteTimeseriesResponseMetaJSON `json:"-"`
}
// bgpRouteTimeseriesResponseMetaJSON contains the JSON metadata for the struct
// [BGPRouteTimeseriesResponseMeta]
type bgpRouteTimeseriesResponseMetaJSON struct {
DateRange apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteTimeseriesResponseMeta) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteTimeseriesResponseMetaJSON) RawJSON() string {
return r.raw
}
type BGPRouteTimeseriesResponseMetaDateRange struct {
// Adjusted end of date range.
EndTime time.Time `json:"endTime,required" format:"date-time"`
// Adjusted start of date range.
StartTime time.Time `json:"startTime,required" format:"date-time"`
JSON bgpRouteTimeseriesResponseMetaDateRangeJSON `json:"-"`
}
// bgpRouteTimeseriesResponseMetaDateRangeJSON contains the JSON metadata for the
// struct [BGPRouteTimeseriesResponseMetaDateRange]
type bgpRouteTimeseriesResponseMetaDateRangeJSON struct {
EndTime apijson.Field
StartTime apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteTimeseriesResponseMetaDateRange) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteTimeseriesResponseMetaDateRangeJSON) RawJSON() string {
return r.raw
}
type BGPRouteTimeseriesResponseSerieIPV4_24s struct {
Timestamps []time.Time `json:"timestamps,required" format:"date-time"`
Values []int64 `json:"values,required"`
JSON bgpRouteTimeseriesResponseSerieIPV4_24sJSON `json:"-"`
}
// bgpRouteTimeseriesResponseSerieIPV4_24sJSON contains the JSON metadata for the
// struct [BGPRouteTimeseriesResponseSerieIPV4_24s]
type bgpRouteTimeseriesResponseSerieIPV4_24sJSON struct {
Timestamps apijson.Field
Values apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteTimeseriesResponseSerieIPV4_24s) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteTimeseriesResponseSerieIPV4_24sJSON) RawJSON() string {
return r.raw
}
type BGPRouteTimeseriesResponseSerieIPV6_48s struct {
Timestamps []time.Time `json:"timestamps,required" format:"date-time"`
Values []int64 `json:"values,required"`
JSON bgpRouteTimeseriesResponseSerieIPV6_48sJSON `json:"-"`
}
// bgpRouteTimeseriesResponseSerieIPV6_48sJSON contains the JSON metadata for the
// struct [BGPRouteTimeseriesResponseSerieIPV6_48s]
type bgpRouteTimeseriesResponseSerieIPV6_48sJSON struct {
Timestamps apijson.Field
Values apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteTimeseriesResponseSerieIPV6_48s) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteTimeseriesResponseSerieIPV6_48sJSON) RawJSON() string {
return r.raw
}
type BGPRouteMoasParams struct {
// Format results are returned in.
Format param.Field[BGPRouteMoasParamsFormat] `query:"format"`
// Lookup only RPKI invalid MOASes
InvalidOnly param.Field[bool] `query:"invalid_only"`
// Lookup MOASes originated by the given ASN
Origin param.Field[int64] `query:"origin"`
// Lookup MOASes by prefix
Prefix param.Field[string] `query:"prefix"`
}
// URLQuery serializes [BGPRouteMoasParams]'s query parameters as `url.Values`.
func (r BGPRouteMoasParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// Format results are returned in.
type BGPRouteMoasParamsFormat string
const (
BGPRouteMoasParamsFormatJson BGPRouteMoasParamsFormat = "JSON"
BGPRouteMoasParamsFormatCsv BGPRouteMoasParamsFormat = "CSV"
)
func (r BGPRouteMoasParamsFormat) IsKnown() bool {
switch r {
case BGPRouteMoasParamsFormatJson, BGPRouteMoasParamsFormatCsv:
return true
}
return false
}
type BGPRouteMoasResponseEnvelope struct {
Result BGPRouteMoasResponse `json:"result,required"`
Success bool `json:"success,required"`
JSON bgpRouteMoasResponseEnvelopeJSON `json:"-"`
}
// bgpRouteMoasResponseEnvelopeJSON contains the JSON metadata for the struct
// [BGPRouteMoasResponseEnvelope]
type bgpRouteMoasResponseEnvelopeJSON struct {
Result apijson.Field
Success apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteMoasResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteMoasResponseEnvelopeJSON) RawJSON() string {
return r.raw
}
type BGPRoutePfx2asParams struct {
// Format results are returned in.
Format param.Field[BGPRoutePfx2asParamsFormat] `query:"format"`
// Return only results with the longest prefix match for the given prefix. For
// example, specify a /32 prefix to lookup the origin ASN for an IPv4 address.
LongestPrefixMatch param.Field[bool] `query:"longestPrefixMatch"`
// Lookup prefixes originated by the given ASN
Origin param.Field[int64] `query:"origin"`
// Lookup origin ASNs of the given prefix
Prefix param.Field[string] `query:"prefix"`
// Return only results with matching rpki status: valid, invalid or unknown
RPKIStatus param.Field[BGPRoutePfx2asParamsRPKIStatus] `query:"rpkiStatus"`
}
// URLQuery serializes [BGPRoutePfx2asParams]'s query parameters as `url.Values`.
func (r BGPRoutePfx2asParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// Format results are returned in.
type BGPRoutePfx2asParamsFormat string
const (
BGPRoutePfx2asParamsFormatJson BGPRoutePfx2asParamsFormat = "JSON"
BGPRoutePfx2asParamsFormatCsv BGPRoutePfx2asParamsFormat = "CSV"
)
func (r BGPRoutePfx2asParamsFormat) IsKnown() bool {
switch r {
case BGPRoutePfx2asParamsFormatJson, BGPRoutePfx2asParamsFormatCsv:
return true
}
return false
}
// Return only results with matching rpki status: valid, invalid or unknown
type BGPRoutePfx2asParamsRPKIStatus string
const (
BGPRoutePfx2asParamsRPKIStatusValid BGPRoutePfx2asParamsRPKIStatus = "VALID"
BGPRoutePfx2asParamsRPKIStatusInvalid BGPRoutePfx2asParamsRPKIStatus = "INVALID"
BGPRoutePfx2asParamsRPKIStatusUnknown BGPRoutePfx2asParamsRPKIStatus = "UNKNOWN"
)
func (r BGPRoutePfx2asParamsRPKIStatus) IsKnown() bool {
switch r {
case BGPRoutePfx2asParamsRPKIStatusValid, BGPRoutePfx2asParamsRPKIStatusInvalid, BGPRoutePfx2asParamsRPKIStatusUnknown:
return true
}
return false
}
type BGPRoutePfx2asResponseEnvelope struct {
Result BGPRoutePfx2asResponse `json:"result,required"`
Success bool `json:"success,required"`
JSON bgpRoutePfx2asResponseEnvelopeJSON `json:"-"`
}
// bgpRoutePfx2asResponseEnvelopeJSON contains the JSON metadata for the struct
// [BGPRoutePfx2asResponseEnvelope]
type bgpRoutePfx2asResponseEnvelopeJSON struct {
Result apijson.Field
Success apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRoutePfx2asResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRoutePfx2asResponseEnvelopeJSON) RawJSON() string {
return r.raw
}
type BGPRouteStatsParams struct {
// Single ASN as integer.
ASN param.Field[int64] `query:"asn"`
// Format results are returned in.
Format param.Field[BGPRouteStatsParamsFormat] `query:"format"`
// Location Alpha2 code.
Location param.Field[string] `query:"location"`
}
// URLQuery serializes [BGPRouteStatsParams]'s query parameters as `url.Values`.
func (r BGPRouteStatsParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// Format results are returned in.
type BGPRouteStatsParamsFormat string
const (
BGPRouteStatsParamsFormatJson BGPRouteStatsParamsFormat = "JSON"
BGPRouteStatsParamsFormatCsv BGPRouteStatsParamsFormat = "CSV"
)
func (r BGPRouteStatsParamsFormat) IsKnown() bool {
switch r {
case BGPRouteStatsParamsFormatJson, BGPRouteStatsParamsFormatCsv:
return true
}
return false
}
type BGPRouteStatsResponseEnvelope struct {
Result BGPRouteStatsResponse `json:"result,required"`
Success bool `json:"success,required"`
JSON bgpRouteStatsResponseEnvelopeJSON `json:"-"`
}
// bgpRouteStatsResponseEnvelopeJSON contains the JSON metadata for the struct
// [BGPRouteStatsResponseEnvelope]
type bgpRouteStatsResponseEnvelopeJSON struct {
Result apijson.Field
Success apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteStatsResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteStatsResponseEnvelopeJSON) RawJSON() string {
return r.raw
}
type BGPRouteTimeseriesParams struct {
// Single ASN as integer.
ASN param.Field[int64] `query:"asn"`
// End of the date range (inclusive).
DateEnd param.Field[time.Time] `query:"dateEnd" format:"date-time"`
// Shorthand date ranges for the last X days - use when you don't need specific
// start and end dates.
DateRange param.Field[BGPRouteTimeseriesParamsDateRange] `query:"dateRange"`
// Start of the date range (inclusive).
DateStart param.Field[time.Time] `query:"dateStart" format:"date-time"`
// Format results are returned in.
Format param.Field[BGPRouteTimeseriesParamsFormat] `query:"format"`
// Include data delay meta information
IncludeDelay param.Field[bool] `query:"includeDelay"`
// Location Alpha2 code.
Location param.Field[string] `query:"location"`
}
// URLQuery serializes [BGPRouteTimeseriesParams]'s query parameters as
// `url.Values`.
func (r BGPRouteTimeseriesParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// Shorthand date ranges for the last X days - use when you don't need specific
// start and end dates.
type BGPRouteTimeseriesParamsDateRange string
const (
BGPRouteTimeseriesParamsDateRange1d BGPRouteTimeseriesParamsDateRange = "1d"
BGPRouteTimeseriesParamsDateRange2d BGPRouteTimeseriesParamsDateRange = "2d"
BGPRouteTimeseriesParamsDateRange7d BGPRouteTimeseriesParamsDateRange = "7d"
BGPRouteTimeseriesParamsDateRange14d BGPRouteTimeseriesParamsDateRange = "14d"
BGPRouteTimeseriesParamsDateRange28d BGPRouteTimeseriesParamsDateRange = "28d"
BGPRouteTimeseriesParamsDateRange12w BGPRouteTimeseriesParamsDateRange = "12w"
BGPRouteTimeseriesParamsDateRange24w BGPRouteTimeseriesParamsDateRange = "24w"
BGPRouteTimeseriesParamsDateRange52w BGPRouteTimeseriesParamsDateRange = "52w"
BGPRouteTimeseriesParamsDateRange1dControl BGPRouteTimeseriesParamsDateRange = "1dControl"
BGPRouteTimeseriesParamsDateRange2dControl BGPRouteTimeseriesParamsDateRange = "2dControl"
BGPRouteTimeseriesParamsDateRange7dControl BGPRouteTimeseriesParamsDateRange = "7dControl"
BGPRouteTimeseriesParamsDateRange14dControl BGPRouteTimeseriesParamsDateRange = "14dControl"
BGPRouteTimeseriesParamsDateRange28dControl BGPRouteTimeseriesParamsDateRange = "28dControl"
BGPRouteTimeseriesParamsDateRange12wControl BGPRouteTimeseriesParamsDateRange = "12wControl"
BGPRouteTimeseriesParamsDateRange24wControl BGPRouteTimeseriesParamsDateRange = "24wControl"
)
func (r BGPRouteTimeseriesParamsDateRange) IsKnown() bool {
switch r {
case BGPRouteTimeseriesParamsDateRange1d, BGPRouteTimeseriesParamsDateRange2d, BGPRouteTimeseriesParamsDateRange7d, BGPRouteTimeseriesParamsDateRange14d, BGPRouteTimeseriesParamsDateRange28d, BGPRouteTimeseriesParamsDateRange12w, BGPRouteTimeseriesParamsDateRange24w, BGPRouteTimeseriesParamsDateRange52w, BGPRouteTimeseriesParamsDateRange1dControl, BGPRouteTimeseriesParamsDateRange2dControl, BGPRouteTimeseriesParamsDateRange7dControl, BGPRouteTimeseriesParamsDateRange14dControl, BGPRouteTimeseriesParamsDateRange28dControl, BGPRouteTimeseriesParamsDateRange12wControl, BGPRouteTimeseriesParamsDateRange24wControl:
return true
}
return false
}
// Format results are returned in.
type BGPRouteTimeseriesParamsFormat string
const (
BGPRouteTimeseriesParamsFormatJson BGPRouteTimeseriesParamsFormat = "JSON"
BGPRouteTimeseriesParamsFormatCsv BGPRouteTimeseriesParamsFormat = "CSV"
)
func (r BGPRouteTimeseriesParamsFormat) IsKnown() bool {
switch r {
case BGPRouteTimeseriesParamsFormatJson, BGPRouteTimeseriesParamsFormatCsv:
return true
}
return false
}
type BGPRouteTimeseriesResponseEnvelope struct {
Result BGPRouteTimeseriesResponse `json:"result,required"`
Success bool `json:"success,required"`
JSON bgpRouteTimeseriesResponseEnvelopeJSON `json:"-"`
}
// bgpRouteTimeseriesResponseEnvelopeJSON contains the JSON metadata for the struct
// [BGPRouteTimeseriesResponseEnvelope]
type bgpRouteTimeseriesResponseEnvelopeJSON struct {
Result apijson.Field
Success apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BGPRouteTimeseriesResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bgpRouteTimeseriesResponseEnvelopeJSON) RawJSON() string {
return r.raw
}