forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.go
5041 lines (4575 loc) · 157 KB
/
models.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
package security
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/tracing"
"github.com/satori/go.uuid"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v2.0/security"
// AadConnectivityState enumerates the values for aad connectivity state.
type AadConnectivityState string
const (
// Connected ...
Connected AadConnectivityState = "Connected"
// Discovered ...
Discovered AadConnectivityState = "Discovered"
// NotLicensed ...
NotLicensed AadConnectivityState = "NotLicensed"
)
// PossibleAadConnectivityStateValues returns an array of possible values for the AadConnectivityState const type.
func PossibleAadConnectivityStateValues() []AadConnectivityState {
return []AadConnectivityState{Connected, Discovered, NotLicensed}
}
// AlertNotifications enumerates the values for alert notifications.
type AlertNotifications string
const (
// Off Don't get notifications on new alerts
Off AlertNotifications = "Off"
// On Get notifications on new alerts
On AlertNotifications = "On"
)
// PossibleAlertNotificationsValues returns an array of possible values for the AlertNotifications const type.
func PossibleAlertNotificationsValues() []AlertNotifications {
return []AlertNotifications{Off, On}
}
// AlertsToAdmins enumerates the values for alerts to admins.
type AlertsToAdmins string
const (
// AlertsToAdminsOff Don't send notification on new alerts to the subscription's admins
AlertsToAdminsOff AlertsToAdmins = "Off"
// AlertsToAdminsOn Send notification on new alerts to the subscription's admins
AlertsToAdminsOn AlertsToAdmins = "On"
)
// PossibleAlertsToAdminsValues returns an array of possible values for the AlertsToAdmins const type.
func PossibleAlertsToAdminsValues() []AlertsToAdmins {
return []AlertsToAdmins{AlertsToAdminsOff, AlertsToAdminsOn}
}
// AutoProvision enumerates the values for auto provision.
type AutoProvision string
const (
// AutoProvisionOff Do not install security agent on the VMs automatically
AutoProvisionOff AutoProvision = "Off"
// AutoProvisionOn Install missing security agent on VMs automatically
AutoProvisionOn AutoProvision = "On"
)
// PossibleAutoProvisionValues returns an array of possible values for the AutoProvision const type.
func PossibleAutoProvisionValues() []AutoProvision {
return []AutoProvision{AutoProvisionOff, AutoProvisionOn}
}
// ConnectionType enumerates the values for connection type.
type ConnectionType string
const (
// External ...
External ConnectionType = "External"
// Internal ...
Internal ConnectionType = "Internal"
)
// PossibleConnectionTypeValues returns an array of possible values for the ConnectionType const type.
func PossibleConnectionTypeValues() []ConnectionType {
return []ConnectionType{External, Internal}
}
// ExternalSecuritySolutionKind enumerates the values for external security solution kind.
type ExternalSecuritySolutionKind string
const (
// AAD ...
AAD ExternalSecuritySolutionKind = "AAD"
// ATA ...
ATA ExternalSecuritySolutionKind = "ATA"
// CEF ...
CEF ExternalSecuritySolutionKind = "CEF"
)
// PossibleExternalSecuritySolutionKindValues returns an array of possible values for the ExternalSecuritySolutionKind const type.
func PossibleExternalSecuritySolutionKindValues() []ExternalSecuritySolutionKind {
return []ExternalSecuritySolutionKind{AAD, ATA, CEF}
}
// Family enumerates the values for family.
type Family string
const (
// Ngfw ...
Ngfw Family = "Ngfw"
// SaasWaf ...
SaasWaf Family = "SaasWaf"
// Va ...
Va Family = "Va"
// Waf ...
Waf Family = "Waf"
)
// PossibleFamilyValues returns an array of possible values for the Family const type.
func PossibleFamilyValues() []Family {
return []Family{Ngfw, SaasWaf, Va, Waf}
}
// KindEnum enumerates the values for kind enum.
type KindEnum string
const (
// KindAAD ...
KindAAD KindEnum = "AAD"
// KindATA ...
KindATA KindEnum = "ATA"
// KindCEF ...
KindCEF KindEnum = "CEF"
// KindExternalSecuritySolution ...
KindExternalSecuritySolution KindEnum = "ExternalSecuritySolution"
)
// PossibleKindEnumValues returns an array of possible values for the KindEnum const type.
func PossibleKindEnumValues() []KindEnum {
return []KindEnum{KindAAD, KindATA, KindCEF, KindExternalSecuritySolution}
}
// PricingTier enumerates the values for pricing tier.
type PricingTier string
const (
// Free Get free Azure security center experience with basic security features
Free PricingTier = "Free"
// Standard Get the standard Azure security center experience with advanced security features
Standard PricingTier = "Standard"
)
// PossiblePricingTierValues returns an array of possible values for the PricingTier const type.
func PossiblePricingTierValues() []PricingTier {
return []PricingTier{Free, Standard}
}
// Protocol enumerates the values for protocol.
type Protocol string
const (
// All ...
All Protocol = "*"
// TCP ...
TCP Protocol = "TCP"
// UDP ...
UDP Protocol = "UDP"
)
// PossibleProtocolValues returns an array of possible values for the Protocol const type.
func PossibleProtocolValues() []Protocol {
return []Protocol{All, TCP, UDP}
}
// ReportedSeverity enumerates the values for reported severity.
type ReportedSeverity string
const (
// High ...
High ReportedSeverity = "High"
// Informational ...
Informational ReportedSeverity = "Informational"
// Low ...
Low ReportedSeverity = "Low"
// Medium ...
Medium ReportedSeverity = "Medium"
)
// PossibleReportedSeverityValues returns an array of possible values for the ReportedSeverity const type.
func PossibleReportedSeverityValues() []ReportedSeverity {
return []ReportedSeverity{High, Informational, Low, Medium}
}
// SettingKind enumerates the values for setting kind.
type SettingKind string
const (
// SettingKindAlertSuppressionSetting ...
SettingKindAlertSuppressionSetting SettingKind = "AlertSuppressionSetting"
// SettingKindDataExportSetting ...
SettingKindDataExportSetting SettingKind = "DataExportSetting"
)
// PossibleSettingKindValues returns an array of possible values for the SettingKind const type.
func PossibleSettingKindValues() []SettingKind {
return []SettingKind{SettingKindAlertSuppressionSetting, SettingKindDataExportSetting}
}
// Status enumerates the values for status.
type Status string
const (
// Initiated ...
Initiated Status = "Initiated"
// Revoked ...
Revoked Status = "Revoked"
)
// PossibleStatusValues returns an array of possible values for the Status const type.
func PossibleStatusValues() []Status {
return []Status{Initiated, Revoked}
}
// StatusReason enumerates the values for status reason.
type StatusReason string
const (
// Expired ...
Expired StatusReason = "Expired"
// NewerRequestInitiated ...
NewerRequestInitiated StatusReason = "NewerRequestInitiated"
// UserRequested ...
UserRequested StatusReason = "UserRequested"
)
// PossibleStatusReasonValues returns an array of possible values for the StatusReason const type.
func PossibleStatusReasonValues() []StatusReason {
return []StatusReason{Expired, NewerRequestInitiated, UserRequested}
}
// AadConnectivityState1 describes an Azure resource with kind
type AadConnectivityState1 struct {
// ConnectivityState - Possible values include: 'Discovered', 'NotLicensed', 'Connected'
ConnectivityState AadConnectivityState `json:"connectivityState,omitempty"`
}
// AadExternalSecuritySolution represents an AAD identity protection solution which sends logs to an OMS
// workspace.
type AadExternalSecuritySolution struct {
Properties *AadSolutionProperties `json:"properties,omitempty"`
// ID - Resource Id
ID *string `json:"id,omitempty"`
// Name - Resource name
Name *string `json:"name,omitempty"`
// Type - Resource type
Type *string `json:"type,omitempty"`
// Location - Location where the resource is stored
Location *string `json:"location,omitempty"`
// Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD'
Kind KindEnum `json:"kind,omitempty"`
}
// MarshalJSON is the custom marshaler for AadExternalSecuritySolution.
func (aess AadExternalSecuritySolution) MarshalJSON() ([]byte, error) {
aess.Kind = KindAAD
objectMap := make(map[string]interface{})
if aess.Properties != nil {
objectMap["properties"] = aess.Properties
}
if aess.ID != nil {
objectMap["id"] = aess.ID
}
if aess.Name != nil {
objectMap["name"] = aess.Name
}
if aess.Type != nil {
objectMap["type"] = aess.Type
}
if aess.Location != nil {
objectMap["location"] = aess.Location
}
if aess.Kind != "" {
objectMap["kind"] = aess.Kind
}
return json.Marshal(objectMap)
}
// AsCefExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AadExternalSecuritySolution.
func (aess AadExternalSecuritySolution) AsCefExternalSecuritySolution() (*CefExternalSecuritySolution, bool) {
return nil, false
}
// AsAtaExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AadExternalSecuritySolution.
func (aess AadExternalSecuritySolution) AsAtaExternalSecuritySolution() (*AtaExternalSecuritySolution, bool) {
return nil, false
}
// AsAadExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AadExternalSecuritySolution.
func (aess AadExternalSecuritySolution) AsAadExternalSecuritySolution() (*AadExternalSecuritySolution, bool) {
return &aess, true
}
// AsExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AadExternalSecuritySolution.
func (aess AadExternalSecuritySolution) AsExternalSecuritySolution() (*ExternalSecuritySolution, bool) {
return nil, false
}
// AsBasicExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AadExternalSecuritySolution.
func (aess AadExternalSecuritySolution) AsBasicExternalSecuritySolution() (BasicExternalSecuritySolution, bool) {
return &aess, true
}
// AadSolutionProperties ...
type AadSolutionProperties struct {
DeviceVendor *string `json:"deviceVendor,omitempty"`
DeviceType *string `json:"deviceType,omitempty"`
Workspace *ConnectedWorkspace `json:"workspace,omitempty"`
// ConnectivityState - Possible values include: 'Discovered', 'NotLicensed', 'Connected'
ConnectivityState AadConnectivityState `json:"connectivityState,omitempty"`
}
// AdvancedThreatProtectionProperties the Advanced Threat Protection settings.
type AdvancedThreatProtectionProperties struct {
// IsEnabled - Indicates whether Advanced Threat Protection is enabled.
IsEnabled *bool `json:"isEnabled,omitempty"`
}
// AdvancedThreatProtectionSetting the Advanced Threat Protection resource.
type AdvancedThreatProtectionSetting struct {
autorest.Response `json:"-"`
*AdvancedThreatProtectionProperties `json:"properties,omitempty"`
// ID - Resource Id
ID *string `json:"id,omitempty"`
// Name - Resource name
Name *string `json:"name,omitempty"`
// Type - Resource type
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for AdvancedThreatProtectionSetting.
func (atps AdvancedThreatProtectionSetting) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if atps.AdvancedThreatProtectionProperties != nil {
objectMap["properties"] = atps.AdvancedThreatProtectionProperties
}
if atps.ID != nil {
objectMap["id"] = atps.ID
}
if atps.Name != nil {
objectMap["name"] = atps.Name
}
if atps.Type != nil {
objectMap["type"] = atps.Type
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for AdvancedThreatProtectionSetting struct.
func (atps *AdvancedThreatProtectionSetting) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "properties":
if v != nil {
var advancedThreatProtectionProperties AdvancedThreatProtectionProperties
err = json.Unmarshal(*v, &advancedThreatProtectionProperties)
if err != nil {
return err
}
atps.AdvancedThreatProtectionProperties = &advancedThreatProtectionProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
atps.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
atps.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
atps.Type = &typeVar
}
}
}
return nil
}
// Alert security alert
type Alert struct {
autorest.Response `json:"-"`
*AlertProperties `json:"properties,omitempty"`
// ID - Resource Id
ID *string `json:"id,omitempty"`
// Name - Resource name
Name *string `json:"name,omitempty"`
// Type - Resource type
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for Alert.
func (a Alert) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if a.AlertProperties != nil {
objectMap["properties"] = a.AlertProperties
}
if a.ID != nil {
objectMap["id"] = a.ID
}
if a.Name != nil {
objectMap["name"] = a.Name
}
if a.Type != nil {
objectMap["type"] = a.Type
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Alert struct.
func (a *Alert) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "properties":
if v != nil {
var alertProperties AlertProperties
err = json.Unmarshal(*v, &alertProperties)
if err != nil {
return err
}
a.AlertProperties = &alertProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
a.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
a.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
a.Type = &typeVar
}
}
}
return nil
}
// AlertConfidenceReason factors that increase our confidence that the alert is a true positive
type AlertConfidenceReason struct {
// Type - Type of confidence factor
Type *string `json:"type,omitempty"`
// Reason - description of the confidence reason
Reason *string `json:"reason,omitempty"`
}
// AlertEntity changing set of properties depending on the entity type.
type AlertEntity struct {
// AdditionalProperties - Unmatched properties from the message are deserialized this collection
AdditionalProperties map[string]interface{} `json:""`
// Type - Type of entity
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for AlertEntity.
func (ae AlertEntity) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ae.Type != nil {
objectMap["type"] = ae.Type
}
for k, v := range ae.AdditionalProperties {
objectMap[k] = v
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for AlertEntity struct.
func (ae *AlertEntity) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
default:
if v != nil {
var additionalProperties interface{}
err = json.Unmarshal(*v, &additionalProperties)
if err != nil {
return err
}
if ae.AdditionalProperties == nil {
ae.AdditionalProperties = make(map[string]interface{})
}
ae.AdditionalProperties[k] = additionalProperties
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
ae.Type = &typeVar
}
}
}
return nil
}
// AlertList list of security alerts
type AlertList struct {
autorest.Response `json:"-"`
Value *[]Alert `json:"value,omitempty"`
// NextLink - The URI to fetch the next page.
NextLink *string `json:"nextLink,omitempty"`
}
// AlertListIterator provides access to a complete listing of Alert values.
type AlertListIterator struct {
i int
page AlertListPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *AlertListIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/AlertListIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *AlertListIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter AlertListIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter AlertListIterator) Response() AlertList {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter AlertListIterator) Value() Alert {
if !iter.page.NotDone() {
return Alert{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the AlertListIterator type.
func NewAlertListIterator(page AlertListPage) AlertListIterator {
return AlertListIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (al AlertList) IsEmpty() bool {
return al.Value == nil || len(*al.Value) == 0
}
// alertListPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (al AlertList) alertListPreparer(ctx context.Context) (*http.Request, error) {
if al.NextLink == nil || len(to.String(al.NextLink)) < 1 {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(al.NextLink)))
}
// AlertListPage contains a page of Alert values.
type AlertListPage struct {
fn func(context.Context, AlertList) (AlertList, error)
al AlertList
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *AlertListPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/AlertListPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.al)
if err != nil {
return err
}
page.al = next
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *AlertListPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page AlertListPage) NotDone() bool {
return !page.al.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page AlertListPage) Response() AlertList {
return page.al
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page AlertListPage) Values() []Alert {
if page.al.IsEmpty() {
return nil
}
return *page.al.Value
}
// Creates a new instance of the AlertListPage type.
func NewAlertListPage(getNextPage func(context.Context, AlertList) (AlertList, error)) AlertListPage {
return AlertListPage{fn: getNextPage}
}
// AlertProperties describes security alert properties.
type AlertProperties struct {
// State - State of the alert (Active, Dismissed etc.)
State *string `json:"state,omitempty"`
// ReportedTimeUtc - The time the incident was reported to Microsoft.Security in UTC
ReportedTimeUtc *date.Time `json:"reportedTimeUtc,omitempty"`
// VendorName - Name of the vendor that discovered the incident
VendorName *string `json:"vendorName,omitempty"`
// AlertName - Name of the alert type
AlertName *string `json:"alertName,omitempty"`
// AlertDisplayName - Display name of the alert type
AlertDisplayName *string `json:"alertDisplayName,omitempty"`
// DetectedTimeUtc - The time the incident was detected by the vendor
DetectedTimeUtc *date.Time `json:"detectedTimeUtc,omitempty"`
// Description - Description of the incident and what it means
Description *string `json:"description,omitempty"`
// RemediationSteps - Recommended steps to reradiate the incident
RemediationSteps *string `json:"remediationSteps,omitempty"`
// ActionTaken - The action that was taken as a response to the alert (Active, Blocked etc.)
ActionTaken *string `json:"actionTaken,omitempty"`
// ReportedSeverity - Estimated severity of this alert. Possible values include: 'Informational', 'Low', 'Medium', 'High'
ReportedSeverity ReportedSeverity `json:"reportedSeverity,omitempty"`
// CompromisedEntity - The entity that the incident happened on
CompromisedEntity *string `json:"compromisedEntity,omitempty"`
// AssociatedResource - Azure resource ID of the associated resource
AssociatedResource *string `json:"associatedResource,omitempty"`
ExtendedProperties map[string]interface{} `json:"extendedProperties"`
// SystemSource - The type of the alerted resource (Azure, Non-Azure)
SystemSource *string `json:"systemSource,omitempty"`
// CanBeInvestigated - Whether this alert can be investigated with Azure Security Center
CanBeInvestigated *bool `json:"canBeInvestigated,omitempty"`
// IsIncident - Whether this alert is for incident type or not (otherwise - single alert)
IsIncident *bool `json:"isIncident,omitempty"`
// Entities - objects that are related to this alerts
Entities *[]AlertEntity `json:"entities,omitempty"`
// ConfidenceScore - level of confidence we have on the alert
ConfidenceScore *float64 `json:"confidenceScore,omitempty"`
// ConfidenceReasons - reasons the alert got the confidenceScore value
ConfidenceReasons *[]AlertConfidenceReason `json:"confidenceReasons,omitempty"`
// SubscriptionID - Azure subscription ID of the resource that had the security alert or the subscription ID of the workspace that this resource reports to
SubscriptionID *string `json:"subscriptionId,omitempty"`
// InstanceID - Instance ID of the alert.
InstanceID *string `json:"instanceId,omitempty"`
// WorkspaceArmID - Azure resource ID of the workspace that the alert was reported to.
WorkspaceArmID *string `json:"workspaceArmId,omitempty"`
}
// MarshalJSON is the custom marshaler for AlertProperties.
func (ap AlertProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ap.State != nil {
objectMap["state"] = ap.State
}
if ap.ReportedTimeUtc != nil {
objectMap["reportedTimeUtc"] = ap.ReportedTimeUtc
}
if ap.VendorName != nil {
objectMap["vendorName"] = ap.VendorName
}
if ap.AlertName != nil {
objectMap["alertName"] = ap.AlertName
}
if ap.AlertDisplayName != nil {
objectMap["alertDisplayName"] = ap.AlertDisplayName
}
if ap.DetectedTimeUtc != nil {
objectMap["detectedTimeUtc"] = ap.DetectedTimeUtc
}
if ap.Description != nil {
objectMap["description"] = ap.Description
}
if ap.RemediationSteps != nil {
objectMap["remediationSteps"] = ap.RemediationSteps
}
if ap.ActionTaken != nil {
objectMap["actionTaken"] = ap.ActionTaken
}
if ap.ReportedSeverity != "" {
objectMap["reportedSeverity"] = ap.ReportedSeverity
}
if ap.CompromisedEntity != nil {
objectMap["compromisedEntity"] = ap.CompromisedEntity
}
if ap.AssociatedResource != nil {
objectMap["associatedResource"] = ap.AssociatedResource
}
if ap.ExtendedProperties != nil {
objectMap["extendedProperties"] = ap.ExtendedProperties
}
if ap.SystemSource != nil {
objectMap["systemSource"] = ap.SystemSource
}
if ap.CanBeInvestigated != nil {
objectMap["canBeInvestigated"] = ap.CanBeInvestigated
}
if ap.IsIncident != nil {
objectMap["isIncident"] = ap.IsIncident
}
if ap.Entities != nil {
objectMap["entities"] = ap.Entities
}
if ap.ConfidenceScore != nil {
objectMap["confidenceScore"] = ap.ConfidenceScore
}
if ap.ConfidenceReasons != nil {
objectMap["confidenceReasons"] = ap.ConfidenceReasons
}
if ap.SubscriptionID != nil {
objectMap["subscriptionId"] = ap.SubscriptionID
}
if ap.InstanceID != nil {
objectMap["instanceId"] = ap.InstanceID
}
if ap.WorkspaceArmID != nil {
objectMap["workspaceArmId"] = ap.WorkspaceArmID
}
return json.Marshal(objectMap)
}
// AllowedConnectionsList list of all possible traffic between Azure resources
type AllowedConnectionsList struct {
autorest.Response `json:"-"`
Value *[]AllowedConnectionsResource `json:"value,omitempty"`
// NextLink - The URI to fetch the next page.
NextLink *string `json:"nextLink,omitempty"`
}
// AllowedConnectionsListIterator provides access to a complete listing of AllowedConnectionsResource
// values.
type AllowedConnectionsListIterator struct {
i int
page AllowedConnectionsListPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *AllowedConnectionsListIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/AllowedConnectionsListIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *AllowedConnectionsListIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter AllowedConnectionsListIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter AllowedConnectionsListIterator) Response() AllowedConnectionsList {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter AllowedConnectionsListIterator) Value() AllowedConnectionsResource {
if !iter.page.NotDone() {
return AllowedConnectionsResource{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the AllowedConnectionsListIterator type.
func NewAllowedConnectionsListIterator(page AllowedConnectionsListPage) AllowedConnectionsListIterator {
return AllowedConnectionsListIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (ACL AllowedConnectionsList) IsEmpty() bool {
return ACL.Value == nil || len(*ACL.Value) == 0
}
// allowedConnectionsListPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (ACL AllowedConnectionsList) allowedConnectionsListPreparer(ctx context.Context) (*http.Request, error) {
if ACL.NextLink == nil || len(to.String(ACL.NextLink)) < 1 {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(ACL.NextLink)))
}
// AllowedConnectionsListPage contains a page of AllowedConnectionsResource values.
type AllowedConnectionsListPage struct {
fn func(context.Context, AllowedConnectionsList) (AllowedConnectionsList, error)
ACL AllowedConnectionsList
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *AllowedConnectionsListPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/AllowedConnectionsListPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.ACL)
if err != nil {
return err
}
page.ACL = next
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *AllowedConnectionsListPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page AllowedConnectionsListPage) NotDone() bool {
return !page.ACL.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page AllowedConnectionsListPage) Response() AllowedConnectionsList {
return page.ACL
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page AllowedConnectionsListPage) Values() []AllowedConnectionsResource {
if page.ACL.IsEmpty() {
return nil
}
return *page.ACL.Value
}
// Creates a new instance of the AllowedConnectionsListPage type.
func NewAllowedConnectionsListPage(getNextPage func(context.Context, AllowedConnectionsList) (AllowedConnectionsList, error)) AllowedConnectionsListPage {
return AllowedConnectionsListPage{fn: getNextPage}
}
// AllowedConnectionsResource the resource whose properties describes the allowed traffic between Azure
// resources
type AllowedConnectionsResource struct {
autorest.Response `json:"-"`
// ID - Resource Id
ID *string `json:"id,omitempty"`
// Name - Resource name
Name *string `json:"name,omitempty"`
// Type - Resource type
Type *string `json:"type,omitempty"`
// Location - Location where the resource is stored
Location *string `json:"location,omitempty"`
*AllowedConnectionsResourceProperties `json:"properties,omitempty"`
}