/
deviceposture.go
2188 lines (1887 loc) · 77.1 KB
/
deviceposture.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
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.
package zero_trust
import (
"context"
"fmt"
"net/http"
"reflect"
"github.com/cloudflare/cloudflare-go/v2/internal/apijson"
"github.com/cloudflare/cloudflare-go/v2/internal/pagination"
"github.com/cloudflare/cloudflare-go/v2/internal/param"
"github.com/cloudflare/cloudflare-go/v2/internal/requestconfig"
"github.com/cloudflare/cloudflare-go/v2/internal/shared"
"github.com/cloudflare/cloudflare-go/v2/option"
"github.com/tidwall/gjson"
)
// DevicePostureService 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 [NewDevicePostureService] method
// instead.
type DevicePostureService struct {
Options []option.RequestOption
Integrations *DevicePostureIntegrationService
}
// NewDevicePostureService 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 NewDevicePostureService(opts ...option.RequestOption) (r *DevicePostureService) {
r = &DevicePostureService{}
r.Options = opts
r.Integrations = NewDevicePostureIntegrationService(opts...)
return
}
// Creates a new device posture rule.
func (r *DevicePostureService) New(ctx context.Context, params DevicePostureNewParams, opts ...option.RequestOption) (res *DevicePostureRule, err error) {
opts = append(r.Options[:], opts...)
var env DevicePostureNewResponseEnvelope
path := fmt.Sprintf("accounts/%s/devices/posture", params.AccountID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}
// Updates a device posture rule.
func (r *DevicePostureService) Update(ctx context.Context, ruleID string, params DevicePostureUpdateParams, opts ...option.RequestOption) (res *DevicePostureRule, err error) {
opts = append(r.Options[:], opts...)
var env DevicePostureUpdateResponseEnvelope
path := fmt.Sprintf("accounts/%s/devices/posture/%s", params.AccountID, ruleID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}
// Fetches device posture rules for a Zero Trust account.
func (r *DevicePostureService) List(ctx context.Context, query DevicePostureListParams, opts ...option.RequestOption) (res *pagination.SinglePage[DevicePostureRule], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := fmt.Sprintf("accounts/%s/devices/posture", query.AccountID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
}
err = cfg.Execute()
if err != nil {
return nil, err
}
res.SetPageConfig(cfg, raw)
return res, nil
}
// Fetches device posture rules for a Zero Trust account.
func (r *DevicePostureService) ListAutoPaging(ctx context.Context, query DevicePostureListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[DevicePostureRule] {
return pagination.NewSinglePageAutoPager(r.List(ctx, query, opts...))
}
// Deletes a device posture rule.
func (r *DevicePostureService) Delete(ctx context.Context, ruleID string, params DevicePostureDeleteParams, opts ...option.RequestOption) (res *DevicePostureDeleteResponse, err error) {
opts = append(r.Options[:], opts...)
var env DevicePostureDeleteResponseEnvelope
path := fmt.Sprintf("accounts/%s/devices/posture/%s", params.AccountID, ruleID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}
// Fetches a single device posture rule.
func (r *DevicePostureService) Get(ctx context.Context, ruleID string, query DevicePostureGetParams, opts ...option.RequestOption) (res *DevicePostureRule, err error) {
opts = append(r.Options[:], opts...)
var env DevicePostureGetResponseEnvelope
path := fmt.Sprintf("accounts/%s/devices/posture/%s", query.AccountID, ruleID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}
type CarbonblackInput = string
type CarbonblackInputParam = string
type ClientCertificateInput struct {
// UUID of Cloudflare managed certificate.
CertificateID string `json:"certificate_id,required"`
// Common Name that is protected by the certificate
Cn string `json:"cn,required"`
JSON clientCertificateInputJSON `json:"-"`
}
// clientCertificateInputJSON contains the JSON metadata for the struct
// [ClientCertificateInput]
type clientCertificateInputJSON struct {
CertificateID apijson.Field
Cn apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ClientCertificateInput) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r clientCertificateInputJSON) RawJSON() string {
return r.raw
}
func (r ClientCertificateInput) implementsZeroTrustDeviceInput() {}
type ClientCertificateInputParam struct {
// UUID of Cloudflare managed certificate.
CertificateID param.Field[string] `json:"certificate_id,required"`
// Common Name that is protected by the certificate
Cn param.Field[string] `json:"cn,required"`
}
func (r ClientCertificateInputParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r ClientCertificateInputParam) implementsZeroTrustDeviceInputUnionParam() {}
type CrowdstrikeInput struct {
// Posture Integration ID.
ConnectionID string `json:"connection_id,required"`
// For more details on last seen, please refer to the Crowdstrike documentation.
LastSeen string `json:"last_seen"`
// operator
Operator CrowdstrikeInputOperator `json:"operator"`
// Os Version
OS string `json:"os"`
// overall
Overall string `json:"overall"`
// SensorConfig
SensorConfig string `json:"sensor_config"`
// For more details on state, please refer to the Crowdstrike documentation.
State CrowdstrikeInputState `json:"state"`
// Version
Version string `json:"version"`
// Version Operator
VersionOperator CrowdstrikeInputVersionOperator `json:"versionOperator"`
JSON crowdstrikeInputJSON `json:"-"`
}
// crowdstrikeInputJSON contains the JSON metadata for the struct
// [CrowdstrikeInput]
type crowdstrikeInputJSON struct {
ConnectionID apijson.Field
LastSeen apijson.Field
Operator apijson.Field
OS apijson.Field
Overall apijson.Field
SensorConfig apijson.Field
State apijson.Field
Version apijson.Field
VersionOperator apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CrowdstrikeInput) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r crowdstrikeInputJSON) RawJSON() string {
return r.raw
}
func (r CrowdstrikeInput) implementsZeroTrustDeviceInput() {}
// operator
type CrowdstrikeInputOperator string
const (
CrowdstrikeInputOperatorLess CrowdstrikeInputOperator = "<"
CrowdstrikeInputOperatorLessOrEquals CrowdstrikeInputOperator = "<="
CrowdstrikeInputOperatorGreater CrowdstrikeInputOperator = ">"
CrowdstrikeInputOperatorGreaterOrEquals CrowdstrikeInputOperator = ">="
CrowdstrikeInputOperatorEquals CrowdstrikeInputOperator = "=="
)
func (r CrowdstrikeInputOperator) IsKnown() bool {
switch r {
case CrowdstrikeInputOperatorLess, CrowdstrikeInputOperatorLessOrEquals, CrowdstrikeInputOperatorGreater, CrowdstrikeInputOperatorGreaterOrEquals, CrowdstrikeInputOperatorEquals:
return true
}
return false
}
// For more details on state, please refer to the Crowdstrike documentation.
type CrowdstrikeInputState string
const (
CrowdstrikeInputStateOnline CrowdstrikeInputState = "online"
CrowdstrikeInputStateOffline CrowdstrikeInputState = "offline"
CrowdstrikeInputStateUnknown CrowdstrikeInputState = "unknown"
)
func (r CrowdstrikeInputState) IsKnown() bool {
switch r {
case CrowdstrikeInputStateOnline, CrowdstrikeInputStateOffline, CrowdstrikeInputStateUnknown:
return true
}
return false
}
// Version Operator
type CrowdstrikeInputVersionOperator string
const (
CrowdstrikeInputVersionOperatorLess CrowdstrikeInputVersionOperator = "<"
CrowdstrikeInputVersionOperatorLessOrEquals CrowdstrikeInputVersionOperator = "<="
CrowdstrikeInputVersionOperatorGreater CrowdstrikeInputVersionOperator = ">"
CrowdstrikeInputVersionOperatorGreaterOrEquals CrowdstrikeInputVersionOperator = ">="
CrowdstrikeInputVersionOperatorEquals CrowdstrikeInputVersionOperator = "=="
)
func (r CrowdstrikeInputVersionOperator) IsKnown() bool {
switch r {
case CrowdstrikeInputVersionOperatorLess, CrowdstrikeInputVersionOperatorLessOrEquals, CrowdstrikeInputVersionOperatorGreater, CrowdstrikeInputVersionOperatorGreaterOrEquals, CrowdstrikeInputVersionOperatorEquals:
return true
}
return false
}
type CrowdstrikeInputParam struct {
// Posture Integration ID.
ConnectionID param.Field[string] `json:"connection_id,required"`
// For more details on last seen, please refer to the Crowdstrike documentation.
LastSeen param.Field[string] `json:"last_seen"`
// operator
Operator param.Field[CrowdstrikeInputOperator] `json:"operator"`
// Os Version
OS param.Field[string] `json:"os"`
// overall
Overall param.Field[string] `json:"overall"`
// SensorConfig
SensorConfig param.Field[string] `json:"sensor_config"`
// For more details on state, please refer to the Crowdstrike documentation.
State param.Field[CrowdstrikeInputState] `json:"state"`
// Version
Version param.Field[string] `json:"version"`
// Version Operator
VersionOperator param.Field[CrowdstrikeInputVersionOperator] `json:"versionOperator"`
}
func (r CrowdstrikeInputParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r CrowdstrikeInputParam) implementsZeroTrustDeviceInputUnionParam() {}
// The value to be checked against.
type DeviceInput struct {
// Whether or not file exists
Exists bool `json:"exists"`
// Operating system
OperatingSystem DeviceInputOperatingSystem `json:"operating_system"`
// File path.
Path string `json:"path"`
// SHA-256.
Sha256 string `json:"sha256"`
// Signing certificate thumbprint.
Thumbprint string `json:"thumbprint"`
// List ID.
ID string `json:"id"`
// Domain
Domain string `json:"domain"`
// operator
Operator DeviceInputOperator `json:"operator"`
// Operating System Distribution Name (linux only)
OSDistroName string `json:"os_distro_name"`
// Version of OS Distribution (linux only)
OSDistroRevision string `json:"os_distro_revision"`
// Additional version data. For Mac or iOS, the Product Verison Extra. For Linux,
// the kernel release version. (Mac, iOS, and Linux only)
OSVersionExtra string `json:"os_version_extra"`
// Version of OS
Version string `json:"version"`
// Enabled
Enabled bool `json:"enabled"`
CheckDisks interface{} `json:"checkDisks,required"`
// Whether to check all disks for encryption.
RequireAll bool `json:"requireAll"`
// UUID of Cloudflare managed certificate.
CertificateID string `json:"certificate_id"`
// Common Name that is protected by the certificate
Cn string `json:"cn"`
// Compliance Status
ComplianceStatus DeviceInputComplianceStatus `json:"compliance_status"`
// Posture Integration ID.
ConnectionID string `json:"connection_id"`
// For more details on last seen, please refer to the Crowdstrike documentation.
LastSeen string `json:"last_seen"`
// Os Version
OS string `json:"os"`
// overall
Overall string `json:"overall"`
// SensorConfig
SensorConfig string `json:"sensor_config"`
// For more details on state, please refer to the Crowdstrike documentation.
State DeviceInputState `json:"state"`
// Version Operator
VersionOperator DeviceInputVersionOperator `json:"versionOperator"`
// Count Operator
CountOperator DeviceInputCountOperator `json:"countOperator"`
// The Number of Issues.
IssueCount string `json:"issue_count"`
// For more details on eid last seen, refer to the Tanium documentation.
EidLastSeen string `json:"eid_last_seen"`
// For more details on risk level, refer to the Tanium documentation.
RiskLevel DeviceInputRiskLevel `json:"risk_level"`
// Score Operator
ScoreOperator DeviceInputScoreOperator `json:"scoreOperator"`
// For more details on total score, refer to the Tanium documentation.
TotalScore float64 `json:"total_score"`
// The Number of active threats.
ActiveThreats float64 `json:"active_threats"`
// Whether device is infected.
Infected bool `json:"infected"`
// Whether device is active.
IsActive bool `json:"is_active"`
// Network status of device.
NetworkStatus DeviceInputNetworkStatus `json:"network_status"`
JSON deviceInputJSON `json:"-"`
union DeviceInputUnion
}
// deviceInputJSON contains the JSON metadata for the struct [DeviceInput]
type deviceInputJSON struct {
Exists apijson.Field
OperatingSystem apijson.Field
Path apijson.Field
Sha256 apijson.Field
Thumbprint apijson.Field
ID apijson.Field
Domain apijson.Field
Operator apijson.Field
OSDistroName apijson.Field
OSDistroRevision apijson.Field
OSVersionExtra apijson.Field
Version apijson.Field
Enabled apijson.Field
CheckDisks apijson.Field
RequireAll apijson.Field
CertificateID apijson.Field
Cn apijson.Field
ComplianceStatus apijson.Field
ConnectionID apijson.Field
LastSeen apijson.Field
OS apijson.Field
Overall apijson.Field
SensorConfig apijson.Field
State apijson.Field
VersionOperator apijson.Field
CountOperator apijson.Field
IssueCount apijson.Field
EidLastSeen apijson.Field
RiskLevel apijson.Field
ScoreOperator apijson.Field
TotalScore apijson.Field
ActiveThreats apijson.Field
Infected apijson.Field
IsActive apijson.Field
NetworkStatus apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r deviceInputJSON) RawJSON() string {
return r.raw
}
func (r *DeviceInput) UnmarshalJSON(data []byte) (err error) {
err = apijson.UnmarshalRoot(data, &r.union)
if err != nil {
return err
}
return apijson.Port(r.union, &r)
}
func (r DeviceInput) AsUnion() DeviceInputUnion {
return r.union
}
// The value to be checked against.
//
// Union satisfied by [zero_trust.FileInput], [zero_trust.UniqueClientIDInput],
// [zero_trust.DomainJoinedInput], [zero_trust.OSVersionInput],
// [zero_trust.FirewallInput], [zero_trust.SentineloneInput],
// [zero_trust.DeviceInputTeamsDevicesCarbonblackInputRequest],
// [zero_trust.DiskEncryptionInput],
// [zero_trust.DeviceInputTeamsDevicesApplicationInputRequest],
// [zero_trust.ClientCertificateInput], [zero_trust.WorkspaceOneInput],
// [zero_trust.CrowdstrikeInput], [zero_trust.IntuneInput],
// [zero_trust.KolideInput], [zero_trust.TaniumInput] or
// [zero_trust.SentineloneS2sInput].
type DeviceInputUnion interface {
implementsZeroTrustDeviceInput()
}
func init() {
apijson.RegisterUnion(
reflect.TypeOf((*DeviceInputUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(FileInput{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(UniqueClientIDInput{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(DomainJoinedInput{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(OSVersionInput{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(FirewallInput{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(SentineloneInput{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(DeviceInputTeamsDevicesCarbonblackInputRequest{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(DiskEncryptionInput{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(DeviceInputTeamsDevicesApplicationInputRequest{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(ClientCertificateInput{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(WorkspaceOneInput{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(CrowdstrikeInput{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(IntuneInput{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(KolideInput{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(TaniumInput{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(SentineloneS2sInput{}),
},
)
}
type DeviceInputTeamsDevicesCarbonblackInputRequest struct {
// Operating system
OperatingSystem DeviceInputTeamsDevicesCarbonblackInputRequestOperatingSystem `json:"operating_system,required"`
// File path.
Path string `json:"path,required"`
// SHA-256.
Sha256 string `json:"sha256"`
// Signing certificate thumbprint.
Thumbprint string `json:"thumbprint"`
JSON deviceInputTeamsDevicesCarbonblackInputRequestJSON `json:"-"`
}
// deviceInputTeamsDevicesCarbonblackInputRequestJSON contains the JSON metadata
// for the struct [DeviceInputTeamsDevicesCarbonblackInputRequest]
type deviceInputTeamsDevicesCarbonblackInputRequestJSON struct {
OperatingSystem apijson.Field
Path apijson.Field
Sha256 apijson.Field
Thumbprint apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeviceInputTeamsDevicesCarbonblackInputRequest) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r deviceInputTeamsDevicesCarbonblackInputRequestJSON) RawJSON() string {
return r.raw
}
func (r DeviceInputTeamsDevicesCarbonblackInputRequest) implementsZeroTrustDeviceInput() {}
// Operating system
type DeviceInputTeamsDevicesCarbonblackInputRequestOperatingSystem string
const (
DeviceInputTeamsDevicesCarbonblackInputRequestOperatingSystemWindows DeviceInputTeamsDevicesCarbonblackInputRequestOperatingSystem = "windows"
DeviceInputTeamsDevicesCarbonblackInputRequestOperatingSystemLinux DeviceInputTeamsDevicesCarbonblackInputRequestOperatingSystem = "linux"
DeviceInputTeamsDevicesCarbonblackInputRequestOperatingSystemMac DeviceInputTeamsDevicesCarbonblackInputRequestOperatingSystem = "mac"
)
func (r DeviceInputTeamsDevicesCarbonblackInputRequestOperatingSystem) IsKnown() bool {
switch r {
case DeviceInputTeamsDevicesCarbonblackInputRequestOperatingSystemWindows, DeviceInputTeamsDevicesCarbonblackInputRequestOperatingSystemLinux, DeviceInputTeamsDevicesCarbonblackInputRequestOperatingSystemMac:
return true
}
return false
}
type DeviceInputTeamsDevicesApplicationInputRequest struct {
// Operating system
OperatingSystem DeviceInputTeamsDevicesApplicationInputRequestOperatingSystem `json:"operating_system,required"`
// Path for the application.
Path string `json:"path,required"`
// SHA-256.
Sha256 string `json:"sha256"`
// Signing certificate thumbprint.
Thumbprint string `json:"thumbprint"`
JSON deviceInputTeamsDevicesApplicationInputRequestJSON `json:"-"`
}
// deviceInputTeamsDevicesApplicationInputRequestJSON contains the JSON metadata
// for the struct [DeviceInputTeamsDevicesApplicationInputRequest]
type deviceInputTeamsDevicesApplicationInputRequestJSON struct {
OperatingSystem apijson.Field
Path apijson.Field
Sha256 apijson.Field
Thumbprint apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeviceInputTeamsDevicesApplicationInputRequest) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r deviceInputTeamsDevicesApplicationInputRequestJSON) RawJSON() string {
return r.raw
}
func (r DeviceInputTeamsDevicesApplicationInputRequest) implementsZeroTrustDeviceInput() {}
// Operating system
type DeviceInputTeamsDevicesApplicationInputRequestOperatingSystem string
const (
DeviceInputTeamsDevicesApplicationInputRequestOperatingSystemWindows DeviceInputTeamsDevicesApplicationInputRequestOperatingSystem = "windows"
DeviceInputTeamsDevicesApplicationInputRequestOperatingSystemLinux DeviceInputTeamsDevicesApplicationInputRequestOperatingSystem = "linux"
DeviceInputTeamsDevicesApplicationInputRequestOperatingSystemMac DeviceInputTeamsDevicesApplicationInputRequestOperatingSystem = "mac"
)
func (r DeviceInputTeamsDevicesApplicationInputRequestOperatingSystem) IsKnown() bool {
switch r {
case DeviceInputTeamsDevicesApplicationInputRequestOperatingSystemWindows, DeviceInputTeamsDevicesApplicationInputRequestOperatingSystemLinux, DeviceInputTeamsDevicesApplicationInputRequestOperatingSystemMac:
return true
}
return false
}
// Operating system
type DeviceInputOperatingSystem string
const (
DeviceInputOperatingSystemWindows DeviceInputOperatingSystem = "windows"
DeviceInputOperatingSystemLinux DeviceInputOperatingSystem = "linux"
DeviceInputOperatingSystemMac DeviceInputOperatingSystem = "mac"
DeviceInputOperatingSystemAndroid DeviceInputOperatingSystem = "android"
DeviceInputOperatingSystemIos DeviceInputOperatingSystem = "ios"
DeviceInputOperatingSystemChromeos DeviceInputOperatingSystem = "chromeos"
)
func (r DeviceInputOperatingSystem) IsKnown() bool {
switch r {
case DeviceInputOperatingSystemWindows, DeviceInputOperatingSystemLinux, DeviceInputOperatingSystemMac, DeviceInputOperatingSystemAndroid, DeviceInputOperatingSystemIos, DeviceInputOperatingSystemChromeos:
return true
}
return false
}
// operator
type DeviceInputOperator string
const (
DeviceInputOperatorLess DeviceInputOperator = "<"
DeviceInputOperatorLessOrEquals DeviceInputOperator = "<="
DeviceInputOperatorGreater DeviceInputOperator = ">"
DeviceInputOperatorGreaterOrEquals DeviceInputOperator = ">="
DeviceInputOperatorEquals DeviceInputOperator = "=="
)
func (r DeviceInputOperator) IsKnown() bool {
switch r {
case DeviceInputOperatorLess, DeviceInputOperatorLessOrEquals, DeviceInputOperatorGreater, DeviceInputOperatorGreaterOrEquals, DeviceInputOperatorEquals:
return true
}
return false
}
// Compliance Status
type DeviceInputComplianceStatus string
const (
DeviceInputComplianceStatusCompliant DeviceInputComplianceStatus = "compliant"
DeviceInputComplianceStatusNoncompliant DeviceInputComplianceStatus = "noncompliant"
DeviceInputComplianceStatusUnknown DeviceInputComplianceStatus = "unknown"
DeviceInputComplianceStatusNotapplicable DeviceInputComplianceStatus = "notapplicable"
DeviceInputComplianceStatusIngraceperiod DeviceInputComplianceStatus = "ingraceperiod"
DeviceInputComplianceStatusError DeviceInputComplianceStatus = "error"
)
func (r DeviceInputComplianceStatus) IsKnown() bool {
switch r {
case DeviceInputComplianceStatusCompliant, DeviceInputComplianceStatusNoncompliant, DeviceInputComplianceStatusUnknown, DeviceInputComplianceStatusNotapplicable, DeviceInputComplianceStatusIngraceperiod, DeviceInputComplianceStatusError:
return true
}
return false
}
// For more details on state, please refer to the Crowdstrike documentation.
type DeviceInputState string
const (
DeviceInputStateOnline DeviceInputState = "online"
DeviceInputStateOffline DeviceInputState = "offline"
DeviceInputStateUnknown DeviceInputState = "unknown"
)
func (r DeviceInputState) IsKnown() bool {
switch r {
case DeviceInputStateOnline, DeviceInputStateOffline, DeviceInputStateUnknown:
return true
}
return false
}
// Version Operator
type DeviceInputVersionOperator string
const (
DeviceInputVersionOperatorLess DeviceInputVersionOperator = "<"
DeviceInputVersionOperatorLessOrEquals DeviceInputVersionOperator = "<="
DeviceInputVersionOperatorGreater DeviceInputVersionOperator = ">"
DeviceInputVersionOperatorGreaterOrEquals DeviceInputVersionOperator = ">="
DeviceInputVersionOperatorEquals DeviceInputVersionOperator = "=="
)
func (r DeviceInputVersionOperator) IsKnown() bool {
switch r {
case DeviceInputVersionOperatorLess, DeviceInputVersionOperatorLessOrEquals, DeviceInputVersionOperatorGreater, DeviceInputVersionOperatorGreaterOrEquals, DeviceInputVersionOperatorEquals:
return true
}
return false
}
// Count Operator
type DeviceInputCountOperator string
const (
DeviceInputCountOperatorLess DeviceInputCountOperator = "<"
DeviceInputCountOperatorLessOrEquals DeviceInputCountOperator = "<="
DeviceInputCountOperatorGreater DeviceInputCountOperator = ">"
DeviceInputCountOperatorGreaterOrEquals DeviceInputCountOperator = ">="
DeviceInputCountOperatorEquals DeviceInputCountOperator = "=="
)
func (r DeviceInputCountOperator) IsKnown() bool {
switch r {
case DeviceInputCountOperatorLess, DeviceInputCountOperatorLessOrEquals, DeviceInputCountOperatorGreater, DeviceInputCountOperatorGreaterOrEquals, DeviceInputCountOperatorEquals:
return true
}
return false
}
// For more details on risk level, refer to the Tanium documentation.
type DeviceInputRiskLevel string
const (
DeviceInputRiskLevelLow DeviceInputRiskLevel = "low"
DeviceInputRiskLevelMedium DeviceInputRiskLevel = "medium"
DeviceInputRiskLevelHigh DeviceInputRiskLevel = "high"
DeviceInputRiskLevelCritical DeviceInputRiskLevel = "critical"
)
func (r DeviceInputRiskLevel) IsKnown() bool {
switch r {
case DeviceInputRiskLevelLow, DeviceInputRiskLevelMedium, DeviceInputRiskLevelHigh, DeviceInputRiskLevelCritical:
return true
}
return false
}
// Score Operator
type DeviceInputScoreOperator string
const (
DeviceInputScoreOperatorLess DeviceInputScoreOperator = "<"
DeviceInputScoreOperatorLessOrEquals DeviceInputScoreOperator = "<="
DeviceInputScoreOperatorGreater DeviceInputScoreOperator = ">"
DeviceInputScoreOperatorGreaterOrEquals DeviceInputScoreOperator = ">="
DeviceInputScoreOperatorEquals DeviceInputScoreOperator = "=="
)
func (r DeviceInputScoreOperator) IsKnown() bool {
switch r {
case DeviceInputScoreOperatorLess, DeviceInputScoreOperatorLessOrEquals, DeviceInputScoreOperatorGreater, DeviceInputScoreOperatorGreaterOrEquals, DeviceInputScoreOperatorEquals:
return true
}
return false
}
// Network status of device.
type DeviceInputNetworkStatus string
const (
DeviceInputNetworkStatusConnected DeviceInputNetworkStatus = "connected"
DeviceInputNetworkStatusDisconnected DeviceInputNetworkStatus = "disconnected"
DeviceInputNetworkStatusDisconnecting DeviceInputNetworkStatus = "disconnecting"
DeviceInputNetworkStatusConnecting DeviceInputNetworkStatus = "connecting"
)
func (r DeviceInputNetworkStatus) IsKnown() bool {
switch r {
case DeviceInputNetworkStatusConnected, DeviceInputNetworkStatusDisconnected, DeviceInputNetworkStatusDisconnecting, DeviceInputNetworkStatusConnecting:
return true
}
return false
}
// The value to be checked against.
type DeviceInputParam struct {
// Whether or not file exists
Exists param.Field[bool] `json:"exists"`
// Operating system
OperatingSystem param.Field[DeviceInputOperatingSystem] `json:"operating_system"`
// File path.
Path param.Field[string] `json:"path"`
// SHA-256.
Sha256 param.Field[string] `json:"sha256"`
// Signing certificate thumbprint.
Thumbprint param.Field[string] `json:"thumbprint"`
// List ID.
ID param.Field[string] `json:"id"`
// Domain
Domain param.Field[string] `json:"domain"`
// operator
Operator param.Field[DeviceInputOperator] `json:"operator"`
// Operating System Distribution Name (linux only)
OSDistroName param.Field[string] `json:"os_distro_name"`
// Version of OS Distribution (linux only)
OSDistroRevision param.Field[string] `json:"os_distro_revision"`
// Additional version data. For Mac or iOS, the Product Verison Extra. For Linux,
// the kernel release version. (Mac, iOS, and Linux only)
OSVersionExtra param.Field[string] `json:"os_version_extra"`
// Version of OS
Version param.Field[string] `json:"version"`
// Enabled
Enabled param.Field[bool] `json:"enabled"`
CheckDisks param.Field[interface{}] `json:"checkDisks,required"`
// Whether to check all disks for encryption.
RequireAll param.Field[bool] `json:"requireAll"`
// UUID of Cloudflare managed certificate.
CertificateID param.Field[string] `json:"certificate_id"`
// Common Name that is protected by the certificate
Cn param.Field[string] `json:"cn"`
// Compliance Status
ComplianceStatus param.Field[DeviceInputComplianceStatus] `json:"compliance_status"`
// Posture Integration ID.
ConnectionID param.Field[string] `json:"connection_id"`
// For more details on last seen, please refer to the Crowdstrike documentation.
LastSeen param.Field[string] `json:"last_seen"`
// Os Version
OS param.Field[string] `json:"os"`
// overall
Overall param.Field[string] `json:"overall"`
// SensorConfig
SensorConfig param.Field[string] `json:"sensor_config"`
// For more details on state, please refer to the Crowdstrike documentation.
State param.Field[DeviceInputState] `json:"state"`
// Version Operator
VersionOperator param.Field[DeviceInputVersionOperator] `json:"versionOperator"`
// Count Operator
CountOperator param.Field[DeviceInputCountOperator] `json:"countOperator"`
// The Number of Issues.
IssueCount param.Field[string] `json:"issue_count"`
// For more details on eid last seen, refer to the Tanium documentation.
EidLastSeen param.Field[string] `json:"eid_last_seen"`
// For more details on risk level, refer to the Tanium documentation.
RiskLevel param.Field[DeviceInputRiskLevel] `json:"risk_level"`
// Score Operator
ScoreOperator param.Field[DeviceInputScoreOperator] `json:"scoreOperator"`
// For more details on total score, refer to the Tanium documentation.
TotalScore param.Field[float64] `json:"total_score"`
// The Number of active threats.
ActiveThreats param.Field[float64] `json:"active_threats"`
// Whether device is infected.
Infected param.Field[bool] `json:"infected"`
// Whether device is active.
IsActive param.Field[bool] `json:"is_active"`
// Network status of device.
NetworkStatus param.Field[DeviceInputNetworkStatus] `json:"network_status"`
}
func (r DeviceInputParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r DeviceInputParam) implementsZeroTrustDeviceInputUnionParam() {}
// The value to be checked against.
//
// Satisfied by [zero_trust.FileInputParam], [zero_trust.UniqueClientIDInputParam],
// [zero_trust.DomainJoinedInputParam], [zero_trust.OSVersionInputParam],
// [zero_trust.FirewallInputParam], [zero_trust.SentineloneInputParam],
// [zero_trust.DeviceInputTeamsDevicesCarbonblackInputRequestParam],
// [zero_trust.DiskEncryptionInputParam],
// [zero_trust.DeviceInputTeamsDevicesApplicationInputRequestParam],
// [zero_trust.ClientCertificateInputParam], [zero_trust.WorkspaceOneInputParam],
// [zero_trust.CrowdstrikeInputParam], [zero_trust.IntuneInputParam],
// [zero_trust.KolideInputParam], [zero_trust.TaniumInputParam],
// [zero_trust.SentineloneS2sInputParam], [DeviceInputParam].
type DeviceInputUnionParam interface {
implementsZeroTrustDeviceInputUnionParam()
}
type DeviceInputTeamsDevicesCarbonblackInputRequestParam struct {
// Operating system
OperatingSystem param.Field[DeviceInputTeamsDevicesCarbonblackInputRequestOperatingSystem] `json:"operating_system,required"`
// File path.
Path param.Field[string] `json:"path,required"`
// SHA-256.
Sha256 param.Field[string] `json:"sha256"`
// Signing certificate thumbprint.
Thumbprint param.Field[string] `json:"thumbprint"`
}
func (r DeviceInputTeamsDevicesCarbonblackInputRequestParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r DeviceInputTeamsDevicesCarbonblackInputRequestParam) implementsZeroTrustDeviceInputUnionParam() {
}
type DeviceInputTeamsDevicesApplicationInputRequestParam struct {
// Operating system
OperatingSystem param.Field[DeviceInputTeamsDevicesApplicationInputRequestOperatingSystem] `json:"operating_system,required"`
// Path for the application.
Path param.Field[string] `json:"path,required"`
// SHA-256.
Sha256 param.Field[string] `json:"sha256"`
// Signing certificate thumbprint.
Thumbprint param.Field[string] `json:"thumbprint"`
}
func (r DeviceInputTeamsDevicesApplicationInputRequestParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r DeviceInputTeamsDevicesApplicationInputRequestParam) implementsZeroTrustDeviceInputUnionParam() {
}
type DeviceMatch struct {
Platform DeviceMatchPlatform `json:"platform"`
JSON deviceMatchJSON `json:"-"`
}
// deviceMatchJSON contains the JSON metadata for the struct [DeviceMatch]
type deviceMatchJSON struct {
Platform apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeviceMatch) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r deviceMatchJSON) RawJSON() string {
return r.raw
}
type DeviceMatchPlatform string
const (
DeviceMatchPlatformWindows DeviceMatchPlatform = "windows"
DeviceMatchPlatformMac DeviceMatchPlatform = "mac"
DeviceMatchPlatformLinux DeviceMatchPlatform = "linux"
DeviceMatchPlatformAndroid DeviceMatchPlatform = "android"
DeviceMatchPlatformIos DeviceMatchPlatform = "ios"
)
func (r DeviceMatchPlatform) IsKnown() bool {
switch r {
case DeviceMatchPlatformWindows, DeviceMatchPlatformMac, DeviceMatchPlatformLinux, DeviceMatchPlatformAndroid, DeviceMatchPlatformIos:
return true
}
return false
}
type DeviceMatchParam struct {
Platform param.Field[DeviceMatchPlatform] `json:"platform"`
}
func (r DeviceMatchParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type DevicePostureRule struct {
// API UUID.
ID string `json:"id"`
// The description of the device posture rule.
Description string `json:"description"`
// Sets the expiration time for a posture check result. If empty, the result
// remains valid until it is overwritten by new data from the WARP client.
Expiration string `json:"expiration"`
// The value to be checked against.
Input DeviceInput `json:"input"`
// The conditions that the client must match to run the rule.
Match []DeviceMatch `json:"match"`
// The name of the device posture rule.
Name string `json:"name"`
// Polling frequency for the WARP client posture check. Default: `5m` (poll every
// five minutes). Minimum: `1m`.
Schedule string `json:"schedule"`
// The type of device posture rule.
Type DevicePostureRuleType `json:"type"`
JSON devicePostureRuleJSON `json:"-"`
}
// devicePostureRuleJSON contains the JSON metadata for the struct
// [DevicePostureRule]
type devicePostureRuleJSON struct {
ID apijson.Field
Description apijson.Field
Expiration apijson.Field
Input apijson.Field
Match apijson.Field
Name apijson.Field
Schedule apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DevicePostureRule) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r devicePostureRuleJSON) RawJSON() string {
return r.raw
}