forked from cloudflare/cloudflare-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared.ts
More file actions
1002 lines (811 loc) · 19.7 KB
/
Copy pathshared.ts
File metadata and controls
1002 lines (811 loc) · 19.7 KB
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
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import * as Shared from './shared';
import { SinglePage, V4PagePaginationArray } from '../pagination';
export type ASN = number;
export type ASNParam = number;
export interface AuditLog {
/**
* A string that uniquely identifies the audit log.
*/
id?: string;
action?: AuditLog.Action;
actor?: AuditLog.Actor;
/**
* The source of the event.
*/
interface?: string;
/**
* An object which can lend more context to the action being logged. This is a
* flexible value and varies between different actions.
*/
metadata?: unknown;
/**
* The new value of the resource that was modified.
*/
newValue?: string;
/**
* The value of the resource before it was modified.
*/
oldValue?: string;
owner?: AuditLog.Owner;
resource?: AuditLog.Resource;
/**
* A UTC RFC3339 timestamp that specifies when the action being logged occured.
*/
when?: string;
}
export namespace AuditLog {
export interface Action {
/**
* A boolean that indicates if the action attempted was successful.
*/
result?: boolean;
/**
* A short string that describes the action that was performed.
*/
type?: string;
}
export interface Actor {
/**
* The ID of the actor that performed the action. If a user performed the action,
* this will be their User ID.
*/
id?: string;
/**
* The email of the user that performed the action.
*/
email?: string;
/**
* The IP address of the request that performed the action.
*/
ip?: string;
/**
* The type of actor, whether a User, Cloudflare Admin, or an Automated System.
*/
type?: 'user' | 'admin' | 'Cloudflare';
}
export interface Owner {
/**
* Identifier
*/
id?: string;
}
export interface Resource {
/**
* An identifier for the resource that was affected by the action.
*/
id?: string;
/**
* A short string that describes the resource that was affected by the action.
*/
type?: string;
}
}
/**
* The Certificate Authority that will issue the certificate.
*/
export type CertificateCA = 'digicert' | 'google' | 'lets_encrypt' | 'ssl_com';
/**
* The Certificate Authority that will issue the certificate.
*/
export type CertificateCAParam = 'digicert' | 'google' | 'lets_encrypt' | 'ssl_com';
/**
* Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa),
* or "keyless-certificate" (for Keyless SSL servers).
*/
export type CertificateRequestType = 'origin-rsa' | 'origin-ecc' | 'keyless-certificate';
/**
* Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa),
* or "keyless-certificate" (for Keyless SSL servers).
*/
export type CertificateRequestTypeParam = 'origin-rsa' | 'origin-ecc' | 'keyless-certificate';
/**
* A Cloudflare Tunnel that connects your origin to Cloudflare's edge.
*/
export interface CloudflareTunnel {
/**
* UUID of the tunnel.
*/
id?: string;
/**
* Cloudflare account ID
*/
account_tag?: string;
/**
* Indicates if this is a locally or remotely configured tunnel. If `local`, manage
* the tunnel using a YAML file on the origin machine. If `cloudflare`, manage the
* tunnel on the Zero Trust dashboard.
*/
config_src?: 'local' | 'cloudflare';
/**
* @deprecated This field will start returning an empty array. To fetch the
* connections of a given tunnel, please use the dedicated endpoint
* `/accounts/{account_id}/{tunnel_type}/{tunnel_id}/connections`
*/
connections?: Array<CloudflareTunnel.Connection>;
/**
* Timestamp of when the tunnel established at least one connection to Cloudflare's
* edge. If `null`, the tunnel is inactive.
*/
conns_active_at?: string;
/**
* Timestamp of when the tunnel became inactive (no connections to Cloudflare's
* edge). If `null`, the tunnel is active.
*/
conns_inactive_at?: string;
/**
* Timestamp of when the resource was created.
*/
created_at?: string;
/**
* Timestamp of when the resource was deleted. If `null`, the resource has not been
* deleted.
*/
deleted_at?: string;
/**
* Metadata associated with the tunnel.
*/
metadata?: unknown;
/**
* A user-friendly name for a tunnel.
*/
name?: string;
/**
* @deprecated Use the config_src field instead.
*/
remote_config?: boolean;
/**
* The status of the tunnel. Valid values are `inactive` (tunnel has never been
* run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy
* state), `healthy` (tunnel is active and able to serve traffic), or `down`
* (tunnel can not serve traffic as it has no connections to the Cloudflare Edge).
*/
status?: 'inactive' | 'degraded' | 'healthy' | 'down';
/**
* The type of tunnel.
*/
tun_type?: 'cfd_tunnel' | 'warp_connector' | 'warp' | 'magic' | 'ip_sec' | 'gre' | 'cni';
}
export namespace CloudflareTunnel {
export interface Connection {
/**
* UUID of the Cloudflare Tunnel connection.
*/
id?: string;
/**
* UUID of the Cloudflare Tunnel connector.
*/
client_id?: string;
/**
* The cloudflared version used to establish this connection.
*/
client_version?: string;
/**
* The Cloudflare data center used for this connection.
*/
colo_name?: string;
/**
* Cloudflare continues to track connections for several minutes after they
* disconnect. This is an optimization to improve latency and reliability of
* reconnecting. If `true`, the connection has disconnected but is still being
* tracked. If `false`, the connection is actively serving traffic.
*/
is_pending_reconnect?: boolean;
/**
* Timestamp of when the connection was established.
*/
opened_at?: string;
/**
* The public IP address of the host running cloudflared.
*/
origin_ip?: string;
/**
* UUID of the Cloudflare Tunnel connection.
*/
uuid?: string;
}
}
export interface ErrorData {
code?: number;
documentation_url?: string;
message?: string;
source?: ErrorData.Source;
}
export namespace ErrorData {
export interface Source {
pointer?: string;
}
}
export interface Identifier {
/**
* Identifier.
*/
id?: string;
}
export interface LoadBalancerPreview {
/**
* Monitored pool IDs mapped to their respective names.
*/
pools?: { [key: string]: string };
preview_id?: string;
}
export interface Member {
/**
* Membership identifier tag.
*/
id?: string;
/**
* The contact email address of the user.
*/
email?: string;
/**
* Access policy for the membership
*/
policies?: Array<Member.Policy>;
/**
* Roles assigned to this Member.
*/
roles?: Array<Role>;
/**
* A member's status in the account.
*/
status?: 'accepted' | 'pending';
/**
* Details of the user associated to the membership.
*/
user?: Member.User;
}
export namespace Member {
export interface Policy {
/**
* Policy identifier.
*/
id?: string;
/**
* Allow or deny operations against the resources.
*/
access?: 'allow' | 'deny';
/**
* A set of permission groups that are specified to the policy.
*/
permission_groups?: Array<Policy.PermissionGroup>;
/**
* A list of resource groups that the policy applies to.
*/
resource_groups?: Array<Policy.ResourceGroup>;
}
export namespace Policy {
/**
* A named group of permissions that map to a group of operations against
* resources.
*/
export interface PermissionGroup {
/**
* Identifier of the permission group.
*/
id: string;
/**
* Attributes associated to the permission group.
*/
meta?: PermissionGroup.Meta;
/**
* Name of the permission group.
*/
name?: string;
}
export namespace PermissionGroup {
/**
* Attributes associated to the permission group.
*/
export interface Meta {
key?: string;
value?: string;
}
}
/**
* A group of scoped resources.
*/
export interface ResourceGroup {
/**
* Identifier of the resource group.
*/
id: string;
/**
* The scope associated to the resource group
*/
scope: Array<ResourceGroup.Scope>;
/**
* Attributes associated to the resource group.
*/
meta?: ResourceGroup.Meta;
/**
* Name of the resource group.
*/
name?: string;
}
export namespace ResourceGroup {
/**
* A scope is a combination of scope objects which provides additional context.
*/
export interface Scope {
/**
* This is a combination of pre-defined resource name and identifier (like Account
* ID etc.)
*/
key: string;
/**
* A list of scope objects for additional context.
*/
objects: Array<Scope.Object>;
}
export namespace Scope {
/**
* A scope object represents any resource that can have actions applied against
* invite.
*/
export interface Object {
/**
* This is a combination of pre-defined resource name and identifier (like Zone ID
* etc.)
*/
key: string;
}
}
/**
* Attributes associated to the resource group.
*/
export interface Meta {
key?: string;
value?: string;
}
}
}
/**
* Details of the user associated to the membership.
*/
export interface User {
/**
* The contact email address of the user.
*/
email: string;
/**
* Identifier
*/
id?: string;
/**
* User's first name
*/
first_name?: string | null;
/**
* User's last name
*/
last_name?: string | null;
/**
* Indicates whether two-factor authentication is enabled for the user account.
* Does not apply to API authentication.
*/
two_factor_authentication_enabled?: boolean;
}
}
export interface PaginationInfo {
/**
* Total number of results for the requested service
*/
count?: number;
/**
* Current page within paginated list of results
*/
page?: number;
/**
* Number of results per page of results
*/
per_page?: number;
/**
* Total results available without any search parameters
*/
total_count?: number;
}
export type Permission = string;
export interface PermissionGrant {
read?: boolean;
write?: boolean;
}
export interface PermissionGrantParam {
read?: boolean;
write?: boolean;
}
/**
* The rate plan applied to the subscription.
*/
export interface RatePlan {
/**
* The ID of the rate plan.
*/
id?:
| 'free'
| 'lite'
| 'pro'
| 'pro_plus'
| 'business'
| 'enterprise'
| 'partners_free'
| 'partners_pro'
| 'partners_business'
| 'partners_enterprise';
/**
* The currency applied to the rate plan subscription.
*/
currency?: string;
/**
* Whether this rate plan is managed externally from Cloudflare.
*/
externally_managed?: boolean;
/**
* Whether a rate plan is enterprise-based (or newly adopted term contract).
*/
is_contract?: boolean;
/**
* The full name of the rate plan.
*/
public_name?: string;
/**
* The scope that this rate plan applies to.
*/
scope?: string;
/**
* The list of sets this rate plan applies to. Returns array of strings.
*/
sets?: Array<string>;
}
/**
* The rate plan applied to the subscription.
*/
export interface RatePlanParam {
/**
* The ID of the rate plan.
*/
id?:
| 'free'
| 'lite'
| 'pro'
| 'pro_plus'
| 'business'
| 'enterprise'
| 'partners_free'
| 'partners_pro'
| 'partners_business'
| 'partners_enterprise';
/**
* The currency applied to the rate plan subscription.
*/
currency?: string;
/**
* Whether this rate plan is managed externally from Cloudflare.
*/
externally_managed?: boolean;
/**
* Whether a rate plan is enterprise-based (or newly adopted term contract).
*/
is_contract?: boolean;
/**
* The full name of the rate plan.
*/
public_name?: string;
/**
* The scope that this rate plan applies to.
*/
scope?: string;
/**
* The list of sets this rate plan applies to. Returns array of strings.
*/
sets?: Array<string>;
}
export interface ResponseInfo {
code: number;
message: string;
documentation_url?: string;
source?: ResponseInfo.Source;
}
export namespace ResponseInfo {
export interface Source {
pointer?: string;
}
}
export type Result = Result.UnionMember0 | Result.AaaAPIResponseCommon;
export namespace Result {
export interface UnionMember0 {
errors?: Array<Shared.ResponseInfo>;
messages?: Array<Shared.ResponseInfo>;
result?: Array<Shared.AuditLog>;
success?: boolean;
}
export interface AaaAPIResponseCommon {
errors: Array<Shared.ResponseInfo>;
messages: Array<Shared.ResponseInfo>;
/**
* Whether the API call was successful
*/
success: true;
}
}
export interface Role {
/**
* Role identifier tag.
*/
id: string;
/**
* Description of role's permissions.
*/
description: string;
/**
* Role name.
*/
name: string;
permissions: Role.Permissions;
}
export namespace Role {
export interface Permissions {
analytics?: Shared.PermissionGrant;
billing?: Shared.PermissionGrant;
cache_purge?: Shared.PermissionGrant;
dns?: Shared.PermissionGrant;
dns_records?: Shared.PermissionGrant;
lb?: Shared.PermissionGrant;
logs?: Shared.PermissionGrant;
organization?: Shared.PermissionGrant;
ssl?: Shared.PermissionGrant;
waf?: Shared.PermissionGrant;
zone_settings?: Shared.PermissionGrant;
zones?: Shared.PermissionGrant;
}
}
export interface RoleParam {
/**
* Role identifier tag.
*/
id: string;
}
/**
* Direction to order DNS records in.
*/
export type SortDirection = 'asc' | 'desc';
/**
* Direction to order DNS records in.
*/
export type SortDirectionParam = 'asc' | 'desc';
export interface Subscription {
/**
* Subscription identifier tag.
*/
id?: string;
/**
* The monetary unit in which pricing information is displayed.
*/
currency?: string;
/**
* The end of the current period and also when the next billing is due.
*/
current_period_end?: string;
/**
* When the current billing period started. May match initial_period_start if this
* is the first period.
*/
current_period_start?: string;
/**
* How often the subscription is renewed automatically.
*/
frequency?: 'weekly' | 'monthly' | 'quarterly' | 'yearly';
/**
* The price of the subscription that will be billed, in US dollars.
*/
price?: number;
/**
* The rate plan applied to the subscription.
*/
rate_plan?: RatePlan;
/**
* The state that the subscription is in.
*/
state?: 'Trial' | 'Provisioned' | 'Paid' | 'AwaitingPayment' | 'Cancelled' | 'Failed' | 'Expired';
}
/**
* A component value for a subscription.
*/
export interface SubscriptionComponent {
/**
* The default amount assigned.
*/
default?: number;
/**
* The name of the component value.
*/
name?: string;
/**
* The unit price for the component value.
*/
price?: number;
/**
* The amount of the component value assigned.
*/
value?: number;
}
/**
* A simple zone object. May have null properties if not a zone subscription.
*/
export interface SubscriptionZone {
/**
* Identifier
*/
id?: string;
/**
* The domain name
*/
name?: string;
}
export interface Token {
/**
* Token identifier tag.
*/
id?: string;
condition?: Token.Condition;
/**
* The expiration time on or after which the JWT MUST NOT be accepted for
* processing.
*/
expires_on?: string;
/**
* The time on which the token was created.
*/
issued_on?: string;
/**
* Last time the token was used.
*/
last_used_on?: string;
/**
* Last time the token was modified.
*/
modified_on?: string;
/**
* Token name.
*/
name?: string;
/**
* The time before which the token MUST NOT be accepted for processing.
*/
not_before?: string;
/**
* List of access policies assigned to the token.
*/
policies?: Array<TokenPolicy>;
/**
* Status of the token.
*/
status?: 'active' | 'disabled' | 'expired';
}
export namespace Token {
export interface Condition {
/**
* Client IP restrictions.
*/
request_ip?: Condition.RequestIP;
}
export namespace Condition {
/**
* Client IP restrictions.
*/
export interface RequestIP {
/**
* List of IPv4/IPv6 CIDR addresses.
*/
in?: Array<Shared.TokenConditionCIDRList>;
/**
* List of IPv4/IPv6 CIDR addresses.
*/
not_in?: Array<Shared.TokenConditionCIDRList>;
}
}
}
/**
* IPv4/IPv6 CIDR.
*/
export type TokenConditionCIDRList = string;
/**
* IPv4/IPv6 CIDR.
*/
export type TokenConditionCIDRListParam = string;
export interface TokenPolicy {
/**
* Policy identifier.
*/
id: string;
/**
* Allow or deny operations against the resources.
*/
effect: 'allow' | 'deny';
/**
* A set of permission groups that are specified to the policy.
*/
permission_groups: Array<TokenPolicy.PermissionGroup>;
/**
* A list of resource names that the policy applies to.
*/
resources: { [key: string]: string } | { [key: string]: { [key: string]: string } };
}
export namespace TokenPolicy {
/**
* A named group of permissions that map to a group of operations against
* resources.
*/
export interface PermissionGroup {
/**
* Identifier of the permission group.
*/
id: string;
/**
* Attributes associated to the permission group.
*/
meta?: PermissionGroup.Meta;
/**
* Name of the permission group.
*/
name?: string;
}
export namespace PermissionGroup {
/**
* Attributes associated to the permission group.
*/
export interface Meta {
key?: string;
value?: string;
}
}
}
export interface TokenPolicyParam {
/**
* Allow or deny operations against the resources.
*/
effect: 'allow' | 'deny';
/**
* A set of permission groups that are specified to the policy.
*/
permission_groups: Array<TokenPolicyParam.PermissionGroup>;
/**
* A list of resource names that the policy applies to.
*/
resources: { [key: string]: string } | { [key: string]: { [key: string]: string } };
}
export namespace TokenPolicyParam {
/**
* A named group of permissions that map to a group of operations against
* resources.
*/
export interface PermissionGroup {
/**
* Identifier of the permission group.
*/
id: string;
/**
* Attributes associated to the permission group.
*/
meta?: PermissionGroup.Meta;
}
export namespace PermissionGroup {
/**
* Attributes associated to the permission group.
*/
export interface Meta {
key?: string;
value?: string;
}
}
}
/**
* The token value.
*/
export type TokenValue = string;
export class MembersV4PagePaginationArray extends V4PagePaginationArray<Member> {}
export class RolesV4PagePaginationArray extends V4PagePaginationArray<Role> {}
export class SubscriptionsSinglePage extends SinglePage<Subscription> {}
export class TokensV4PagePaginationArray extends V4PagePaginationArray<Token> {}
export class AuditLogsV4PagePaginationArray extends V4PagePaginationArray<AuditLog> {}