1 package policy
2
3
4
5
6
7
8
9 import (
10 "context"
11 "encoding/json"
12 "github.com/Azure/go-autorest/autorest"
13 "github.com/Azure/go-autorest/autorest/date"
14 "github.com/Azure/go-autorest/autorest/to"
15 "github.com/Azure/go-autorest/tracing"
16 "net/http"
17 )
18
19
20 const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2021-06-01-preview/policy"
21
22
23 type Alias struct {
24
25 Name *string `json:"name,omitempty"`
26
27 Paths *[]AliasPath `json:"paths,omitempty"`
28
29 Type AliasType `json:"type,omitempty"`
30
31 DefaultPath *string `json:"defaultPath,omitempty"`
32
33 DefaultPattern *AliasPattern `json:"defaultPattern,omitempty"`
34
35 DefaultMetadata *AliasPathMetadata `json:"defaultMetadata,omitempty"`
36 }
37
38
39 func (a Alias) MarshalJSON() ([]byte, error) {
40 objectMap := make(map[string]interface{})
41 if a.Name != nil {
42 objectMap["name"] = a.Name
43 }
44 if a.Paths != nil {
45 objectMap["paths"] = a.Paths
46 }
47 if a.Type != "" {
48 objectMap["type"] = a.Type
49 }
50 if a.DefaultPath != nil {
51 objectMap["defaultPath"] = a.DefaultPath
52 }
53 if a.DefaultPattern != nil {
54 objectMap["defaultPattern"] = a.DefaultPattern
55 }
56 return json.Marshal(objectMap)
57 }
58
59
60 type AliasPath struct {
61
62 Path *string `json:"path,omitempty"`
63
64 APIVersions *[]string `json:"apiVersions,omitempty"`
65
66 Pattern *AliasPattern `json:"pattern,omitempty"`
67
68 Metadata *AliasPathMetadata `json:"metadata,omitempty"`
69 }
70
71
72 func (ap AliasPath) MarshalJSON() ([]byte, error) {
73 objectMap := make(map[string]interface{})
74 if ap.Path != nil {
75 objectMap["path"] = ap.Path
76 }
77 if ap.APIVersions != nil {
78 objectMap["apiVersions"] = ap.APIVersions
79 }
80 if ap.Pattern != nil {
81 objectMap["pattern"] = ap.Pattern
82 }
83 return json.Marshal(objectMap)
84 }
85
86
87 type AliasPathMetadata struct {
88
89 Type AliasPathTokenType `json:"type,omitempty"`
90
91 Attributes AliasPathAttributes `json:"attributes,omitempty"`
92 }
93
94
95 func (apm AliasPathMetadata) MarshalJSON() ([]byte, error) {
96 objectMap := make(map[string]interface{})
97 return json.Marshal(objectMap)
98 }
99
100
101 type AliasPattern struct {
102
103 Phrase *string `json:"phrase,omitempty"`
104
105 Variable *string `json:"variable,omitempty"`
106
107 Type AliasPatternType `json:"type,omitempty"`
108 }
109
110
111 type Assignment struct {
112 autorest.Response `json:"-"`
113
114 *AssignmentProperties `json:"properties,omitempty"`
115
116 ID *string `json:"id,omitempty"`
117
118 Type *string `json:"type,omitempty"`
119
120 Name *string `json:"name,omitempty"`
121
122 Location *string `json:"location,omitempty"`
123
124 Identity *Identity `json:"identity,omitempty"`
125
126 SystemData *SystemData `json:"systemData,omitempty"`
127 }
128
129
130 func (a Assignment) MarshalJSON() ([]byte, error) {
131 objectMap := make(map[string]interface{})
132 if a.AssignmentProperties != nil {
133 objectMap["properties"] = a.AssignmentProperties
134 }
135 if a.Location != nil {
136 objectMap["location"] = a.Location
137 }
138 if a.Identity != nil {
139 objectMap["identity"] = a.Identity
140 }
141 return json.Marshal(objectMap)
142 }
143
144
145 func (a *Assignment) UnmarshalJSON(body []byte) error {
146 var m map[string]*json.RawMessage
147 err := json.Unmarshal(body, &m)
148 if err != nil {
149 return err
150 }
151 for k, v := range m {
152 switch k {
153 case "properties":
154 if v != nil {
155 var assignmentProperties AssignmentProperties
156 err = json.Unmarshal(*v, &assignmentProperties)
157 if err != nil {
158 return err
159 }
160 a.AssignmentProperties = &assignmentProperties
161 }
162 case "id":
163 if v != nil {
164 var ID string
165 err = json.Unmarshal(*v, &ID)
166 if err != nil {
167 return err
168 }
169 a.ID = &ID
170 }
171 case "type":
172 if v != nil {
173 var typeVar string
174 err = json.Unmarshal(*v, &typeVar)
175 if err != nil {
176 return err
177 }
178 a.Type = &typeVar
179 }
180 case "name":
181 if v != nil {
182 var name string
183 err = json.Unmarshal(*v, &name)
184 if err != nil {
185 return err
186 }
187 a.Name = &name
188 }
189 case "location":
190 if v != nil {
191 var location string
192 err = json.Unmarshal(*v, &location)
193 if err != nil {
194 return err
195 }
196 a.Location = &location
197 }
198 case "identity":
199 if v != nil {
200 var identity Identity
201 err = json.Unmarshal(*v, &identity)
202 if err != nil {
203 return err
204 }
205 a.Identity = &identity
206 }
207 case "systemData":
208 if v != nil {
209 var systemData SystemData
210 err = json.Unmarshal(*v, &systemData)
211 if err != nil {
212 return err
213 }
214 a.SystemData = &systemData
215 }
216 }
217 }
218
219 return nil
220 }
221
222
223 type AssignmentListResult struct {
224 autorest.Response `json:"-"`
225
226 Value *[]Assignment `json:"value,omitempty"`
227
228 NextLink *string `json:"nextLink,omitempty"`
229 }
230
231
232 type AssignmentListResultIterator struct {
233 i int
234 page AssignmentListResultPage
235 }
236
237
238
239 func (iter *AssignmentListResultIterator) NextWithContext(ctx context.Context) (err error) {
240 if tracing.IsEnabled() {
241 ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentListResultIterator.NextWithContext")
242 defer func() {
243 sc := -1
244 if iter.Response().Response.Response != nil {
245 sc = iter.Response().Response.Response.StatusCode
246 }
247 tracing.EndSpan(ctx, sc, err)
248 }()
249 }
250 iter.i++
251 if iter.i < len(iter.page.Values()) {
252 return nil
253 }
254 err = iter.page.NextWithContext(ctx)
255 if err != nil {
256 iter.i--
257 return err
258 }
259 iter.i = 0
260 return nil
261 }
262
263
264
265
266 func (iter *AssignmentListResultIterator) Next() error {
267 return iter.NextWithContext(context.Background())
268 }
269
270
271 func (iter AssignmentListResultIterator) NotDone() bool {
272 return iter.page.NotDone() && iter.i < len(iter.page.Values())
273 }
274
275
276 func (iter AssignmentListResultIterator) Response() AssignmentListResult {
277 return iter.page.Response()
278 }
279
280
281
282 func (iter AssignmentListResultIterator) Value() Assignment {
283 if !iter.page.NotDone() {
284 return Assignment{}
285 }
286 return iter.page.Values()[iter.i]
287 }
288
289
290 func NewAssignmentListResultIterator(page AssignmentListResultPage) AssignmentListResultIterator {
291 return AssignmentListResultIterator{page: page}
292 }
293
294
295 func (alr AssignmentListResult) IsEmpty() bool {
296 return alr.Value == nil || len(*alr.Value) == 0
297 }
298
299
300 func (alr AssignmentListResult) hasNextLink() bool {
301 return alr.NextLink != nil && len(*alr.NextLink) != 0
302 }
303
304
305
306 func (alr AssignmentListResult) assignmentListResultPreparer(ctx context.Context) (*http.Request, error) {
307 if !alr.hasNextLink() {
308 return nil, nil
309 }
310 return autorest.Prepare((&http.Request{}).WithContext(ctx),
311 autorest.AsJSON(),
312 autorest.AsGet(),
313 autorest.WithBaseURL(to.String(alr.NextLink)))
314 }
315
316
317 type AssignmentListResultPage struct {
318 fn func(context.Context, AssignmentListResult) (AssignmentListResult, error)
319 alr AssignmentListResult
320 }
321
322
323
324 func (page *AssignmentListResultPage) NextWithContext(ctx context.Context) (err error) {
325 if tracing.IsEnabled() {
326 ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentListResultPage.NextWithContext")
327 defer func() {
328 sc := -1
329 if page.Response().Response.Response != nil {
330 sc = page.Response().Response.Response.StatusCode
331 }
332 tracing.EndSpan(ctx, sc, err)
333 }()
334 }
335 for {
336 next, err := page.fn(ctx, page.alr)
337 if err != nil {
338 return err
339 }
340 page.alr = next
341 if !next.hasNextLink() || !next.IsEmpty() {
342 break
343 }
344 }
345 return nil
346 }
347
348
349
350
351 func (page *AssignmentListResultPage) Next() error {
352 return page.NextWithContext(context.Background())
353 }
354
355
356 func (page AssignmentListResultPage) NotDone() bool {
357 return !page.alr.IsEmpty()
358 }
359
360
361 func (page AssignmentListResultPage) Response() AssignmentListResult {
362 return page.alr
363 }
364
365
366 func (page AssignmentListResultPage) Values() []Assignment {
367 if page.alr.IsEmpty() {
368 return nil
369 }
370 return *page.alr.Value
371 }
372
373
374 func NewAssignmentListResultPage(cur AssignmentListResult, getNextPage func(context.Context, AssignmentListResult) (AssignmentListResult, error)) AssignmentListResultPage {
375 return AssignmentListResultPage{
376 fn: getNextPage,
377 alr: cur,
378 }
379 }
380
381
382 type AssignmentProperties struct {
383
384 DisplayName *string `json:"displayName,omitempty"`
385
386 PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`
387
388 Scope *string `json:"scope,omitempty"`
389
390 NotScopes *[]string `json:"notScopes,omitempty"`
391
392 Parameters map[string]*ParameterValuesValue `json:"parameters"`
393
394 Description *string `json:"description,omitempty"`
395
396 Metadata interface{} `json:"metadata,omitempty"`
397
398 EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"`
399
400 NonComplianceMessages *[]NonComplianceMessage `json:"nonComplianceMessages,omitempty"`
401 }
402
403
404 func (ap AssignmentProperties) MarshalJSON() ([]byte, error) {
405 objectMap := make(map[string]interface{})
406 if ap.DisplayName != nil {
407 objectMap["displayName"] = ap.DisplayName
408 }
409 if ap.PolicyDefinitionID != nil {
410 objectMap["policyDefinitionId"] = ap.PolicyDefinitionID
411 }
412 if ap.NotScopes != nil {
413 objectMap["notScopes"] = ap.NotScopes
414 }
415 if ap.Parameters != nil {
416 objectMap["parameters"] = ap.Parameters
417 }
418 if ap.Description != nil {
419 objectMap["description"] = ap.Description
420 }
421 if ap.Metadata != nil {
422 objectMap["metadata"] = ap.Metadata
423 }
424 if ap.EnforcementMode != "" {
425 objectMap["enforcementMode"] = ap.EnforcementMode
426 }
427 if ap.NonComplianceMessages != nil {
428 objectMap["nonComplianceMessages"] = ap.NonComplianceMessages
429 }
430 return json.Marshal(objectMap)
431 }
432
433
434 type AssignmentUpdate struct {
435
436 Location *string `json:"location,omitempty"`
437
438 Identity *Identity `json:"identity,omitempty"`
439 }
440
441
442 type CloudError struct {
443 Error *ErrorResponse `json:"error,omitempty"`
444 }
445
446
447 type DataEffect struct {
448
449 Name *string `json:"name,omitempty"`
450
451 DetailsSchema interface{} `json:"detailsSchema,omitempty"`
452 }
453
454
455 type DataManifestCustomResourceFunctionDefinition struct {
456
457 Name *string `json:"name,omitempty"`
458
459 FullyQualifiedResourceType *string `json:"fullyQualifiedResourceType,omitempty"`
460
461 DefaultProperties *[]string `json:"defaultProperties,omitempty"`
462
463 AllowCustomProperties *bool `json:"allowCustomProperties,omitempty"`
464 }
465
466
467 type DataManifestResourceFunctionsDefinition struct {
468
469 Standard *[]string `json:"standard,omitempty"`
470
471 Custom *[]DataManifestCustomResourceFunctionDefinition `json:"custom,omitempty"`
472 }
473
474
475 type DataPolicyManifest struct {
476 autorest.Response `json:"-"`
477
478 *DataPolicyManifestProperties `json:"properties,omitempty"`
479
480 ID *string `json:"id,omitempty"`
481
482 Name *string `json:"name,omitempty"`
483
484 Type *string `json:"type,omitempty"`
485 }
486
487
488 func (dpm DataPolicyManifest) MarshalJSON() ([]byte, error) {
489 objectMap := make(map[string]interface{})
490 if dpm.DataPolicyManifestProperties != nil {
491 objectMap["properties"] = dpm.DataPolicyManifestProperties
492 }
493 return json.Marshal(objectMap)
494 }
495
496
497 func (dpm *DataPolicyManifest) UnmarshalJSON(body []byte) error {
498 var m map[string]*json.RawMessage
499 err := json.Unmarshal(body, &m)
500 if err != nil {
501 return err
502 }
503 for k, v := range m {
504 switch k {
505 case "properties":
506 if v != nil {
507 var dataPolicyManifestProperties DataPolicyManifestProperties
508 err = json.Unmarshal(*v, &dataPolicyManifestProperties)
509 if err != nil {
510 return err
511 }
512 dpm.DataPolicyManifestProperties = &dataPolicyManifestProperties
513 }
514 case "id":
515 if v != nil {
516 var ID string
517 err = json.Unmarshal(*v, &ID)
518 if err != nil {
519 return err
520 }
521 dpm.ID = &ID
522 }
523 case "name":
524 if v != nil {
525 var name string
526 err = json.Unmarshal(*v, &name)
527 if err != nil {
528 return err
529 }
530 dpm.Name = &name
531 }
532 case "type":
533 if v != nil {
534 var typeVar string
535 err = json.Unmarshal(*v, &typeVar)
536 if err != nil {
537 return err
538 }
539 dpm.Type = &typeVar
540 }
541 }
542 }
543
544 return nil
545 }
546
547
548 type DataPolicyManifestListResult struct {
549 autorest.Response `json:"-"`
550
551 Value *[]DataPolicyManifest `json:"value,omitempty"`
552
553 NextLink *string `json:"nextLink,omitempty"`
554 }
555
556
557 type DataPolicyManifestListResultIterator struct {
558 i int
559 page DataPolicyManifestListResultPage
560 }
561
562
563
564 func (iter *DataPolicyManifestListResultIterator) NextWithContext(ctx context.Context) (err error) {
565 if tracing.IsEnabled() {
566 ctx = tracing.StartSpan(ctx, fqdn+"/DataPolicyManifestListResultIterator.NextWithContext")
567 defer func() {
568 sc := -1
569 if iter.Response().Response.Response != nil {
570 sc = iter.Response().Response.Response.StatusCode
571 }
572 tracing.EndSpan(ctx, sc, err)
573 }()
574 }
575 iter.i++
576 if iter.i < len(iter.page.Values()) {
577 return nil
578 }
579 err = iter.page.NextWithContext(ctx)
580 if err != nil {
581 iter.i--
582 return err
583 }
584 iter.i = 0
585 return nil
586 }
587
588
589
590
591 func (iter *DataPolicyManifestListResultIterator) Next() error {
592 return iter.NextWithContext(context.Background())
593 }
594
595
596 func (iter DataPolicyManifestListResultIterator) NotDone() bool {
597 return iter.page.NotDone() && iter.i < len(iter.page.Values())
598 }
599
600
601 func (iter DataPolicyManifestListResultIterator) Response() DataPolicyManifestListResult {
602 return iter.page.Response()
603 }
604
605
606
607 func (iter DataPolicyManifestListResultIterator) Value() DataPolicyManifest {
608 if !iter.page.NotDone() {
609 return DataPolicyManifest{}
610 }
611 return iter.page.Values()[iter.i]
612 }
613
614
615 func NewDataPolicyManifestListResultIterator(page DataPolicyManifestListResultPage) DataPolicyManifestListResultIterator {
616 return DataPolicyManifestListResultIterator{page: page}
617 }
618
619
620 func (dpmlr DataPolicyManifestListResult) IsEmpty() bool {
621 return dpmlr.Value == nil || len(*dpmlr.Value) == 0
622 }
623
624
625 func (dpmlr DataPolicyManifestListResult) hasNextLink() bool {
626 return dpmlr.NextLink != nil && len(*dpmlr.NextLink) != 0
627 }
628
629
630
631 func (dpmlr DataPolicyManifestListResult) dataPolicyManifestListResultPreparer(ctx context.Context) (*http.Request, error) {
632 if !dpmlr.hasNextLink() {
633 return nil, nil
634 }
635 return autorest.Prepare((&http.Request{}).WithContext(ctx),
636 autorest.AsJSON(),
637 autorest.AsGet(),
638 autorest.WithBaseURL(to.String(dpmlr.NextLink)))
639 }
640
641
642 type DataPolicyManifestListResultPage struct {
643 fn func(context.Context, DataPolicyManifestListResult) (DataPolicyManifestListResult, error)
644 dpmlr DataPolicyManifestListResult
645 }
646
647
648
649 func (page *DataPolicyManifestListResultPage) NextWithContext(ctx context.Context) (err error) {
650 if tracing.IsEnabled() {
651 ctx = tracing.StartSpan(ctx, fqdn+"/DataPolicyManifestListResultPage.NextWithContext")
652 defer func() {
653 sc := -1
654 if page.Response().Response.Response != nil {
655 sc = page.Response().Response.Response.StatusCode
656 }
657 tracing.EndSpan(ctx, sc, err)
658 }()
659 }
660 for {
661 next, err := page.fn(ctx, page.dpmlr)
662 if err != nil {
663 return err
664 }
665 page.dpmlr = next
666 if !next.hasNextLink() || !next.IsEmpty() {
667 break
668 }
669 }
670 return nil
671 }
672
673
674
675
676 func (page *DataPolicyManifestListResultPage) Next() error {
677 return page.NextWithContext(context.Background())
678 }
679
680
681 func (page DataPolicyManifestListResultPage) NotDone() bool {
682 return !page.dpmlr.IsEmpty()
683 }
684
685
686 func (page DataPolicyManifestListResultPage) Response() DataPolicyManifestListResult {
687 return page.dpmlr
688 }
689
690
691 func (page DataPolicyManifestListResultPage) Values() []DataPolicyManifest {
692 if page.dpmlr.IsEmpty() {
693 return nil
694 }
695 return *page.dpmlr.Value
696 }
697
698
699 func NewDataPolicyManifestListResultPage(cur DataPolicyManifestListResult, getNextPage func(context.Context, DataPolicyManifestListResult) (DataPolicyManifestListResult, error)) DataPolicyManifestListResultPage {
700 return DataPolicyManifestListResultPage{
701 fn: getNextPage,
702 dpmlr: cur,
703 }
704 }
705
706
707 type DataPolicyManifestProperties struct {
708
709 Namespaces *[]string `json:"namespaces,omitempty"`
710
711 PolicyMode *string `json:"policyMode,omitempty"`
712
713 IsBuiltInOnly *bool `json:"isBuiltInOnly,omitempty"`
714
715 ResourceTypeAliases *[]ResourceTypeAliases `json:"resourceTypeAliases,omitempty"`
716
717 Effects *[]DataEffect `json:"effects,omitempty"`
718
719 FieldValues *[]string `json:"fieldValues,omitempty"`
720
721 *DataManifestResourceFunctionsDefinition `json:"resourceFunctions,omitempty"`
722 }
723
724
725 func (dpmp DataPolicyManifestProperties) MarshalJSON() ([]byte, error) {
726 objectMap := make(map[string]interface{})
727 if dpmp.Namespaces != nil {
728 objectMap["namespaces"] = dpmp.Namespaces
729 }
730 if dpmp.PolicyMode != nil {
731 objectMap["policyMode"] = dpmp.PolicyMode
732 }
733 if dpmp.IsBuiltInOnly != nil {
734 objectMap["isBuiltInOnly"] = dpmp.IsBuiltInOnly
735 }
736 if dpmp.ResourceTypeAliases != nil {
737 objectMap["resourceTypeAliases"] = dpmp.ResourceTypeAliases
738 }
739 if dpmp.Effects != nil {
740 objectMap["effects"] = dpmp.Effects
741 }
742 if dpmp.FieldValues != nil {
743 objectMap["fieldValues"] = dpmp.FieldValues
744 }
745 if dpmp.DataManifestResourceFunctionsDefinition != nil {
746 objectMap["resourceFunctions"] = dpmp.DataManifestResourceFunctionsDefinition
747 }
748 return json.Marshal(objectMap)
749 }
750
751
752 func (dpmp *DataPolicyManifestProperties) UnmarshalJSON(body []byte) error {
753 var m map[string]*json.RawMessage
754 err := json.Unmarshal(body, &m)
755 if err != nil {
756 return err
757 }
758 for k, v := range m {
759 switch k {
760 case "namespaces":
761 if v != nil {
762 var namespaces []string
763 err = json.Unmarshal(*v, &namespaces)
764 if err != nil {
765 return err
766 }
767 dpmp.Namespaces = &namespaces
768 }
769 case "policyMode":
770 if v != nil {
771 var policyMode string
772 err = json.Unmarshal(*v, &policyMode)
773 if err != nil {
774 return err
775 }
776 dpmp.PolicyMode = &policyMode
777 }
778 case "isBuiltInOnly":
779 if v != nil {
780 var isBuiltInOnly bool
781 err = json.Unmarshal(*v, &isBuiltInOnly)
782 if err != nil {
783 return err
784 }
785 dpmp.IsBuiltInOnly = &isBuiltInOnly
786 }
787 case "resourceTypeAliases":
788 if v != nil {
789 var resourceTypeAliases []ResourceTypeAliases
790 err = json.Unmarshal(*v, &resourceTypeAliases)
791 if err != nil {
792 return err
793 }
794 dpmp.ResourceTypeAliases = &resourceTypeAliases
795 }
796 case "effects":
797 if v != nil {
798 var effects []DataEffect
799 err = json.Unmarshal(*v, &effects)
800 if err != nil {
801 return err
802 }
803 dpmp.Effects = &effects
804 }
805 case "fieldValues":
806 if v != nil {
807 var fieldValues []string
808 err = json.Unmarshal(*v, &fieldValues)
809 if err != nil {
810 return err
811 }
812 dpmp.FieldValues = &fieldValues
813 }
814 case "resourceFunctions":
815 if v != nil {
816 var dataManifestResourceFunctionsDefinition DataManifestResourceFunctionsDefinition
817 err = json.Unmarshal(*v, &dataManifestResourceFunctionsDefinition)
818 if err != nil {
819 return err
820 }
821 dpmp.DataManifestResourceFunctionsDefinition = &dataManifestResourceFunctionsDefinition
822 }
823 }
824 }
825
826 return nil
827 }
828
829
830 type Definition struct {
831 autorest.Response `json:"-"`
832
833 *DefinitionProperties `json:"properties,omitempty"`
834
835 ID *string `json:"id,omitempty"`
836
837 Name *string `json:"name,omitempty"`
838
839 Type *string `json:"type,omitempty"`
840
841 SystemData *SystemData `json:"systemData,omitempty"`
842 }
843
844
845 func (d Definition) MarshalJSON() ([]byte, error) {
846 objectMap := make(map[string]interface{})
847 if d.DefinitionProperties != nil {
848 objectMap["properties"] = d.DefinitionProperties
849 }
850 return json.Marshal(objectMap)
851 }
852
853
854 func (d *Definition) UnmarshalJSON(body []byte) error {
855 var m map[string]*json.RawMessage
856 err := json.Unmarshal(body, &m)
857 if err != nil {
858 return err
859 }
860 for k, v := range m {
861 switch k {
862 case "properties":
863 if v != nil {
864 var definitionProperties DefinitionProperties
865 err = json.Unmarshal(*v, &definitionProperties)
866 if err != nil {
867 return err
868 }
869 d.DefinitionProperties = &definitionProperties
870 }
871 case "id":
872 if v != nil {
873 var ID string
874 err = json.Unmarshal(*v, &ID)
875 if err != nil {
876 return err
877 }
878 d.ID = &ID
879 }
880 case "name":
881 if v != nil {
882 var name string
883 err = json.Unmarshal(*v, &name)
884 if err != nil {
885 return err
886 }
887 d.Name = &name
888 }
889 case "type":
890 if v != nil {
891 var typeVar string
892 err = json.Unmarshal(*v, &typeVar)
893 if err != nil {
894 return err
895 }
896 d.Type = &typeVar
897 }
898 case "systemData":
899 if v != nil {
900 var systemData SystemData
901 err = json.Unmarshal(*v, &systemData)
902 if err != nil {
903 return err
904 }
905 d.SystemData = &systemData
906 }
907 }
908 }
909
910 return nil
911 }
912
913
914 type DefinitionGroup struct {
915
916 Name *string `json:"name,omitempty"`
917
918 DisplayName *string `json:"displayName,omitempty"`
919
920 Category *string `json:"category,omitempty"`
921
922 Description *string `json:"description,omitempty"`
923
924 AdditionalMetadataID *string `json:"additionalMetadataId,omitempty"`
925 }
926
927
928 type DefinitionListResult struct {
929 autorest.Response `json:"-"`
930
931 Value *[]Definition `json:"value,omitempty"`
932
933 NextLink *string `json:"nextLink,omitempty"`
934 }
935
936
937 type DefinitionListResultIterator struct {
938 i int
939 page DefinitionListResultPage
940 }
941
942
943
944 func (iter *DefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) {
945 if tracing.IsEnabled() {
946 ctx = tracing.StartSpan(ctx, fqdn+"/DefinitionListResultIterator.NextWithContext")
947 defer func() {
948 sc := -1
949 if iter.Response().Response.Response != nil {
950 sc = iter.Response().Response.Response.StatusCode
951 }
952 tracing.EndSpan(ctx, sc, err)
953 }()
954 }
955 iter.i++
956 if iter.i < len(iter.page.Values()) {
957 return nil
958 }
959 err = iter.page.NextWithContext(ctx)
960 if err != nil {
961 iter.i--
962 return err
963 }
964 iter.i = 0
965 return nil
966 }
967
968
969
970
971 func (iter *DefinitionListResultIterator) Next() error {
972 return iter.NextWithContext(context.Background())
973 }
974
975
976 func (iter DefinitionListResultIterator) NotDone() bool {
977 return iter.page.NotDone() && iter.i < len(iter.page.Values())
978 }
979
980
981 func (iter DefinitionListResultIterator) Response() DefinitionListResult {
982 return iter.page.Response()
983 }
984
985
986
987 func (iter DefinitionListResultIterator) Value() Definition {
988 if !iter.page.NotDone() {
989 return Definition{}
990 }
991 return iter.page.Values()[iter.i]
992 }
993
994
995 func NewDefinitionListResultIterator(page DefinitionListResultPage) DefinitionListResultIterator {
996 return DefinitionListResultIterator{page: page}
997 }
998
999
1000 func (dlr DefinitionListResult) IsEmpty() bool {
1001 return dlr.Value == nil || len(*dlr.Value) == 0
1002 }
1003
1004
1005 func (dlr DefinitionListResult) hasNextLink() bool {
1006 return dlr.NextLink != nil && len(*dlr.NextLink) != 0
1007 }
1008
1009
1010
1011 func (dlr DefinitionListResult) definitionListResultPreparer(ctx context.Context) (*http.Request, error) {
1012 if !dlr.hasNextLink() {
1013 return nil, nil
1014 }
1015 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1016 autorest.AsJSON(),
1017 autorest.AsGet(),
1018 autorest.WithBaseURL(to.String(dlr.NextLink)))
1019 }
1020
1021
1022 type DefinitionListResultPage struct {
1023 fn func(context.Context, DefinitionListResult) (DefinitionListResult, error)
1024 dlr DefinitionListResult
1025 }
1026
1027
1028
1029 func (page *DefinitionListResultPage) NextWithContext(ctx context.Context) (err error) {
1030 if tracing.IsEnabled() {
1031 ctx = tracing.StartSpan(ctx, fqdn+"/DefinitionListResultPage.NextWithContext")
1032 defer func() {
1033 sc := -1
1034 if page.Response().Response.Response != nil {
1035 sc = page.Response().Response.Response.StatusCode
1036 }
1037 tracing.EndSpan(ctx, sc, err)
1038 }()
1039 }
1040 for {
1041 next, err := page.fn(ctx, page.dlr)
1042 if err != nil {
1043 return err
1044 }
1045 page.dlr = next
1046 if !next.hasNextLink() || !next.IsEmpty() {
1047 break
1048 }
1049 }
1050 return nil
1051 }
1052
1053
1054
1055
1056 func (page *DefinitionListResultPage) Next() error {
1057 return page.NextWithContext(context.Background())
1058 }
1059
1060
1061 func (page DefinitionListResultPage) NotDone() bool {
1062 return !page.dlr.IsEmpty()
1063 }
1064
1065
1066 func (page DefinitionListResultPage) Response() DefinitionListResult {
1067 return page.dlr
1068 }
1069
1070
1071 func (page DefinitionListResultPage) Values() []Definition {
1072 if page.dlr.IsEmpty() {
1073 return nil
1074 }
1075 return *page.dlr.Value
1076 }
1077
1078
1079 func NewDefinitionListResultPage(cur DefinitionListResult, getNextPage func(context.Context, DefinitionListResult) (DefinitionListResult, error)) DefinitionListResultPage {
1080 return DefinitionListResultPage{
1081 fn: getNextPage,
1082 dlr: cur,
1083 }
1084 }
1085
1086
1087 type DefinitionProperties struct {
1088
1089 PolicyType Type `json:"policyType,omitempty"`
1090
1091 Mode *string `json:"mode,omitempty"`
1092
1093 DisplayName *string `json:"displayName,omitempty"`
1094
1095 Description *string `json:"description,omitempty"`
1096
1097 PolicyRule interface{} `json:"policyRule,omitempty"`
1098
1099 Metadata interface{} `json:"metadata,omitempty"`
1100
1101 Parameters map[string]*ParameterDefinitionsValue `json:"parameters"`
1102 }
1103
1104
1105 func (dp DefinitionProperties) MarshalJSON() ([]byte, error) {
1106 objectMap := make(map[string]interface{})
1107 if dp.PolicyType != "" {
1108 objectMap["policyType"] = dp.PolicyType
1109 }
1110 if dp.Mode != nil {
1111 objectMap["mode"] = dp.Mode
1112 }
1113 if dp.DisplayName != nil {
1114 objectMap["displayName"] = dp.DisplayName
1115 }
1116 if dp.Description != nil {
1117 objectMap["description"] = dp.Description
1118 }
1119 if dp.PolicyRule != nil {
1120 objectMap["policyRule"] = dp.PolicyRule
1121 }
1122 if dp.Metadata != nil {
1123 objectMap["metadata"] = dp.Metadata
1124 }
1125 if dp.Parameters != nil {
1126 objectMap["parameters"] = dp.Parameters
1127 }
1128 return json.Marshal(objectMap)
1129 }
1130
1131
1132 type DefinitionReference struct {
1133
1134 PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`
1135
1136 Parameters map[string]*ParameterValuesValue `json:"parameters"`
1137
1138 PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"`
1139
1140 GroupNames *[]string `json:"groupNames,omitempty"`
1141 }
1142
1143
1144 func (dr DefinitionReference) MarshalJSON() ([]byte, error) {
1145 objectMap := make(map[string]interface{})
1146 if dr.PolicyDefinitionID != nil {
1147 objectMap["policyDefinitionId"] = dr.PolicyDefinitionID
1148 }
1149 if dr.Parameters != nil {
1150 objectMap["parameters"] = dr.Parameters
1151 }
1152 if dr.PolicyDefinitionReferenceID != nil {
1153 objectMap["policyDefinitionReferenceId"] = dr.PolicyDefinitionReferenceID
1154 }
1155 if dr.GroupNames != nil {
1156 objectMap["groupNames"] = dr.GroupNames
1157 }
1158 return json.Marshal(objectMap)
1159 }
1160
1161
1162 type ErrorAdditionalInfo struct {
1163
1164 Type *string `json:"type,omitempty"`
1165
1166 Info interface{} `json:"info,omitempty"`
1167 }
1168
1169
1170 func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
1171 objectMap := make(map[string]interface{})
1172 return json.Marshal(objectMap)
1173 }
1174
1175
1176
1177 type ErrorResponse struct {
1178
1179 Code *string `json:"code,omitempty"`
1180
1181 Message *string `json:"message,omitempty"`
1182
1183 Target *string `json:"target,omitempty"`
1184
1185 Details *[]ErrorResponse `json:"details,omitempty"`
1186
1187 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
1188 }
1189
1190
1191 func (er ErrorResponse) MarshalJSON() ([]byte, error) {
1192 objectMap := make(map[string]interface{})
1193 return json.Marshal(objectMap)
1194 }
1195
1196
1197 type Exemption struct {
1198 autorest.Response `json:"-"`
1199
1200 *ExemptionProperties `json:"properties,omitempty"`
1201
1202 SystemData *SystemData `json:"systemData,omitempty"`
1203
1204 ID *string `json:"id,omitempty"`
1205
1206 Name *string `json:"name,omitempty"`
1207
1208 Type *string `json:"type,omitempty"`
1209 }
1210
1211
1212 func (e Exemption) MarshalJSON() ([]byte, error) {
1213 objectMap := make(map[string]interface{})
1214 if e.ExemptionProperties != nil {
1215 objectMap["properties"] = e.ExemptionProperties
1216 }
1217 return json.Marshal(objectMap)
1218 }
1219
1220
1221 func (e *Exemption) UnmarshalJSON(body []byte) error {
1222 var m map[string]*json.RawMessage
1223 err := json.Unmarshal(body, &m)
1224 if err != nil {
1225 return err
1226 }
1227 for k, v := range m {
1228 switch k {
1229 case "properties":
1230 if v != nil {
1231 var exemptionProperties ExemptionProperties
1232 err = json.Unmarshal(*v, &exemptionProperties)
1233 if err != nil {
1234 return err
1235 }
1236 e.ExemptionProperties = &exemptionProperties
1237 }
1238 case "systemData":
1239 if v != nil {
1240 var systemData SystemData
1241 err = json.Unmarshal(*v, &systemData)
1242 if err != nil {
1243 return err
1244 }
1245 e.SystemData = &systemData
1246 }
1247 case "id":
1248 if v != nil {
1249 var ID string
1250 err = json.Unmarshal(*v, &ID)
1251 if err != nil {
1252 return err
1253 }
1254 e.ID = &ID
1255 }
1256 case "name":
1257 if v != nil {
1258 var name string
1259 err = json.Unmarshal(*v, &name)
1260 if err != nil {
1261 return err
1262 }
1263 e.Name = &name
1264 }
1265 case "type":
1266 if v != nil {
1267 var typeVar string
1268 err = json.Unmarshal(*v, &typeVar)
1269 if err != nil {
1270 return err
1271 }
1272 e.Type = &typeVar
1273 }
1274 }
1275 }
1276
1277 return nil
1278 }
1279
1280
1281 type ExemptionListResult struct {
1282 autorest.Response `json:"-"`
1283
1284 Value *[]Exemption `json:"value,omitempty"`
1285
1286 NextLink *string `json:"nextLink,omitempty"`
1287 }
1288
1289
1290 func (elr ExemptionListResult) MarshalJSON() ([]byte, error) {
1291 objectMap := make(map[string]interface{})
1292 if elr.Value != nil {
1293 objectMap["value"] = elr.Value
1294 }
1295 return json.Marshal(objectMap)
1296 }
1297
1298
1299 type ExemptionListResultIterator struct {
1300 i int
1301 page ExemptionListResultPage
1302 }
1303
1304
1305
1306 func (iter *ExemptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
1307 if tracing.IsEnabled() {
1308 ctx = tracing.StartSpan(ctx, fqdn+"/ExemptionListResultIterator.NextWithContext")
1309 defer func() {
1310 sc := -1
1311 if iter.Response().Response.Response != nil {
1312 sc = iter.Response().Response.Response.StatusCode
1313 }
1314 tracing.EndSpan(ctx, sc, err)
1315 }()
1316 }
1317 iter.i++
1318 if iter.i < len(iter.page.Values()) {
1319 return nil
1320 }
1321 err = iter.page.NextWithContext(ctx)
1322 if err != nil {
1323 iter.i--
1324 return err
1325 }
1326 iter.i = 0
1327 return nil
1328 }
1329
1330
1331
1332
1333 func (iter *ExemptionListResultIterator) Next() error {
1334 return iter.NextWithContext(context.Background())
1335 }
1336
1337
1338 func (iter ExemptionListResultIterator) NotDone() bool {
1339 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1340 }
1341
1342
1343 func (iter ExemptionListResultIterator) Response() ExemptionListResult {
1344 return iter.page.Response()
1345 }
1346
1347
1348
1349 func (iter ExemptionListResultIterator) Value() Exemption {
1350 if !iter.page.NotDone() {
1351 return Exemption{}
1352 }
1353 return iter.page.Values()[iter.i]
1354 }
1355
1356
1357 func NewExemptionListResultIterator(page ExemptionListResultPage) ExemptionListResultIterator {
1358 return ExemptionListResultIterator{page: page}
1359 }
1360
1361
1362 func (elr ExemptionListResult) IsEmpty() bool {
1363 return elr.Value == nil || len(*elr.Value) == 0
1364 }
1365
1366
1367 func (elr ExemptionListResult) hasNextLink() bool {
1368 return elr.NextLink != nil && len(*elr.NextLink) != 0
1369 }
1370
1371
1372
1373 func (elr ExemptionListResult) exemptionListResultPreparer(ctx context.Context) (*http.Request, error) {
1374 if !elr.hasNextLink() {
1375 return nil, nil
1376 }
1377 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1378 autorest.AsJSON(),
1379 autorest.AsGet(),
1380 autorest.WithBaseURL(to.String(elr.NextLink)))
1381 }
1382
1383
1384 type ExemptionListResultPage struct {
1385 fn func(context.Context, ExemptionListResult) (ExemptionListResult, error)
1386 elr ExemptionListResult
1387 }
1388
1389
1390
1391 func (page *ExemptionListResultPage) NextWithContext(ctx context.Context) (err error) {
1392 if tracing.IsEnabled() {
1393 ctx = tracing.StartSpan(ctx, fqdn+"/ExemptionListResultPage.NextWithContext")
1394 defer func() {
1395 sc := -1
1396 if page.Response().Response.Response != nil {
1397 sc = page.Response().Response.Response.StatusCode
1398 }
1399 tracing.EndSpan(ctx, sc, err)
1400 }()
1401 }
1402 for {
1403 next, err := page.fn(ctx, page.elr)
1404 if err != nil {
1405 return err
1406 }
1407 page.elr = next
1408 if !next.hasNextLink() || !next.IsEmpty() {
1409 break
1410 }
1411 }
1412 return nil
1413 }
1414
1415
1416
1417
1418 func (page *ExemptionListResultPage) Next() error {
1419 return page.NextWithContext(context.Background())
1420 }
1421
1422
1423 func (page ExemptionListResultPage) NotDone() bool {
1424 return !page.elr.IsEmpty()
1425 }
1426
1427
1428 func (page ExemptionListResultPage) Response() ExemptionListResult {
1429 return page.elr
1430 }
1431
1432
1433 func (page ExemptionListResultPage) Values() []Exemption {
1434 if page.elr.IsEmpty() {
1435 return nil
1436 }
1437 return *page.elr.Value
1438 }
1439
1440
1441 func NewExemptionListResultPage(cur ExemptionListResult, getNextPage func(context.Context, ExemptionListResult) (ExemptionListResult, error)) ExemptionListResultPage {
1442 return ExemptionListResultPage{
1443 fn: getNextPage,
1444 elr: cur,
1445 }
1446 }
1447
1448
1449 type ExemptionProperties struct {
1450
1451 PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"`
1452
1453 PolicyDefinitionReferenceIds *[]string `json:"policyDefinitionReferenceIds,omitempty"`
1454
1455 ExemptionCategory ExemptionCategory `json:"exemptionCategory,omitempty"`
1456
1457 ExpiresOn *date.Time `json:"expiresOn,omitempty"`
1458
1459 DisplayName *string `json:"displayName,omitempty"`
1460
1461 Description *string `json:"description,omitempty"`
1462
1463 Metadata interface{} `json:"metadata,omitempty"`
1464 }
1465
1466
1467
1468 type Identity struct {
1469
1470 PrincipalID *string `json:"principalId,omitempty"`
1471
1472 TenantID *string `json:"tenantId,omitempty"`
1473
1474 Type ResourceIdentityType `json:"type,omitempty"`
1475
1476 UserAssignedIdentities map[string]*IdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"`
1477 }
1478
1479
1480 func (i Identity) MarshalJSON() ([]byte, error) {
1481 objectMap := make(map[string]interface{})
1482 if i.Type != "" {
1483 objectMap["type"] = i.Type
1484 }
1485 if i.UserAssignedIdentities != nil {
1486 objectMap["userAssignedIdentities"] = i.UserAssignedIdentities
1487 }
1488 return json.Marshal(objectMap)
1489 }
1490
1491
1492 type IdentityUserAssignedIdentitiesValue struct {
1493
1494 PrincipalID *string `json:"principalId,omitempty"`
1495
1496 ClientID *string `json:"clientId,omitempty"`
1497 }
1498
1499
1500 func (iAiv IdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) {
1501 objectMap := make(map[string]interface{})
1502 return json.Marshal(objectMap)
1503 }
1504
1505
1506
1507 type NonComplianceMessage struct {
1508
1509 Message *string `json:"message,omitempty"`
1510
1511 PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"`
1512 }
1513
1514
1515 type ParameterDefinitionsValue struct {
1516
1517 Type ParameterType `json:"type,omitempty"`
1518
1519 AllowedValues *[]interface{} `json:"allowedValues,omitempty"`
1520
1521 DefaultValue interface{} `json:"defaultValue,omitempty"`
1522
1523 Metadata *ParameterDefinitionsValueMetadata `json:"metadata,omitempty"`
1524 }
1525
1526
1527 type ParameterDefinitionsValueMetadata struct {
1528
1529 AdditionalProperties map[string]interface{} `json:""`
1530
1531 DisplayName *string `json:"displayName,omitempty"`
1532
1533 Description *string `json:"description,omitempty"`
1534
1535 StrongType *string `json:"strongType,omitempty"`
1536
1537 AssignPermissions *bool `json:"assignPermissions,omitempty"`
1538 }
1539
1540
1541 func (pdv ParameterDefinitionsValueMetadata) MarshalJSON() ([]byte, error) {
1542 objectMap := make(map[string]interface{})
1543 if pdv.DisplayName != nil {
1544 objectMap["displayName"] = pdv.DisplayName
1545 }
1546 if pdv.Description != nil {
1547 objectMap["description"] = pdv.Description
1548 }
1549 if pdv.StrongType != nil {
1550 objectMap["strongType"] = pdv.StrongType
1551 }
1552 if pdv.AssignPermissions != nil {
1553 objectMap["assignPermissions"] = pdv.AssignPermissions
1554 }
1555 for k, v := range pdv.AdditionalProperties {
1556 objectMap[k] = v
1557 }
1558 return json.Marshal(objectMap)
1559 }
1560
1561
1562 func (pdv *ParameterDefinitionsValueMetadata) UnmarshalJSON(body []byte) error {
1563 var m map[string]*json.RawMessage
1564 err := json.Unmarshal(body, &m)
1565 if err != nil {
1566 return err
1567 }
1568 for k, v := range m {
1569 switch k {
1570 default:
1571 if v != nil {
1572 var additionalProperties interface{}
1573 err = json.Unmarshal(*v, &additionalProperties)
1574 if err != nil {
1575 return err
1576 }
1577 if pdv.AdditionalProperties == nil {
1578 pdv.AdditionalProperties = make(map[string]interface{})
1579 }
1580 pdv.AdditionalProperties[k] = additionalProperties
1581 }
1582 case "displayName":
1583 if v != nil {
1584 var displayName string
1585 err = json.Unmarshal(*v, &displayName)
1586 if err != nil {
1587 return err
1588 }
1589 pdv.DisplayName = &displayName
1590 }
1591 case "description":
1592 if v != nil {
1593 var description string
1594 err = json.Unmarshal(*v, &description)
1595 if err != nil {
1596 return err
1597 }
1598 pdv.Description = &description
1599 }
1600 case "strongType":
1601 if v != nil {
1602 var strongType string
1603 err = json.Unmarshal(*v, &strongType)
1604 if err != nil {
1605 return err
1606 }
1607 pdv.StrongType = &strongType
1608 }
1609 case "assignPermissions":
1610 if v != nil {
1611 var assignPermissions bool
1612 err = json.Unmarshal(*v, &assignPermissions)
1613 if err != nil {
1614 return err
1615 }
1616 pdv.AssignPermissions = &assignPermissions
1617 }
1618 }
1619 }
1620
1621 return nil
1622 }
1623
1624
1625 type ParameterValuesValue struct {
1626
1627 Value interface{} `json:"value,omitempty"`
1628 }
1629
1630
1631 type ResourceTypeAliases struct {
1632
1633 ResourceType *string `json:"resourceType,omitempty"`
1634
1635 Aliases *[]Alias `json:"aliases,omitempty"`
1636 }
1637
1638
1639 type SetDefinition struct {
1640 autorest.Response `json:"-"`
1641
1642 *SetDefinitionProperties `json:"properties,omitempty"`
1643
1644 ID *string `json:"id,omitempty"`
1645
1646 Name *string `json:"name,omitempty"`
1647
1648 Type *string `json:"type,omitempty"`
1649
1650 SystemData *SystemData `json:"systemData,omitempty"`
1651 }
1652
1653
1654 func (sd SetDefinition) MarshalJSON() ([]byte, error) {
1655 objectMap := make(map[string]interface{})
1656 if sd.SetDefinitionProperties != nil {
1657 objectMap["properties"] = sd.SetDefinitionProperties
1658 }
1659 return json.Marshal(objectMap)
1660 }
1661
1662
1663 func (sd *SetDefinition) UnmarshalJSON(body []byte) error {
1664 var m map[string]*json.RawMessage
1665 err := json.Unmarshal(body, &m)
1666 if err != nil {
1667 return err
1668 }
1669 for k, v := range m {
1670 switch k {
1671 case "properties":
1672 if v != nil {
1673 var setDefinitionProperties SetDefinitionProperties
1674 err = json.Unmarshal(*v, &setDefinitionProperties)
1675 if err != nil {
1676 return err
1677 }
1678 sd.SetDefinitionProperties = &setDefinitionProperties
1679 }
1680 case "id":
1681 if v != nil {
1682 var ID string
1683 err = json.Unmarshal(*v, &ID)
1684 if err != nil {
1685 return err
1686 }
1687 sd.ID = &ID
1688 }
1689 case "name":
1690 if v != nil {
1691 var name string
1692 err = json.Unmarshal(*v, &name)
1693 if err != nil {
1694 return err
1695 }
1696 sd.Name = &name
1697 }
1698 case "type":
1699 if v != nil {
1700 var typeVar string
1701 err = json.Unmarshal(*v, &typeVar)
1702 if err != nil {
1703 return err
1704 }
1705 sd.Type = &typeVar
1706 }
1707 case "systemData":
1708 if v != nil {
1709 var systemData SystemData
1710 err = json.Unmarshal(*v, &systemData)
1711 if err != nil {
1712 return err
1713 }
1714 sd.SystemData = &systemData
1715 }
1716 }
1717 }
1718
1719 return nil
1720 }
1721
1722
1723 type SetDefinitionListResult struct {
1724 autorest.Response `json:"-"`
1725
1726 Value *[]SetDefinition `json:"value,omitempty"`
1727
1728 NextLink *string `json:"nextLink,omitempty"`
1729 }
1730
1731
1732 type SetDefinitionListResultIterator struct {
1733 i int
1734 page SetDefinitionListResultPage
1735 }
1736
1737
1738
1739 func (iter *SetDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) {
1740 if tracing.IsEnabled() {
1741 ctx = tracing.StartSpan(ctx, fqdn+"/SetDefinitionListResultIterator.NextWithContext")
1742 defer func() {
1743 sc := -1
1744 if iter.Response().Response.Response != nil {
1745 sc = iter.Response().Response.Response.StatusCode
1746 }
1747 tracing.EndSpan(ctx, sc, err)
1748 }()
1749 }
1750 iter.i++
1751 if iter.i < len(iter.page.Values()) {
1752 return nil
1753 }
1754 err = iter.page.NextWithContext(ctx)
1755 if err != nil {
1756 iter.i--
1757 return err
1758 }
1759 iter.i = 0
1760 return nil
1761 }
1762
1763
1764
1765
1766 func (iter *SetDefinitionListResultIterator) Next() error {
1767 return iter.NextWithContext(context.Background())
1768 }
1769
1770
1771 func (iter SetDefinitionListResultIterator) NotDone() bool {
1772 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1773 }
1774
1775
1776 func (iter SetDefinitionListResultIterator) Response() SetDefinitionListResult {
1777 return iter.page.Response()
1778 }
1779
1780
1781
1782 func (iter SetDefinitionListResultIterator) Value() SetDefinition {
1783 if !iter.page.NotDone() {
1784 return SetDefinition{}
1785 }
1786 return iter.page.Values()[iter.i]
1787 }
1788
1789
1790 func NewSetDefinitionListResultIterator(page SetDefinitionListResultPage) SetDefinitionListResultIterator {
1791 return SetDefinitionListResultIterator{page: page}
1792 }
1793
1794
1795 func (sdlr SetDefinitionListResult) IsEmpty() bool {
1796 return sdlr.Value == nil || len(*sdlr.Value) == 0
1797 }
1798
1799
1800 func (sdlr SetDefinitionListResult) hasNextLink() bool {
1801 return sdlr.NextLink != nil && len(*sdlr.NextLink) != 0
1802 }
1803
1804
1805
1806 func (sdlr SetDefinitionListResult) setDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) {
1807 if !sdlr.hasNextLink() {
1808 return nil, nil
1809 }
1810 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1811 autorest.AsJSON(),
1812 autorest.AsGet(),
1813 autorest.WithBaseURL(to.String(sdlr.NextLink)))
1814 }
1815
1816
1817 type SetDefinitionListResultPage struct {
1818 fn func(context.Context, SetDefinitionListResult) (SetDefinitionListResult, error)
1819 sdlr SetDefinitionListResult
1820 }
1821
1822
1823
1824 func (page *SetDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) {
1825 if tracing.IsEnabled() {
1826 ctx = tracing.StartSpan(ctx, fqdn+"/SetDefinitionListResultPage.NextWithContext")
1827 defer func() {
1828 sc := -1
1829 if page.Response().Response.Response != nil {
1830 sc = page.Response().Response.Response.StatusCode
1831 }
1832 tracing.EndSpan(ctx, sc, err)
1833 }()
1834 }
1835 for {
1836 next, err := page.fn(ctx, page.sdlr)
1837 if err != nil {
1838 return err
1839 }
1840 page.sdlr = next
1841 if !next.hasNextLink() || !next.IsEmpty() {
1842 break
1843 }
1844 }
1845 return nil
1846 }
1847
1848
1849
1850
1851 func (page *SetDefinitionListResultPage) Next() error {
1852 return page.NextWithContext(context.Background())
1853 }
1854
1855
1856 func (page SetDefinitionListResultPage) NotDone() bool {
1857 return !page.sdlr.IsEmpty()
1858 }
1859
1860
1861 func (page SetDefinitionListResultPage) Response() SetDefinitionListResult {
1862 return page.sdlr
1863 }
1864
1865
1866 func (page SetDefinitionListResultPage) Values() []SetDefinition {
1867 if page.sdlr.IsEmpty() {
1868 return nil
1869 }
1870 return *page.sdlr.Value
1871 }
1872
1873
1874 func NewSetDefinitionListResultPage(cur SetDefinitionListResult, getNextPage func(context.Context, SetDefinitionListResult) (SetDefinitionListResult, error)) SetDefinitionListResultPage {
1875 return SetDefinitionListResultPage{
1876 fn: getNextPage,
1877 sdlr: cur,
1878 }
1879 }
1880
1881
1882 type SetDefinitionProperties struct {
1883
1884 PolicyType Type `json:"policyType,omitempty"`
1885
1886 DisplayName *string `json:"displayName,omitempty"`
1887
1888 Description *string `json:"description,omitempty"`
1889
1890 Metadata interface{} `json:"metadata,omitempty"`
1891
1892 Parameters map[string]*ParameterDefinitionsValue `json:"parameters"`
1893
1894 PolicyDefinitions *[]DefinitionReference `json:"policyDefinitions,omitempty"`
1895
1896 PolicyDefinitionGroups *[]DefinitionGroup `json:"policyDefinitionGroups,omitempty"`
1897 }
1898
1899
1900 func (sdp SetDefinitionProperties) MarshalJSON() ([]byte, error) {
1901 objectMap := make(map[string]interface{})
1902 if sdp.PolicyType != "" {
1903 objectMap["policyType"] = sdp.PolicyType
1904 }
1905 if sdp.DisplayName != nil {
1906 objectMap["displayName"] = sdp.DisplayName
1907 }
1908 if sdp.Description != nil {
1909 objectMap["description"] = sdp.Description
1910 }
1911 if sdp.Metadata != nil {
1912 objectMap["metadata"] = sdp.Metadata
1913 }
1914 if sdp.Parameters != nil {
1915 objectMap["parameters"] = sdp.Parameters
1916 }
1917 if sdp.PolicyDefinitions != nil {
1918 objectMap["policyDefinitions"] = sdp.PolicyDefinitions
1919 }
1920 if sdp.PolicyDefinitionGroups != nil {
1921 objectMap["policyDefinitionGroups"] = sdp.PolicyDefinitionGroups
1922 }
1923 return json.Marshal(objectMap)
1924 }
1925
1926
1927 type SystemData struct {
1928
1929 CreatedBy *string `json:"createdBy,omitempty"`
1930
1931 CreatedByType CreatedByType `json:"createdByType,omitempty"`
1932
1933 CreatedAt *date.Time `json:"createdAt,omitempty"`
1934
1935 LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
1936
1937 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
1938
1939 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
1940 }
1941
1942
1943 type Variable struct {
1944 autorest.Response `json:"-"`
1945
1946 *VariableProperties `json:"properties,omitempty"`
1947
1948 SystemData *SystemData `json:"systemData,omitempty"`
1949
1950 ID *string `json:"id,omitempty"`
1951
1952 Name *string `json:"name,omitempty"`
1953
1954 Type *string `json:"type,omitempty"`
1955 }
1956
1957
1958 func (vVar Variable) MarshalJSON() ([]byte, error) {
1959 objectMap := make(map[string]interface{})
1960 if vVar.VariableProperties != nil {
1961 objectMap["properties"] = vVar.VariableProperties
1962 }
1963 return json.Marshal(objectMap)
1964 }
1965
1966
1967 func (vVar *Variable) UnmarshalJSON(body []byte) error {
1968 var m map[string]*json.RawMessage
1969 err := json.Unmarshal(body, &m)
1970 if err != nil {
1971 return err
1972 }
1973 for k, v := range m {
1974 switch k {
1975 case "properties":
1976 if v != nil {
1977 var variableProperties VariableProperties
1978 err = json.Unmarshal(*v, &variableProperties)
1979 if err != nil {
1980 return err
1981 }
1982 vVar.VariableProperties = &variableProperties
1983 }
1984 case "systemData":
1985 if v != nil {
1986 var systemData SystemData
1987 err = json.Unmarshal(*v, &systemData)
1988 if err != nil {
1989 return err
1990 }
1991 vVar.SystemData = &systemData
1992 }
1993 case "id":
1994 if v != nil {
1995 var ID string
1996 err = json.Unmarshal(*v, &ID)
1997 if err != nil {
1998 return err
1999 }
2000 vVar.ID = &ID
2001 }
2002 case "name":
2003 if v != nil {
2004 var name string
2005 err = json.Unmarshal(*v, &name)
2006 if err != nil {
2007 return err
2008 }
2009 vVar.Name = &name
2010 }
2011 case "type":
2012 if v != nil {
2013 var typeVar string
2014 err = json.Unmarshal(*v, &typeVar)
2015 if err != nil {
2016 return err
2017 }
2018 vVar.Type = &typeVar
2019 }
2020 }
2021 }
2022
2023 return nil
2024 }
2025
2026
2027 type VariableColumn struct {
2028
2029 ColumnName *string `json:"columnName,omitempty"`
2030 }
2031
2032
2033 type VariableListResult struct {
2034 autorest.Response `json:"-"`
2035
2036 Value *[]Variable `json:"value,omitempty"`
2037
2038 NextLink *string `json:"nextLink,omitempty"`
2039 }
2040
2041
2042 func (vlr VariableListResult) MarshalJSON() ([]byte, error) {
2043 objectMap := make(map[string]interface{})
2044 if vlr.Value != nil {
2045 objectMap["value"] = vlr.Value
2046 }
2047 return json.Marshal(objectMap)
2048 }
2049
2050
2051 type VariableListResultIterator struct {
2052 i int
2053 page VariableListResultPage
2054 }
2055
2056
2057
2058 func (iter *VariableListResultIterator) NextWithContext(ctx context.Context) (err error) {
2059 if tracing.IsEnabled() {
2060 ctx = tracing.StartSpan(ctx, fqdn+"/VariableListResultIterator.NextWithContext")
2061 defer func() {
2062 sc := -1
2063 if iter.Response().Response.Response != nil {
2064 sc = iter.Response().Response.Response.StatusCode
2065 }
2066 tracing.EndSpan(ctx, sc, err)
2067 }()
2068 }
2069 iter.i++
2070 if iter.i < len(iter.page.Values()) {
2071 return nil
2072 }
2073 err = iter.page.NextWithContext(ctx)
2074 if err != nil {
2075 iter.i--
2076 return err
2077 }
2078 iter.i = 0
2079 return nil
2080 }
2081
2082
2083
2084
2085 func (iter *VariableListResultIterator) Next() error {
2086 return iter.NextWithContext(context.Background())
2087 }
2088
2089
2090 func (iter VariableListResultIterator) NotDone() bool {
2091 return iter.page.NotDone() && iter.i < len(iter.page.Values())
2092 }
2093
2094
2095 func (iter VariableListResultIterator) Response() VariableListResult {
2096 return iter.page.Response()
2097 }
2098
2099
2100
2101 func (iter VariableListResultIterator) Value() Variable {
2102 if !iter.page.NotDone() {
2103 return Variable{}
2104 }
2105 return iter.page.Values()[iter.i]
2106 }
2107
2108
2109 func NewVariableListResultIterator(page VariableListResultPage) VariableListResultIterator {
2110 return VariableListResultIterator{page: page}
2111 }
2112
2113
2114 func (vlr VariableListResult) IsEmpty() bool {
2115 return vlr.Value == nil || len(*vlr.Value) == 0
2116 }
2117
2118
2119 func (vlr VariableListResult) hasNextLink() bool {
2120 return vlr.NextLink != nil && len(*vlr.NextLink) != 0
2121 }
2122
2123
2124
2125 func (vlr VariableListResult) variableListResultPreparer(ctx context.Context) (*http.Request, error) {
2126 if !vlr.hasNextLink() {
2127 return nil, nil
2128 }
2129 return autorest.Prepare((&http.Request{}).WithContext(ctx),
2130 autorest.AsJSON(),
2131 autorest.AsGet(),
2132 autorest.WithBaseURL(to.String(vlr.NextLink)))
2133 }
2134
2135
2136 type VariableListResultPage struct {
2137 fn func(context.Context, VariableListResult) (VariableListResult, error)
2138 vlr VariableListResult
2139 }
2140
2141
2142
2143 func (page *VariableListResultPage) NextWithContext(ctx context.Context) (err error) {
2144 if tracing.IsEnabled() {
2145 ctx = tracing.StartSpan(ctx, fqdn+"/VariableListResultPage.NextWithContext")
2146 defer func() {
2147 sc := -1
2148 if page.Response().Response.Response != nil {
2149 sc = page.Response().Response.Response.StatusCode
2150 }
2151 tracing.EndSpan(ctx, sc, err)
2152 }()
2153 }
2154 for {
2155 next, err := page.fn(ctx, page.vlr)
2156 if err != nil {
2157 return err
2158 }
2159 page.vlr = next
2160 if !next.hasNextLink() || !next.IsEmpty() {
2161 break
2162 }
2163 }
2164 return nil
2165 }
2166
2167
2168
2169
2170 func (page *VariableListResultPage) Next() error {
2171 return page.NextWithContext(context.Background())
2172 }
2173
2174
2175 func (page VariableListResultPage) NotDone() bool {
2176 return !page.vlr.IsEmpty()
2177 }
2178
2179
2180 func (page VariableListResultPage) Response() VariableListResult {
2181 return page.vlr
2182 }
2183
2184
2185 func (page VariableListResultPage) Values() []Variable {
2186 if page.vlr.IsEmpty() {
2187 return nil
2188 }
2189 return *page.vlr.Value
2190 }
2191
2192
2193 func NewVariableListResultPage(cur VariableListResult, getNextPage func(context.Context, VariableListResult) (VariableListResult, error)) VariableListResultPage {
2194 return VariableListResultPage{
2195 fn: getNextPage,
2196 vlr: cur,
2197 }
2198 }
2199
2200
2201 type VariableProperties struct {
2202
2203 Columns *[]VariableColumn `json:"columns,omitempty"`
2204 }
2205
2206
2207 type VariableValue struct {
2208 autorest.Response `json:"-"`
2209
2210 *VariableValueProperties `json:"properties,omitempty"`
2211
2212 SystemData *SystemData `json:"systemData,omitempty"`
2213
2214 ID *string `json:"id,omitempty"`
2215
2216 Name *string `json:"name,omitempty"`
2217
2218 Type *string `json:"type,omitempty"`
2219 }
2220
2221
2222 func (vv VariableValue) MarshalJSON() ([]byte, error) {
2223 objectMap := make(map[string]interface{})
2224 if vv.VariableValueProperties != nil {
2225 objectMap["properties"] = vv.VariableValueProperties
2226 }
2227 return json.Marshal(objectMap)
2228 }
2229
2230
2231 func (vv *VariableValue) UnmarshalJSON(body []byte) error {
2232 var m map[string]*json.RawMessage
2233 err := json.Unmarshal(body, &m)
2234 if err != nil {
2235 return err
2236 }
2237 for k, v := range m {
2238 switch k {
2239 case "properties":
2240 if v != nil {
2241 var variableValueProperties VariableValueProperties
2242 err = json.Unmarshal(*v, &variableValueProperties)
2243 if err != nil {
2244 return err
2245 }
2246 vv.VariableValueProperties = &variableValueProperties
2247 }
2248 case "systemData":
2249 if v != nil {
2250 var systemData SystemData
2251 err = json.Unmarshal(*v, &systemData)
2252 if err != nil {
2253 return err
2254 }
2255 vv.SystemData = &systemData
2256 }
2257 case "id":
2258 if v != nil {
2259 var ID string
2260 err = json.Unmarshal(*v, &ID)
2261 if err != nil {
2262 return err
2263 }
2264 vv.ID = &ID
2265 }
2266 case "name":
2267 if v != nil {
2268 var name string
2269 err = json.Unmarshal(*v, &name)
2270 if err != nil {
2271 return err
2272 }
2273 vv.Name = &name
2274 }
2275 case "type":
2276 if v != nil {
2277 var typeVar string
2278 err = json.Unmarshal(*v, &typeVar)
2279 if err != nil {
2280 return err
2281 }
2282 vv.Type = &typeVar
2283 }
2284 }
2285 }
2286
2287 return nil
2288 }
2289
2290
2291 type VariableValueColumnValue struct {
2292
2293 ColumnName *string `json:"columnName,omitempty"`
2294
2295 ColumnValue interface{} `json:"columnValue,omitempty"`
2296 }
2297
2298
2299 type VariableValueListResult struct {
2300 autorest.Response `json:"-"`
2301
2302 Value *[]VariableValue `json:"value,omitempty"`
2303
2304 NextLink *string `json:"nextLink,omitempty"`
2305 }
2306
2307
2308 func (vvlr VariableValueListResult) MarshalJSON() ([]byte, error) {
2309 objectMap := make(map[string]interface{})
2310 if vvlr.Value != nil {
2311 objectMap["value"] = vvlr.Value
2312 }
2313 return json.Marshal(objectMap)
2314 }
2315
2316
2317 type VariableValueListResultIterator struct {
2318 i int
2319 page VariableValueListResultPage
2320 }
2321
2322
2323
2324 func (iter *VariableValueListResultIterator) NextWithContext(ctx context.Context) (err error) {
2325 if tracing.IsEnabled() {
2326 ctx = tracing.StartSpan(ctx, fqdn+"/VariableValueListResultIterator.NextWithContext")
2327 defer func() {
2328 sc := -1
2329 if iter.Response().Response.Response != nil {
2330 sc = iter.Response().Response.Response.StatusCode
2331 }
2332 tracing.EndSpan(ctx, sc, err)
2333 }()
2334 }
2335 iter.i++
2336 if iter.i < len(iter.page.Values()) {
2337 return nil
2338 }
2339 err = iter.page.NextWithContext(ctx)
2340 if err != nil {
2341 iter.i--
2342 return err
2343 }
2344 iter.i = 0
2345 return nil
2346 }
2347
2348
2349
2350
2351 func (iter *VariableValueListResultIterator) Next() error {
2352 return iter.NextWithContext(context.Background())
2353 }
2354
2355
2356 func (iter VariableValueListResultIterator) NotDone() bool {
2357 return iter.page.NotDone() && iter.i < len(iter.page.Values())
2358 }
2359
2360
2361 func (iter VariableValueListResultIterator) Response() VariableValueListResult {
2362 return iter.page.Response()
2363 }
2364
2365
2366
2367 func (iter VariableValueListResultIterator) Value() VariableValue {
2368 if !iter.page.NotDone() {
2369 return VariableValue{}
2370 }
2371 return iter.page.Values()[iter.i]
2372 }
2373
2374
2375 func NewVariableValueListResultIterator(page VariableValueListResultPage) VariableValueListResultIterator {
2376 return VariableValueListResultIterator{page: page}
2377 }
2378
2379
2380 func (vvlr VariableValueListResult) IsEmpty() bool {
2381 return vvlr.Value == nil || len(*vvlr.Value) == 0
2382 }
2383
2384
2385 func (vvlr VariableValueListResult) hasNextLink() bool {
2386 return vvlr.NextLink != nil && len(*vvlr.NextLink) != 0
2387 }
2388
2389
2390
2391 func (vvlr VariableValueListResult) variableValueListResultPreparer(ctx context.Context) (*http.Request, error) {
2392 if !vvlr.hasNextLink() {
2393 return nil, nil
2394 }
2395 return autorest.Prepare((&http.Request{}).WithContext(ctx),
2396 autorest.AsJSON(),
2397 autorest.AsGet(),
2398 autorest.WithBaseURL(to.String(vvlr.NextLink)))
2399 }
2400
2401
2402 type VariableValueListResultPage struct {
2403 fn func(context.Context, VariableValueListResult) (VariableValueListResult, error)
2404 vvlr VariableValueListResult
2405 }
2406
2407
2408
2409 func (page *VariableValueListResultPage) NextWithContext(ctx context.Context) (err error) {
2410 if tracing.IsEnabled() {
2411 ctx = tracing.StartSpan(ctx, fqdn+"/VariableValueListResultPage.NextWithContext")
2412 defer func() {
2413 sc := -1
2414 if page.Response().Response.Response != nil {
2415 sc = page.Response().Response.Response.StatusCode
2416 }
2417 tracing.EndSpan(ctx, sc, err)
2418 }()
2419 }
2420 for {
2421 next, err := page.fn(ctx, page.vvlr)
2422 if err != nil {
2423 return err
2424 }
2425 page.vvlr = next
2426 if !next.hasNextLink() || !next.IsEmpty() {
2427 break
2428 }
2429 }
2430 return nil
2431 }
2432
2433
2434
2435
2436 func (page *VariableValueListResultPage) Next() error {
2437 return page.NextWithContext(context.Background())
2438 }
2439
2440
2441 func (page VariableValueListResultPage) NotDone() bool {
2442 return !page.vvlr.IsEmpty()
2443 }
2444
2445
2446 func (page VariableValueListResultPage) Response() VariableValueListResult {
2447 return page.vvlr
2448 }
2449
2450
2451 func (page VariableValueListResultPage) Values() []VariableValue {
2452 if page.vvlr.IsEmpty() {
2453 return nil
2454 }
2455 return *page.vvlr.Value
2456 }
2457
2458
2459 func NewVariableValueListResultPage(cur VariableValueListResult, getNextPage func(context.Context, VariableValueListResult) (VariableValueListResult, error)) VariableValueListResultPage {
2460 return VariableValueListResultPage{
2461 fn: getNextPage,
2462 vvlr: cur,
2463 }
2464 }
2465
2466
2467 type VariableValueProperties struct {
2468
2469 Values *[]VariableValueColumnValue `json:"values,omitempty"`
2470 }
2471
View as plain text