-
Notifications
You must be signed in to change notification settings - Fork 822
/
models.go
3081 lines (2879 loc) · 107 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 policyinsights
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// 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/azure"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2020-07-01-preview/policyinsights"
// CheckRestrictionsRequest the check policy restrictions parameters describing the resource that is being
// evaluated.
type CheckRestrictionsRequest struct {
// ResourceDetails - The information about the resource that will be evaluated.
ResourceDetails *CheckRestrictionsResourceDetails `json:"resourceDetails,omitempty"`
// PendingFields - The list of fields and values that should be evaluated for potential restrictions.
PendingFields *[]PendingField `json:"pendingFields,omitempty"`
}
// CheckRestrictionsResourceDetails the information about the resource that will be evaluated.
type CheckRestrictionsResourceDetails struct {
// ResourceContent - The resource content. This should include whatever properties are already known and can be a partial set of all resource properties.
ResourceContent interface{} `json:"resourceContent,omitempty"`
// APIVersion - The api-version of the resource content.
APIVersion *string `json:"apiVersion,omitempty"`
// Scope - The scope where the resource is being created. For example, if the resource is a child resource this would be the parent resource's resource ID.
Scope *string `json:"scope,omitempty"`
}
// CheckRestrictionsResult the result of a check policy restrictions evaluation on a resource.
type CheckRestrictionsResult struct {
autorest.Response `json:"-"`
// FieldRestrictions - READ-ONLY; The restrictions that will be placed on various fields in the resource by policy.
FieldRestrictions *[]FieldRestrictions `json:"fieldRestrictions,omitempty"`
// ContentEvaluationResult - READ-ONLY; Evaluation results for the provided partial resource content.
ContentEvaluationResult *CheckRestrictionsResultContentEvaluationResult `json:"contentEvaluationResult,omitempty"`
}
// MarshalJSON is the custom marshaler for CheckRestrictionsResult.
func (crr CheckRestrictionsResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// CheckRestrictionsResultContentEvaluationResult evaluation results for the provided partial resource
// content.
type CheckRestrictionsResultContentEvaluationResult struct {
// PolicyEvaluations - Policy evaluation results against the given resource content. This will indicate if the partial content that was provided will be denied as-is.
PolicyEvaluations *[]PolicyEvaluationResult `json:"policyEvaluations,omitempty"`
}
// ComplianceDetail the compliance state rollup.
type ComplianceDetail struct {
// ComplianceState - The compliance state.
ComplianceState *string `json:"complianceState,omitempty"`
// Count - Summarized count value for this compliance state.
Count *int32 `json:"count,omitempty"`
}
// ComponentEventDetails component event details.
type ComponentEventDetails struct {
// AdditionalProperties - Unmatched properties from the message are deserialized this collection
AdditionalProperties map[string]interface{} `json:""`
// ID - Component Id.
ID *string `json:"id,omitempty"`
// Type - Component type.
Type *string `json:"type,omitempty"`
// Name - Component name.
Name *string `json:"name,omitempty"`
// Timestamp - Timestamp for component policy event record.
Timestamp *date.Time `json:"timestamp,omitempty"`
// TenantID - Tenant ID for the policy event record.
TenantID *string `json:"tenantId,omitempty"`
// PrincipalOid - Principal object ID for the user who initiated the resource component operation that triggered the policy event.
PrincipalOid *string `json:"principalOid,omitempty"`
// PolicyDefinitionAction - Policy definition action, i.e. effect.
PolicyDefinitionAction *string `json:"policyDefinitionAction,omitempty"`
}
// MarshalJSON is the custom marshaler for ComponentEventDetails.
func (ced ComponentEventDetails) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ced.ID != nil {
objectMap["id"] = ced.ID
}
if ced.Type != nil {
objectMap["type"] = ced.Type
}
if ced.Name != nil {
objectMap["name"] = ced.Name
}
if ced.Timestamp != nil {
objectMap["timestamp"] = ced.Timestamp
}
if ced.TenantID != nil {
objectMap["tenantId"] = ced.TenantID
}
if ced.PrincipalOid != nil {
objectMap["principalOid"] = ced.PrincipalOid
}
if ced.PolicyDefinitionAction != nil {
objectMap["policyDefinitionAction"] = ced.PolicyDefinitionAction
}
for k, v := range ced.AdditionalProperties {
objectMap[k] = v
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ComponentEventDetails struct.
func (ced *ComponentEventDetails) 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 ced.AdditionalProperties == nil {
ced.AdditionalProperties = make(map[string]interface{})
}
ced.AdditionalProperties[k] = additionalProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
ced.ID = &ID
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
ced.Type = &typeVar
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
ced.Name = &name
}
case "timestamp":
if v != nil {
var timestamp date.Time
err = json.Unmarshal(*v, ×tamp)
if err != nil {
return err
}
ced.Timestamp = ×tamp
}
case "tenantId":
if v != nil {
var tenantID string
err = json.Unmarshal(*v, &tenantID)
if err != nil {
return err
}
ced.TenantID = &tenantID
}
case "principalOid":
if v != nil {
var principalOid string
err = json.Unmarshal(*v, &principalOid)
if err != nil {
return err
}
ced.PrincipalOid = &principalOid
}
case "policyDefinitionAction":
if v != nil {
var policyDefinitionAction string
err = json.Unmarshal(*v, &policyDefinitionAction)
if err != nil {
return err
}
ced.PolicyDefinitionAction = &policyDefinitionAction
}
}
}
return nil
}
// ComponentStateDetails component state details.
type ComponentStateDetails struct {
// AdditionalProperties - Unmatched properties from the message are deserialized this collection
AdditionalProperties map[string]interface{} `json:""`
// ID - Component Id.
ID *string `json:"id,omitempty"`
// Type - Component type.
Type *string `json:"type,omitempty"`
// Name - Component name.
Name *string `json:"name,omitempty"`
// Timestamp - Component compliance evaluation timestamp.
Timestamp *date.Time `json:"timestamp,omitempty"`
// ComplianceState - Component compliance state.
ComplianceState *string `json:"complianceState,omitempty"`
}
// MarshalJSON is the custom marshaler for ComponentStateDetails.
func (csd ComponentStateDetails) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if csd.ID != nil {
objectMap["id"] = csd.ID
}
if csd.Type != nil {
objectMap["type"] = csd.Type
}
if csd.Name != nil {
objectMap["name"] = csd.Name
}
if csd.Timestamp != nil {
objectMap["timestamp"] = csd.Timestamp
}
if csd.ComplianceState != nil {
objectMap["complianceState"] = csd.ComplianceState
}
for k, v := range csd.AdditionalProperties {
objectMap[k] = v
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ComponentStateDetails struct.
func (csd *ComponentStateDetails) 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 csd.AdditionalProperties == nil {
csd.AdditionalProperties = make(map[string]interface{})
}
csd.AdditionalProperties[k] = additionalProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
csd.ID = &ID
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
csd.Type = &typeVar
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
csd.Name = &name
}
case "timestamp":
if v != nil {
var timestamp date.Time
err = json.Unmarshal(*v, ×tamp)
if err != nil {
return err
}
csd.Timestamp = ×tamp
}
case "complianceState":
if v != nil {
var complianceState string
err = json.Unmarshal(*v, &complianceState)
if err != nil {
return err
}
csd.ComplianceState = &complianceState
}
}
}
return nil
}
// ErrorDefinition error definition.
type ErrorDefinition struct {
// Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code.
Code *string `json:"code,omitempty"`
// Message - READ-ONLY; Description of the error.
Message *string `json:"message,omitempty"`
// Target - READ-ONLY; The target of the error.
Target *string `json:"target,omitempty"`
// Details - READ-ONLY; Internal error details.
Details *[]ErrorDefinition `json:"details,omitempty"`
// AdditionalInfo - READ-ONLY; Additional scenario specific error details.
AdditionalInfo *[]TypedErrorInfo `json:"additionalInfo,omitempty"`
}
// MarshalJSON is the custom marshaler for ErrorDefinition.
func (ed ErrorDefinition) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// ErrorResponse error response.
type ErrorResponse struct {
// Error - The error details.
Error *ErrorDefinition `json:"error,omitempty"`
}
// ExpressionEvaluationDetails evaluation details of policy language expressions.
type ExpressionEvaluationDetails struct {
// Result - Evaluation result.
Result *string `json:"result,omitempty"`
// Expression - Expression evaluated.
Expression *string `json:"expression,omitempty"`
// ExpressionKind - READ-ONLY; The kind of expression that was evaluated.
ExpressionKind *string `json:"expressionKind,omitempty"`
// Path - Property path if the expression is a field or an alias.
Path *string `json:"path,omitempty"`
// ExpressionValue - Value of the expression.
ExpressionValue interface{} `json:"expressionValue,omitempty"`
// TargetValue - Target value to be compared with the expression value.
TargetValue interface{} `json:"targetValue,omitempty"`
// Operator - Operator to compare the expression value and the target value.
Operator *string `json:"operator,omitempty"`
}
// MarshalJSON is the custom marshaler for ExpressionEvaluationDetails.
func (eed ExpressionEvaluationDetails) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if eed.Result != nil {
objectMap["result"] = eed.Result
}
if eed.Expression != nil {
objectMap["expression"] = eed.Expression
}
if eed.Path != nil {
objectMap["path"] = eed.Path
}
if eed.ExpressionValue != nil {
objectMap["expressionValue"] = eed.ExpressionValue
}
if eed.TargetValue != nil {
objectMap["targetValue"] = eed.TargetValue
}
if eed.Operator != nil {
objectMap["operator"] = eed.Operator
}
return json.Marshal(objectMap)
}
// FieldRestriction the restrictions on a field imposed by a specific policy.
type FieldRestriction struct {
// Result - READ-ONLY; The type of restriction that is imposed on the field. Possible values include: 'Required', 'Removed', 'Deny'
Result FieldRestrictionResult `json:"result,omitempty"`
// DefaultValue - READ-ONLY; The value that policy will set for the field if the user does not provide a value.
DefaultValue *string `json:"defaultValue,omitempty"`
// Values - READ-ONLY; The values that policy either requires or denies for the field.
Values *[]string `json:"values,omitempty"`
// Policy - READ-ONLY; The details of the policy that is causing the field restriction.
Policy *PolicyReference `json:"policy,omitempty"`
}
// MarshalJSON is the custom marshaler for FieldRestriction.
func (fr FieldRestriction) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// FieldRestrictions the restrictions that will be placed on a field in the resource by policy.
type FieldRestrictions struct {
// Field - READ-ONLY; The name of the field. This can be a top-level property like 'name' or 'type' or an Azure Policy field alias.
Field *string `json:"field,omitempty"`
// Restrictions - The restrictions placed on that field by policy.
Restrictions *[]FieldRestriction `json:"restrictions,omitempty"`
}
// MarshalJSON is the custom marshaler for FieldRestrictions.
func (fr FieldRestrictions) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if fr.Restrictions != nil {
objectMap["restrictions"] = fr.Restrictions
}
return json.Marshal(objectMap)
}
// IfNotExistsEvaluationDetails evaluation details of IfNotExists effect.
type IfNotExistsEvaluationDetails struct {
// ResourceID - ID of the last evaluated resource for IfNotExists effect.
ResourceID *string `json:"resourceId,omitempty"`
// TotalResources - Total number of resources to which the existence condition is applicable.
TotalResources *int32 `json:"totalResources,omitempty"`
}
// Operation operation definition.
type Operation struct {
// Name - Operation name.
Name *string `json:"name,omitempty"`
// Display - Display metadata associated with the operation.
Display *OperationDisplay `json:"display,omitempty"`
}
// OperationDisplay display metadata associated with the operation.
type OperationDisplay struct {
// Provider - Resource provider name.
Provider *string `json:"provider,omitempty"`
// Resource - Resource name on which the operation is performed.
Resource *string `json:"resource,omitempty"`
// Operation - Operation name.
Operation *string `json:"operation,omitempty"`
// Description - Operation description.
Description *string `json:"description,omitempty"`
}
// OperationsListResults list of available operations.
type OperationsListResults struct {
autorest.Response `json:"-"`
// OdataCount - OData entity count; represents the number of operations returned.
OdataCount *int32 `json:"@odata.count,omitempty"`
// Value - List of available operations.
Value *[]Operation `json:"value,omitempty"`
}
// PendingField a field that should be evaluated against Azure Policy to determine restrictions.
type PendingField struct {
// Field - The name of the field. This can be a top-level property like 'name' or 'type' or an Azure Policy field alias.
Field *string `json:"field,omitempty"`
// Values - The list of potential values for the field that should be evaluated against Azure Policy.
Values *[]string `json:"values,omitempty"`
}
// PolicyAssignmentSummary policy assignment summary.
type PolicyAssignmentSummary struct {
// PolicyAssignmentID - Policy assignment ID.
PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"`
// PolicySetDefinitionID - Policy set definition ID, if the policy assignment is for a policy set.
PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"`
// Results - Compliance summary for the policy assignment.
Results *SummaryResults `json:"results,omitempty"`
// PolicyDefinitions - Policy definitions summary.
PolicyDefinitions *[]PolicyDefinitionSummary `json:"policyDefinitions,omitempty"`
// PolicyGroups - Policy definition group summary.
PolicyGroups *[]PolicyGroupSummary `json:"policyGroups,omitempty"`
}
// PolicyDefinitionSummary policy definition summary.
type PolicyDefinitionSummary struct {
// PolicyDefinitionID - Policy definition ID.
PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`
// PolicyDefinitionReferenceID - Policy definition reference ID.
PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"`
// PolicyDefinitionGroupNames - Policy definition group names.
PolicyDefinitionGroupNames *[]string `json:"policyDefinitionGroupNames,omitempty"`
// Effect - Policy effect, i.e. policy definition action.
Effect *string `json:"effect,omitempty"`
// Results - Compliance summary for the policy definition.
Results *SummaryResults `json:"results,omitempty"`
}
// PolicyDetails the policy details.
type PolicyDetails struct {
// PolicyDefinitionID - READ-ONLY; The ID of the policy definition.
PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`
// PolicyAssignmentID - READ-ONLY; The ID of the policy assignment.
PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"`
// PolicyAssignmentDisplayName - READ-ONLY; The display name of the policy assignment.
PolicyAssignmentDisplayName *string `json:"policyAssignmentDisplayName,omitempty"`
// PolicyAssignmentScope - READ-ONLY; The scope of the policy assignment.
PolicyAssignmentScope *string `json:"policyAssignmentScope,omitempty"`
// PolicySetDefinitionID - READ-ONLY; The ID of the policy set definition.
PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"`
// PolicyDefinitionReferenceID - READ-ONLY; The policy definition reference ID within the policy set definition.
PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"`
}
// MarshalJSON is the custom marshaler for PolicyDetails.
func (pd PolicyDetails) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// PolicyEvaluationDetails policy evaluation details.
type PolicyEvaluationDetails struct {
// EvaluatedExpressions - Details of the evaluated expressions.
EvaluatedExpressions *[]ExpressionEvaluationDetails `json:"evaluatedExpressions,omitempty"`
// IfNotExistsDetails - Evaluation details of IfNotExists effect.
IfNotExistsDetails *IfNotExistsEvaluationDetails `json:"ifNotExistsDetails,omitempty"`
}
// PolicyEvaluationResult the result of a non-compliant policy evaluation against the given resource
// content.
type PolicyEvaluationResult struct {
// PolicyInfo - READ-ONLY; The details of the policy that was evaluated.
PolicyInfo *PolicyReference `json:"policyInfo,omitempty"`
// EvaluationResult - READ-ONLY; The result of the policy evaluation against the resource. This will typically be 'NonCompliant' but may contain other values if errors were encountered.
EvaluationResult *string `json:"evaluationResult,omitempty"`
// EvaluationDetails - READ-ONLY; The detailed results of the policy expressions and values that were evaluated.
EvaluationDetails *PolicyEvaluationDetails `json:"evaluationDetails,omitempty"`
}
// MarshalJSON is the custom marshaler for PolicyEvaluationResult.
func (per PolicyEvaluationResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// PolicyEvent policy event record.
type PolicyEvent struct {
// AdditionalProperties - Unmatched properties from the message are deserialized this collection
AdditionalProperties map[string]interface{} `json:""`
// OdataID - OData entity ID; always set to null since policy event records do not have an entity ID.
OdataID *string `json:"@odata.id,omitempty"`
// OdataContext - OData context string; used by OData clients to resolve type information based on metadata.
OdataContext *string `json:"@odata.context,omitempty"`
// Timestamp - Timestamp for the policy event record.
Timestamp *date.Time `json:"timestamp,omitempty"`
// ResourceID - Resource ID.
ResourceID *string `json:"resourceId,omitempty"`
// PolicyAssignmentID - Policy assignment ID.
PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"`
// PolicyDefinitionID - Policy definition ID.
PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`
// EffectiveParameters - Effective parameters for the policy assignment.
EffectiveParameters *string `json:"effectiveParameters,omitempty"`
// IsCompliant - Flag which states whether the resource is compliant against the policy assignment it was evaluated against.
IsCompliant *bool `json:"isCompliant,omitempty"`
// SubscriptionID - Subscription ID.
SubscriptionID *string `json:"subscriptionId,omitempty"`
// ResourceType - Resource type.
ResourceType *string `json:"resourceType,omitempty"`
// ResourceLocation - Resource location.
ResourceLocation *string `json:"resourceLocation,omitempty"`
// ResourceGroup - Resource group name.
ResourceGroup *string `json:"resourceGroup,omitempty"`
// ResourceTags - List of resource tags.
ResourceTags *string `json:"resourceTags,omitempty"`
// PolicyAssignmentName - Policy assignment name.
PolicyAssignmentName *string `json:"policyAssignmentName,omitempty"`
// PolicyAssignmentOwner - Policy assignment owner.
PolicyAssignmentOwner *string `json:"policyAssignmentOwner,omitempty"`
// PolicyAssignmentParameters - Policy assignment parameters.
PolicyAssignmentParameters *string `json:"policyAssignmentParameters,omitempty"`
// PolicyAssignmentScope - Policy assignment scope.
PolicyAssignmentScope *string `json:"policyAssignmentScope,omitempty"`
// PolicyDefinitionName - Policy definition name.
PolicyDefinitionName *string `json:"policyDefinitionName,omitempty"`
// PolicyDefinitionAction - Policy definition action, i.e. effect.
PolicyDefinitionAction *string `json:"policyDefinitionAction,omitempty"`
// PolicyDefinitionCategory - Policy definition category.
PolicyDefinitionCategory *string `json:"policyDefinitionCategory,omitempty"`
// PolicySetDefinitionID - Policy set definition ID, if the policy assignment is for a policy set.
PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"`
// PolicySetDefinitionName - Policy set definition name, if the policy assignment is for a policy set.
PolicySetDefinitionName *string `json:"policySetDefinitionName,omitempty"`
// PolicySetDefinitionOwner - Policy set definition owner, if the policy assignment is for a policy set.
PolicySetDefinitionOwner *string `json:"policySetDefinitionOwner,omitempty"`
// PolicySetDefinitionCategory - Policy set definition category, if the policy assignment is for a policy set.
PolicySetDefinitionCategory *string `json:"policySetDefinitionCategory,omitempty"`
// PolicySetDefinitionParameters - Policy set definition parameters, if the policy assignment is for a policy set.
PolicySetDefinitionParameters *string `json:"policySetDefinitionParameters,omitempty"`
// ManagementGroupIds - Comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under.
ManagementGroupIds *string `json:"managementGroupIds,omitempty"`
// PolicyDefinitionReferenceID - Reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set.
PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"`
// ComplianceState - Compliance state of the resource.
ComplianceState *string `json:"complianceState,omitempty"`
// TenantID - Tenant ID for the policy event record.
TenantID *string `json:"tenantId,omitempty"`
// PrincipalOid - Principal object ID for the user who initiated the resource operation that triggered the policy event.
PrincipalOid *string `json:"principalOid,omitempty"`
// Components - Components events records populated only when URL contains $expand=components clause.
Components *[]ComponentEventDetails `json:"components,omitempty"`
}
// MarshalJSON is the custom marshaler for PolicyEvent.
func (peVar PolicyEvent) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if peVar.OdataID != nil {
objectMap["@odata.id"] = peVar.OdataID
}
if peVar.OdataContext != nil {
objectMap["@odata.context"] = peVar.OdataContext
}
if peVar.Timestamp != nil {
objectMap["timestamp"] = peVar.Timestamp
}
if peVar.ResourceID != nil {
objectMap["resourceId"] = peVar.ResourceID
}
if peVar.PolicyAssignmentID != nil {
objectMap["policyAssignmentId"] = peVar.PolicyAssignmentID
}
if peVar.PolicyDefinitionID != nil {
objectMap["policyDefinitionId"] = peVar.PolicyDefinitionID
}
if peVar.EffectiveParameters != nil {
objectMap["effectiveParameters"] = peVar.EffectiveParameters
}
if peVar.IsCompliant != nil {
objectMap["isCompliant"] = peVar.IsCompliant
}
if peVar.SubscriptionID != nil {
objectMap["subscriptionId"] = peVar.SubscriptionID
}
if peVar.ResourceType != nil {
objectMap["resourceType"] = peVar.ResourceType
}
if peVar.ResourceLocation != nil {
objectMap["resourceLocation"] = peVar.ResourceLocation
}
if peVar.ResourceGroup != nil {
objectMap["resourceGroup"] = peVar.ResourceGroup
}
if peVar.ResourceTags != nil {
objectMap["resourceTags"] = peVar.ResourceTags
}
if peVar.PolicyAssignmentName != nil {
objectMap["policyAssignmentName"] = peVar.PolicyAssignmentName
}
if peVar.PolicyAssignmentOwner != nil {
objectMap["policyAssignmentOwner"] = peVar.PolicyAssignmentOwner
}
if peVar.PolicyAssignmentParameters != nil {
objectMap["policyAssignmentParameters"] = peVar.PolicyAssignmentParameters
}
if peVar.PolicyAssignmentScope != nil {
objectMap["policyAssignmentScope"] = peVar.PolicyAssignmentScope
}
if peVar.PolicyDefinitionName != nil {
objectMap["policyDefinitionName"] = peVar.PolicyDefinitionName
}
if peVar.PolicyDefinitionAction != nil {
objectMap["policyDefinitionAction"] = peVar.PolicyDefinitionAction
}
if peVar.PolicyDefinitionCategory != nil {
objectMap["policyDefinitionCategory"] = peVar.PolicyDefinitionCategory
}
if peVar.PolicySetDefinitionID != nil {
objectMap["policySetDefinitionId"] = peVar.PolicySetDefinitionID
}
if peVar.PolicySetDefinitionName != nil {
objectMap["policySetDefinitionName"] = peVar.PolicySetDefinitionName
}
if peVar.PolicySetDefinitionOwner != nil {
objectMap["policySetDefinitionOwner"] = peVar.PolicySetDefinitionOwner
}
if peVar.PolicySetDefinitionCategory != nil {
objectMap["policySetDefinitionCategory"] = peVar.PolicySetDefinitionCategory
}
if peVar.PolicySetDefinitionParameters != nil {
objectMap["policySetDefinitionParameters"] = peVar.PolicySetDefinitionParameters
}
if peVar.ManagementGroupIds != nil {
objectMap["managementGroupIds"] = peVar.ManagementGroupIds
}
if peVar.PolicyDefinitionReferenceID != nil {
objectMap["policyDefinitionReferenceId"] = peVar.PolicyDefinitionReferenceID
}
if peVar.ComplianceState != nil {
objectMap["complianceState"] = peVar.ComplianceState
}
if peVar.TenantID != nil {
objectMap["tenantId"] = peVar.TenantID
}
if peVar.PrincipalOid != nil {
objectMap["principalOid"] = peVar.PrincipalOid
}
if peVar.Components != nil {
objectMap["components"] = peVar.Components
}
for k, v := range peVar.AdditionalProperties {
objectMap[k] = v
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for PolicyEvent struct.
func (peVar *PolicyEvent) 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 peVar.AdditionalProperties == nil {
peVar.AdditionalProperties = make(map[string]interface{})
}
peVar.AdditionalProperties[k] = additionalProperties
}
case "@odata.id":
if v != nil {
var odataID string
err = json.Unmarshal(*v, &odataID)
if err != nil {
return err
}
peVar.OdataID = &odataID
}
case "@odata.context":
if v != nil {
var odataContext string
err = json.Unmarshal(*v, &odataContext)
if err != nil {
return err
}
peVar.OdataContext = &odataContext
}
case "timestamp":
if v != nil {
var timestamp date.Time
err = json.Unmarshal(*v, ×tamp)
if err != nil {
return err
}
peVar.Timestamp = ×tamp
}
case "resourceId":
if v != nil {
var resourceID string
err = json.Unmarshal(*v, &resourceID)
if err != nil {
return err
}
peVar.ResourceID = &resourceID
}
case "policyAssignmentId":
if v != nil {
var policyAssignmentID string
err = json.Unmarshal(*v, &policyAssignmentID)
if err != nil {
return err
}
peVar.PolicyAssignmentID = &policyAssignmentID
}
case "policyDefinitionId":
if v != nil {
var policyDefinitionID string
err = json.Unmarshal(*v, &policyDefinitionID)
if err != nil {
return err
}
peVar.PolicyDefinitionID = &policyDefinitionID
}
case "effectiveParameters":
if v != nil {
var effectiveParameters string
err = json.Unmarshal(*v, &effectiveParameters)
if err != nil {
return err
}
peVar.EffectiveParameters = &effectiveParameters
}
case "isCompliant":
if v != nil {
var isCompliant bool
err = json.Unmarshal(*v, &isCompliant)
if err != nil {
return err
}
peVar.IsCompliant = &isCompliant
}
case "subscriptionId":
if v != nil {
var subscriptionID string
err = json.Unmarshal(*v, &subscriptionID)
if err != nil {
return err
}
peVar.SubscriptionID = &subscriptionID
}
case "resourceType":
if v != nil {
var resourceType string
err = json.Unmarshal(*v, &resourceType)
if err != nil {
return err
}
peVar.ResourceType = &resourceType
}
case "resourceLocation":
if v != nil {
var resourceLocation string
err = json.Unmarshal(*v, &resourceLocation)
if err != nil {
return err
}
peVar.ResourceLocation = &resourceLocation
}
case "resourceGroup":
if v != nil {
var resourceGroup string
err = json.Unmarshal(*v, &resourceGroup)
if err != nil {
return err
}
peVar.ResourceGroup = &resourceGroup
}
case "resourceTags":
if v != nil {
var resourceTags string
err = json.Unmarshal(*v, &resourceTags)
if err != nil {
return err
}
peVar.ResourceTags = &resourceTags
}
case "policyAssignmentName":
if v != nil {
var policyAssignmentName string
err = json.Unmarshal(*v, &policyAssignmentName)
if err != nil {
return err
}
peVar.PolicyAssignmentName = &policyAssignmentName
}
case "policyAssignmentOwner":
if v != nil {
var policyAssignmentOwner string
err = json.Unmarshal(*v, &policyAssignmentOwner)
if err != nil {
return err
}
peVar.PolicyAssignmentOwner = &policyAssignmentOwner
}
case "policyAssignmentParameters":
if v != nil {
var policyAssignmentParameters string
err = json.Unmarshal(*v, &policyAssignmentParameters)
if err != nil {
return err
}
peVar.PolicyAssignmentParameters = &policyAssignmentParameters
}
case "policyAssignmentScope":
if v != nil {
var policyAssignmentScope string
err = json.Unmarshal(*v, &policyAssignmentScope)
if err != nil {
return err
}
peVar.PolicyAssignmentScope = &policyAssignmentScope
}
case "policyDefinitionName":
if v != nil {
var policyDefinitionName string
err = json.Unmarshal(*v, &policyDefinitionName)
if err != nil {
return err
}
peVar.PolicyDefinitionName = &policyDefinitionName
}
case "policyDefinitionAction":
if v != nil {
var policyDefinitionAction string
err = json.Unmarshal(*v, &policyDefinitionAction)
if err != nil {
return err
}
peVar.PolicyDefinitionAction = &policyDefinitionAction
}
case "policyDefinitionCategory":
if v != nil {
var policyDefinitionCategory string
err = json.Unmarshal(*v, &policyDefinitionCategory)
if err != nil {
return err
}
peVar.PolicyDefinitionCategory = &policyDefinitionCategory
}
case "policySetDefinitionId":
if v != nil {
var policySetDefinitionID string
err = json.Unmarshal(*v, &policySetDefinitionID)
if err != nil {
return err
}
peVar.PolicySetDefinitionID = &policySetDefinitionID
}
case "policySetDefinitionName":
if v != nil {
var policySetDefinitionName string
err = json.Unmarshal(*v, &policySetDefinitionName)
if err != nil {
return err
}
peVar.PolicySetDefinitionName = &policySetDefinitionName
}
case "policySetDefinitionOwner":
if v != nil {
var policySetDefinitionOwner string
err = json.Unmarshal(*v, &policySetDefinitionOwner)
if err != nil {
return err
}
peVar.PolicySetDefinitionOwner = &policySetDefinitionOwner
}
case "policySetDefinitionCategory":
if v != nil {
var policySetDefinitionCategory string
err = json.Unmarshal(*v, &policySetDefinitionCategory)
if err != nil {
return err
}
peVar.PolicySetDefinitionCategory = &policySetDefinitionCategory
}
case "policySetDefinitionParameters":
if v != nil {
var policySetDefinitionParameters string
err = json.Unmarshal(*v, &policySetDefinitionParameters)
if err != nil {
return err
}
peVar.PolicySetDefinitionParameters = &policySetDefinitionParameters
}
case "managementGroupIds":
if v != nil {
var managementGroupIds string
err = json.Unmarshal(*v, &managementGroupIds)
if err != nil {
return err
}
peVar.ManagementGroupIds = &managementGroupIds
}
case "policyDefinitionReferenceId":
if v != nil {
var policyDefinitionReferenceID string
err = json.Unmarshal(*v, &policyDefinitionReferenceID)
if err != nil {
return err
}
peVar.PolicyDefinitionReferenceID = &policyDefinitionReferenceID
}
case "complianceState":
if v != nil {
var complianceState string
err = json.Unmarshal(*v, &complianceState)
if err != nil {
return err
}
peVar.ComplianceState = &complianceState
}
case "tenantId":
if v != nil {
var tenantID string
err = json.Unmarshal(*v, &tenantID)
if err != nil {
return err
}
peVar.TenantID = &tenantID
}
case "principalOid":
if v != nil {