-
Notifications
You must be signed in to change notification settings - Fork 541
/
entityasn.go
751 lines (643 loc) · 24 KB
/
entityasn.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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package radar
import (
"context"
"fmt"
"net/http"
"net/url"
"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"
)
// EntityASNService 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 [NewEntityASNService] method instead.
type EntityASNService struct {
Options []option.RequestOption
}
// NewEntityASNService 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 NewEntityASNService(opts ...option.RequestOption) (r *EntityASNService) {
r = &EntityASNService{}
r.Options = opts
return
}
// Gets a list of autonomous systems (AS).
func (r *EntityASNService) List(ctx context.Context, query EntityASNListParams, opts ...option.RequestOption) (res *EntityASNListResponse, err error) {
opts = append(r.Options[:], opts...)
var env EntityASNListResponseEnvelope
path := "radar/entities/asns"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}
// Get the requested autonomous system information. A confidence level below `5`
// indicates a low level of confidence in the traffic data - normally this happens
// because Cloudflare has a small amount of traffic from/to this AS). Population
// estimates come from APNIC (refer to https://labs.apnic.net/?p=526).
func (r *EntityASNService) Get(ctx context.Context, asn int64, query EntityASNGetParams, opts ...option.RequestOption) (res *EntityASNGetResponse, err error) {
opts = append(r.Options[:], opts...)
var env EntityASNGetResponseEnvelope
path := fmt.Sprintf("radar/entities/asns/%v", asn)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}
// Get the requested autonomous system information based on IP address. Population
// estimates come from APNIC (refer to https://labs.apnic.net/?p=526).
func (r *EntityASNService) IP(ctx context.Context, query EntityASNIPParams, opts ...option.RequestOption) (res *EntityAsnipResponse, err error) {
opts = append(r.Options[:], opts...)
var env EntityAsnipResponseEnvelope
path := "radar/entities/asns/ip"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}
// Get AS-level relationship for given networks.
func (r *EntityASNService) Rel(ctx context.Context, asn int64, query EntityASNRelParams, opts ...option.RequestOption) (res *EntityASNRelResponse, err error) {
opts = append(r.Options[:], opts...)
var env EntityASNRelResponseEnvelope
path := fmt.Sprintf("radar/entities/asns/%v/rel", asn)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}
type EntityASNListResponse struct {
ASNs []EntityASNListResponseASN `json:"asns,required"`
JSON entityASNListResponseJSON `json:"-"`
}
// entityASNListResponseJSON contains the JSON metadata for the struct
// [EntityASNListResponse]
type entityASNListResponseJSON struct {
ASNs apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityASNListResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityASNListResponseJSON) RawJSON() string {
return r.raw
}
type EntityASNListResponseASN struct {
ASN int64 `json:"asn,required"`
Country string `json:"country,required"`
CountryName string `json:"countryName,required"`
Name string `json:"name,required"`
Aka string `json:"aka"`
// Deprecated field. Please use 'aka'.
NameLong string `json:"nameLong"`
OrgName string `json:"orgName"`
Website string `json:"website"`
JSON entityASNListResponseASNJSON `json:"-"`
}
// entityASNListResponseASNJSON contains the JSON metadata for the struct
// [EntityASNListResponseASN]
type entityASNListResponseASNJSON struct {
ASN apijson.Field
Country apijson.Field
CountryName apijson.Field
Name apijson.Field
Aka apijson.Field
NameLong apijson.Field
OrgName apijson.Field
Website apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityASNListResponseASN) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityASNListResponseASNJSON) RawJSON() string {
return r.raw
}
type EntityASNGetResponse struct {
ASN EntityASNGetResponseASN `json:"asn,required"`
JSON entityASNGetResponseJSON `json:"-"`
}
// entityASNGetResponseJSON contains the JSON metadata for the struct
// [EntityASNGetResponse]
type entityASNGetResponseJSON struct {
ASN apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityASNGetResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityASNGetResponseJSON) RawJSON() string {
return r.raw
}
type EntityASNGetResponseASN struct {
ASN int64 `json:"asn,required"`
ConfidenceLevel int64 `json:"confidenceLevel,required"`
Country string `json:"country,required"`
CountryName string `json:"countryName,required"`
EstimatedUsers EntityASNGetResponseASNEstimatedUsers `json:"estimatedUsers,required"`
Name string `json:"name,required"`
OrgName string `json:"orgName,required"`
Related []EntityASNGetResponseASNRelated `json:"related,required"`
// Regional Internet Registry
Source string `json:"source,required"`
Website string `json:"website,required"`
Aka string `json:"aka"`
// Deprecated field. Please use 'aka'.
NameLong string `json:"nameLong"`
JSON entityASNGetResponseASNJSON `json:"-"`
}
// entityASNGetResponseASNJSON contains the JSON metadata for the struct
// [EntityASNGetResponseASN]
type entityASNGetResponseASNJSON struct {
ASN apijson.Field
ConfidenceLevel apijson.Field
Country apijson.Field
CountryName apijson.Field
EstimatedUsers apijson.Field
Name apijson.Field
OrgName apijson.Field
Related apijson.Field
Source apijson.Field
Website apijson.Field
Aka apijson.Field
NameLong apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityASNGetResponseASN) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityASNGetResponseASNJSON) RawJSON() string {
return r.raw
}
type EntityASNGetResponseASNEstimatedUsers struct {
Locations []EntityASNGetResponseASNEstimatedUsersLocation `json:"locations,required"`
// Total estimated users
EstimatedUsers int64 `json:"estimatedUsers"`
JSON entityASNGetResponseASNEstimatedUsersJSON `json:"-"`
}
// entityASNGetResponseASNEstimatedUsersJSON contains the JSON metadata for the
// struct [EntityASNGetResponseASNEstimatedUsers]
type entityASNGetResponseASNEstimatedUsersJSON struct {
Locations apijson.Field
EstimatedUsers apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityASNGetResponseASNEstimatedUsers) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityASNGetResponseASNEstimatedUsersJSON) RawJSON() string {
return r.raw
}
type EntityASNGetResponseASNEstimatedUsersLocation struct {
LocationAlpha2 string `json:"locationAlpha2,required"`
LocationName string `json:"locationName,required"`
// Estimated users per location
EstimatedUsers int64 `json:"estimatedUsers"`
JSON entityASNGetResponseASNEstimatedUsersLocationJSON `json:"-"`
}
// entityASNGetResponseASNEstimatedUsersLocationJSON contains the JSON metadata for
// the struct [EntityASNGetResponseASNEstimatedUsersLocation]
type entityASNGetResponseASNEstimatedUsersLocationJSON struct {
LocationAlpha2 apijson.Field
LocationName apijson.Field
EstimatedUsers apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityASNGetResponseASNEstimatedUsersLocation) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityASNGetResponseASNEstimatedUsersLocationJSON) RawJSON() string {
return r.raw
}
type EntityASNGetResponseASNRelated struct {
ASN int64 `json:"asn,required"`
Name string `json:"name,required"`
Aka string `json:"aka"`
// Total estimated users
EstimatedUsers int64 `json:"estimatedUsers"`
JSON entityASNGetResponseASNRelatedJSON `json:"-"`
}
// entityASNGetResponseASNRelatedJSON contains the JSON metadata for the struct
// [EntityASNGetResponseASNRelated]
type entityASNGetResponseASNRelatedJSON struct {
ASN apijson.Field
Name apijson.Field
Aka apijson.Field
EstimatedUsers apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityASNGetResponseASNRelated) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityASNGetResponseASNRelatedJSON) RawJSON() string {
return r.raw
}
type EntityAsnipResponse struct {
ASN EntityAsnipResponseASN `json:"asn,required"`
JSON entityAsnipResponseJSON `json:"-"`
}
// entityAsnipResponseJSON contains the JSON metadata for the struct
// [EntityAsnipResponse]
type entityAsnipResponseJSON struct {
ASN apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityAsnipResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityAsnipResponseJSON) RawJSON() string {
return r.raw
}
type EntityAsnipResponseASN struct {
ASN int64 `json:"asn,required"`
Country string `json:"country,required"`
CountryName string `json:"countryName,required"`
EstimatedUsers EntityAsnipResponseASNEstimatedUsers `json:"estimatedUsers,required"`
Name string `json:"name,required"`
OrgName string `json:"orgName,required"`
Related []EntityAsnipResponseASNRelated `json:"related,required"`
// Regional Internet Registry
Source string `json:"source,required"`
Website string `json:"website,required"`
Aka string `json:"aka"`
// Deprecated field. Please use 'aka'.
NameLong string `json:"nameLong"`
JSON entityAsnipResponseASNJSON `json:"-"`
}
// entityAsnipResponseASNJSON contains the JSON metadata for the struct
// [EntityAsnipResponseASN]
type entityAsnipResponseASNJSON struct {
ASN apijson.Field
Country apijson.Field
CountryName apijson.Field
EstimatedUsers apijson.Field
Name apijson.Field
OrgName apijson.Field
Related apijson.Field
Source apijson.Field
Website apijson.Field
Aka apijson.Field
NameLong apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityAsnipResponseASN) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityAsnipResponseASNJSON) RawJSON() string {
return r.raw
}
type EntityAsnipResponseASNEstimatedUsers struct {
Locations []EntityAsnipResponseASNEstimatedUsersLocation `json:"locations,required"`
// Total estimated users
EstimatedUsers int64 `json:"estimatedUsers"`
JSON entityAsnipResponseASNEstimatedUsersJSON `json:"-"`
}
// entityAsnipResponseASNEstimatedUsersJSON contains the JSON metadata for the
// struct [EntityAsnipResponseASNEstimatedUsers]
type entityAsnipResponseASNEstimatedUsersJSON struct {
Locations apijson.Field
EstimatedUsers apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityAsnipResponseASNEstimatedUsers) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityAsnipResponseASNEstimatedUsersJSON) RawJSON() string {
return r.raw
}
type EntityAsnipResponseASNEstimatedUsersLocation struct {
LocationAlpha2 string `json:"locationAlpha2,required"`
LocationName string `json:"locationName,required"`
// Estimated users per location
EstimatedUsers int64 `json:"estimatedUsers"`
JSON entityAsnipResponseASNEstimatedUsersLocationJSON `json:"-"`
}
// entityAsnipResponseASNEstimatedUsersLocationJSON contains the JSON metadata for
// the struct [EntityAsnipResponseASNEstimatedUsersLocation]
type entityAsnipResponseASNEstimatedUsersLocationJSON struct {
LocationAlpha2 apijson.Field
LocationName apijson.Field
EstimatedUsers apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityAsnipResponseASNEstimatedUsersLocation) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityAsnipResponseASNEstimatedUsersLocationJSON) RawJSON() string {
return r.raw
}
type EntityAsnipResponseASNRelated struct {
ASN int64 `json:"asn,required"`
Name string `json:"name,required"`
Aka string `json:"aka"`
// Total estimated users
EstimatedUsers int64 `json:"estimatedUsers"`
JSON entityAsnipResponseASNRelatedJSON `json:"-"`
}
// entityAsnipResponseASNRelatedJSON contains the JSON metadata for the struct
// [EntityAsnipResponseASNRelated]
type entityAsnipResponseASNRelatedJSON struct {
ASN apijson.Field
Name apijson.Field
Aka apijson.Field
EstimatedUsers apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityAsnipResponseASNRelated) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityAsnipResponseASNRelatedJSON) RawJSON() string {
return r.raw
}
type EntityASNRelResponse struct {
Meta EntityASNRelResponseMeta `json:"meta,required"`
Rels []EntityASNRelResponseRel `json:"rels,required"`
JSON entityASNRelResponseJSON `json:"-"`
}
// entityASNRelResponseJSON contains the JSON metadata for the struct
// [EntityASNRelResponse]
type entityASNRelResponseJSON struct {
Meta apijson.Field
Rels apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityASNRelResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityASNRelResponseJSON) RawJSON() string {
return r.raw
}
type EntityASNRelResponseMeta struct {
DataTime string `json:"data_time,required"`
QueryTime string `json:"query_time,required"`
TotalPeers int64 `json:"total_peers,required"`
JSON entityASNRelResponseMetaJSON `json:"-"`
}
// entityASNRelResponseMetaJSON contains the JSON metadata for the struct
// [EntityASNRelResponseMeta]
type entityASNRelResponseMetaJSON struct {
DataTime apijson.Field
QueryTime apijson.Field
TotalPeers apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityASNRelResponseMeta) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityASNRelResponseMetaJSON) RawJSON() string {
return r.raw
}
type EntityASNRelResponseRel struct {
Asn1 int64 `json:"asn1,required"`
Asn1Country string `json:"asn1_country,required"`
Asn1Name string `json:"asn1_name,required"`
Asn2 int64 `json:"asn2,required"`
Asn2Country string `json:"asn2_country,required"`
Asn2Name string `json:"asn2_name,required"`
Rel string `json:"rel,required"`
JSON entityASNRelResponseRelJSON `json:"-"`
}
// entityASNRelResponseRelJSON contains the JSON metadata for the struct
// [EntityASNRelResponseRel]
type entityASNRelResponseRelJSON struct {
Asn1 apijson.Field
Asn1Country apijson.Field
Asn1Name apijson.Field
Asn2 apijson.Field
Asn2Country apijson.Field
Asn2Name apijson.Field
Rel apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityASNRelResponseRel) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityASNRelResponseRelJSON) RawJSON() string {
return r.raw
}
type EntityASNListParams struct {
// Comma separated list of ASNs.
ASN param.Field[string] `query:"asn"`
// Format results are returned in.
Format param.Field[EntityASNListParamsFormat] `query:"format"`
// Limit the number of objects in the response.
Limit param.Field[int64] `query:"limit"`
// Location Alpha2 to filter results.
Location param.Field[string] `query:"location"`
// Number of objects to skip before grabbing results.
Offset param.Field[int64] `query:"offset"`
// Order asn list.
OrderBy param.Field[EntityASNListParamsOrderBy] `query:"orderBy"`
}
// URLQuery serializes [EntityASNListParams]'s query parameters as `url.Values`.
func (r EntityASNListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// Format results are returned in.
type EntityASNListParamsFormat string
const (
EntityASNListParamsFormatJson EntityASNListParamsFormat = "JSON"
EntityASNListParamsFormatCsv EntityASNListParamsFormat = "CSV"
)
func (r EntityASNListParamsFormat) IsKnown() bool {
switch r {
case EntityASNListParamsFormatJson, EntityASNListParamsFormatCsv:
return true
}
return false
}
// Order asn list.
type EntityASNListParamsOrderBy string
const (
EntityASNListParamsOrderByASN EntityASNListParamsOrderBy = "ASN"
EntityASNListParamsOrderByPopulation EntityASNListParamsOrderBy = "POPULATION"
)
func (r EntityASNListParamsOrderBy) IsKnown() bool {
switch r {
case EntityASNListParamsOrderByASN, EntityASNListParamsOrderByPopulation:
return true
}
return false
}
type EntityASNListResponseEnvelope struct {
Result EntityASNListResponse `json:"result,required"`
Success bool `json:"success,required"`
JSON entityASNListResponseEnvelopeJSON `json:"-"`
}
// entityASNListResponseEnvelopeJSON contains the JSON metadata for the struct
// [EntityASNListResponseEnvelope]
type entityASNListResponseEnvelopeJSON struct {
Result apijson.Field
Success apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityASNListResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityASNListResponseEnvelopeJSON) RawJSON() string {
return r.raw
}
type EntityASNGetParams struct {
// Format results are returned in.
Format param.Field[EntityASNGetParamsFormat] `query:"format"`
}
// URLQuery serializes [EntityASNGetParams]'s query parameters as `url.Values`.
func (r EntityASNGetParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// Format results are returned in.
type EntityASNGetParamsFormat string
const (
EntityASNGetParamsFormatJson EntityASNGetParamsFormat = "JSON"
EntityASNGetParamsFormatCsv EntityASNGetParamsFormat = "CSV"
)
func (r EntityASNGetParamsFormat) IsKnown() bool {
switch r {
case EntityASNGetParamsFormatJson, EntityASNGetParamsFormatCsv:
return true
}
return false
}
type EntityASNGetResponseEnvelope struct {
Result EntityASNGetResponse `json:"result,required"`
Success bool `json:"success,required"`
JSON entityASNGetResponseEnvelopeJSON `json:"-"`
}
// entityASNGetResponseEnvelopeJSON contains the JSON metadata for the struct
// [EntityASNGetResponseEnvelope]
type entityASNGetResponseEnvelopeJSON struct {
Result apijson.Field
Success apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityASNGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityASNGetResponseEnvelopeJSON) RawJSON() string {
return r.raw
}
type EntityASNIPParams struct {
// IP address.
IP param.Field[string] `query:"ip,required"`
// Format results are returned in.
Format param.Field[EntityAsnipParamsFormat] `query:"format"`
}
// URLQuery serializes [EntityASNIPParams]'s query parameters as `url.Values`.
func (r EntityASNIPParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// Format results are returned in.
type EntityAsnipParamsFormat string
const (
EntityAsnipParamsFormatJson EntityAsnipParamsFormat = "JSON"
EntityAsnipParamsFormatCsv EntityAsnipParamsFormat = "CSV"
)
func (r EntityAsnipParamsFormat) IsKnown() bool {
switch r {
case EntityAsnipParamsFormatJson, EntityAsnipParamsFormatCsv:
return true
}
return false
}
type EntityAsnipResponseEnvelope struct {
Result EntityAsnipResponse `json:"result,required"`
Success bool `json:"success,required"`
JSON entityAsnipResponseEnvelopeJSON `json:"-"`
}
// entityAsnipResponseEnvelopeJSON contains the JSON metadata for the struct
// [EntityAsnipResponseEnvelope]
type entityAsnipResponseEnvelopeJSON struct {
Result apijson.Field
Success apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityAsnipResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityAsnipResponseEnvelopeJSON) RawJSON() string {
return r.raw
}
type EntityASNRelParams struct {
// Get the AS relationship of ASN2 with respect to the given ASN
Asn2 param.Field[int64] `query:"asn2"`
// Format results are returned in.
Format param.Field[EntityASNRelParamsFormat] `query:"format"`
}
// URLQuery serializes [EntityASNRelParams]'s query parameters as `url.Values`.
func (r EntityASNRelParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// Format results are returned in.
type EntityASNRelParamsFormat string
const (
EntityASNRelParamsFormatJson EntityASNRelParamsFormat = "JSON"
EntityASNRelParamsFormatCsv EntityASNRelParamsFormat = "CSV"
)
func (r EntityASNRelParamsFormat) IsKnown() bool {
switch r {
case EntityASNRelParamsFormatJson, EntityASNRelParamsFormatCsv:
return true
}
return false
}
type EntityASNRelResponseEnvelope struct {
Result EntityASNRelResponse `json:"result,required"`
Success bool `json:"success,required"`
JSON entityASNRelResponseEnvelopeJSON `json:"-"`
}
// entityASNRelResponseEnvelopeJSON contains the JSON metadata for the struct
// [EntityASNRelResponseEnvelope]
type entityASNRelResponseEnvelopeJSON struct {
Result apijson.Field
Success apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EntityASNRelResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r entityASNRelResponseEnvelopeJSON) RawJSON() string {
return r.raw
}