1 package insights
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/azure"
14 "github.com/Azure/go-autorest/autorest/date"
15 "github.com/Azure/go-autorest/autorest/to"
16 "github.com/Azure/go-autorest/tracing"
17 "net/http"
18 )
19
20
21 const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-07-01-preview/insights"
22
23
24 type BasicAction interface {
25 AsAlertingAction() (*AlertingAction, bool)
26 AsLogToMetricAction() (*LogToMetricAction, bool)
27 AsAction() (*Action, bool)
28 }
29
30
31 type Action struct {
32
33 OdataType OdataTypeBasicAction `json:"odata.type,omitempty"`
34 }
35
36 func unmarshalBasicAction(body []byte) (BasicAction, error) {
37 var m map[string]interface{}
38 err := json.Unmarshal(body, &m)
39 if err != nil {
40 return nil, err
41 }
42
43 switch m["odata.type"] {
44 case string(OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction):
45 var aa AlertingAction
46 err := json.Unmarshal(body, &aa)
47 return aa, err
48 case string(OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction):
49 var ltma LogToMetricAction
50 err := json.Unmarshal(body, <ma)
51 return ltma, err
52 default:
53 var a Action
54 err := json.Unmarshal(body, &a)
55 return a, err
56 }
57 }
58 func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) {
59 var rawMessages []*json.RawMessage
60 err := json.Unmarshal(body, &rawMessages)
61 if err != nil {
62 return nil, err
63 }
64
65 aArray := make([]BasicAction, len(rawMessages))
66
67 for index, rawMessage := range rawMessages {
68 a, err := unmarshalBasicAction(*rawMessage)
69 if err != nil {
70 return nil, err
71 }
72 aArray[index] = a
73 }
74 return aArray, nil
75 }
76
77
78 func (a Action) MarshalJSON() ([]byte, error) {
79 a.OdataType = OdataTypeBasicActionOdataTypeAction
80 objectMap := make(map[string]interface{})
81 if a.OdataType != "" {
82 objectMap["odata.type"] = a.OdataType
83 }
84 return json.Marshal(objectMap)
85 }
86
87
88 func (a Action) AsAlertingAction() (*AlertingAction, bool) {
89 return nil, false
90 }
91
92
93 func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) {
94 return nil, false
95 }
96
97
98 func (a Action) AsAction() (*Action, bool) {
99 return &a, true
100 }
101
102
103 func (a Action) AsBasicAction() (BasicAction, bool) {
104 return &a, true
105 }
106
107
108 type ActionGroup struct {
109
110 GroupShortName *string `json:"groupShortName,omitempty"`
111
112 Enabled *bool `json:"enabled,omitempty"`
113
114 EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"`
115
116 SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"`
117
118 WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"`
119
120 ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"`
121
122 AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"`
123
124 AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"`
125
126 VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"`
127
128 LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"`
129
130 AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"`
131
132 ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"`
133 }
134
135
136 type ActionGroupList struct {
137 autorest.Response `json:"-"`
138
139 Value *[]ActionGroupResource `json:"value,omitempty"`
140
141 NextLink *string `json:"nextLink,omitempty"`
142 }
143
144
145 type ActionGroupPatch struct {
146
147 Enabled *bool `json:"enabled,omitempty"`
148 }
149
150
151 type ActionGroupPatchBody struct {
152
153 Tags map[string]*string `json:"tags"`
154
155 *ActionGroupPatch `json:"properties,omitempty"`
156 }
157
158
159 func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) {
160 objectMap := make(map[string]interface{})
161 if agpb.Tags != nil {
162 objectMap["tags"] = agpb.Tags
163 }
164 if agpb.ActionGroupPatch != nil {
165 objectMap["properties"] = agpb.ActionGroupPatch
166 }
167 return json.Marshal(objectMap)
168 }
169
170
171 func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error {
172 var m map[string]*json.RawMessage
173 err := json.Unmarshal(body, &m)
174 if err != nil {
175 return err
176 }
177 for k, v := range m {
178 switch k {
179 case "tags":
180 if v != nil {
181 var tags map[string]*string
182 err = json.Unmarshal(*v, &tags)
183 if err != nil {
184 return err
185 }
186 agpb.Tags = tags
187 }
188 case "properties":
189 if v != nil {
190 var actionGroupPatch ActionGroupPatch
191 err = json.Unmarshal(*v, &actionGroupPatch)
192 if err != nil {
193 return err
194 }
195 agpb.ActionGroupPatch = &actionGroupPatch
196 }
197 }
198 }
199
200 return nil
201 }
202
203
204 type ActionGroupResource struct {
205 autorest.Response `json:"-"`
206
207 *ActionGroup `json:"properties,omitempty"`
208
209 ID *string `json:"id,omitempty"`
210
211 Name *string `json:"name,omitempty"`
212
213 Type *string `json:"type,omitempty"`
214
215 Kind *string `json:"kind,omitempty"`
216
217 Identity *string `json:"identity,omitempty"`
218
219 Location *string `json:"location,omitempty"`
220
221 Tags map[string]*string `json:"tags"`
222 }
223
224
225 func (agr ActionGroupResource) MarshalJSON() ([]byte, error) {
226 objectMap := make(map[string]interface{})
227 if agr.ActionGroup != nil {
228 objectMap["properties"] = agr.ActionGroup
229 }
230 if agr.Location != nil {
231 objectMap["location"] = agr.Location
232 }
233 if agr.Tags != nil {
234 objectMap["tags"] = agr.Tags
235 }
236 return json.Marshal(objectMap)
237 }
238
239
240 func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error {
241 var m map[string]*json.RawMessage
242 err := json.Unmarshal(body, &m)
243 if err != nil {
244 return err
245 }
246 for k, v := range m {
247 switch k {
248 case "properties":
249 if v != nil {
250 var actionGroup ActionGroup
251 err = json.Unmarshal(*v, &actionGroup)
252 if err != nil {
253 return err
254 }
255 agr.ActionGroup = &actionGroup
256 }
257 case "id":
258 if v != nil {
259 var ID string
260 err = json.Unmarshal(*v, &ID)
261 if err != nil {
262 return err
263 }
264 agr.ID = &ID
265 }
266 case "name":
267 if v != nil {
268 var name string
269 err = json.Unmarshal(*v, &name)
270 if err != nil {
271 return err
272 }
273 agr.Name = &name
274 }
275 case "type":
276 if v != nil {
277 var typeVar string
278 err = json.Unmarshal(*v, &typeVar)
279 if err != nil {
280 return err
281 }
282 agr.Type = &typeVar
283 }
284 case "kind":
285 if v != nil {
286 var kind string
287 err = json.Unmarshal(*v, &kind)
288 if err != nil {
289 return err
290 }
291 agr.Kind = &kind
292 }
293 case "identity":
294 if v != nil {
295 var identity string
296 err = json.Unmarshal(*v, &identity)
297 if err != nil {
298 return err
299 }
300 agr.Identity = &identity
301 }
302 case "location":
303 if v != nil {
304 var location string
305 err = json.Unmarshal(*v, &location)
306 if err != nil {
307 return err
308 }
309 agr.Location = &location
310 }
311 case "tags":
312 if v != nil {
313 var tags map[string]*string
314 err = json.Unmarshal(*v, &tags)
315 if err != nil {
316 return err
317 }
318 agr.Tags = tags
319 }
320 }
321 }
322
323 return nil
324 }
325
326
327 type ActionList struct {
328
329 ActionGroups *[]ActionGroup `json:"actionGroups,omitempty"`
330 }
331
332
333 type ActivityLogAlertResource struct {
334 autorest.Response `json:"-"`
335
336 *AlertRuleProperties `json:"properties,omitempty"`
337
338 ID *string `json:"id,omitempty"`
339
340 Name *string `json:"name,omitempty"`
341
342 Type *string `json:"type,omitempty"`
343
344 Kind *string `json:"kind,omitempty"`
345
346 Identity *string `json:"identity,omitempty"`
347
348 Location *string `json:"location,omitempty"`
349
350 Tags map[string]*string `json:"tags"`
351 }
352
353
354 func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) {
355 objectMap := make(map[string]interface{})
356 if alar.AlertRuleProperties != nil {
357 objectMap["properties"] = alar.AlertRuleProperties
358 }
359 if alar.Location != nil {
360 objectMap["location"] = alar.Location
361 }
362 if alar.Tags != nil {
363 objectMap["tags"] = alar.Tags
364 }
365 return json.Marshal(objectMap)
366 }
367
368
369 func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error {
370 var m map[string]*json.RawMessage
371 err := json.Unmarshal(body, &m)
372 if err != nil {
373 return err
374 }
375 for k, v := range m {
376 switch k {
377 case "properties":
378 if v != nil {
379 var alertRuleProperties AlertRuleProperties
380 err = json.Unmarshal(*v, &alertRuleProperties)
381 if err != nil {
382 return err
383 }
384 alar.AlertRuleProperties = &alertRuleProperties
385 }
386 case "id":
387 if v != nil {
388 var ID string
389 err = json.Unmarshal(*v, &ID)
390 if err != nil {
391 return err
392 }
393 alar.ID = &ID
394 }
395 case "name":
396 if v != nil {
397 var name string
398 err = json.Unmarshal(*v, &name)
399 if err != nil {
400 return err
401 }
402 alar.Name = &name
403 }
404 case "type":
405 if v != nil {
406 var typeVar string
407 err = json.Unmarshal(*v, &typeVar)
408 if err != nil {
409 return err
410 }
411 alar.Type = &typeVar
412 }
413 case "kind":
414 if v != nil {
415 var kind string
416 err = json.Unmarshal(*v, &kind)
417 if err != nil {
418 return err
419 }
420 alar.Kind = &kind
421 }
422 case "identity":
423 if v != nil {
424 var identity string
425 err = json.Unmarshal(*v, &identity)
426 if err != nil {
427 return err
428 }
429 alar.Identity = &identity
430 }
431 case "location":
432 if v != nil {
433 var location string
434 err = json.Unmarshal(*v, &location)
435 if err != nil {
436 return err
437 }
438 alar.Location = &location
439 }
440 case "tags":
441 if v != nil {
442 var tags map[string]*string
443 err = json.Unmarshal(*v, &tags)
444 if err != nil {
445 return err
446 }
447 alar.Tags = tags
448 }
449 }
450 }
451
452 return nil
453 }
454
455
456 type AlertingAction struct {
457
458 Severity AlertSeverity `json:"severity,omitempty"`
459
460 AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"`
461
462 ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"`
463
464 Trigger *TriggerCondition `json:"trigger,omitempty"`
465
466 OdataType OdataTypeBasicAction `json:"odata.type,omitempty"`
467 }
468
469
470 func (aa AlertingAction) MarshalJSON() ([]byte, error) {
471 aa.OdataType = OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction
472 objectMap := make(map[string]interface{})
473 if aa.Severity != "" {
474 objectMap["severity"] = aa.Severity
475 }
476 if aa.AznsAction != nil {
477 objectMap["aznsAction"] = aa.AznsAction
478 }
479 if aa.ThrottlingInMin != nil {
480 objectMap["throttlingInMin"] = aa.ThrottlingInMin
481 }
482 if aa.Trigger != nil {
483 objectMap["trigger"] = aa.Trigger
484 }
485 if aa.OdataType != "" {
486 objectMap["odata.type"] = aa.OdataType
487 }
488 return json.Marshal(objectMap)
489 }
490
491
492 func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) {
493 return &aa, true
494 }
495
496
497 func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) {
498 return nil, false
499 }
500
501
502 func (aa AlertingAction) AsAction() (*Action, bool) {
503 return nil, false
504 }
505
506
507 func (aa AlertingAction) AsBasicAction() (BasicAction, bool) {
508 return &aa, true
509 }
510
511
512 type AlertRule struct {
513
514 Name *string `json:"name,omitempty"`
515
516 Description *string `json:"description,omitempty"`
517
518 ProvisioningState *string `json:"provisioningState,omitempty"`
519
520 IsEnabled *bool `json:"isEnabled,omitempty"`
521
522 Condition BasicRuleCondition `json:"condition,omitempty"`
523
524 Action BasicRuleAction `json:"action,omitempty"`
525
526 Actions *[]BasicRuleAction `json:"actions,omitempty"`
527
528 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
529 }
530
531
532 func (ar AlertRule) MarshalJSON() ([]byte, error) {
533 objectMap := make(map[string]interface{})
534 if ar.Name != nil {
535 objectMap["name"] = ar.Name
536 }
537 if ar.Description != nil {
538 objectMap["description"] = ar.Description
539 }
540 if ar.ProvisioningState != nil {
541 objectMap["provisioningState"] = ar.ProvisioningState
542 }
543 if ar.IsEnabled != nil {
544 objectMap["isEnabled"] = ar.IsEnabled
545 }
546 objectMap["condition"] = ar.Condition
547 objectMap["action"] = ar.Action
548 if ar.Actions != nil {
549 objectMap["actions"] = ar.Actions
550 }
551 return json.Marshal(objectMap)
552 }
553
554
555 func (ar *AlertRule) UnmarshalJSON(body []byte) error {
556 var m map[string]*json.RawMessage
557 err := json.Unmarshal(body, &m)
558 if err != nil {
559 return err
560 }
561 for k, v := range m {
562 switch k {
563 case "name":
564 if v != nil {
565 var name string
566 err = json.Unmarshal(*v, &name)
567 if err != nil {
568 return err
569 }
570 ar.Name = &name
571 }
572 case "description":
573 if v != nil {
574 var description string
575 err = json.Unmarshal(*v, &description)
576 if err != nil {
577 return err
578 }
579 ar.Description = &description
580 }
581 case "provisioningState":
582 if v != nil {
583 var provisioningState string
584 err = json.Unmarshal(*v, &provisioningState)
585 if err != nil {
586 return err
587 }
588 ar.ProvisioningState = &provisioningState
589 }
590 case "isEnabled":
591 if v != nil {
592 var isEnabled bool
593 err = json.Unmarshal(*v, &isEnabled)
594 if err != nil {
595 return err
596 }
597 ar.IsEnabled = &isEnabled
598 }
599 case "condition":
600 if v != nil {
601 condition, err := unmarshalBasicRuleCondition(*v)
602 if err != nil {
603 return err
604 }
605 ar.Condition = condition
606 }
607 case "action":
608 if v != nil {
609 action, err := unmarshalBasicRuleAction(*v)
610 if err != nil {
611 return err
612 }
613 ar.Action = action
614 }
615 case "actions":
616 if v != nil {
617 actions, err := unmarshalBasicRuleActionArray(*v)
618 if err != nil {
619 return err
620 }
621 ar.Actions = &actions
622 }
623 case "lastUpdatedTime":
624 if v != nil {
625 var lastUpdatedTime date.Time
626 err = json.Unmarshal(*v, &lastUpdatedTime)
627 if err != nil {
628 return err
629 }
630 ar.LastUpdatedTime = &lastUpdatedTime
631 }
632 }
633 }
634
635 return nil
636 }
637
638
639
640 type AlertRuleAllOfCondition struct {
641
642 AllOf *[]AlertRuleAnyOfOrLeafCondition `json:"allOf,omitempty"`
643 }
644
645
646
647
648
649
650
651
652
653
654 type AlertRuleAnyOfOrLeafCondition struct {
655
656 AnyOf *[]AlertRuleLeafCondition `json:"anyOf,omitempty"`
657
658
659 Field *string `json:"field,omitempty"`
660
661 Equals *string `json:"equals,omitempty"`
662
663 ContainsAny *[]string `json:"containsAny,omitempty"`
664 }
665
666
667
668
669 type AlertRuleLeafCondition struct {
670
671
672 Field *string `json:"field,omitempty"`
673
674 Equals *string `json:"equals,omitempty"`
675
676 ContainsAny *[]string `json:"containsAny,omitempty"`
677 }
678
679
680 type AlertRuleList struct {
681 autorest.Response `json:"-"`
682
683 Value *[]ActivityLogAlertResource `json:"value,omitempty"`
684
685 NextLink *string `json:"nextLink,omitempty"`
686 }
687
688
689 type AlertRuleListIterator struct {
690 i int
691 page AlertRuleListPage
692 }
693
694
695
696 func (iter *AlertRuleListIterator) NextWithContext(ctx context.Context) (err error) {
697 if tracing.IsEnabled() {
698 ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleListIterator.NextWithContext")
699 defer func() {
700 sc := -1
701 if iter.Response().Response.Response != nil {
702 sc = iter.Response().Response.Response.StatusCode
703 }
704 tracing.EndSpan(ctx, sc, err)
705 }()
706 }
707 iter.i++
708 if iter.i < len(iter.page.Values()) {
709 return nil
710 }
711 err = iter.page.NextWithContext(ctx)
712 if err != nil {
713 iter.i--
714 return err
715 }
716 iter.i = 0
717 return nil
718 }
719
720
721
722
723 func (iter *AlertRuleListIterator) Next() error {
724 return iter.NextWithContext(context.Background())
725 }
726
727
728 func (iter AlertRuleListIterator) NotDone() bool {
729 return iter.page.NotDone() && iter.i < len(iter.page.Values())
730 }
731
732
733 func (iter AlertRuleListIterator) Response() AlertRuleList {
734 return iter.page.Response()
735 }
736
737
738
739 func (iter AlertRuleListIterator) Value() ActivityLogAlertResource {
740 if !iter.page.NotDone() {
741 return ActivityLogAlertResource{}
742 }
743 return iter.page.Values()[iter.i]
744 }
745
746
747 func NewAlertRuleListIterator(page AlertRuleListPage) AlertRuleListIterator {
748 return AlertRuleListIterator{page: page}
749 }
750
751
752 func (arl AlertRuleList) IsEmpty() bool {
753 return arl.Value == nil || len(*arl.Value) == 0
754 }
755
756
757 func (arl AlertRuleList) hasNextLink() bool {
758 return arl.NextLink != nil && len(*arl.NextLink) != 0
759 }
760
761
762
763 func (arl AlertRuleList) alertRuleListPreparer(ctx context.Context) (*http.Request, error) {
764 if !arl.hasNextLink() {
765 return nil, nil
766 }
767 return autorest.Prepare((&http.Request{}).WithContext(ctx),
768 autorest.AsJSON(),
769 autorest.AsGet(),
770 autorest.WithBaseURL(to.String(arl.NextLink)))
771 }
772
773
774 type AlertRuleListPage struct {
775 fn func(context.Context, AlertRuleList) (AlertRuleList, error)
776 arl AlertRuleList
777 }
778
779
780
781 func (page *AlertRuleListPage) NextWithContext(ctx context.Context) (err error) {
782 if tracing.IsEnabled() {
783 ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleListPage.NextWithContext")
784 defer func() {
785 sc := -1
786 if page.Response().Response.Response != nil {
787 sc = page.Response().Response.Response.StatusCode
788 }
789 tracing.EndSpan(ctx, sc, err)
790 }()
791 }
792 for {
793 next, err := page.fn(ctx, page.arl)
794 if err != nil {
795 return err
796 }
797 page.arl = next
798 if !next.hasNextLink() || !next.IsEmpty() {
799 break
800 }
801 }
802 return nil
803 }
804
805
806
807
808 func (page *AlertRuleListPage) Next() error {
809 return page.NextWithContext(context.Background())
810 }
811
812
813 func (page AlertRuleListPage) NotDone() bool {
814 return !page.arl.IsEmpty()
815 }
816
817
818 func (page AlertRuleListPage) Response() AlertRuleList {
819 return page.arl
820 }
821
822
823 func (page AlertRuleListPage) Values() []ActivityLogAlertResource {
824 if page.arl.IsEmpty() {
825 return nil
826 }
827 return *page.arl.Value
828 }
829
830
831 func NewAlertRuleListPage(cur AlertRuleList, getNextPage func(context.Context, AlertRuleList) (AlertRuleList, error)) AlertRuleListPage {
832 return AlertRuleListPage{
833 fn: getNextPage,
834 arl: cur,
835 }
836 }
837
838
839 type AlertRulePatchObject struct {
840
841 Tags map[string]*string `json:"tags"`
842
843 *AlertRulePatchProperties `json:"properties,omitempty"`
844 }
845
846
847 func (arpo AlertRulePatchObject) MarshalJSON() ([]byte, error) {
848 objectMap := make(map[string]interface{})
849 if arpo.Tags != nil {
850 objectMap["tags"] = arpo.Tags
851 }
852 if arpo.AlertRulePatchProperties != nil {
853 objectMap["properties"] = arpo.AlertRulePatchProperties
854 }
855 return json.Marshal(objectMap)
856 }
857
858
859 func (arpo *AlertRulePatchObject) UnmarshalJSON(body []byte) error {
860 var m map[string]*json.RawMessage
861 err := json.Unmarshal(body, &m)
862 if err != nil {
863 return err
864 }
865 for k, v := range m {
866 switch k {
867 case "tags":
868 if v != nil {
869 var tags map[string]*string
870 err = json.Unmarshal(*v, &tags)
871 if err != nil {
872 return err
873 }
874 arpo.Tags = tags
875 }
876 case "properties":
877 if v != nil {
878 var alertRulePatchProperties AlertRulePatchProperties
879 err = json.Unmarshal(*v, &alertRulePatchProperties)
880 if err != nil {
881 return err
882 }
883 arpo.AlertRulePatchProperties = &alertRulePatchProperties
884 }
885 }
886 }
887
888 return nil
889 }
890
891
892 type AlertRulePatchProperties struct {
893
894 Enabled *bool `json:"enabled,omitempty"`
895 }
896
897
898 type AlertRuleProperties struct {
899
900 Scopes *[]string `json:"scopes,omitempty"`
901
902 Condition *AlertRuleAllOfCondition `json:"condition,omitempty"`
903
904 Actions *ActionList `json:"actions,omitempty"`
905
906 Enabled *bool `json:"enabled,omitempty"`
907
908 Description *string `json:"description,omitempty"`
909 }
910
911
912 type AlertRuleResource struct {
913 autorest.Response `json:"-"`
914
915 *AlertRule `json:"properties,omitempty"`
916
917 ID *string `json:"id,omitempty"`
918
919 Name *string `json:"name,omitempty"`
920
921 Type *string `json:"type,omitempty"`
922
923 Location *string `json:"location,omitempty"`
924
925 Tags map[string]*string `json:"tags"`
926
927 Kind *string `json:"kind,omitempty"`
928
929 Etag *string `json:"etag,omitempty"`
930 }
931
932
933 func (arr AlertRuleResource) MarshalJSON() ([]byte, error) {
934 objectMap := make(map[string]interface{})
935 if arr.AlertRule != nil {
936 objectMap["properties"] = arr.AlertRule
937 }
938 if arr.Location != nil {
939 objectMap["location"] = arr.Location
940 }
941 if arr.Tags != nil {
942 objectMap["tags"] = arr.Tags
943 }
944 return json.Marshal(objectMap)
945 }
946
947
948 func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error {
949 var m map[string]*json.RawMessage
950 err := json.Unmarshal(body, &m)
951 if err != nil {
952 return err
953 }
954 for k, v := range m {
955 switch k {
956 case "properties":
957 if v != nil {
958 var alertRule AlertRule
959 err = json.Unmarshal(*v, &alertRule)
960 if err != nil {
961 return err
962 }
963 arr.AlertRule = &alertRule
964 }
965 case "id":
966 if v != nil {
967 var ID string
968 err = json.Unmarshal(*v, &ID)
969 if err != nil {
970 return err
971 }
972 arr.ID = &ID
973 }
974 case "name":
975 if v != nil {
976 var name string
977 err = json.Unmarshal(*v, &name)
978 if err != nil {
979 return err
980 }
981 arr.Name = &name
982 }
983 case "type":
984 if v != nil {
985 var typeVar string
986 err = json.Unmarshal(*v, &typeVar)
987 if err != nil {
988 return err
989 }
990 arr.Type = &typeVar
991 }
992 case "location":
993 if v != nil {
994 var location string
995 err = json.Unmarshal(*v, &location)
996 if err != nil {
997 return err
998 }
999 arr.Location = &location
1000 }
1001 case "tags":
1002 if v != nil {
1003 var tags map[string]*string
1004 err = json.Unmarshal(*v, &tags)
1005 if err != nil {
1006 return err
1007 }
1008 arr.Tags = tags
1009 }
1010 case "kind":
1011 if v != nil {
1012 var kind string
1013 err = json.Unmarshal(*v, &kind)
1014 if err != nil {
1015 return err
1016 }
1017 arr.Kind = &kind
1018 }
1019 case "etag":
1020 if v != nil {
1021 var etag string
1022 err = json.Unmarshal(*v, &etag)
1023 if err != nil {
1024 return err
1025 }
1026 arr.Etag = &etag
1027 }
1028 }
1029 }
1030
1031 return nil
1032 }
1033
1034
1035 type AlertRuleResourceCollection struct {
1036 autorest.Response `json:"-"`
1037
1038 Value *[]AlertRuleResource `json:"value,omitempty"`
1039 }
1040
1041
1042 type AlertRuleResourcePatch struct {
1043
1044 Tags map[string]*string `json:"tags"`
1045
1046 *AlertRule `json:"properties,omitempty"`
1047 }
1048
1049
1050 func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) {
1051 objectMap := make(map[string]interface{})
1052 if arrp.Tags != nil {
1053 objectMap["tags"] = arrp.Tags
1054 }
1055 if arrp.AlertRule != nil {
1056 objectMap["properties"] = arrp.AlertRule
1057 }
1058 return json.Marshal(objectMap)
1059 }
1060
1061
1062 func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error {
1063 var m map[string]*json.RawMessage
1064 err := json.Unmarshal(body, &m)
1065 if err != nil {
1066 return err
1067 }
1068 for k, v := range m {
1069 switch k {
1070 case "tags":
1071 if v != nil {
1072 var tags map[string]*string
1073 err = json.Unmarshal(*v, &tags)
1074 if err != nil {
1075 return err
1076 }
1077 arrp.Tags = tags
1078 }
1079 case "properties":
1080 if v != nil {
1081 var alertRule AlertRule
1082 err = json.Unmarshal(*v, &alertRule)
1083 if err != nil {
1084 return err
1085 }
1086 arrp.AlertRule = &alertRule
1087 }
1088 }
1089 }
1090
1091 return nil
1092 }
1093
1094
1095 type ArmRoleReceiver struct {
1096
1097 Name *string `json:"name,omitempty"`
1098
1099 RoleID *string `json:"roleId,omitempty"`
1100
1101 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"`
1102 }
1103
1104
1105 type AutomationRunbookReceiver struct {
1106
1107 AutomationAccountID *string `json:"automationAccountId,omitempty"`
1108
1109 RunbookName *string `json:"runbookName,omitempty"`
1110
1111 WebhookResourceID *string `json:"webhookResourceId,omitempty"`
1112
1113 IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"`
1114
1115 Name *string `json:"name,omitempty"`
1116
1117 ServiceURI *string `json:"serviceUri,omitempty"`
1118
1119 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"`
1120 }
1121
1122
1123 type AutoscaleNotification struct {
1124
1125 Operation *string `json:"operation,omitempty"`
1126
1127 Email *EmailNotification `json:"email,omitempty"`
1128
1129 Webhooks *[]WebhookNotification `json:"webhooks,omitempty"`
1130 }
1131
1132
1133 type AutoscaleProfile struct {
1134
1135 Name *string `json:"name,omitempty"`
1136
1137 Capacity *ScaleCapacity `json:"capacity,omitempty"`
1138
1139 Rules *[]ScaleRule `json:"rules,omitempty"`
1140
1141 FixedDate *TimeWindow `json:"fixedDate,omitempty"`
1142
1143 Recurrence *Recurrence `json:"recurrence,omitempty"`
1144 }
1145
1146
1147
1148 type AutoscaleSetting struct {
1149
1150 Profiles *[]AutoscaleProfile `json:"profiles,omitempty"`
1151
1152 Notifications *[]AutoscaleNotification `json:"notifications,omitempty"`
1153
1154 Enabled *bool `json:"enabled,omitempty"`
1155
1156 Name *string `json:"name,omitempty"`
1157
1158 TargetResourceURI *string `json:"targetResourceUri,omitempty"`
1159
1160 TargetResourceLocation *string `json:"targetResourceLocation,omitempty"`
1161 }
1162
1163
1164 type AutoscaleSettingResource struct {
1165 autorest.Response `json:"-"`
1166
1167 *AutoscaleSetting `json:"properties,omitempty"`
1168
1169 ID *string `json:"id,omitempty"`
1170
1171 Name *string `json:"name,omitempty"`
1172
1173 Type *string `json:"type,omitempty"`
1174
1175 Location *string `json:"location,omitempty"`
1176
1177 Tags map[string]*string `json:"tags"`
1178
1179 Kind *string `json:"kind,omitempty"`
1180
1181 Etag *string `json:"etag,omitempty"`
1182 }
1183
1184
1185 func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) {
1186 objectMap := make(map[string]interface{})
1187 if asr.AutoscaleSetting != nil {
1188 objectMap["properties"] = asr.AutoscaleSetting
1189 }
1190 if asr.Location != nil {
1191 objectMap["location"] = asr.Location
1192 }
1193 if asr.Tags != nil {
1194 objectMap["tags"] = asr.Tags
1195 }
1196 return json.Marshal(objectMap)
1197 }
1198
1199
1200 func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error {
1201 var m map[string]*json.RawMessage
1202 err := json.Unmarshal(body, &m)
1203 if err != nil {
1204 return err
1205 }
1206 for k, v := range m {
1207 switch k {
1208 case "properties":
1209 if v != nil {
1210 var autoscaleSetting AutoscaleSetting
1211 err = json.Unmarshal(*v, &autoscaleSetting)
1212 if err != nil {
1213 return err
1214 }
1215 asr.AutoscaleSetting = &autoscaleSetting
1216 }
1217 case "id":
1218 if v != nil {
1219 var ID string
1220 err = json.Unmarshal(*v, &ID)
1221 if err != nil {
1222 return err
1223 }
1224 asr.ID = &ID
1225 }
1226 case "name":
1227 if v != nil {
1228 var name string
1229 err = json.Unmarshal(*v, &name)
1230 if err != nil {
1231 return err
1232 }
1233 asr.Name = &name
1234 }
1235 case "type":
1236 if v != nil {
1237 var typeVar string
1238 err = json.Unmarshal(*v, &typeVar)
1239 if err != nil {
1240 return err
1241 }
1242 asr.Type = &typeVar
1243 }
1244 case "location":
1245 if v != nil {
1246 var location string
1247 err = json.Unmarshal(*v, &location)
1248 if err != nil {
1249 return err
1250 }
1251 asr.Location = &location
1252 }
1253 case "tags":
1254 if v != nil {
1255 var tags map[string]*string
1256 err = json.Unmarshal(*v, &tags)
1257 if err != nil {
1258 return err
1259 }
1260 asr.Tags = tags
1261 }
1262 case "kind":
1263 if v != nil {
1264 var kind string
1265 err = json.Unmarshal(*v, &kind)
1266 if err != nil {
1267 return err
1268 }
1269 asr.Kind = &kind
1270 }
1271 case "etag":
1272 if v != nil {
1273 var etag string
1274 err = json.Unmarshal(*v, &etag)
1275 if err != nil {
1276 return err
1277 }
1278 asr.Etag = &etag
1279 }
1280 }
1281 }
1282
1283 return nil
1284 }
1285
1286
1287 type AutoscaleSettingResourceCollection struct {
1288 autorest.Response `json:"-"`
1289
1290 Value *[]AutoscaleSettingResource `json:"value,omitempty"`
1291
1292 NextLink *string `json:"nextLink,omitempty"`
1293 }
1294
1295
1296
1297 type AutoscaleSettingResourceCollectionIterator struct {
1298 i int
1299 page AutoscaleSettingResourceCollectionPage
1300 }
1301
1302
1303
1304 func (iter *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) {
1305 if tracing.IsEnabled() {
1306 ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.NextWithContext")
1307 defer func() {
1308 sc := -1
1309 if iter.Response().Response.Response != nil {
1310 sc = iter.Response().Response.Response.StatusCode
1311 }
1312 tracing.EndSpan(ctx, sc, err)
1313 }()
1314 }
1315 iter.i++
1316 if iter.i < len(iter.page.Values()) {
1317 return nil
1318 }
1319 err = iter.page.NextWithContext(ctx)
1320 if err != nil {
1321 iter.i--
1322 return err
1323 }
1324 iter.i = 0
1325 return nil
1326 }
1327
1328
1329
1330
1331 func (iter *AutoscaleSettingResourceCollectionIterator) Next() error {
1332 return iter.NextWithContext(context.Background())
1333 }
1334
1335
1336 func (iter AutoscaleSettingResourceCollectionIterator) NotDone() bool {
1337 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1338 }
1339
1340
1341 func (iter AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection {
1342 return iter.page.Response()
1343 }
1344
1345
1346
1347 func (iter AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource {
1348 if !iter.page.NotDone() {
1349 return AutoscaleSettingResource{}
1350 }
1351 return iter.page.Values()[iter.i]
1352 }
1353
1354
1355 func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator {
1356 return AutoscaleSettingResourceCollectionIterator{page: page}
1357 }
1358
1359
1360 func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool {
1361 return asrc.Value == nil || len(*asrc.Value) == 0
1362 }
1363
1364
1365 func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool {
1366 return asrc.NextLink != nil && len(*asrc.NextLink) != 0
1367 }
1368
1369
1370
1371 func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) {
1372 if !asrc.hasNextLink() {
1373 return nil, nil
1374 }
1375 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1376 autorest.AsJSON(),
1377 autorest.AsGet(),
1378 autorest.WithBaseURL(to.String(asrc.NextLink)))
1379 }
1380
1381
1382 type AutoscaleSettingResourceCollectionPage struct {
1383 fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)
1384 asrc AutoscaleSettingResourceCollection
1385 }
1386
1387
1388
1389 func (page *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) {
1390 if tracing.IsEnabled() {
1391 ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.NextWithContext")
1392 defer func() {
1393 sc := -1
1394 if page.Response().Response.Response != nil {
1395 sc = page.Response().Response.Response.StatusCode
1396 }
1397 tracing.EndSpan(ctx, sc, err)
1398 }()
1399 }
1400 for {
1401 next, err := page.fn(ctx, page.asrc)
1402 if err != nil {
1403 return err
1404 }
1405 page.asrc = next
1406 if !next.hasNextLink() || !next.IsEmpty() {
1407 break
1408 }
1409 }
1410 return nil
1411 }
1412
1413
1414
1415
1416 func (page *AutoscaleSettingResourceCollectionPage) Next() error {
1417 return page.NextWithContext(context.Background())
1418 }
1419
1420
1421 func (page AutoscaleSettingResourceCollectionPage) NotDone() bool {
1422 return !page.asrc.IsEmpty()
1423 }
1424
1425
1426 func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection {
1427 return page.asrc
1428 }
1429
1430
1431 func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource {
1432 if page.asrc.IsEmpty() {
1433 return nil
1434 }
1435 return *page.asrc.Value
1436 }
1437
1438
1439 func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage {
1440 return AutoscaleSettingResourceCollectionPage{
1441 fn: getNextPage,
1442 asrc: cur,
1443 }
1444 }
1445
1446
1447 type AutoscaleSettingResourcePatch struct {
1448
1449 Tags map[string]*string `json:"tags"`
1450
1451 *AutoscaleSetting `json:"properties,omitempty"`
1452 }
1453
1454
1455 func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) {
1456 objectMap := make(map[string]interface{})
1457 if asrp.Tags != nil {
1458 objectMap["tags"] = asrp.Tags
1459 }
1460 if asrp.AutoscaleSetting != nil {
1461 objectMap["properties"] = asrp.AutoscaleSetting
1462 }
1463 return json.Marshal(objectMap)
1464 }
1465
1466
1467 func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error {
1468 var m map[string]*json.RawMessage
1469 err := json.Unmarshal(body, &m)
1470 if err != nil {
1471 return err
1472 }
1473 for k, v := range m {
1474 switch k {
1475 case "tags":
1476 if v != nil {
1477 var tags map[string]*string
1478 err = json.Unmarshal(*v, &tags)
1479 if err != nil {
1480 return err
1481 }
1482 asrp.Tags = tags
1483 }
1484 case "properties":
1485 if v != nil {
1486 var autoscaleSetting AutoscaleSetting
1487 err = json.Unmarshal(*v, &autoscaleSetting)
1488 if err != nil {
1489 return err
1490 }
1491 asrp.AutoscaleSetting = &autoscaleSetting
1492 }
1493 }
1494 }
1495
1496 return nil
1497 }
1498
1499
1500 type AzNsActionGroup struct {
1501
1502 ActionGroup *[]string `json:"actionGroup,omitempty"`
1503
1504 EmailSubject *string `json:"emailSubject,omitempty"`
1505
1506 CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"`
1507 }
1508
1509
1510 type AzureAppPushReceiver struct {
1511
1512 Name *string `json:"name,omitempty"`
1513
1514 EmailAddress *string `json:"emailAddress,omitempty"`
1515 }
1516
1517
1518 type AzureFunctionReceiver struct {
1519
1520 Name *string `json:"name,omitempty"`
1521
1522 FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"`
1523
1524 FunctionName *string `json:"functionName,omitempty"`
1525
1526 HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"`
1527
1528 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"`
1529 }
1530
1531
1532 type AzureMonitorMetricsDestination struct {
1533
1534
1535 Name *string `json:"name,omitempty"`
1536 }
1537
1538
1539 type AzureMonitorPrivateLinkScope struct {
1540 autorest.Response `json:"-"`
1541
1542 *AzureMonitorPrivateLinkScopeProperties `json:"properties,omitempty"`
1543
1544 ID *string `json:"id,omitempty"`
1545
1546 Name *string `json:"name,omitempty"`
1547
1548 Type *string `json:"type,omitempty"`
1549
1550 Location *string `json:"location,omitempty"`
1551
1552 Tags map[string]*string `json:"tags"`
1553 }
1554
1555
1556 func (ampls AzureMonitorPrivateLinkScope) MarshalJSON() ([]byte, error) {
1557 objectMap := make(map[string]interface{})
1558 if ampls.AzureMonitorPrivateLinkScopeProperties != nil {
1559 objectMap["properties"] = ampls.AzureMonitorPrivateLinkScopeProperties
1560 }
1561 if ampls.Location != nil {
1562 objectMap["location"] = ampls.Location
1563 }
1564 if ampls.Tags != nil {
1565 objectMap["tags"] = ampls.Tags
1566 }
1567 return json.Marshal(objectMap)
1568 }
1569
1570
1571 func (ampls *AzureMonitorPrivateLinkScope) UnmarshalJSON(body []byte) error {
1572 var m map[string]*json.RawMessage
1573 err := json.Unmarshal(body, &m)
1574 if err != nil {
1575 return err
1576 }
1577 for k, v := range m {
1578 switch k {
1579 case "properties":
1580 if v != nil {
1581 var azureMonitorPrivateLinkScopeProperties AzureMonitorPrivateLinkScopeProperties
1582 err = json.Unmarshal(*v, &azureMonitorPrivateLinkScopeProperties)
1583 if err != nil {
1584 return err
1585 }
1586 ampls.AzureMonitorPrivateLinkScopeProperties = &azureMonitorPrivateLinkScopeProperties
1587 }
1588 case "id":
1589 if v != nil {
1590 var ID string
1591 err = json.Unmarshal(*v, &ID)
1592 if err != nil {
1593 return err
1594 }
1595 ampls.ID = &ID
1596 }
1597 case "name":
1598 if v != nil {
1599 var name string
1600 err = json.Unmarshal(*v, &name)
1601 if err != nil {
1602 return err
1603 }
1604 ampls.Name = &name
1605 }
1606 case "type":
1607 if v != nil {
1608 var typeVar string
1609 err = json.Unmarshal(*v, &typeVar)
1610 if err != nil {
1611 return err
1612 }
1613 ampls.Type = &typeVar
1614 }
1615 case "location":
1616 if v != nil {
1617 var location string
1618 err = json.Unmarshal(*v, &location)
1619 if err != nil {
1620 return err
1621 }
1622 ampls.Location = &location
1623 }
1624 case "tags":
1625 if v != nil {
1626 var tags map[string]*string
1627 err = json.Unmarshal(*v, &tags)
1628 if err != nil {
1629 return err
1630 }
1631 ampls.Tags = tags
1632 }
1633 }
1634 }
1635
1636 return nil
1637 }
1638
1639
1640 type AzureMonitorPrivateLinkScopeListResult struct {
1641 autorest.Response `json:"-"`
1642
1643 Value *[]AzureMonitorPrivateLinkScope `json:"value,omitempty"`
1644
1645 NextLink *string `json:"nextLink,omitempty"`
1646 }
1647
1648
1649
1650 type AzureMonitorPrivateLinkScopeListResultIterator struct {
1651 i int
1652 page AzureMonitorPrivateLinkScopeListResultPage
1653 }
1654
1655
1656
1657 func (iter *AzureMonitorPrivateLinkScopeListResultIterator) NextWithContext(ctx context.Context) (err error) {
1658 if tracing.IsEnabled() {
1659 ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultIterator.NextWithContext")
1660 defer func() {
1661 sc := -1
1662 if iter.Response().Response.Response != nil {
1663 sc = iter.Response().Response.Response.StatusCode
1664 }
1665 tracing.EndSpan(ctx, sc, err)
1666 }()
1667 }
1668 iter.i++
1669 if iter.i < len(iter.page.Values()) {
1670 return nil
1671 }
1672 err = iter.page.NextWithContext(ctx)
1673 if err != nil {
1674 iter.i--
1675 return err
1676 }
1677 iter.i = 0
1678 return nil
1679 }
1680
1681
1682
1683
1684 func (iter *AzureMonitorPrivateLinkScopeListResultIterator) Next() error {
1685 return iter.NextWithContext(context.Background())
1686 }
1687
1688
1689 func (iter AzureMonitorPrivateLinkScopeListResultIterator) NotDone() bool {
1690 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1691 }
1692
1693
1694 func (iter AzureMonitorPrivateLinkScopeListResultIterator) Response() AzureMonitorPrivateLinkScopeListResult {
1695 return iter.page.Response()
1696 }
1697
1698
1699
1700 func (iter AzureMonitorPrivateLinkScopeListResultIterator) Value() AzureMonitorPrivateLinkScope {
1701 if !iter.page.NotDone() {
1702 return AzureMonitorPrivateLinkScope{}
1703 }
1704 return iter.page.Values()[iter.i]
1705 }
1706
1707
1708 func NewAzureMonitorPrivateLinkScopeListResultIterator(page AzureMonitorPrivateLinkScopeListResultPage) AzureMonitorPrivateLinkScopeListResultIterator {
1709 return AzureMonitorPrivateLinkScopeListResultIterator{page: page}
1710 }
1711
1712
1713 func (amplslr AzureMonitorPrivateLinkScopeListResult) IsEmpty() bool {
1714 return amplslr.Value == nil || len(*amplslr.Value) == 0
1715 }
1716
1717
1718 func (amplslr AzureMonitorPrivateLinkScopeListResult) hasNextLink() bool {
1719 return amplslr.NextLink != nil && len(*amplslr.NextLink) != 0
1720 }
1721
1722
1723
1724 func (amplslr AzureMonitorPrivateLinkScopeListResult) azureMonitorPrivateLinkScopeListResultPreparer(ctx context.Context) (*http.Request, error) {
1725 if !amplslr.hasNextLink() {
1726 return nil, nil
1727 }
1728 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1729 autorest.AsJSON(),
1730 autorest.AsGet(),
1731 autorest.WithBaseURL(to.String(amplslr.NextLink)))
1732 }
1733
1734
1735 type AzureMonitorPrivateLinkScopeListResultPage struct {
1736 fn func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error)
1737 amplslr AzureMonitorPrivateLinkScopeListResult
1738 }
1739
1740
1741
1742 func (page *AzureMonitorPrivateLinkScopeListResultPage) NextWithContext(ctx context.Context) (err error) {
1743 if tracing.IsEnabled() {
1744 ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultPage.NextWithContext")
1745 defer func() {
1746 sc := -1
1747 if page.Response().Response.Response != nil {
1748 sc = page.Response().Response.Response.StatusCode
1749 }
1750 tracing.EndSpan(ctx, sc, err)
1751 }()
1752 }
1753 for {
1754 next, err := page.fn(ctx, page.amplslr)
1755 if err != nil {
1756 return err
1757 }
1758 page.amplslr = next
1759 if !next.hasNextLink() || !next.IsEmpty() {
1760 break
1761 }
1762 }
1763 return nil
1764 }
1765
1766
1767
1768
1769 func (page *AzureMonitorPrivateLinkScopeListResultPage) Next() error {
1770 return page.NextWithContext(context.Background())
1771 }
1772
1773
1774 func (page AzureMonitorPrivateLinkScopeListResultPage) NotDone() bool {
1775 return !page.amplslr.IsEmpty()
1776 }
1777
1778
1779 func (page AzureMonitorPrivateLinkScopeListResultPage) Response() AzureMonitorPrivateLinkScopeListResult {
1780 return page.amplslr
1781 }
1782
1783
1784 func (page AzureMonitorPrivateLinkScopeListResultPage) Values() []AzureMonitorPrivateLinkScope {
1785 if page.amplslr.IsEmpty() {
1786 return nil
1787 }
1788 return *page.amplslr.Value
1789 }
1790
1791
1792 func NewAzureMonitorPrivateLinkScopeListResultPage(cur AzureMonitorPrivateLinkScopeListResult, getNextPage func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error)) AzureMonitorPrivateLinkScopeListResultPage {
1793 return AzureMonitorPrivateLinkScopeListResultPage{
1794 fn: getNextPage,
1795 amplslr: cur,
1796 }
1797 }
1798
1799
1800 type AzureMonitorPrivateLinkScopeProperties struct {
1801
1802 ProvisioningState *string `json:"provisioningState,omitempty"`
1803
1804 PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"`
1805 }
1806
1807
1808 func (amplsp AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) {
1809 objectMap := make(map[string]interface{})
1810 return json.Marshal(objectMap)
1811 }
1812
1813
1814 type AzureResource struct {
1815
1816 ID *string `json:"id,omitempty"`
1817
1818 Name *string `json:"name,omitempty"`
1819
1820 Type *string `json:"type,omitempty"`
1821
1822 Kind *string `json:"kind,omitempty"`
1823
1824 Identity *string `json:"identity,omitempty"`
1825
1826 Location *string `json:"location,omitempty"`
1827
1828 Tags map[string]*string `json:"tags"`
1829 }
1830
1831
1832 func (ar AzureResource) MarshalJSON() ([]byte, error) {
1833 objectMap := make(map[string]interface{})
1834 if ar.Location != nil {
1835 objectMap["location"] = ar.Location
1836 }
1837 if ar.Tags != nil {
1838 objectMap["tags"] = ar.Tags
1839 }
1840 return json.Marshal(objectMap)
1841 }
1842
1843
1844 type BaselineMetadata struct {
1845
1846 Name *string `json:"name,omitempty"`
1847
1848 Value *string `json:"value,omitempty"`
1849 }
1850
1851
1852 type ConfigurationAccessEndpointSpec struct {
1853
1854 Endpoint *string `json:"endpoint,omitempty"`
1855 }
1856
1857
1858 func (caes ConfigurationAccessEndpointSpec) MarshalJSON() ([]byte, error) {
1859 objectMap := make(map[string]interface{})
1860 return json.Marshal(objectMap)
1861 }
1862
1863
1864 type Criteria struct {
1865
1866 MetricName *string `json:"metricName,omitempty"`
1867
1868 Dimensions *[]Dimension `json:"dimensions,omitempty"`
1869 }
1870
1871
1872 type DataCollectionEndpoint struct {
1873
1874 Description *string `json:"description,omitempty"`
1875
1876 ImmutableID *string `json:"immutableId,omitempty"`
1877
1878 ConfigurationAccess *DataCollectionEndpointConfigurationAccess `json:"configurationAccess,omitempty"`
1879
1880 LogsIngestion *DataCollectionEndpointLogsIngestion `json:"logsIngestion,omitempty"`
1881
1882 NetworkAcls *DataCollectionEndpointNetworkAcls `json:"networkAcls,omitempty"`
1883
1884 ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"`
1885 }
1886
1887
1888 func (dce DataCollectionEndpoint) MarshalJSON() ([]byte, error) {
1889 objectMap := make(map[string]interface{})
1890 if dce.Description != nil {
1891 objectMap["description"] = dce.Description
1892 }
1893 if dce.ImmutableID != nil {
1894 objectMap["immutableId"] = dce.ImmutableID
1895 }
1896 if dce.ConfigurationAccess != nil {
1897 objectMap["configurationAccess"] = dce.ConfigurationAccess
1898 }
1899 if dce.LogsIngestion != nil {
1900 objectMap["logsIngestion"] = dce.LogsIngestion
1901 }
1902 if dce.NetworkAcls != nil {
1903 objectMap["networkAcls"] = dce.NetworkAcls
1904 }
1905 return json.Marshal(objectMap)
1906 }
1907
1908
1909 type DataCollectionEndpointConfigurationAccess struct {
1910
1911 Endpoint *string `json:"endpoint,omitempty"`
1912 }
1913
1914
1915 func (dceA DataCollectionEndpointConfigurationAccess) MarshalJSON() ([]byte, error) {
1916 objectMap := make(map[string]interface{})
1917 return json.Marshal(objectMap)
1918 }
1919
1920
1921 type DataCollectionEndpointLogsIngestion struct {
1922
1923 Endpoint *string `json:"endpoint,omitempty"`
1924 }
1925
1926
1927 func (dceI DataCollectionEndpointLogsIngestion) MarshalJSON() ([]byte, error) {
1928 objectMap := make(map[string]interface{})
1929 return json.Marshal(objectMap)
1930 }
1931
1932
1933 type DataCollectionEndpointNetworkAcls struct {
1934
1935 PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"`
1936 }
1937
1938
1939 type DataCollectionEndpointResource struct {
1940 autorest.Response `json:"-"`
1941
1942 *DataCollectionEndpointResourceProperties `json:"properties,omitempty"`
1943
1944 Location *string `json:"location,omitempty"`
1945
1946 Tags map[string]*string `json:"tags"`
1947
1948 Kind KnownDataCollectionEndpointResourceKind `json:"kind,omitempty"`
1949
1950 ID *string `json:"id,omitempty"`
1951
1952 Name *string `json:"name,omitempty"`
1953
1954 Type *string `json:"type,omitempty"`
1955
1956 Etag *string `json:"etag,omitempty"`
1957
1958 SystemData *DataCollectionEndpointResourceSystemData `json:"systemData,omitempty"`
1959 }
1960
1961
1962 func (dcer DataCollectionEndpointResource) MarshalJSON() ([]byte, error) {
1963 objectMap := make(map[string]interface{})
1964 if dcer.DataCollectionEndpointResourceProperties != nil {
1965 objectMap["properties"] = dcer.DataCollectionEndpointResourceProperties
1966 }
1967 if dcer.Location != nil {
1968 objectMap["location"] = dcer.Location
1969 }
1970 if dcer.Tags != nil {
1971 objectMap["tags"] = dcer.Tags
1972 }
1973 if dcer.Kind != "" {
1974 objectMap["kind"] = dcer.Kind
1975 }
1976 return json.Marshal(objectMap)
1977 }
1978
1979
1980 func (dcer *DataCollectionEndpointResource) UnmarshalJSON(body []byte) error {
1981 var m map[string]*json.RawMessage
1982 err := json.Unmarshal(body, &m)
1983 if err != nil {
1984 return err
1985 }
1986 for k, v := range m {
1987 switch k {
1988 case "properties":
1989 if v != nil {
1990 var dataCollectionEndpointResourceProperties DataCollectionEndpointResourceProperties
1991 err = json.Unmarshal(*v, &dataCollectionEndpointResourceProperties)
1992 if err != nil {
1993 return err
1994 }
1995 dcer.DataCollectionEndpointResourceProperties = &dataCollectionEndpointResourceProperties
1996 }
1997 case "location":
1998 if v != nil {
1999 var location string
2000 err = json.Unmarshal(*v, &location)
2001 if err != nil {
2002 return err
2003 }
2004 dcer.Location = &location
2005 }
2006 case "tags":
2007 if v != nil {
2008 var tags map[string]*string
2009 err = json.Unmarshal(*v, &tags)
2010 if err != nil {
2011 return err
2012 }
2013 dcer.Tags = tags
2014 }
2015 case "kind":
2016 if v != nil {
2017 var kind KnownDataCollectionEndpointResourceKind
2018 err = json.Unmarshal(*v, &kind)
2019 if err != nil {
2020 return err
2021 }
2022 dcer.Kind = kind
2023 }
2024 case "id":
2025 if v != nil {
2026 var ID string
2027 err = json.Unmarshal(*v, &ID)
2028 if err != nil {
2029 return err
2030 }
2031 dcer.ID = &ID
2032 }
2033 case "name":
2034 if v != nil {
2035 var name string
2036 err = json.Unmarshal(*v, &name)
2037 if err != nil {
2038 return err
2039 }
2040 dcer.Name = &name
2041 }
2042 case "type":
2043 if v != nil {
2044 var typeVar string
2045 err = json.Unmarshal(*v, &typeVar)
2046 if err != nil {
2047 return err
2048 }
2049 dcer.Type = &typeVar
2050 }
2051 case "etag":
2052 if v != nil {
2053 var etag string
2054 err = json.Unmarshal(*v, &etag)
2055 if err != nil {
2056 return err
2057 }
2058 dcer.Etag = &etag
2059 }
2060 case "systemData":
2061 if v != nil {
2062 var systemData DataCollectionEndpointResourceSystemData
2063 err = json.Unmarshal(*v, &systemData)
2064 if err != nil {
2065 return err
2066 }
2067 dcer.SystemData = &systemData
2068 }
2069 }
2070 }
2071
2072 return nil
2073 }
2074
2075
2076 type DataCollectionEndpointResourceListResult struct {
2077 autorest.Response `json:"-"`
2078
2079 Value *[]DataCollectionEndpointResource `json:"value,omitempty"`
2080
2081 NextLink *string `json:"nextLink,omitempty"`
2082 }
2083
2084
2085
2086 type DataCollectionEndpointResourceListResultIterator struct {
2087 i int
2088 page DataCollectionEndpointResourceListResultPage
2089 }
2090
2091
2092
2093 func (iter *DataCollectionEndpointResourceListResultIterator) NextWithContext(ctx context.Context) (err error) {
2094 if tracing.IsEnabled() {
2095 ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointResourceListResultIterator.NextWithContext")
2096 defer func() {
2097 sc := -1
2098 if iter.Response().Response.Response != nil {
2099 sc = iter.Response().Response.Response.StatusCode
2100 }
2101 tracing.EndSpan(ctx, sc, err)
2102 }()
2103 }
2104 iter.i++
2105 if iter.i < len(iter.page.Values()) {
2106 return nil
2107 }
2108 err = iter.page.NextWithContext(ctx)
2109 if err != nil {
2110 iter.i--
2111 return err
2112 }
2113 iter.i = 0
2114 return nil
2115 }
2116
2117
2118
2119
2120 func (iter *DataCollectionEndpointResourceListResultIterator) Next() error {
2121 return iter.NextWithContext(context.Background())
2122 }
2123
2124
2125 func (iter DataCollectionEndpointResourceListResultIterator) NotDone() bool {
2126 return iter.page.NotDone() && iter.i < len(iter.page.Values())
2127 }
2128
2129
2130 func (iter DataCollectionEndpointResourceListResultIterator) Response() DataCollectionEndpointResourceListResult {
2131 return iter.page.Response()
2132 }
2133
2134
2135
2136 func (iter DataCollectionEndpointResourceListResultIterator) Value() DataCollectionEndpointResource {
2137 if !iter.page.NotDone() {
2138 return DataCollectionEndpointResource{}
2139 }
2140 return iter.page.Values()[iter.i]
2141 }
2142
2143
2144 func NewDataCollectionEndpointResourceListResultIterator(page DataCollectionEndpointResourceListResultPage) DataCollectionEndpointResourceListResultIterator {
2145 return DataCollectionEndpointResourceListResultIterator{page: page}
2146 }
2147
2148
2149 func (dcerlr DataCollectionEndpointResourceListResult) IsEmpty() bool {
2150 return dcerlr.Value == nil || len(*dcerlr.Value) == 0
2151 }
2152
2153
2154 func (dcerlr DataCollectionEndpointResourceListResult) hasNextLink() bool {
2155 return dcerlr.NextLink != nil && len(*dcerlr.NextLink) != 0
2156 }
2157
2158
2159
2160 func (dcerlr DataCollectionEndpointResourceListResult) dataCollectionEndpointResourceListResultPreparer(ctx context.Context) (*http.Request, error) {
2161 if !dcerlr.hasNextLink() {
2162 return nil, nil
2163 }
2164 return autorest.Prepare((&http.Request{}).WithContext(ctx),
2165 autorest.AsJSON(),
2166 autorest.AsGet(),
2167 autorest.WithBaseURL(to.String(dcerlr.NextLink)))
2168 }
2169
2170
2171 type DataCollectionEndpointResourceListResultPage struct {
2172 fn func(context.Context, DataCollectionEndpointResourceListResult) (DataCollectionEndpointResourceListResult, error)
2173 dcerlr DataCollectionEndpointResourceListResult
2174 }
2175
2176
2177
2178 func (page *DataCollectionEndpointResourceListResultPage) NextWithContext(ctx context.Context) (err error) {
2179 if tracing.IsEnabled() {
2180 ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointResourceListResultPage.NextWithContext")
2181 defer func() {
2182 sc := -1
2183 if page.Response().Response.Response != nil {
2184 sc = page.Response().Response.Response.StatusCode
2185 }
2186 tracing.EndSpan(ctx, sc, err)
2187 }()
2188 }
2189 for {
2190 next, err := page.fn(ctx, page.dcerlr)
2191 if err != nil {
2192 return err
2193 }
2194 page.dcerlr = next
2195 if !next.hasNextLink() || !next.IsEmpty() {
2196 break
2197 }
2198 }
2199 return nil
2200 }
2201
2202
2203
2204
2205 func (page *DataCollectionEndpointResourceListResultPage) Next() error {
2206 return page.NextWithContext(context.Background())
2207 }
2208
2209
2210 func (page DataCollectionEndpointResourceListResultPage) NotDone() bool {
2211 return !page.dcerlr.IsEmpty()
2212 }
2213
2214
2215 func (page DataCollectionEndpointResourceListResultPage) Response() DataCollectionEndpointResourceListResult {
2216 return page.dcerlr
2217 }
2218
2219
2220 func (page DataCollectionEndpointResourceListResultPage) Values() []DataCollectionEndpointResource {
2221 if page.dcerlr.IsEmpty() {
2222 return nil
2223 }
2224 return *page.dcerlr.Value
2225 }
2226
2227
2228 func NewDataCollectionEndpointResourceListResultPage(cur DataCollectionEndpointResourceListResult, getNextPage func(context.Context, DataCollectionEndpointResourceListResult) (DataCollectionEndpointResourceListResult, error)) DataCollectionEndpointResourceListResultPage {
2229 return DataCollectionEndpointResourceListResultPage{
2230 fn: getNextPage,
2231 dcerlr: cur,
2232 }
2233 }
2234
2235
2236 type DataCollectionEndpointResourceProperties struct {
2237
2238 Description *string `json:"description,omitempty"`
2239
2240 ImmutableID *string `json:"immutableId,omitempty"`
2241
2242 ConfigurationAccess *DataCollectionEndpointConfigurationAccess `json:"configurationAccess,omitempty"`
2243
2244 LogsIngestion *DataCollectionEndpointLogsIngestion `json:"logsIngestion,omitempty"`
2245
2246 NetworkAcls *DataCollectionEndpointNetworkAcls `json:"networkAcls,omitempty"`
2247
2248 ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"`
2249 }
2250
2251
2252 func (dcer DataCollectionEndpointResourceProperties) MarshalJSON() ([]byte, error) {
2253 objectMap := make(map[string]interface{})
2254 if dcer.Description != nil {
2255 objectMap["description"] = dcer.Description
2256 }
2257 if dcer.ImmutableID != nil {
2258 objectMap["immutableId"] = dcer.ImmutableID
2259 }
2260 if dcer.ConfigurationAccess != nil {
2261 objectMap["configurationAccess"] = dcer.ConfigurationAccess
2262 }
2263 if dcer.LogsIngestion != nil {
2264 objectMap["logsIngestion"] = dcer.LogsIngestion
2265 }
2266 if dcer.NetworkAcls != nil {
2267 objectMap["networkAcls"] = dcer.NetworkAcls
2268 }
2269 return json.Marshal(objectMap)
2270 }
2271
2272
2273
2274 type DataCollectionEndpointResourceSystemData struct {
2275
2276 CreatedBy *string `json:"createdBy,omitempty"`
2277
2278 CreatedByType CreatedByType `json:"createdByType,omitempty"`
2279
2280 CreatedAt *date.Time `json:"createdAt,omitempty"`
2281
2282 LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
2283
2284 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
2285
2286 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
2287 }
2288
2289
2290 type DataCollectionRule struct {
2291
2292 Description *string `json:"description,omitempty"`
2293
2294 ImmutableID *string `json:"immutableId,omitempty"`
2295
2296
2297 DataSources *DataCollectionRuleDataSources `json:"dataSources,omitempty"`
2298
2299 Destinations *DataCollectionRuleDestinations `json:"destinations,omitempty"`
2300
2301 DataFlows *[]DataFlow `json:"dataFlows,omitempty"`
2302
2303 ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"`
2304 }
2305
2306
2307 func (dcr DataCollectionRule) MarshalJSON() ([]byte, error) {
2308 objectMap := make(map[string]interface{})
2309 if dcr.Description != nil {
2310 objectMap["description"] = dcr.Description
2311 }
2312 if dcr.DataSources != nil {
2313 objectMap["dataSources"] = dcr.DataSources
2314 }
2315 if dcr.Destinations != nil {
2316 objectMap["destinations"] = dcr.Destinations
2317 }
2318 if dcr.DataFlows != nil {
2319 objectMap["dataFlows"] = dcr.DataFlows
2320 }
2321 return json.Marshal(objectMap)
2322 }
2323
2324
2325
2326 type DataCollectionRuleAssociation struct {
2327
2328 Description *string `json:"description,omitempty"`
2329
2330 DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"`
2331
2332 DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"`
2333
2334 ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"`
2335 }
2336
2337
2338 func (dcra DataCollectionRuleAssociation) MarshalJSON() ([]byte, error) {
2339 objectMap := make(map[string]interface{})
2340 if dcra.Description != nil {
2341 objectMap["description"] = dcra.Description
2342 }
2343 if dcra.DataCollectionRuleID != nil {
2344 objectMap["dataCollectionRuleId"] = dcra.DataCollectionRuleID
2345 }
2346 if dcra.DataCollectionEndpointID != nil {
2347 objectMap["dataCollectionEndpointId"] = dcra.DataCollectionEndpointID
2348 }
2349 return json.Marshal(objectMap)
2350 }
2351
2352
2353 type DataCollectionRuleAssociationProxyOnlyResource struct {
2354 autorest.Response `json:"-"`
2355
2356 *DataCollectionRuleAssociationProxyOnlyResourceProperties `json:"properties,omitempty"`
2357
2358 ID *string `json:"id,omitempty"`
2359
2360 Name *string `json:"name,omitempty"`
2361
2362 Type *string `json:"type,omitempty"`
2363
2364 Etag *string `json:"etag,omitempty"`
2365
2366 SystemData *DataCollectionRuleAssociationProxyOnlyResourceSystemData `json:"systemData,omitempty"`
2367 }
2368
2369
2370 func (dcrapor DataCollectionRuleAssociationProxyOnlyResource) MarshalJSON() ([]byte, error) {
2371 objectMap := make(map[string]interface{})
2372 if dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties != nil {
2373 objectMap["properties"] = dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties
2374 }
2375 return json.Marshal(objectMap)
2376 }
2377
2378
2379 func (dcrapor *DataCollectionRuleAssociationProxyOnlyResource) UnmarshalJSON(body []byte) error {
2380 var m map[string]*json.RawMessage
2381 err := json.Unmarshal(body, &m)
2382 if err != nil {
2383 return err
2384 }
2385 for k, v := range m {
2386 switch k {
2387 case "properties":
2388 if v != nil {
2389 var dataCollectionRuleAssociationProxyOnlyResourceProperties DataCollectionRuleAssociationProxyOnlyResourceProperties
2390 err = json.Unmarshal(*v, &dataCollectionRuleAssociationProxyOnlyResourceProperties)
2391 if err != nil {
2392 return err
2393 }
2394 dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties = &dataCollectionRuleAssociationProxyOnlyResourceProperties
2395 }
2396 case "id":
2397 if v != nil {
2398 var ID string
2399 err = json.Unmarshal(*v, &ID)
2400 if err != nil {
2401 return err
2402 }
2403 dcrapor.ID = &ID
2404 }
2405 case "name":
2406 if v != nil {
2407 var name string
2408 err = json.Unmarshal(*v, &name)
2409 if err != nil {
2410 return err
2411 }
2412 dcrapor.Name = &name
2413 }
2414 case "type":
2415 if v != nil {
2416 var typeVar string
2417 err = json.Unmarshal(*v, &typeVar)
2418 if err != nil {
2419 return err
2420 }
2421 dcrapor.Type = &typeVar
2422 }
2423 case "etag":
2424 if v != nil {
2425 var etag string
2426 err = json.Unmarshal(*v, &etag)
2427 if err != nil {
2428 return err
2429 }
2430 dcrapor.Etag = &etag
2431 }
2432 case "systemData":
2433 if v != nil {
2434 var systemData DataCollectionRuleAssociationProxyOnlyResourceSystemData
2435 err = json.Unmarshal(*v, &systemData)
2436 if err != nil {
2437 return err
2438 }
2439 dcrapor.SystemData = &systemData
2440 }
2441 }
2442 }
2443
2444 return nil
2445 }
2446
2447
2448 type DataCollectionRuleAssociationProxyOnlyResourceListResult struct {
2449 autorest.Response `json:"-"`
2450
2451 Value *[]DataCollectionRuleAssociationProxyOnlyResource `json:"value,omitempty"`
2452
2453 NextLink *string `json:"nextLink,omitempty"`
2454 }
2455
2456
2457
2458 type DataCollectionRuleAssociationProxyOnlyResourceListResultIterator struct {
2459 i int
2460 page DataCollectionRuleAssociationProxyOnlyResourceListResultPage
2461 }
2462
2463
2464
2465 func (iter *DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) NextWithContext(ctx context.Context) (err error) {
2466 if tracing.IsEnabled() {
2467 ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationProxyOnlyResourceListResultIterator.NextWithContext")
2468 defer func() {
2469 sc := -1
2470 if iter.Response().Response.Response != nil {
2471 sc = iter.Response().Response.Response.StatusCode
2472 }
2473 tracing.EndSpan(ctx, sc, err)
2474 }()
2475 }
2476 iter.i++
2477 if iter.i < len(iter.page.Values()) {
2478 return nil
2479 }
2480 err = iter.page.NextWithContext(ctx)
2481 if err != nil {
2482 iter.i--
2483 return err
2484 }
2485 iter.i = 0
2486 return nil
2487 }
2488
2489
2490
2491
2492 func (iter *DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Next() error {
2493 return iter.NextWithContext(context.Background())
2494 }
2495
2496
2497 func (iter DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) NotDone() bool {
2498 return iter.page.NotDone() && iter.i < len(iter.page.Values())
2499 }
2500
2501
2502 func (iter DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Response() DataCollectionRuleAssociationProxyOnlyResourceListResult {
2503 return iter.page.Response()
2504 }
2505
2506
2507
2508 func (iter DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Value() DataCollectionRuleAssociationProxyOnlyResource {
2509 if !iter.page.NotDone() {
2510 return DataCollectionRuleAssociationProxyOnlyResource{}
2511 }
2512 return iter.page.Values()[iter.i]
2513 }
2514
2515
2516 func NewDataCollectionRuleAssociationProxyOnlyResourceListResultIterator(page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) DataCollectionRuleAssociationProxyOnlyResourceListResultIterator {
2517 return DataCollectionRuleAssociationProxyOnlyResourceListResultIterator{page: page}
2518 }
2519
2520
2521 func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) IsEmpty() bool {
2522 return dcraporlr.Value == nil || len(*dcraporlr.Value) == 0
2523 }
2524
2525
2526 func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) hasNextLink() bool {
2527 return dcraporlr.NextLink != nil && len(*dcraporlr.NextLink) != 0
2528 }
2529
2530
2531
2532 func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer(ctx context.Context) (*http.Request, error) {
2533 if !dcraporlr.hasNextLink() {
2534 return nil, nil
2535 }
2536 return autorest.Prepare((&http.Request{}).WithContext(ctx),
2537 autorest.AsJSON(),
2538 autorest.AsGet(),
2539 autorest.WithBaseURL(to.String(dcraporlr.NextLink)))
2540 }
2541
2542
2543
2544 type DataCollectionRuleAssociationProxyOnlyResourceListResultPage struct {
2545 fn func(context.Context, DataCollectionRuleAssociationProxyOnlyResourceListResult) (DataCollectionRuleAssociationProxyOnlyResourceListResult, error)
2546 dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult
2547 }
2548
2549
2550
2551 func (page *DataCollectionRuleAssociationProxyOnlyResourceListResultPage) NextWithContext(ctx context.Context) (err error) {
2552 if tracing.IsEnabled() {
2553 ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationProxyOnlyResourceListResultPage.NextWithContext")
2554 defer func() {
2555 sc := -1
2556 if page.Response().Response.Response != nil {
2557 sc = page.Response().Response.Response.StatusCode
2558 }
2559 tracing.EndSpan(ctx, sc, err)
2560 }()
2561 }
2562 for {
2563 next, err := page.fn(ctx, page.dcraporlr)
2564 if err != nil {
2565 return err
2566 }
2567 page.dcraporlr = next
2568 if !next.hasNextLink() || !next.IsEmpty() {
2569 break
2570 }
2571 }
2572 return nil
2573 }
2574
2575
2576
2577
2578 func (page *DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Next() error {
2579 return page.NextWithContext(context.Background())
2580 }
2581
2582
2583 func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) NotDone() bool {
2584 return !page.dcraporlr.IsEmpty()
2585 }
2586
2587
2588 func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Response() DataCollectionRuleAssociationProxyOnlyResourceListResult {
2589 return page.dcraporlr
2590 }
2591
2592
2593 func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Values() []DataCollectionRuleAssociationProxyOnlyResource {
2594 if page.dcraporlr.IsEmpty() {
2595 return nil
2596 }
2597 return *page.dcraporlr.Value
2598 }
2599
2600
2601 func NewDataCollectionRuleAssociationProxyOnlyResourceListResultPage(cur DataCollectionRuleAssociationProxyOnlyResourceListResult, getNextPage func(context.Context, DataCollectionRuleAssociationProxyOnlyResourceListResult) (DataCollectionRuleAssociationProxyOnlyResourceListResult, error)) DataCollectionRuleAssociationProxyOnlyResourceListResultPage {
2602 return DataCollectionRuleAssociationProxyOnlyResourceListResultPage{
2603 fn: getNextPage,
2604 dcraporlr: cur,
2605 }
2606 }
2607
2608
2609 type DataCollectionRuleAssociationProxyOnlyResourceProperties struct {
2610
2611 Description *string `json:"description,omitempty"`
2612
2613 DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"`
2614
2615 DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"`
2616
2617 ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"`
2618 }
2619
2620
2621 func (dcrapor DataCollectionRuleAssociationProxyOnlyResourceProperties) MarshalJSON() ([]byte, error) {
2622 objectMap := make(map[string]interface{})
2623 if dcrapor.Description != nil {
2624 objectMap["description"] = dcrapor.Description
2625 }
2626 if dcrapor.DataCollectionRuleID != nil {
2627 objectMap["dataCollectionRuleId"] = dcrapor.DataCollectionRuleID
2628 }
2629 if dcrapor.DataCollectionEndpointID != nil {
2630 objectMap["dataCollectionEndpointId"] = dcrapor.DataCollectionEndpointID
2631 }
2632 return json.Marshal(objectMap)
2633 }
2634
2635
2636
2637 type DataCollectionRuleAssociationProxyOnlyResourceSystemData struct {
2638
2639 CreatedBy *string `json:"createdBy,omitempty"`
2640
2641 CreatedByType CreatedByType `json:"createdByType,omitempty"`
2642
2643 CreatedAt *date.Time `json:"createdAt,omitempty"`
2644
2645 LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
2646
2647 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
2648
2649 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
2650 }
2651
2652
2653
2654
2655 type DataCollectionRuleDataSources struct {
2656
2657 PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"`
2658
2659 WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"`
2660
2661 Syslog *[]SyslogDataSource `json:"syslog,omitempty"`
2662
2663 Extensions *[]ExtensionDataSource `json:"extensions,omitempty"`
2664 }
2665
2666
2667 type DataCollectionRuleDestinations struct {
2668
2669 LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"`
2670
2671 AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"`
2672 }
2673
2674
2675 type DataCollectionRuleResource struct {
2676 autorest.Response `json:"-"`
2677
2678 *DataCollectionRuleResourceProperties `json:"properties,omitempty"`
2679
2680 Location *string `json:"location,omitempty"`
2681
2682 Tags map[string]*string `json:"tags"`
2683
2684 Kind KnownDataCollectionRuleResourceKind `json:"kind,omitempty"`
2685
2686 ID *string `json:"id,omitempty"`
2687
2688 Name *string `json:"name,omitempty"`
2689
2690 Type *string `json:"type,omitempty"`
2691
2692 Etag *string `json:"etag,omitempty"`
2693
2694 SystemData *DataCollectionRuleResourceSystemData `json:"systemData,omitempty"`
2695 }
2696
2697
2698 func (dcrr DataCollectionRuleResource) MarshalJSON() ([]byte, error) {
2699 objectMap := make(map[string]interface{})
2700 if dcrr.DataCollectionRuleResourceProperties != nil {
2701 objectMap["properties"] = dcrr.DataCollectionRuleResourceProperties
2702 }
2703 if dcrr.Location != nil {
2704 objectMap["location"] = dcrr.Location
2705 }
2706 if dcrr.Tags != nil {
2707 objectMap["tags"] = dcrr.Tags
2708 }
2709 if dcrr.Kind != "" {
2710 objectMap["kind"] = dcrr.Kind
2711 }
2712 return json.Marshal(objectMap)
2713 }
2714
2715
2716 func (dcrr *DataCollectionRuleResource) UnmarshalJSON(body []byte) error {
2717 var m map[string]*json.RawMessage
2718 err := json.Unmarshal(body, &m)
2719 if err != nil {
2720 return err
2721 }
2722 for k, v := range m {
2723 switch k {
2724 case "properties":
2725 if v != nil {
2726 var dataCollectionRuleResourceProperties DataCollectionRuleResourceProperties
2727 err = json.Unmarshal(*v, &dataCollectionRuleResourceProperties)
2728 if err != nil {
2729 return err
2730 }
2731 dcrr.DataCollectionRuleResourceProperties = &dataCollectionRuleResourceProperties
2732 }
2733 case "location":
2734 if v != nil {
2735 var location string
2736 err = json.Unmarshal(*v, &location)
2737 if err != nil {
2738 return err
2739 }
2740 dcrr.Location = &location
2741 }
2742 case "tags":
2743 if v != nil {
2744 var tags map[string]*string
2745 err = json.Unmarshal(*v, &tags)
2746 if err != nil {
2747 return err
2748 }
2749 dcrr.Tags = tags
2750 }
2751 case "kind":
2752 if v != nil {
2753 var kind KnownDataCollectionRuleResourceKind
2754 err = json.Unmarshal(*v, &kind)
2755 if err != nil {
2756 return err
2757 }
2758 dcrr.Kind = kind
2759 }
2760 case "id":
2761 if v != nil {
2762 var ID string
2763 err = json.Unmarshal(*v, &ID)
2764 if err != nil {
2765 return err
2766 }
2767 dcrr.ID = &ID
2768 }
2769 case "name":
2770 if v != nil {
2771 var name string
2772 err = json.Unmarshal(*v, &name)
2773 if err != nil {
2774 return err
2775 }
2776 dcrr.Name = &name
2777 }
2778 case "type":
2779 if v != nil {
2780 var typeVar string
2781 err = json.Unmarshal(*v, &typeVar)
2782 if err != nil {
2783 return err
2784 }
2785 dcrr.Type = &typeVar
2786 }
2787 case "etag":
2788 if v != nil {
2789 var etag string
2790 err = json.Unmarshal(*v, &etag)
2791 if err != nil {
2792 return err
2793 }
2794 dcrr.Etag = &etag
2795 }
2796 case "systemData":
2797 if v != nil {
2798 var systemData DataCollectionRuleResourceSystemData
2799 err = json.Unmarshal(*v, &systemData)
2800 if err != nil {
2801 return err
2802 }
2803 dcrr.SystemData = &systemData
2804 }
2805 }
2806 }
2807
2808 return nil
2809 }
2810
2811
2812 type DataCollectionRuleResourceListResult struct {
2813 autorest.Response `json:"-"`
2814
2815 Value *[]DataCollectionRuleResource `json:"value,omitempty"`
2816
2817 NextLink *string `json:"nextLink,omitempty"`
2818 }
2819
2820
2821
2822 type DataCollectionRuleResourceListResultIterator struct {
2823 i int
2824 page DataCollectionRuleResourceListResultPage
2825 }
2826
2827
2828
2829 func (iter *DataCollectionRuleResourceListResultIterator) NextWithContext(ctx context.Context) (err error) {
2830 if tracing.IsEnabled() {
2831 ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleResourceListResultIterator.NextWithContext")
2832 defer func() {
2833 sc := -1
2834 if iter.Response().Response.Response != nil {
2835 sc = iter.Response().Response.Response.StatusCode
2836 }
2837 tracing.EndSpan(ctx, sc, err)
2838 }()
2839 }
2840 iter.i++
2841 if iter.i < len(iter.page.Values()) {
2842 return nil
2843 }
2844 err = iter.page.NextWithContext(ctx)
2845 if err != nil {
2846 iter.i--
2847 return err
2848 }
2849 iter.i = 0
2850 return nil
2851 }
2852
2853
2854
2855
2856 func (iter *DataCollectionRuleResourceListResultIterator) Next() error {
2857 return iter.NextWithContext(context.Background())
2858 }
2859
2860
2861 func (iter DataCollectionRuleResourceListResultIterator) NotDone() bool {
2862 return iter.page.NotDone() && iter.i < len(iter.page.Values())
2863 }
2864
2865
2866 func (iter DataCollectionRuleResourceListResultIterator) Response() DataCollectionRuleResourceListResult {
2867 return iter.page.Response()
2868 }
2869
2870
2871
2872 func (iter DataCollectionRuleResourceListResultIterator) Value() DataCollectionRuleResource {
2873 if !iter.page.NotDone() {
2874 return DataCollectionRuleResource{}
2875 }
2876 return iter.page.Values()[iter.i]
2877 }
2878
2879
2880 func NewDataCollectionRuleResourceListResultIterator(page DataCollectionRuleResourceListResultPage) DataCollectionRuleResourceListResultIterator {
2881 return DataCollectionRuleResourceListResultIterator{page: page}
2882 }
2883
2884
2885 func (dcrrlr DataCollectionRuleResourceListResult) IsEmpty() bool {
2886 return dcrrlr.Value == nil || len(*dcrrlr.Value) == 0
2887 }
2888
2889
2890 func (dcrrlr DataCollectionRuleResourceListResult) hasNextLink() bool {
2891 return dcrrlr.NextLink != nil && len(*dcrrlr.NextLink) != 0
2892 }
2893
2894
2895
2896 func (dcrrlr DataCollectionRuleResourceListResult) dataCollectionRuleResourceListResultPreparer(ctx context.Context) (*http.Request, error) {
2897 if !dcrrlr.hasNextLink() {
2898 return nil, nil
2899 }
2900 return autorest.Prepare((&http.Request{}).WithContext(ctx),
2901 autorest.AsJSON(),
2902 autorest.AsGet(),
2903 autorest.WithBaseURL(to.String(dcrrlr.NextLink)))
2904 }
2905
2906
2907 type DataCollectionRuleResourceListResultPage struct {
2908 fn func(context.Context, DataCollectionRuleResourceListResult) (DataCollectionRuleResourceListResult, error)
2909 dcrrlr DataCollectionRuleResourceListResult
2910 }
2911
2912
2913
2914 func (page *DataCollectionRuleResourceListResultPage) NextWithContext(ctx context.Context) (err error) {
2915 if tracing.IsEnabled() {
2916 ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleResourceListResultPage.NextWithContext")
2917 defer func() {
2918 sc := -1
2919 if page.Response().Response.Response != nil {
2920 sc = page.Response().Response.Response.StatusCode
2921 }
2922 tracing.EndSpan(ctx, sc, err)
2923 }()
2924 }
2925 for {
2926 next, err := page.fn(ctx, page.dcrrlr)
2927 if err != nil {
2928 return err
2929 }
2930 page.dcrrlr = next
2931 if !next.hasNextLink() || !next.IsEmpty() {
2932 break
2933 }
2934 }
2935 return nil
2936 }
2937
2938
2939
2940
2941 func (page *DataCollectionRuleResourceListResultPage) Next() error {
2942 return page.NextWithContext(context.Background())
2943 }
2944
2945
2946 func (page DataCollectionRuleResourceListResultPage) NotDone() bool {
2947 return !page.dcrrlr.IsEmpty()
2948 }
2949
2950
2951 func (page DataCollectionRuleResourceListResultPage) Response() DataCollectionRuleResourceListResult {
2952 return page.dcrrlr
2953 }
2954
2955
2956 func (page DataCollectionRuleResourceListResultPage) Values() []DataCollectionRuleResource {
2957 if page.dcrrlr.IsEmpty() {
2958 return nil
2959 }
2960 return *page.dcrrlr.Value
2961 }
2962
2963
2964 func NewDataCollectionRuleResourceListResultPage(cur DataCollectionRuleResourceListResult, getNextPage func(context.Context, DataCollectionRuleResourceListResult) (DataCollectionRuleResourceListResult, error)) DataCollectionRuleResourceListResultPage {
2965 return DataCollectionRuleResourceListResultPage{
2966 fn: getNextPage,
2967 dcrrlr: cur,
2968 }
2969 }
2970
2971
2972 type DataCollectionRuleResourceProperties struct {
2973
2974 Description *string `json:"description,omitempty"`
2975
2976 ImmutableID *string `json:"immutableId,omitempty"`
2977
2978
2979 DataSources *DataCollectionRuleDataSources `json:"dataSources,omitempty"`
2980
2981 Destinations *DataCollectionRuleDestinations `json:"destinations,omitempty"`
2982
2983 DataFlows *[]DataFlow `json:"dataFlows,omitempty"`
2984
2985 ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"`
2986 }
2987
2988
2989 func (dcrr DataCollectionRuleResourceProperties) MarshalJSON() ([]byte, error) {
2990 objectMap := make(map[string]interface{})
2991 if dcrr.Description != nil {
2992 objectMap["description"] = dcrr.Description
2993 }
2994 if dcrr.DataSources != nil {
2995 objectMap["dataSources"] = dcrr.DataSources
2996 }
2997 if dcrr.Destinations != nil {
2998 objectMap["destinations"] = dcrr.Destinations
2999 }
3000 if dcrr.DataFlows != nil {
3001 objectMap["dataFlows"] = dcrr.DataFlows
3002 }
3003 return json.Marshal(objectMap)
3004 }
3005
3006
3007
3008 type DataCollectionRuleResourceSystemData struct {
3009
3010 CreatedBy *string `json:"createdBy,omitempty"`
3011
3012 CreatedByType CreatedByType `json:"createdByType,omitempty"`
3013
3014 CreatedAt *date.Time `json:"createdAt,omitempty"`
3015
3016 LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
3017
3018 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
3019
3020 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
3021 }
3022
3023
3024 type DataContainer struct {
3025
3026 Workspace *WorkspaceInfo `json:"workspace,omitempty"`
3027 }
3028
3029
3030 type DataFlow struct {
3031
3032 Streams *[]KnownDataFlowStreams `json:"streams,omitempty"`
3033
3034 Destinations *[]string `json:"destinations,omitempty"`
3035 }
3036
3037
3038 type DataSourcesSpec struct {
3039
3040 PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"`
3041
3042 WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"`
3043
3044 Syslog *[]SyslogDataSource `json:"syslog,omitempty"`
3045
3046 Extensions *[]ExtensionDataSource `json:"extensions,omitempty"`
3047 }
3048
3049
3050 type DestinationsSpec struct {
3051
3052 LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"`
3053
3054 AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"`
3055 }
3056
3057
3058 type DestinationsSpecAzureMonitorMetrics struct {
3059
3060
3061 Name *string `json:"name,omitempty"`
3062 }
3063
3064
3065 type DiagnosticSettings struct {
3066
3067 StorageAccountID *string `json:"storageAccountId,omitempty"`
3068
3069 ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"`
3070
3071 EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"`
3072
3073 EventHubName *string `json:"eventHubName,omitempty"`
3074
3075 Metrics *[]MetricSettings `json:"metrics,omitempty"`
3076
3077 Logs *[]LogSettings `json:"logs,omitempty"`
3078
3079 WorkspaceID *string `json:"workspaceId,omitempty"`
3080
3081 LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"`
3082 }
3083
3084
3085 type DiagnosticSettingsCategory struct {
3086
3087 CategoryType CategoryType `json:"categoryType,omitempty"`
3088 }
3089
3090
3091 type DiagnosticSettingsCategoryResource struct {
3092 autorest.Response `json:"-"`
3093
3094 *DiagnosticSettingsCategory `json:"properties,omitempty"`
3095
3096 ID *string `json:"id,omitempty"`
3097
3098 Name *string `json:"name,omitempty"`
3099
3100 Type *string `json:"type,omitempty"`
3101 }
3102
3103
3104 func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) {
3105 objectMap := make(map[string]interface{})
3106 if dscr.DiagnosticSettingsCategory != nil {
3107 objectMap["properties"] = dscr.DiagnosticSettingsCategory
3108 }
3109 return json.Marshal(objectMap)
3110 }
3111
3112
3113 func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error {
3114 var m map[string]*json.RawMessage
3115 err := json.Unmarshal(body, &m)
3116 if err != nil {
3117 return err
3118 }
3119 for k, v := range m {
3120 switch k {
3121 case "properties":
3122 if v != nil {
3123 var diagnosticSettingsCategory DiagnosticSettingsCategory
3124 err = json.Unmarshal(*v, &diagnosticSettingsCategory)
3125 if err != nil {
3126 return err
3127 }
3128 dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory
3129 }
3130 case "id":
3131 if v != nil {
3132 var ID string
3133 err = json.Unmarshal(*v, &ID)
3134 if err != nil {
3135 return err
3136 }
3137 dscr.ID = &ID
3138 }
3139 case "name":
3140 if v != nil {
3141 var name string
3142 err = json.Unmarshal(*v, &name)
3143 if err != nil {
3144 return err
3145 }
3146 dscr.Name = &name
3147 }
3148 case "type":
3149 if v != nil {
3150 var typeVar string
3151 err = json.Unmarshal(*v, &typeVar)
3152 if err != nil {
3153 return err
3154 }
3155 dscr.Type = &typeVar
3156 }
3157 }
3158 }
3159
3160 return nil
3161 }
3162
3163
3164
3165 type DiagnosticSettingsCategoryResourceCollection struct {
3166 autorest.Response `json:"-"`
3167
3168 Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"`
3169 }
3170
3171
3172 type DiagnosticSettingsResource struct {
3173 autorest.Response `json:"-"`
3174
3175 *DiagnosticSettings `json:"properties,omitempty"`
3176
3177 ID *string `json:"id,omitempty"`
3178
3179 Name *string `json:"name,omitempty"`
3180
3181 Type *string `json:"type,omitempty"`
3182 }
3183
3184
3185 func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) {
3186 objectMap := make(map[string]interface{})
3187 if dsr.DiagnosticSettings != nil {
3188 objectMap["properties"] = dsr.DiagnosticSettings
3189 }
3190 return json.Marshal(objectMap)
3191 }
3192
3193
3194 func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error {
3195 var m map[string]*json.RawMessage
3196 err := json.Unmarshal(body, &m)
3197 if err != nil {
3198 return err
3199 }
3200 for k, v := range m {
3201 switch k {
3202 case "properties":
3203 if v != nil {
3204 var diagnosticSettings DiagnosticSettings
3205 err = json.Unmarshal(*v, &diagnosticSettings)
3206 if err != nil {
3207 return err
3208 }
3209 dsr.DiagnosticSettings = &diagnosticSettings
3210 }
3211 case "id":
3212 if v != nil {
3213 var ID string
3214 err = json.Unmarshal(*v, &ID)
3215 if err != nil {
3216 return err
3217 }
3218 dsr.ID = &ID
3219 }
3220 case "name":
3221 if v != nil {
3222 var name string
3223 err = json.Unmarshal(*v, &name)
3224 if err != nil {
3225 return err
3226 }
3227 dsr.Name = &name
3228 }
3229 case "type":
3230 if v != nil {
3231 var typeVar string
3232 err = json.Unmarshal(*v, &typeVar)
3233 if err != nil {
3234 return err
3235 }
3236 dsr.Type = &typeVar
3237 }
3238 }
3239 }
3240
3241 return nil
3242 }
3243
3244
3245 type DiagnosticSettingsResourceCollection struct {
3246 autorest.Response `json:"-"`
3247
3248 Value *[]DiagnosticSettingsResource `json:"value,omitempty"`
3249 }
3250
3251
3252 type Dimension struct {
3253
3254 Name *string `json:"name,omitempty"`
3255
3256 Operator *string `json:"operator,omitempty"`
3257
3258 Values *[]string `json:"values,omitempty"`
3259 }
3260
3261
3262 type DynamicMetricCriteria struct {
3263
3264 Operator DynamicThresholdOperator `json:"operator,omitempty"`
3265
3266 AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"`
3267
3268 FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"`
3269
3270 IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"`
3271
3272 AdditionalProperties map[string]interface{} `json:""`
3273
3274 Name *string `json:"name,omitempty"`
3275
3276 MetricName *string `json:"metricName,omitempty"`
3277
3278 MetricNamespace *string `json:"metricNamespace,omitempty"`
3279
3280 TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"`
3281
3282 Dimensions *[]MetricDimension `json:"dimensions,omitempty"`
3283
3284 SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"`
3285
3286 CriterionType CriterionType `json:"criterionType,omitempty"`
3287 }
3288
3289
3290 func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) {
3291 dmc.CriterionType = CriterionTypeDynamicThresholdCriterion
3292 objectMap := make(map[string]interface{})
3293 if dmc.Operator != "" {
3294 objectMap["operator"] = dmc.Operator
3295 }
3296 if dmc.AlertSensitivity != "" {
3297 objectMap["alertSensitivity"] = dmc.AlertSensitivity
3298 }
3299 if dmc.FailingPeriods != nil {
3300 objectMap["failingPeriods"] = dmc.FailingPeriods
3301 }
3302 if dmc.IgnoreDataBefore != nil {
3303 objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore
3304 }
3305 if dmc.Name != nil {
3306 objectMap["name"] = dmc.Name
3307 }
3308 if dmc.MetricName != nil {
3309 objectMap["metricName"] = dmc.MetricName
3310 }
3311 if dmc.MetricNamespace != nil {
3312 objectMap["metricNamespace"] = dmc.MetricNamespace
3313 }
3314 if dmc.TimeAggregation != "" {
3315 objectMap["timeAggregation"] = dmc.TimeAggregation
3316 }
3317 if dmc.Dimensions != nil {
3318 objectMap["dimensions"] = dmc.Dimensions
3319 }
3320 if dmc.SkipMetricValidation != nil {
3321 objectMap["skipMetricValidation"] = dmc.SkipMetricValidation
3322 }
3323 if dmc.CriterionType != "" {
3324 objectMap["criterionType"] = dmc.CriterionType
3325 }
3326 for k, v := range dmc.AdditionalProperties {
3327 objectMap[k] = v
3328 }
3329 return json.Marshal(objectMap)
3330 }
3331
3332
3333 func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) {
3334 return nil, false
3335 }
3336
3337
3338 func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) {
3339 return &dmc, true
3340 }
3341
3342
3343 func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) {
3344 return nil, false
3345 }
3346
3347
3348 func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) {
3349 return &dmc, true
3350 }
3351
3352
3353 func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error {
3354 var m map[string]*json.RawMessage
3355 err := json.Unmarshal(body, &m)
3356 if err != nil {
3357 return err
3358 }
3359 for k, v := range m {
3360 switch k {
3361 case "operator":
3362 if v != nil {
3363 var operator DynamicThresholdOperator
3364 err = json.Unmarshal(*v, &operator)
3365 if err != nil {
3366 return err
3367 }
3368 dmc.Operator = operator
3369 }
3370 case "alertSensitivity":
3371 if v != nil {
3372 var alertSensitivity DynamicThresholdSensitivity
3373 err = json.Unmarshal(*v, &alertSensitivity)
3374 if err != nil {
3375 return err
3376 }
3377 dmc.AlertSensitivity = alertSensitivity
3378 }
3379 case "failingPeriods":
3380 if v != nil {
3381 var failingPeriods DynamicThresholdFailingPeriods
3382 err = json.Unmarshal(*v, &failingPeriods)
3383 if err != nil {
3384 return err
3385 }
3386 dmc.FailingPeriods = &failingPeriods
3387 }
3388 case "ignoreDataBefore":
3389 if v != nil {
3390 var ignoreDataBefore date.Time
3391 err = json.Unmarshal(*v, &ignoreDataBefore)
3392 if err != nil {
3393 return err
3394 }
3395 dmc.IgnoreDataBefore = &ignoreDataBefore
3396 }
3397 default:
3398 if v != nil {
3399 var additionalProperties interface{}
3400 err = json.Unmarshal(*v, &additionalProperties)
3401 if err != nil {
3402 return err
3403 }
3404 if dmc.AdditionalProperties == nil {
3405 dmc.AdditionalProperties = make(map[string]interface{})
3406 }
3407 dmc.AdditionalProperties[k] = additionalProperties
3408 }
3409 case "name":
3410 if v != nil {
3411 var name string
3412 err = json.Unmarshal(*v, &name)
3413 if err != nil {
3414 return err
3415 }
3416 dmc.Name = &name
3417 }
3418 case "metricName":
3419 if v != nil {
3420 var metricName string
3421 err = json.Unmarshal(*v, &metricName)
3422 if err != nil {
3423 return err
3424 }
3425 dmc.MetricName = &metricName
3426 }
3427 case "metricNamespace":
3428 if v != nil {
3429 var metricNamespace string
3430 err = json.Unmarshal(*v, &metricNamespace)
3431 if err != nil {
3432 return err
3433 }
3434 dmc.MetricNamespace = &metricNamespace
3435 }
3436 case "timeAggregation":
3437 if v != nil {
3438 var timeAggregation AggregationTypeEnum
3439 err = json.Unmarshal(*v, &timeAggregation)
3440 if err != nil {
3441 return err
3442 }
3443 dmc.TimeAggregation = timeAggregation
3444 }
3445 case "dimensions":
3446 if v != nil {
3447 var dimensions []MetricDimension
3448 err = json.Unmarshal(*v, &dimensions)
3449 if err != nil {
3450 return err
3451 }
3452 dmc.Dimensions = &dimensions
3453 }
3454 case "skipMetricValidation":
3455 if v != nil {
3456 var skipMetricValidation bool
3457 err = json.Unmarshal(*v, &skipMetricValidation)
3458 if err != nil {
3459 return err
3460 }
3461 dmc.SkipMetricValidation = &skipMetricValidation
3462 }
3463 case "criterionType":
3464 if v != nil {
3465 var criterionType CriterionType
3466 err = json.Unmarshal(*v, &criterionType)
3467 if err != nil {
3468 return err
3469 }
3470 dmc.CriterionType = criterionType
3471 }
3472 }
3473 }
3474
3475 return nil
3476 }
3477
3478
3479
3480 type DynamicThresholdFailingPeriods struct {
3481
3482 NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"`
3483
3484 MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"`
3485 }
3486
3487
3488 type EmailNotification struct {
3489
3490 SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"`
3491
3492 SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"`
3493
3494 CustomEmails *[]string `json:"customEmails,omitempty"`
3495 }
3496
3497
3498 type EmailReceiver struct {
3499
3500 Name *string `json:"name,omitempty"`
3501
3502 EmailAddress *string `json:"emailAddress,omitempty"`
3503
3504 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"`
3505
3506 Status ReceiverStatus `json:"status,omitempty"`
3507 }
3508
3509
3510 func (er EmailReceiver) MarshalJSON() ([]byte, error) {
3511 objectMap := make(map[string]interface{})
3512 if er.Name != nil {
3513 objectMap["name"] = er.Name
3514 }
3515 if er.EmailAddress != nil {
3516 objectMap["emailAddress"] = er.EmailAddress
3517 }
3518 if er.UseCommonAlertSchema != nil {
3519 objectMap["useCommonAlertSchema"] = er.UseCommonAlertSchema
3520 }
3521 return json.Marshal(objectMap)
3522 }
3523
3524
3525 type EnableRequest struct {
3526
3527 ReceiverName *string `json:"receiverName,omitempty"`
3528 }
3529
3530
3531 type Error struct {
3532
3533 Code *string `json:"code,omitempty"`
3534
3535 Message *string `json:"message,omitempty"`
3536 }
3537
3538
3539 type ErrorAdditionalInfo struct {
3540
3541 Type *string `json:"type,omitempty"`
3542
3543 Info interface{} `json:"info,omitempty"`
3544 }
3545
3546
3547 func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
3548 objectMap := make(map[string]interface{})
3549 return json.Marshal(objectMap)
3550 }
3551
3552
3553 type ErrorContract struct {
3554
3555 Error *ErrorResponse `json:"error,omitempty"`
3556 }
3557
3558
3559 type ErrorDetail struct {
3560
3561 Code *string `json:"code,omitempty"`
3562
3563 Message *string `json:"message,omitempty"`
3564
3565 Target *string `json:"target,omitempty"`
3566
3567 Details *[]ErrorDetail `json:"details,omitempty"`
3568
3569 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
3570 }
3571
3572
3573 func (ed ErrorDetail) MarshalJSON() ([]byte, error) {
3574 objectMap := make(map[string]interface{})
3575 return json.Marshal(objectMap)
3576 }
3577
3578
3579 type ErrorResponse struct {
3580
3581 Code *string `json:"code,omitempty"`
3582
3583 Message *string `json:"message,omitempty"`
3584 }
3585
3586
3587 type ErrorResponseCommon struct {
3588
3589 Details *[]ErrorResponseCommon `json:"details,omitempty"`
3590
3591 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
3592
3593 Code *string `json:"code,omitempty"`
3594
3595 Message *string `json:"message,omitempty"`
3596 }
3597
3598
3599 func (erc ErrorResponseCommon) MarshalJSON() ([]byte, error) {
3600 objectMap := make(map[string]interface{})
3601 if erc.Code != nil {
3602 objectMap["code"] = erc.Code
3603 }
3604 if erc.Message != nil {
3605 objectMap["message"] = erc.Message
3606 }
3607 return json.Marshal(objectMap)
3608 }
3609
3610
3611
3612 type ErrorResponseCommonV2 struct {
3613
3614 Error *ErrorDetail `json:"error,omitempty"`
3615 }
3616
3617
3618
3619 type EventCategoryCollection struct {
3620 autorest.Response `json:"-"`
3621
3622 Value *[]LocalizableString `json:"value,omitempty"`
3623 }
3624
3625
3626 type EventData struct {
3627
3628 Authorization *SenderAuthorization `json:"authorization,omitempty"`
3629
3630 Claims map[string]*string `json:"claims"`
3631
3632 Caller *string `json:"caller,omitempty"`
3633
3634 Description *string `json:"description,omitempty"`
3635
3636 ID *string `json:"id,omitempty"`
3637
3638 EventDataID *string `json:"eventDataId,omitempty"`
3639
3640 CorrelationID *string `json:"correlationId,omitempty"`
3641
3642 EventName *LocalizableString `json:"eventName,omitempty"`
3643
3644 Category *LocalizableString `json:"category,omitempty"`
3645
3646 HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"`
3647
3648 Level EventLevel `json:"level,omitempty"`
3649
3650 ResourceGroupName *string `json:"resourceGroupName,omitempty"`
3651
3652 ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"`
3653
3654 ResourceID *string `json:"resourceId,omitempty"`
3655
3656 ResourceType *LocalizableString `json:"resourceType,omitempty"`
3657
3658 OperationID *string `json:"operationId,omitempty"`
3659
3660 OperationName *LocalizableString `json:"operationName,omitempty"`
3661
3662 Properties map[string]*string `json:"properties"`
3663
3664 Status *LocalizableString `json:"status,omitempty"`
3665
3666 SubStatus *LocalizableString `json:"subStatus,omitempty"`
3667
3668 EventTimestamp *date.Time `json:"eventTimestamp,omitempty"`
3669
3670 SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"`
3671
3672 SubscriptionID *string `json:"subscriptionId,omitempty"`
3673
3674 TenantID *string `json:"tenantId,omitempty"`
3675 }
3676
3677
3678 func (ed EventData) MarshalJSON() ([]byte, error) {
3679 objectMap := make(map[string]interface{})
3680 return json.Marshal(objectMap)
3681 }
3682
3683
3684 type EventDataCollection struct {
3685 autorest.Response `json:"-"`
3686
3687 Value *[]EventData `json:"value,omitempty"`
3688
3689 NextLink *string `json:"nextLink,omitempty"`
3690 }
3691
3692
3693 type EventDataCollectionIterator struct {
3694 i int
3695 page EventDataCollectionPage
3696 }
3697
3698
3699
3700 func (iter *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) {
3701 if tracing.IsEnabled() {
3702 ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.NextWithContext")
3703 defer func() {
3704 sc := -1
3705 if iter.Response().Response.Response != nil {
3706 sc = iter.Response().Response.Response.StatusCode
3707 }
3708 tracing.EndSpan(ctx, sc, err)
3709 }()
3710 }
3711 iter.i++
3712 if iter.i < len(iter.page.Values()) {
3713 return nil
3714 }
3715 err = iter.page.NextWithContext(ctx)
3716 if err != nil {
3717 iter.i--
3718 return err
3719 }
3720 iter.i = 0
3721 return nil
3722 }
3723
3724
3725
3726
3727 func (iter *EventDataCollectionIterator) Next() error {
3728 return iter.NextWithContext(context.Background())
3729 }
3730
3731
3732 func (iter EventDataCollectionIterator) NotDone() bool {
3733 return iter.page.NotDone() && iter.i < len(iter.page.Values())
3734 }
3735
3736
3737 func (iter EventDataCollectionIterator) Response() EventDataCollection {
3738 return iter.page.Response()
3739 }
3740
3741
3742
3743 func (iter EventDataCollectionIterator) Value() EventData {
3744 if !iter.page.NotDone() {
3745 return EventData{}
3746 }
3747 return iter.page.Values()[iter.i]
3748 }
3749
3750
3751 func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator {
3752 return EventDataCollectionIterator{page: page}
3753 }
3754
3755
3756 func (edc EventDataCollection) IsEmpty() bool {
3757 return edc.Value == nil || len(*edc.Value) == 0
3758 }
3759
3760
3761 func (edc EventDataCollection) hasNextLink() bool {
3762 return edc.NextLink != nil && len(*edc.NextLink) != 0
3763 }
3764
3765
3766
3767 func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) {
3768 if !edc.hasNextLink() {
3769 return nil, nil
3770 }
3771 return autorest.Prepare((&http.Request{}).WithContext(ctx),
3772 autorest.AsJSON(),
3773 autorest.AsGet(),
3774 autorest.WithBaseURL(to.String(edc.NextLink)))
3775 }
3776
3777
3778 type EventDataCollectionPage struct {
3779 fn func(context.Context, EventDataCollection) (EventDataCollection, error)
3780 edc EventDataCollection
3781 }
3782
3783
3784
3785 func (page *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) {
3786 if tracing.IsEnabled() {
3787 ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.NextWithContext")
3788 defer func() {
3789 sc := -1
3790 if page.Response().Response.Response != nil {
3791 sc = page.Response().Response.Response.StatusCode
3792 }
3793 tracing.EndSpan(ctx, sc, err)
3794 }()
3795 }
3796 for {
3797 next, err := page.fn(ctx, page.edc)
3798 if err != nil {
3799 return err
3800 }
3801 page.edc = next
3802 if !next.hasNextLink() || !next.IsEmpty() {
3803 break
3804 }
3805 }
3806 return nil
3807 }
3808
3809
3810
3811
3812 func (page *EventDataCollectionPage) Next() error {
3813 return page.NextWithContext(context.Background())
3814 }
3815
3816
3817 func (page EventDataCollectionPage) NotDone() bool {
3818 return !page.edc.IsEmpty()
3819 }
3820
3821
3822 func (page EventDataCollectionPage) Response() EventDataCollection {
3823 return page.edc
3824 }
3825
3826
3827 func (page EventDataCollectionPage) Values() []EventData {
3828 if page.edc.IsEmpty() {
3829 return nil
3830 }
3831 return *page.edc.Value
3832 }
3833
3834
3835 func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage {
3836 return EventDataCollectionPage{
3837 fn: getNextPage,
3838 edc: cur,
3839 }
3840 }
3841
3842
3843
3844
3845 type ExtensionDataSource struct {
3846
3847
3848 Streams *[]KnownExtensionDataSourceStreams `json:"streams,omitempty"`
3849
3850 ExtensionName *string `json:"extensionName,omitempty"`
3851
3852 ExtensionSettings interface{} `json:"extensionSettings,omitempty"`
3853
3854 InputDataSources *[]string `json:"inputDataSources,omitempty"`
3855
3856
3857 Name *string `json:"name,omitempty"`
3858 }
3859
3860
3861 type HTTPRequestInfo struct {
3862
3863 ClientRequestID *string `json:"clientRequestId,omitempty"`
3864
3865 ClientIPAddress *string `json:"clientIpAddress,omitempty"`
3866
3867 Method *string `json:"method,omitempty"`
3868
3869 URI *string `json:"uri,omitempty"`
3870 }
3871
3872
3873 type Incident struct {
3874 autorest.Response `json:"-"`
3875
3876 Name *string `json:"name,omitempty"`
3877
3878 RuleName *string `json:"ruleName,omitempty"`
3879
3880 IsActive *bool `json:"isActive,omitempty"`
3881
3882 ActivatedTime *date.Time `json:"activatedTime,omitempty"`
3883
3884 ResolvedTime *date.Time `json:"resolvedTime,omitempty"`
3885 }
3886
3887
3888 func (i Incident) MarshalJSON() ([]byte, error) {
3889 objectMap := make(map[string]interface{})
3890 return json.Marshal(objectMap)
3891 }
3892
3893
3894 type IncidentListResult struct {
3895 autorest.Response `json:"-"`
3896
3897 Value *[]Incident `json:"value,omitempty"`
3898 }
3899
3900
3901 type ItsmReceiver struct {
3902
3903 Name *string `json:"name,omitempty"`
3904
3905 WorkspaceID *string `json:"workspaceId,omitempty"`
3906
3907 ConnectionID *string `json:"connectionId,omitempty"`
3908
3909 TicketConfiguration *string `json:"ticketConfiguration,omitempty"`
3910
3911 Region *string `json:"region,omitempty"`
3912 }
3913
3914
3915 type LocalizableString struct {
3916
3917 Value *string `json:"value,omitempty"`
3918
3919 LocalizedValue *string `json:"localizedValue,omitempty"`
3920 }
3921
3922
3923 type LocationThresholdRuleCondition struct {
3924
3925 WindowSize *string `json:"windowSize,omitempty"`
3926
3927 FailedLocationCount *int32 `json:"failedLocationCount,omitempty"`
3928
3929 DataSource BasicRuleDataSource `json:"dataSource,omitempty"`
3930
3931 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"`
3932 }
3933
3934
3935 func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) {
3936 ltrc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition
3937 objectMap := make(map[string]interface{})
3938 if ltrc.WindowSize != nil {
3939 objectMap["windowSize"] = ltrc.WindowSize
3940 }
3941 if ltrc.FailedLocationCount != nil {
3942 objectMap["failedLocationCount"] = ltrc.FailedLocationCount
3943 }
3944 objectMap["dataSource"] = ltrc.DataSource
3945 if ltrc.OdataType != "" {
3946 objectMap["odata.type"] = ltrc.OdataType
3947 }
3948 return json.Marshal(objectMap)
3949 }
3950
3951
3952 func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
3953 return nil, false
3954 }
3955
3956
3957 func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
3958 return <rc, true
3959 }
3960
3961
3962 func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
3963 return nil, false
3964 }
3965
3966
3967 func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) {
3968 return nil, false
3969 }
3970
3971
3972 func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) {
3973 return <rc, true
3974 }
3975
3976
3977 func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error {
3978 var m map[string]*json.RawMessage
3979 err := json.Unmarshal(body, &m)
3980 if err != nil {
3981 return err
3982 }
3983 for k, v := range m {
3984 switch k {
3985 case "windowSize":
3986 if v != nil {
3987 var windowSize string
3988 err = json.Unmarshal(*v, &windowSize)
3989 if err != nil {
3990 return err
3991 }
3992 ltrc.WindowSize = &windowSize
3993 }
3994 case "failedLocationCount":
3995 if v != nil {
3996 var failedLocationCount int32
3997 err = json.Unmarshal(*v, &failedLocationCount)
3998 if err != nil {
3999 return err
4000 }
4001 ltrc.FailedLocationCount = &failedLocationCount
4002 }
4003 case "dataSource":
4004 if v != nil {
4005 dataSource, err := unmarshalBasicRuleDataSource(*v)
4006 if err != nil {
4007 return err
4008 }
4009 ltrc.DataSource = dataSource
4010 }
4011 case "odata.type":
4012 if v != nil {
4013 var odataType OdataTypeBasicRuleCondition
4014 err = json.Unmarshal(*v, &odataType)
4015 if err != nil {
4016 return err
4017 }
4018 ltrc.OdataType = odataType
4019 }
4020 }
4021 }
4022
4023 return nil
4024 }
4025
4026
4027 type LogAnalyticsDestination struct {
4028
4029 WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"`
4030
4031 WorkspaceID *string `json:"workspaceId,omitempty"`
4032
4033
4034 Name *string `json:"name,omitempty"`
4035 }
4036
4037
4038 func (lad LogAnalyticsDestination) MarshalJSON() ([]byte, error) {
4039 objectMap := make(map[string]interface{})
4040 if lad.WorkspaceResourceID != nil {
4041 objectMap["workspaceResourceId"] = lad.WorkspaceResourceID
4042 }
4043 if lad.Name != nil {
4044 objectMap["name"] = lad.Name
4045 }
4046 return json.Marshal(objectMap)
4047 }
4048
4049
4050 type LogicAppReceiver struct {
4051
4052 Name *string `json:"name,omitempty"`
4053
4054 ResourceID *string `json:"resourceId,omitempty"`
4055
4056 CallbackURL *string `json:"callbackUrl,omitempty"`
4057
4058 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"`
4059 }
4060
4061
4062 type LogMetricTrigger struct {
4063
4064 ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"`
4065
4066 Threshold *float64 `json:"threshold,omitempty"`
4067
4068 MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"`
4069
4070 MetricColumn *string `json:"metricColumn,omitempty"`
4071 }
4072
4073
4074 type LogProfileCollection struct {
4075 autorest.Response `json:"-"`
4076
4077 Value *[]LogProfileResource `json:"value,omitempty"`
4078 }
4079
4080
4081 type LogProfileProperties struct {
4082
4083 StorageAccountID *string `json:"storageAccountId,omitempty"`
4084
4085 ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"`
4086
4087 Locations *[]string `json:"locations,omitempty"`
4088
4089 Categories *[]string `json:"categories,omitempty"`
4090
4091 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
4092 }
4093
4094
4095 type LogProfileResource struct {
4096 autorest.Response `json:"-"`
4097
4098 *LogProfileProperties `json:"properties,omitempty"`
4099
4100 ID *string `json:"id,omitempty"`
4101
4102 Name *string `json:"name,omitempty"`
4103
4104 Type *string `json:"type,omitempty"`
4105
4106 Location *string `json:"location,omitempty"`
4107
4108 Tags map[string]*string `json:"tags"`
4109
4110 Kind *string `json:"kind,omitempty"`
4111
4112 Etag *string `json:"etag,omitempty"`
4113 }
4114
4115
4116 func (lpr LogProfileResource) MarshalJSON() ([]byte, error) {
4117 objectMap := make(map[string]interface{})
4118 if lpr.LogProfileProperties != nil {
4119 objectMap["properties"] = lpr.LogProfileProperties
4120 }
4121 if lpr.Location != nil {
4122 objectMap["location"] = lpr.Location
4123 }
4124 if lpr.Tags != nil {
4125 objectMap["tags"] = lpr.Tags
4126 }
4127 return json.Marshal(objectMap)
4128 }
4129
4130
4131 func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error {
4132 var m map[string]*json.RawMessage
4133 err := json.Unmarshal(body, &m)
4134 if err != nil {
4135 return err
4136 }
4137 for k, v := range m {
4138 switch k {
4139 case "properties":
4140 if v != nil {
4141 var logProfileProperties LogProfileProperties
4142 err = json.Unmarshal(*v, &logProfileProperties)
4143 if err != nil {
4144 return err
4145 }
4146 lpr.LogProfileProperties = &logProfileProperties
4147 }
4148 case "id":
4149 if v != nil {
4150 var ID string
4151 err = json.Unmarshal(*v, &ID)
4152 if err != nil {
4153 return err
4154 }
4155 lpr.ID = &ID
4156 }
4157 case "name":
4158 if v != nil {
4159 var name string
4160 err = json.Unmarshal(*v, &name)
4161 if err != nil {
4162 return err
4163 }
4164 lpr.Name = &name
4165 }
4166 case "type":
4167 if v != nil {
4168 var typeVar string
4169 err = json.Unmarshal(*v, &typeVar)
4170 if err != nil {
4171 return err
4172 }
4173 lpr.Type = &typeVar
4174 }
4175 case "location":
4176 if v != nil {
4177 var location string
4178 err = json.Unmarshal(*v, &location)
4179 if err != nil {
4180 return err
4181 }
4182 lpr.Location = &location
4183 }
4184 case "tags":
4185 if v != nil {
4186 var tags map[string]*string
4187 err = json.Unmarshal(*v, &tags)
4188 if err != nil {
4189 return err
4190 }
4191 lpr.Tags = tags
4192 }
4193 case "kind":
4194 if v != nil {
4195 var kind string
4196 err = json.Unmarshal(*v, &kind)
4197 if err != nil {
4198 return err
4199 }
4200 lpr.Kind = &kind
4201 }
4202 case "etag":
4203 if v != nil {
4204 var etag string
4205 err = json.Unmarshal(*v, &etag)
4206 if err != nil {
4207 return err
4208 }
4209 lpr.Etag = &etag
4210 }
4211 }
4212 }
4213
4214 return nil
4215 }
4216
4217
4218 type LogProfileResourcePatch struct {
4219
4220 Tags map[string]*string `json:"tags"`
4221
4222 *LogProfileProperties `json:"properties,omitempty"`
4223 }
4224
4225
4226 func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) {
4227 objectMap := make(map[string]interface{})
4228 if lprp.Tags != nil {
4229 objectMap["tags"] = lprp.Tags
4230 }
4231 if lprp.LogProfileProperties != nil {
4232 objectMap["properties"] = lprp.LogProfileProperties
4233 }
4234 return json.Marshal(objectMap)
4235 }
4236
4237
4238 func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error {
4239 var m map[string]*json.RawMessage
4240 err := json.Unmarshal(body, &m)
4241 if err != nil {
4242 return err
4243 }
4244 for k, v := range m {
4245 switch k {
4246 case "tags":
4247 if v != nil {
4248 var tags map[string]*string
4249 err = json.Unmarshal(*v, &tags)
4250 if err != nil {
4251 return err
4252 }
4253 lprp.Tags = tags
4254 }
4255 case "properties":
4256 if v != nil {
4257 var logProfileProperties LogProfileProperties
4258 err = json.Unmarshal(*v, &logProfileProperties)
4259 if err != nil {
4260 return err
4261 }
4262 lprp.LogProfileProperties = &logProfileProperties
4263 }
4264 }
4265 }
4266
4267 return nil
4268 }
4269
4270
4271 type LogSearchRule struct {
4272
4273 CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty"`
4274
4275 IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"`
4276
4277 Description *string `json:"description,omitempty"`
4278
4279 DisplayName *string `json:"displayName,omitempty"`
4280
4281 AutoMitigate *bool `json:"autoMitigate,omitempty"`
4282
4283 Enabled Enabled `json:"enabled,omitempty"`
4284
4285 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
4286
4287 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
4288
4289 Source *Source `json:"source,omitempty"`
4290
4291 Schedule *Schedule `json:"schedule,omitempty"`
4292
4293 Action BasicAction `json:"action,omitempty"`
4294 }
4295
4296
4297 func (lsr LogSearchRule) MarshalJSON() ([]byte, error) {
4298 objectMap := make(map[string]interface{})
4299 if lsr.Description != nil {
4300 objectMap["description"] = lsr.Description
4301 }
4302 if lsr.DisplayName != nil {
4303 objectMap["displayName"] = lsr.DisplayName
4304 }
4305 if lsr.AutoMitigate != nil {
4306 objectMap["autoMitigate"] = lsr.AutoMitigate
4307 }
4308 if lsr.Enabled != "" {
4309 objectMap["enabled"] = lsr.Enabled
4310 }
4311 if lsr.Source != nil {
4312 objectMap["source"] = lsr.Source
4313 }
4314 if lsr.Schedule != nil {
4315 objectMap["schedule"] = lsr.Schedule
4316 }
4317 objectMap["action"] = lsr.Action
4318 return json.Marshal(objectMap)
4319 }
4320
4321
4322 func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error {
4323 var m map[string]*json.RawMessage
4324 err := json.Unmarshal(body, &m)
4325 if err != nil {
4326 return err
4327 }
4328 for k, v := range m {
4329 switch k {
4330 case "createdWithApiVersion":
4331 if v != nil {
4332 var createdWithAPIVersion string
4333 err = json.Unmarshal(*v, &createdWithAPIVersion)
4334 if err != nil {
4335 return err
4336 }
4337 lsr.CreatedWithAPIVersion = &createdWithAPIVersion
4338 }
4339 case "isLegacyLogAnalyticsRule":
4340 if v != nil {
4341 var isLegacyLogAnalyticsRule bool
4342 err = json.Unmarshal(*v, &isLegacyLogAnalyticsRule)
4343 if err != nil {
4344 return err
4345 }
4346 lsr.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule
4347 }
4348 case "description":
4349 if v != nil {
4350 var description string
4351 err = json.Unmarshal(*v, &description)
4352 if err != nil {
4353 return err
4354 }
4355 lsr.Description = &description
4356 }
4357 case "displayName":
4358 if v != nil {
4359 var displayName string
4360 err = json.Unmarshal(*v, &displayName)
4361 if err != nil {
4362 return err
4363 }
4364 lsr.DisplayName = &displayName
4365 }
4366 case "autoMitigate":
4367 if v != nil {
4368 var autoMitigate bool
4369 err = json.Unmarshal(*v, &autoMitigate)
4370 if err != nil {
4371 return err
4372 }
4373 lsr.AutoMitigate = &autoMitigate
4374 }
4375 case "enabled":
4376 if v != nil {
4377 var enabled Enabled
4378 err = json.Unmarshal(*v, &enabled)
4379 if err != nil {
4380 return err
4381 }
4382 lsr.Enabled = enabled
4383 }
4384 case "lastUpdatedTime":
4385 if v != nil {
4386 var lastUpdatedTime date.Time
4387 err = json.Unmarshal(*v, &lastUpdatedTime)
4388 if err != nil {
4389 return err
4390 }
4391 lsr.LastUpdatedTime = &lastUpdatedTime
4392 }
4393 case "provisioningState":
4394 if v != nil {
4395 var provisioningState ProvisioningState
4396 err = json.Unmarshal(*v, &provisioningState)
4397 if err != nil {
4398 return err
4399 }
4400 lsr.ProvisioningState = provisioningState
4401 }
4402 case "source":
4403 if v != nil {
4404 var source Source
4405 err = json.Unmarshal(*v, &source)
4406 if err != nil {
4407 return err
4408 }
4409 lsr.Source = &source
4410 }
4411 case "schedule":
4412 if v != nil {
4413 var schedule Schedule
4414 err = json.Unmarshal(*v, &schedule)
4415 if err != nil {
4416 return err
4417 }
4418 lsr.Schedule = &schedule
4419 }
4420 case "action":
4421 if v != nil {
4422 action, err := unmarshalBasicAction(*v)
4423 if err != nil {
4424 return err
4425 }
4426 lsr.Action = action
4427 }
4428 }
4429 }
4430
4431 return nil
4432 }
4433
4434
4435 type LogSearchRulePatch struct {
4436
4437 Enabled Enabled `json:"enabled,omitempty"`
4438 }
4439
4440
4441 type LogSearchRuleResource struct {
4442 autorest.Response `json:"-"`
4443
4444 *LogSearchRule `json:"properties,omitempty"`
4445
4446 ID *string `json:"id,omitempty"`
4447
4448 Name *string `json:"name,omitempty"`
4449
4450 Type *string `json:"type,omitempty"`
4451
4452 Location *string `json:"location,omitempty"`
4453
4454 Tags map[string]*string `json:"tags"`
4455
4456 Kind *string `json:"kind,omitempty"`
4457
4458 Etag *string `json:"etag,omitempty"`
4459 }
4460
4461
4462 func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) {
4463 objectMap := make(map[string]interface{})
4464 if lsrr.LogSearchRule != nil {
4465 objectMap["properties"] = lsrr.LogSearchRule
4466 }
4467 if lsrr.Location != nil {
4468 objectMap["location"] = lsrr.Location
4469 }
4470 if lsrr.Tags != nil {
4471 objectMap["tags"] = lsrr.Tags
4472 }
4473 return json.Marshal(objectMap)
4474 }
4475
4476
4477 func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error {
4478 var m map[string]*json.RawMessage
4479 err := json.Unmarshal(body, &m)
4480 if err != nil {
4481 return err
4482 }
4483 for k, v := range m {
4484 switch k {
4485 case "properties":
4486 if v != nil {
4487 var logSearchRule LogSearchRule
4488 err = json.Unmarshal(*v, &logSearchRule)
4489 if err != nil {
4490 return err
4491 }
4492 lsrr.LogSearchRule = &logSearchRule
4493 }
4494 case "id":
4495 if v != nil {
4496 var ID string
4497 err = json.Unmarshal(*v, &ID)
4498 if err != nil {
4499 return err
4500 }
4501 lsrr.ID = &ID
4502 }
4503 case "name":
4504 if v != nil {
4505 var name string
4506 err = json.Unmarshal(*v, &name)
4507 if err != nil {
4508 return err
4509 }
4510 lsrr.Name = &name
4511 }
4512 case "type":
4513 if v != nil {
4514 var typeVar string
4515 err = json.Unmarshal(*v, &typeVar)
4516 if err != nil {
4517 return err
4518 }
4519 lsrr.Type = &typeVar
4520 }
4521 case "location":
4522 if v != nil {
4523 var location string
4524 err = json.Unmarshal(*v, &location)
4525 if err != nil {
4526 return err
4527 }
4528 lsrr.Location = &location
4529 }
4530 case "tags":
4531 if v != nil {
4532 var tags map[string]*string
4533 err = json.Unmarshal(*v, &tags)
4534 if err != nil {
4535 return err
4536 }
4537 lsrr.Tags = tags
4538 }
4539 case "kind":
4540 if v != nil {
4541 var kind string
4542 err = json.Unmarshal(*v, &kind)
4543 if err != nil {
4544 return err
4545 }
4546 lsrr.Kind = &kind
4547 }
4548 case "etag":
4549 if v != nil {
4550 var etag string
4551 err = json.Unmarshal(*v, &etag)
4552 if err != nil {
4553 return err
4554 }
4555 lsrr.Etag = &etag
4556 }
4557 }
4558 }
4559
4560 return nil
4561 }
4562
4563
4564 type LogSearchRuleResourceCollection struct {
4565 autorest.Response `json:"-"`
4566
4567 Value *[]LogSearchRuleResource `json:"value,omitempty"`
4568 }
4569
4570
4571 type LogSearchRuleResourcePatch struct {
4572
4573 Tags map[string]*string `json:"tags"`
4574
4575 *LogSearchRulePatch `json:"properties,omitempty"`
4576 }
4577
4578
4579 func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) {
4580 objectMap := make(map[string]interface{})
4581 if lsrrp.Tags != nil {
4582 objectMap["tags"] = lsrrp.Tags
4583 }
4584 if lsrrp.LogSearchRulePatch != nil {
4585 objectMap["properties"] = lsrrp.LogSearchRulePatch
4586 }
4587 return json.Marshal(objectMap)
4588 }
4589
4590
4591 func (lsrrp *LogSearchRuleResourcePatch) UnmarshalJSON(body []byte) error {
4592 var m map[string]*json.RawMessage
4593 err := json.Unmarshal(body, &m)
4594 if err != nil {
4595 return err
4596 }
4597 for k, v := range m {
4598 switch k {
4599 case "tags":
4600 if v != nil {
4601 var tags map[string]*string
4602 err = json.Unmarshal(*v, &tags)
4603 if err != nil {
4604 return err
4605 }
4606 lsrrp.Tags = tags
4607 }
4608 case "properties":
4609 if v != nil {
4610 var logSearchRulePatch LogSearchRulePatch
4611 err = json.Unmarshal(*v, &logSearchRulePatch)
4612 if err != nil {
4613 return err
4614 }
4615 lsrrp.LogSearchRulePatch = &logSearchRulePatch
4616 }
4617 }
4618 }
4619
4620 return nil
4621 }
4622
4623
4624 type LogSettings struct {
4625
4626 Category *string `json:"category,omitempty"`
4627
4628 Enabled *bool `json:"enabled,omitempty"`
4629
4630 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
4631 }
4632
4633
4634 type LogsIngestionEndpointSpec struct {
4635
4636 Endpoint *string `json:"endpoint,omitempty"`
4637 }
4638
4639
4640 func (lies LogsIngestionEndpointSpec) MarshalJSON() ([]byte, error) {
4641 objectMap := make(map[string]interface{})
4642 return json.Marshal(objectMap)
4643 }
4644
4645
4646 type LogToMetricAction struct {
4647
4648 Criteria *[]Criteria `json:"criteria,omitempty"`
4649
4650 OdataType OdataTypeBasicAction `json:"odata.type,omitempty"`
4651 }
4652
4653
4654 func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) {
4655 ltma.OdataType = OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction
4656 objectMap := make(map[string]interface{})
4657 if ltma.Criteria != nil {
4658 objectMap["criteria"] = ltma.Criteria
4659 }
4660 if ltma.OdataType != "" {
4661 objectMap["odata.type"] = ltma.OdataType
4662 }
4663 return json.Marshal(objectMap)
4664 }
4665
4666
4667 func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) {
4668 return nil, false
4669 }
4670
4671
4672 func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) {
4673 return <ma, true
4674 }
4675
4676
4677 func (ltma LogToMetricAction) AsAction() (*Action, bool) {
4678 return nil, false
4679 }
4680
4681
4682 func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) {
4683 return <ma, true
4684 }
4685
4686
4687 type ManagementEventAggregationCondition struct {
4688
4689 Operator ConditionOperator `json:"operator,omitempty"`
4690
4691 Threshold *float64 `json:"threshold,omitempty"`
4692
4693 WindowSize *string `json:"windowSize,omitempty"`
4694 }
4695
4696
4697 type ManagementEventRuleCondition struct {
4698
4699 Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"`
4700
4701 DataSource BasicRuleDataSource `json:"dataSource,omitempty"`
4702
4703 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"`
4704 }
4705
4706
4707 func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) {
4708 merc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition
4709 objectMap := make(map[string]interface{})
4710 if merc.Aggregation != nil {
4711 objectMap["aggregation"] = merc.Aggregation
4712 }
4713 objectMap["dataSource"] = merc.DataSource
4714 if merc.OdataType != "" {
4715 objectMap["odata.type"] = merc.OdataType
4716 }
4717 return json.Marshal(objectMap)
4718 }
4719
4720
4721 func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
4722 return nil, false
4723 }
4724
4725
4726 func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
4727 return nil, false
4728 }
4729
4730
4731 func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
4732 return &merc, true
4733 }
4734
4735
4736 func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) {
4737 return nil, false
4738 }
4739
4740
4741 func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) {
4742 return &merc, true
4743 }
4744
4745
4746 func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error {
4747 var m map[string]*json.RawMessage
4748 err := json.Unmarshal(body, &m)
4749 if err != nil {
4750 return err
4751 }
4752 for k, v := range m {
4753 switch k {
4754 case "aggregation":
4755 if v != nil {
4756 var aggregation ManagementEventAggregationCondition
4757 err = json.Unmarshal(*v, &aggregation)
4758 if err != nil {
4759 return err
4760 }
4761 merc.Aggregation = &aggregation
4762 }
4763 case "dataSource":
4764 if v != nil {
4765 dataSource, err := unmarshalBasicRuleDataSource(*v)
4766 if err != nil {
4767 return err
4768 }
4769 merc.DataSource = dataSource
4770 }
4771 case "odata.type":
4772 if v != nil {
4773 var odataType OdataTypeBasicRuleCondition
4774 err = json.Unmarshal(*v, &odataType)
4775 if err != nil {
4776 return err
4777 }
4778 merc.OdataType = odataType
4779 }
4780 }
4781 }
4782
4783 return nil
4784 }
4785
4786
4787 type MetadataValue struct {
4788
4789 Name *LocalizableString `json:"name,omitempty"`
4790
4791 Value *string `json:"value,omitempty"`
4792 }
4793
4794
4795 type Metric struct {
4796
4797 ID *string `json:"id,omitempty"`
4798
4799 Type *string `json:"type,omitempty"`
4800
4801 Name *LocalizableString `json:"name,omitempty"`
4802
4803 DisplayDescription *string `json:"displayDescription,omitempty"`
4804
4805 ErrorCode *string `json:"errorCode,omitempty"`
4806
4807 ErrorMessage *string `json:"errorMessage,omitempty"`
4808
4809 Unit MetricUnit `json:"unit,omitempty"`
4810
4811 Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"`
4812 }
4813
4814
4815 type MetricAlertAction struct {
4816
4817 ActionGroupID *string `json:"actionGroupId,omitempty"`
4818
4819 WebHookProperties map[string]*string `json:"webHookProperties"`
4820 }
4821
4822
4823 func (maa MetricAlertAction) MarshalJSON() ([]byte, error) {
4824 objectMap := make(map[string]interface{})
4825 if maa.ActionGroupID != nil {
4826 objectMap["actionGroupId"] = maa.ActionGroupID
4827 }
4828 if maa.WebHookProperties != nil {
4829 objectMap["webHookProperties"] = maa.WebHookProperties
4830 }
4831 return json.Marshal(objectMap)
4832 }
4833
4834
4835 type BasicMetricAlertCriteria interface {
4836 AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool)
4837 AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool)
4838 AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool)
4839 AsMetricAlertCriteria() (*MetricAlertCriteria, bool)
4840 }
4841
4842
4843 type MetricAlertCriteria struct {
4844
4845 AdditionalProperties map[string]interface{} `json:""`
4846
4847 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"`
4848 }
4849
4850 func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) {
4851 var m map[string]interface{}
4852 err := json.Unmarshal(body, &m)
4853 if err != nil {
4854 return nil, err
4855 }
4856
4857 switch m["odata.type"] {
4858 case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria):
4859 var masrmmc MetricAlertSingleResourceMultipleMetricCriteria
4860 err := json.Unmarshal(body, &masrmmc)
4861 return masrmmc, err
4862 case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria):
4863 var wlac WebtestLocationAvailabilityCriteria
4864 err := json.Unmarshal(body, &wlac)
4865 return wlac, err
4866 case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria):
4867 var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria
4868 err := json.Unmarshal(body, &mamrmmc)
4869 return mamrmmc, err
4870 default:
4871 var mac MetricAlertCriteria
4872 err := json.Unmarshal(body, &mac)
4873 return mac, err
4874 }
4875 }
4876 func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) {
4877 var rawMessages []*json.RawMessage
4878 err := json.Unmarshal(body, &rawMessages)
4879 if err != nil {
4880 return nil, err
4881 }
4882
4883 macArray := make([]BasicMetricAlertCriteria, len(rawMessages))
4884
4885 for index, rawMessage := range rawMessages {
4886 mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage)
4887 if err != nil {
4888 return nil, err
4889 }
4890 macArray[index] = mac
4891 }
4892 return macArray, nil
4893 }
4894
4895
4896 func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) {
4897 mac.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria
4898 objectMap := make(map[string]interface{})
4899 if mac.OdataType != "" {
4900 objectMap["odata.type"] = mac.OdataType
4901 }
4902 for k, v := range mac.AdditionalProperties {
4903 objectMap[k] = v
4904 }
4905 return json.Marshal(objectMap)
4906 }
4907
4908
4909 func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) {
4910 return nil, false
4911 }
4912
4913
4914 func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) {
4915 return nil, false
4916 }
4917
4918
4919 func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) {
4920 return nil, false
4921 }
4922
4923
4924 func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) {
4925 return &mac, true
4926 }
4927
4928
4929 func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) {
4930 return &mac, true
4931 }
4932
4933
4934 func (mac *MetricAlertCriteria) UnmarshalJSON(body []byte) error {
4935 var m map[string]*json.RawMessage
4936 err := json.Unmarshal(body, &m)
4937 if err != nil {
4938 return err
4939 }
4940 for k, v := range m {
4941 switch k {
4942 default:
4943 if v != nil {
4944 var additionalProperties interface{}
4945 err = json.Unmarshal(*v, &additionalProperties)
4946 if err != nil {
4947 return err
4948 }
4949 if mac.AdditionalProperties == nil {
4950 mac.AdditionalProperties = make(map[string]interface{})
4951 }
4952 mac.AdditionalProperties[k] = additionalProperties
4953 }
4954 case "odata.type":
4955 if v != nil {
4956 var odataType OdataTypeBasicMetricAlertCriteria
4957 err = json.Unmarshal(*v, &odataType)
4958 if err != nil {
4959 return err
4960 }
4961 mac.OdataType = odataType
4962 }
4963 }
4964 }
4965
4966 return nil
4967 }
4968
4969
4970
4971 type MetricAlertMultipleResourceMultipleMetricCriteria struct {
4972
4973 AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"`
4974
4975 AdditionalProperties map[string]interface{} `json:""`
4976
4977 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"`
4978 }
4979
4980
4981 func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) {
4982 mamrmmc.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria
4983 objectMap := make(map[string]interface{})
4984 if mamrmmc.AllOf != nil {
4985 objectMap["allOf"] = mamrmmc.AllOf
4986 }
4987 if mamrmmc.OdataType != "" {
4988 objectMap["odata.type"] = mamrmmc.OdataType
4989 }
4990 for k, v := range mamrmmc.AdditionalProperties {
4991 objectMap[k] = v
4992 }
4993 return json.Marshal(objectMap)
4994 }
4995
4996
4997 func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) {
4998 return nil, false
4999 }
5000
5001
5002 func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) {
5003 return nil, false
5004 }
5005
5006
5007 func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) {
5008 return &mamrmmc, true
5009 }
5010
5011
5012 func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) {
5013 return nil, false
5014 }
5015
5016
5017 func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) {
5018 return &mamrmmc, true
5019 }
5020
5021
5022 func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error {
5023 var m map[string]*json.RawMessage
5024 err := json.Unmarshal(body, &m)
5025 if err != nil {
5026 return err
5027 }
5028 for k, v := range m {
5029 switch k {
5030 case "allOf":
5031 if v != nil {
5032 allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v)
5033 if err != nil {
5034 return err
5035 }
5036 mamrmmc.AllOf = &allOf
5037 }
5038 default:
5039 if v != nil {
5040 var additionalProperties interface{}
5041 err = json.Unmarshal(*v, &additionalProperties)
5042 if err != nil {
5043 return err
5044 }
5045 if mamrmmc.AdditionalProperties == nil {
5046 mamrmmc.AdditionalProperties = make(map[string]interface{})
5047 }
5048 mamrmmc.AdditionalProperties[k] = additionalProperties
5049 }
5050 case "odata.type":
5051 if v != nil {
5052 var odataType OdataTypeBasicMetricAlertCriteria
5053 err = json.Unmarshal(*v, &odataType)
5054 if err != nil {
5055 return err
5056 }
5057 mamrmmc.OdataType = odataType
5058 }
5059 }
5060 }
5061
5062 return nil
5063 }
5064
5065
5066 type MetricAlertProperties struct {
5067
5068 Description *string `json:"description,omitempty"`
5069
5070 Severity *int32 `json:"severity,omitempty"`
5071
5072 Enabled *bool `json:"enabled,omitempty"`
5073
5074 Scopes *[]string `json:"scopes,omitempty"`
5075
5076 EvaluationFrequency *string `json:"evaluationFrequency,omitempty"`
5077
5078 WindowSize *string `json:"windowSize,omitempty"`
5079
5080 TargetResourceType *string `json:"targetResourceType,omitempty"`
5081
5082 TargetResourceRegion *string `json:"targetResourceRegion,omitempty"`
5083
5084 Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"`
5085
5086 AutoMitigate *bool `json:"autoMitigate,omitempty"`
5087
5088 Actions *[]MetricAlertAction `json:"actions,omitempty"`
5089
5090 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
5091
5092 IsMigrated *bool `json:"isMigrated,omitempty"`
5093 }
5094
5095
5096 func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) {
5097 objectMap := make(map[string]interface{})
5098 if mapVar.Description != nil {
5099 objectMap["description"] = mapVar.Description
5100 }
5101 if mapVar.Severity != nil {
5102 objectMap["severity"] = mapVar.Severity
5103 }
5104 if mapVar.Enabled != nil {
5105 objectMap["enabled"] = mapVar.Enabled
5106 }
5107 if mapVar.Scopes != nil {
5108 objectMap["scopes"] = mapVar.Scopes
5109 }
5110 if mapVar.EvaluationFrequency != nil {
5111 objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency
5112 }
5113 if mapVar.WindowSize != nil {
5114 objectMap["windowSize"] = mapVar.WindowSize
5115 }
5116 if mapVar.TargetResourceType != nil {
5117 objectMap["targetResourceType"] = mapVar.TargetResourceType
5118 }
5119 if mapVar.TargetResourceRegion != nil {
5120 objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion
5121 }
5122 objectMap["criteria"] = mapVar.Criteria
5123 if mapVar.AutoMitigate != nil {
5124 objectMap["autoMitigate"] = mapVar.AutoMitigate
5125 }
5126 if mapVar.Actions != nil {
5127 objectMap["actions"] = mapVar.Actions
5128 }
5129 return json.Marshal(objectMap)
5130 }
5131
5132
5133 func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error {
5134 var m map[string]*json.RawMessage
5135 err := json.Unmarshal(body, &m)
5136 if err != nil {
5137 return err
5138 }
5139 for k, v := range m {
5140 switch k {
5141 case "description":
5142 if v != nil {
5143 var description string
5144 err = json.Unmarshal(*v, &description)
5145 if err != nil {
5146 return err
5147 }
5148 mapVar.Description = &description
5149 }
5150 case "severity":
5151 if v != nil {
5152 var severity int32
5153 err = json.Unmarshal(*v, &severity)
5154 if err != nil {
5155 return err
5156 }
5157 mapVar.Severity = &severity
5158 }
5159 case "enabled":
5160 if v != nil {
5161 var enabled bool
5162 err = json.Unmarshal(*v, &enabled)
5163 if err != nil {
5164 return err
5165 }
5166 mapVar.Enabled = &enabled
5167 }
5168 case "scopes":
5169 if v != nil {
5170 var scopes []string
5171 err = json.Unmarshal(*v, &scopes)
5172 if err != nil {
5173 return err
5174 }
5175 mapVar.Scopes = &scopes
5176 }
5177 case "evaluationFrequency":
5178 if v != nil {
5179 var evaluationFrequency string
5180 err = json.Unmarshal(*v, &evaluationFrequency)
5181 if err != nil {
5182 return err
5183 }
5184 mapVar.EvaluationFrequency = &evaluationFrequency
5185 }
5186 case "windowSize":
5187 if v != nil {
5188 var windowSize string
5189 err = json.Unmarshal(*v, &windowSize)
5190 if err != nil {
5191 return err
5192 }
5193 mapVar.WindowSize = &windowSize
5194 }
5195 case "targetResourceType":
5196 if v != nil {
5197 var targetResourceType string
5198 err = json.Unmarshal(*v, &targetResourceType)
5199 if err != nil {
5200 return err
5201 }
5202 mapVar.TargetResourceType = &targetResourceType
5203 }
5204 case "targetResourceRegion":
5205 if v != nil {
5206 var targetResourceRegion string
5207 err = json.Unmarshal(*v, &targetResourceRegion)
5208 if err != nil {
5209 return err
5210 }
5211 mapVar.TargetResourceRegion = &targetResourceRegion
5212 }
5213 case "criteria":
5214 if v != nil {
5215 criteria, err := unmarshalBasicMetricAlertCriteria(*v)
5216 if err != nil {
5217 return err
5218 }
5219 mapVar.Criteria = criteria
5220 }
5221 case "autoMitigate":
5222 if v != nil {
5223 var autoMitigate bool
5224 err = json.Unmarshal(*v, &autoMitigate)
5225 if err != nil {
5226 return err
5227 }
5228 mapVar.AutoMitigate = &autoMitigate
5229 }
5230 case "actions":
5231 if v != nil {
5232 var actions []MetricAlertAction
5233 err = json.Unmarshal(*v, &actions)
5234 if err != nil {
5235 return err
5236 }
5237 mapVar.Actions = &actions
5238 }
5239 case "lastUpdatedTime":
5240 if v != nil {
5241 var lastUpdatedTime date.Time
5242 err = json.Unmarshal(*v, &lastUpdatedTime)
5243 if err != nil {
5244 return err
5245 }
5246 mapVar.LastUpdatedTime = &lastUpdatedTime
5247 }
5248 case "isMigrated":
5249 if v != nil {
5250 var isMigrated bool
5251 err = json.Unmarshal(*v, &isMigrated)
5252 if err != nil {
5253 return err
5254 }
5255 mapVar.IsMigrated = &isMigrated
5256 }
5257 }
5258 }
5259
5260 return nil
5261 }
5262
5263
5264 type MetricAlertPropertiesPatch struct {
5265
5266 Description *string `json:"description,omitempty"`
5267
5268 Severity *int32 `json:"severity,omitempty"`
5269
5270 Enabled *bool `json:"enabled,omitempty"`
5271
5272 Scopes *[]string `json:"scopes,omitempty"`
5273
5274 EvaluationFrequency *string `json:"evaluationFrequency,omitempty"`
5275
5276 WindowSize *string `json:"windowSize,omitempty"`
5277
5278 TargetResourceType *string `json:"targetResourceType,omitempty"`
5279
5280 TargetResourceRegion *string `json:"targetResourceRegion,omitempty"`
5281
5282 Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"`
5283
5284 AutoMitigate *bool `json:"autoMitigate,omitempty"`
5285
5286 Actions *[]MetricAlertAction `json:"actions,omitempty"`
5287
5288 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
5289
5290 IsMigrated *bool `json:"isMigrated,omitempty"`
5291 }
5292
5293
5294 func (mapp MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) {
5295 objectMap := make(map[string]interface{})
5296 if mapp.Description != nil {
5297 objectMap["description"] = mapp.Description
5298 }
5299 if mapp.Severity != nil {
5300 objectMap["severity"] = mapp.Severity
5301 }
5302 if mapp.Enabled != nil {
5303 objectMap["enabled"] = mapp.Enabled
5304 }
5305 if mapp.Scopes != nil {
5306 objectMap["scopes"] = mapp.Scopes
5307 }
5308 if mapp.EvaluationFrequency != nil {
5309 objectMap["evaluationFrequency"] = mapp.EvaluationFrequency
5310 }
5311 if mapp.WindowSize != nil {
5312 objectMap["windowSize"] = mapp.WindowSize
5313 }
5314 if mapp.TargetResourceType != nil {
5315 objectMap["targetResourceType"] = mapp.TargetResourceType
5316 }
5317 if mapp.TargetResourceRegion != nil {
5318 objectMap["targetResourceRegion"] = mapp.TargetResourceRegion
5319 }
5320 objectMap["criteria"] = mapp.Criteria
5321 if mapp.AutoMitigate != nil {
5322 objectMap["autoMitigate"] = mapp.AutoMitigate
5323 }
5324 if mapp.Actions != nil {
5325 objectMap["actions"] = mapp.Actions
5326 }
5327 return json.Marshal(objectMap)
5328 }
5329
5330
5331 func (mapp *MetricAlertPropertiesPatch) UnmarshalJSON(body []byte) error {
5332 var m map[string]*json.RawMessage
5333 err := json.Unmarshal(body, &m)
5334 if err != nil {
5335 return err
5336 }
5337 for k, v := range m {
5338 switch k {
5339 case "description":
5340 if v != nil {
5341 var description string
5342 err = json.Unmarshal(*v, &description)
5343 if err != nil {
5344 return err
5345 }
5346 mapp.Description = &description
5347 }
5348 case "severity":
5349 if v != nil {
5350 var severity int32
5351 err = json.Unmarshal(*v, &severity)
5352 if err != nil {
5353 return err
5354 }
5355 mapp.Severity = &severity
5356 }
5357 case "enabled":
5358 if v != nil {
5359 var enabled bool
5360 err = json.Unmarshal(*v, &enabled)
5361 if err != nil {
5362 return err
5363 }
5364 mapp.Enabled = &enabled
5365 }
5366 case "scopes":
5367 if v != nil {
5368 var scopes []string
5369 err = json.Unmarshal(*v, &scopes)
5370 if err != nil {
5371 return err
5372 }
5373 mapp.Scopes = &scopes
5374 }
5375 case "evaluationFrequency":
5376 if v != nil {
5377 var evaluationFrequency string
5378 err = json.Unmarshal(*v, &evaluationFrequency)
5379 if err != nil {
5380 return err
5381 }
5382 mapp.EvaluationFrequency = &evaluationFrequency
5383 }
5384 case "windowSize":
5385 if v != nil {
5386 var windowSize string
5387 err = json.Unmarshal(*v, &windowSize)
5388 if err != nil {
5389 return err
5390 }
5391 mapp.WindowSize = &windowSize
5392 }
5393 case "targetResourceType":
5394 if v != nil {
5395 var targetResourceType string
5396 err = json.Unmarshal(*v, &targetResourceType)
5397 if err != nil {
5398 return err
5399 }
5400 mapp.TargetResourceType = &targetResourceType
5401 }
5402 case "targetResourceRegion":
5403 if v != nil {
5404 var targetResourceRegion string
5405 err = json.Unmarshal(*v, &targetResourceRegion)
5406 if err != nil {
5407 return err
5408 }
5409 mapp.TargetResourceRegion = &targetResourceRegion
5410 }
5411 case "criteria":
5412 if v != nil {
5413 criteria, err := unmarshalBasicMetricAlertCriteria(*v)
5414 if err != nil {
5415 return err
5416 }
5417 mapp.Criteria = criteria
5418 }
5419 case "autoMitigate":
5420 if v != nil {
5421 var autoMitigate bool
5422 err = json.Unmarshal(*v, &autoMitigate)
5423 if err != nil {
5424 return err
5425 }
5426 mapp.AutoMitigate = &autoMitigate
5427 }
5428 case "actions":
5429 if v != nil {
5430 var actions []MetricAlertAction
5431 err = json.Unmarshal(*v, &actions)
5432 if err != nil {
5433 return err
5434 }
5435 mapp.Actions = &actions
5436 }
5437 case "lastUpdatedTime":
5438 if v != nil {
5439 var lastUpdatedTime date.Time
5440 err = json.Unmarshal(*v, &lastUpdatedTime)
5441 if err != nil {
5442 return err
5443 }
5444 mapp.LastUpdatedTime = &lastUpdatedTime
5445 }
5446 case "isMigrated":
5447 if v != nil {
5448 var isMigrated bool
5449 err = json.Unmarshal(*v, &isMigrated)
5450 if err != nil {
5451 return err
5452 }
5453 mapp.IsMigrated = &isMigrated
5454 }
5455 }
5456 }
5457
5458 return nil
5459 }
5460
5461
5462 type MetricAlertResource struct {
5463 autorest.Response `json:"-"`
5464
5465 *MetricAlertProperties `json:"properties,omitempty"`
5466
5467 ID *string `json:"id,omitempty"`
5468
5469 Name *string `json:"name,omitempty"`
5470
5471 Type *string `json:"type,omitempty"`
5472
5473 Location *string `json:"location,omitempty"`
5474
5475 Tags map[string]*string `json:"tags"`
5476
5477 Kind *string `json:"kind,omitempty"`
5478
5479 Etag *string `json:"etag,omitempty"`
5480 }
5481
5482
5483 func (mar MetricAlertResource) MarshalJSON() ([]byte, error) {
5484 objectMap := make(map[string]interface{})
5485 if mar.MetricAlertProperties != nil {
5486 objectMap["properties"] = mar.MetricAlertProperties
5487 }
5488 if mar.Location != nil {
5489 objectMap["location"] = mar.Location
5490 }
5491 if mar.Tags != nil {
5492 objectMap["tags"] = mar.Tags
5493 }
5494 return json.Marshal(objectMap)
5495 }
5496
5497
5498 func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error {
5499 var m map[string]*json.RawMessage
5500 err := json.Unmarshal(body, &m)
5501 if err != nil {
5502 return err
5503 }
5504 for k, v := range m {
5505 switch k {
5506 case "properties":
5507 if v != nil {
5508 var metricAlertProperties MetricAlertProperties
5509 err = json.Unmarshal(*v, &metricAlertProperties)
5510 if err != nil {
5511 return err
5512 }
5513 mar.MetricAlertProperties = &metricAlertProperties
5514 }
5515 case "id":
5516 if v != nil {
5517 var ID string
5518 err = json.Unmarshal(*v, &ID)
5519 if err != nil {
5520 return err
5521 }
5522 mar.ID = &ID
5523 }
5524 case "name":
5525 if v != nil {
5526 var name string
5527 err = json.Unmarshal(*v, &name)
5528 if err != nil {
5529 return err
5530 }
5531 mar.Name = &name
5532 }
5533 case "type":
5534 if v != nil {
5535 var typeVar string
5536 err = json.Unmarshal(*v, &typeVar)
5537 if err != nil {
5538 return err
5539 }
5540 mar.Type = &typeVar
5541 }
5542 case "location":
5543 if v != nil {
5544 var location string
5545 err = json.Unmarshal(*v, &location)
5546 if err != nil {
5547 return err
5548 }
5549 mar.Location = &location
5550 }
5551 case "tags":
5552 if v != nil {
5553 var tags map[string]*string
5554 err = json.Unmarshal(*v, &tags)
5555 if err != nil {
5556 return err
5557 }
5558 mar.Tags = tags
5559 }
5560 case "kind":
5561 if v != nil {
5562 var kind string
5563 err = json.Unmarshal(*v, &kind)
5564 if err != nil {
5565 return err
5566 }
5567 mar.Kind = &kind
5568 }
5569 case "etag":
5570 if v != nil {
5571 var etag string
5572 err = json.Unmarshal(*v, &etag)
5573 if err != nil {
5574 return err
5575 }
5576 mar.Etag = &etag
5577 }
5578 }
5579 }
5580
5581 return nil
5582 }
5583
5584
5585 type MetricAlertResourceCollection struct {
5586 autorest.Response `json:"-"`
5587
5588 Value *[]MetricAlertResource `json:"value,omitempty"`
5589 }
5590
5591
5592 type MetricAlertResourcePatch struct {
5593
5594 Tags map[string]*string `json:"tags"`
5595
5596 *MetricAlertPropertiesPatch `json:"properties,omitempty"`
5597 }
5598
5599
5600 func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) {
5601 objectMap := make(map[string]interface{})
5602 if marp.Tags != nil {
5603 objectMap["tags"] = marp.Tags
5604 }
5605 if marp.MetricAlertPropertiesPatch != nil {
5606 objectMap["properties"] = marp.MetricAlertPropertiesPatch
5607 }
5608 return json.Marshal(objectMap)
5609 }
5610
5611
5612 func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error {
5613 var m map[string]*json.RawMessage
5614 err := json.Unmarshal(body, &m)
5615 if err != nil {
5616 return err
5617 }
5618 for k, v := range m {
5619 switch k {
5620 case "tags":
5621 if v != nil {
5622 var tags map[string]*string
5623 err = json.Unmarshal(*v, &tags)
5624 if err != nil {
5625 return err
5626 }
5627 marp.Tags = tags
5628 }
5629 case "properties":
5630 if v != nil {
5631 var metricAlertPropertiesPatch MetricAlertPropertiesPatch
5632 err = json.Unmarshal(*v, &metricAlertPropertiesPatch)
5633 if err != nil {
5634 return err
5635 }
5636 marp.MetricAlertPropertiesPatch = &metricAlertPropertiesPatch
5637 }
5638 }
5639 }
5640
5641 return nil
5642 }
5643
5644
5645
5646 type MetricAlertSingleResourceMultipleMetricCriteria struct {
5647
5648 AllOf *[]MetricCriteria `json:"allOf,omitempty"`
5649
5650 AdditionalProperties map[string]interface{} `json:""`
5651
5652 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"`
5653 }
5654
5655
5656 func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) {
5657 masrmmc.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria
5658 objectMap := make(map[string]interface{})
5659 if masrmmc.AllOf != nil {
5660 objectMap["allOf"] = masrmmc.AllOf
5661 }
5662 if masrmmc.OdataType != "" {
5663 objectMap["odata.type"] = masrmmc.OdataType
5664 }
5665 for k, v := range masrmmc.AdditionalProperties {
5666 objectMap[k] = v
5667 }
5668 return json.Marshal(objectMap)
5669 }
5670
5671
5672 func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) {
5673 return &masrmmc, true
5674 }
5675
5676
5677 func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) {
5678 return nil, false
5679 }
5680
5681
5682 func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) {
5683 return nil, false
5684 }
5685
5686
5687 func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) {
5688 return nil, false
5689 }
5690
5691
5692 func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) {
5693 return &masrmmc, true
5694 }
5695
5696
5697 func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error {
5698 var m map[string]*json.RawMessage
5699 err := json.Unmarshal(body, &m)
5700 if err != nil {
5701 return err
5702 }
5703 for k, v := range m {
5704 switch k {
5705 case "allOf":
5706 if v != nil {
5707 var allOf []MetricCriteria
5708 err = json.Unmarshal(*v, &allOf)
5709 if err != nil {
5710 return err
5711 }
5712 masrmmc.AllOf = &allOf
5713 }
5714 default:
5715 if v != nil {
5716 var additionalProperties interface{}
5717 err = json.Unmarshal(*v, &additionalProperties)
5718 if err != nil {
5719 return err
5720 }
5721 if masrmmc.AdditionalProperties == nil {
5722 masrmmc.AdditionalProperties = make(map[string]interface{})
5723 }
5724 masrmmc.AdditionalProperties[k] = additionalProperties
5725 }
5726 case "odata.type":
5727 if v != nil {
5728 var odataType OdataTypeBasicMetricAlertCriteria
5729 err = json.Unmarshal(*v, &odataType)
5730 if err != nil {
5731 return err
5732 }
5733 masrmmc.OdataType = odataType
5734 }
5735 }
5736 }
5737
5738 return nil
5739 }
5740
5741
5742 type MetricAlertStatus struct {
5743
5744 Name *string `json:"name,omitempty"`
5745
5746 ID *string `json:"id,omitempty"`
5747
5748 Type *string `json:"type,omitempty"`
5749
5750 Properties *MetricAlertStatusProperties `json:"properties,omitempty"`
5751 }
5752
5753
5754 type MetricAlertStatusCollection struct {
5755 autorest.Response `json:"-"`
5756
5757 Value *[]MetricAlertStatus `json:"value,omitempty"`
5758 }
5759
5760
5761 type MetricAlertStatusProperties struct {
5762
5763 Dimensions map[string]*string `json:"dimensions"`
5764
5765 Status *string `json:"status,omitempty"`
5766
5767 Timestamp *date.Time `json:"timestamp,omitempty"`
5768 }
5769
5770
5771 func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) {
5772 objectMap := make(map[string]interface{})
5773 if masp.Dimensions != nil {
5774 objectMap["dimensions"] = masp.Dimensions
5775 }
5776 if masp.Status != nil {
5777 objectMap["status"] = masp.Status
5778 }
5779 if masp.Timestamp != nil {
5780 objectMap["timestamp"] = masp.Timestamp
5781 }
5782 return json.Marshal(objectMap)
5783 }
5784
5785
5786
5787 type MetricAvailability struct {
5788
5789 TimeGrain *string `json:"timeGrain,omitempty"`
5790
5791 Retention *string `json:"retention,omitempty"`
5792 }
5793
5794
5795 type MetricBaselinesProperties struct {
5796
5797 Timespan *string `json:"timespan,omitempty"`
5798
5799 Interval *string `json:"interval,omitempty"`
5800
5801 Namespace *string `json:"namespace,omitempty"`
5802
5803 Baselines *[]TimeSeriesBaseline `json:"baselines,omitempty"`
5804 }
5805
5806
5807 type MetricBaselinesResponse struct {
5808 autorest.Response `json:"-"`
5809
5810 Value *[]SingleMetricBaseline `json:"value,omitempty"`
5811 }
5812
5813
5814 type MetricCriteria struct {
5815
5816 Operator Operator `json:"operator,omitempty"`
5817
5818 Threshold *float64 `json:"threshold,omitempty"`
5819
5820 AdditionalProperties map[string]interface{} `json:""`
5821
5822 Name *string `json:"name,omitempty"`
5823
5824 MetricName *string `json:"metricName,omitempty"`
5825
5826 MetricNamespace *string `json:"metricNamespace,omitempty"`
5827
5828 TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"`
5829
5830 Dimensions *[]MetricDimension `json:"dimensions,omitempty"`
5831
5832 SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"`
5833
5834 CriterionType CriterionType `json:"criterionType,omitempty"`
5835 }
5836
5837
5838 func (mc MetricCriteria) MarshalJSON() ([]byte, error) {
5839 mc.CriterionType = CriterionTypeStaticThresholdCriterion
5840 objectMap := make(map[string]interface{})
5841 if mc.Operator != "" {
5842 objectMap["operator"] = mc.Operator
5843 }
5844 if mc.Threshold != nil {
5845 objectMap["threshold"] = mc.Threshold
5846 }
5847 if mc.Name != nil {
5848 objectMap["name"] = mc.Name
5849 }
5850 if mc.MetricName != nil {
5851 objectMap["metricName"] = mc.MetricName
5852 }
5853 if mc.MetricNamespace != nil {
5854 objectMap["metricNamespace"] = mc.MetricNamespace
5855 }
5856 if mc.TimeAggregation != "" {
5857 objectMap["timeAggregation"] = mc.TimeAggregation
5858 }
5859 if mc.Dimensions != nil {
5860 objectMap["dimensions"] = mc.Dimensions
5861 }
5862 if mc.SkipMetricValidation != nil {
5863 objectMap["skipMetricValidation"] = mc.SkipMetricValidation
5864 }
5865 if mc.CriterionType != "" {
5866 objectMap["criterionType"] = mc.CriterionType
5867 }
5868 for k, v := range mc.AdditionalProperties {
5869 objectMap[k] = v
5870 }
5871 return json.Marshal(objectMap)
5872 }
5873
5874
5875 func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) {
5876 return &mc, true
5877 }
5878
5879
5880 func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) {
5881 return nil, false
5882 }
5883
5884
5885 func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) {
5886 return nil, false
5887 }
5888
5889
5890 func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) {
5891 return &mc, true
5892 }
5893
5894
5895 func (mc *MetricCriteria) UnmarshalJSON(body []byte) error {
5896 var m map[string]*json.RawMessage
5897 err := json.Unmarshal(body, &m)
5898 if err != nil {
5899 return err
5900 }
5901 for k, v := range m {
5902 switch k {
5903 case "operator":
5904 if v != nil {
5905 var operator Operator
5906 err = json.Unmarshal(*v, &operator)
5907 if err != nil {
5908 return err
5909 }
5910 mc.Operator = operator
5911 }
5912 case "threshold":
5913 if v != nil {
5914 var threshold float64
5915 err = json.Unmarshal(*v, &threshold)
5916 if err != nil {
5917 return err
5918 }
5919 mc.Threshold = &threshold
5920 }
5921 default:
5922 if v != nil {
5923 var additionalProperties interface{}
5924 err = json.Unmarshal(*v, &additionalProperties)
5925 if err != nil {
5926 return err
5927 }
5928 if mc.AdditionalProperties == nil {
5929 mc.AdditionalProperties = make(map[string]interface{})
5930 }
5931 mc.AdditionalProperties[k] = additionalProperties
5932 }
5933 case "name":
5934 if v != nil {
5935 var name string
5936 err = json.Unmarshal(*v, &name)
5937 if err != nil {
5938 return err
5939 }
5940 mc.Name = &name
5941 }
5942 case "metricName":
5943 if v != nil {
5944 var metricName string
5945 err = json.Unmarshal(*v, &metricName)
5946 if err != nil {
5947 return err
5948 }
5949 mc.MetricName = &metricName
5950 }
5951 case "metricNamespace":
5952 if v != nil {
5953 var metricNamespace string
5954 err = json.Unmarshal(*v, &metricNamespace)
5955 if err != nil {
5956 return err
5957 }
5958 mc.MetricNamespace = &metricNamespace
5959 }
5960 case "timeAggregation":
5961 if v != nil {
5962 var timeAggregation AggregationTypeEnum
5963 err = json.Unmarshal(*v, &timeAggregation)
5964 if err != nil {
5965 return err
5966 }
5967 mc.TimeAggregation = timeAggregation
5968 }
5969 case "dimensions":
5970 if v != nil {
5971 var dimensions []MetricDimension
5972 err = json.Unmarshal(*v, &dimensions)
5973 if err != nil {
5974 return err
5975 }
5976 mc.Dimensions = &dimensions
5977 }
5978 case "skipMetricValidation":
5979 if v != nil {
5980 var skipMetricValidation bool
5981 err = json.Unmarshal(*v, &skipMetricValidation)
5982 if err != nil {
5983 return err
5984 }
5985 mc.SkipMetricValidation = &skipMetricValidation
5986 }
5987 case "criterionType":
5988 if v != nil {
5989 var criterionType CriterionType
5990 err = json.Unmarshal(*v, &criterionType)
5991 if err != nil {
5992 return err
5993 }
5994 mc.CriterionType = criterionType
5995 }
5996 }
5997 }
5998
5999 return nil
6000 }
6001
6002
6003 type MetricDefinition struct {
6004
6005 IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"`
6006
6007 ResourceID *string `json:"resourceId,omitempty"`
6008
6009 Namespace *string `json:"namespace,omitempty"`
6010
6011 Name *LocalizableString `json:"name,omitempty"`
6012
6013 DisplayDescription *string `json:"displayDescription,omitempty"`
6014
6015 Category *string `json:"category,omitempty"`
6016
6017 MetricClass MetricClass `json:"metricClass,omitempty"`
6018
6019 Unit MetricUnit `json:"unit,omitempty"`
6020
6021 PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"`
6022
6023 SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"`
6024
6025 MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"`
6026
6027 ID *string `json:"id,omitempty"`
6028
6029 Dimensions *[]LocalizableString `json:"dimensions,omitempty"`
6030 }
6031
6032
6033 type MetricDefinitionCollection struct {
6034 autorest.Response `json:"-"`
6035
6036 Value *[]MetricDefinition `json:"value,omitempty"`
6037 }
6038
6039
6040 type MetricDimension struct {
6041
6042 Name *string `json:"name,omitempty"`
6043
6044 Operator *string `json:"operator,omitempty"`
6045
6046 Values *[]string `json:"values,omitempty"`
6047 }
6048
6049
6050 type MetricNamespace struct {
6051
6052 ID *string `json:"id,omitempty"`
6053
6054 Type *string `json:"type,omitempty"`
6055
6056 Name *string `json:"name,omitempty"`
6057
6058 Classification NamespaceClassification `json:"classification,omitempty"`
6059
6060 Properties *MetricNamespaceName `json:"properties,omitempty"`
6061 }
6062
6063
6064 type MetricNamespaceCollection struct {
6065 autorest.Response `json:"-"`
6066
6067 Value *[]MetricNamespace `json:"value,omitempty"`
6068 }
6069
6070
6071 type MetricNamespaceName struct {
6072
6073 MetricNamespaceName *string `json:"metricNamespaceName,omitempty"`
6074 }
6075
6076
6077 type MetricSettings struct {
6078
6079 TimeGrain *string `json:"timeGrain,omitempty"`
6080
6081 Category *string `json:"category,omitempty"`
6082
6083 Enabled *bool `json:"enabled,omitempty"`
6084
6085 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
6086 }
6087
6088
6089 type MetricSingleDimension struct {
6090
6091 Name *string `json:"name,omitempty"`
6092
6093 Value *string `json:"value,omitempty"`
6094 }
6095
6096
6097 type MetricTrigger struct {
6098
6099 MetricName *string `json:"metricName,omitempty"`
6100
6101 MetricNamespace *string `json:"metricNamespace,omitempty"`
6102
6103 MetricResourceURI *string `json:"metricResourceUri,omitempty"`
6104
6105 MetricResourceLocation *string `json:"metricResourceLocation,omitempty"`
6106
6107 TimeGrain *string `json:"timeGrain,omitempty"`
6108
6109 Statistic MetricStatisticType `json:"statistic,omitempty"`
6110
6111 TimeWindow *string `json:"timeWindow,omitempty"`
6112
6113 TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"`
6114
6115 Operator ComparisonOperationType `json:"operator,omitempty"`
6116
6117 Threshold *float64 `json:"threshold,omitempty"`
6118
6119 Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"`
6120
6121 DividePerInstance *bool `json:"dividePerInstance,omitempty"`
6122 }
6123
6124
6125 type MetricValue struct {
6126
6127 TimeStamp *date.Time `json:"timeStamp,omitempty"`
6128
6129 Average *float64 `json:"average,omitempty"`
6130
6131 Minimum *float64 `json:"minimum,omitempty"`
6132
6133 Maximum *float64 `json:"maximum,omitempty"`
6134
6135 Total *float64 `json:"total,omitempty"`
6136
6137 Count *float64 `json:"count,omitempty"`
6138 }
6139
6140
6141 type BasicMultiMetricCriteria interface {
6142 AsMetricCriteria() (*MetricCriteria, bool)
6143 AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool)
6144 AsMultiMetricCriteria() (*MultiMetricCriteria, bool)
6145 }
6146
6147
6148 type MultiMetricCriteria struct {
6149
6150 AdditionalProperties map[string]interface{} `json:""`
6151
6152 Name *string `json:"name,omitempty"`
6153
6154 MetricName *string `json:"metricName,omitempty"`
6155
6156 MetricNamespace *string `json:"metricNamespace,omitempty"`
6157
6158 TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"`
6159
6160 Dimensions *[]MetricDimension `json:"dimensions,omitempty"`
6161
6162 SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"`
6163
6164 CriterionType CriterionType `json:"criterionType,omitempty"`
6165 }
6166
6167 func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) {
6168 var m map[string]interface{}
6169 err := json.Unmarshal(body, &m)
6170 if err != nil {
6171 return nil, err
6172 }
6173
6174 switch m["criterionType"] {
6175 case string(CriterionTypeStaticThresholdCriterion):
6176 var mc MetricCriteria
6177 err := json.Unmarshal(body, &mc)
6178 return mc, err
6179 case string(CriterionTypeDynamicThresholdCriterion):
6180 var dmc DynamicMetricCriteria
6181 err := json.Unmarshal(body, &dmc)
6182 return dmc, err
6183 default:
6184 var mmc MultiMetricCriteria
6185 err := json.Unmarshal(body, &mmc)
6186 return mmc, err
6187 }
6188 }
6189 func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) {
6190 var rawMessages []*json.RawMessage
6191 err := json.Unmarshal(body, &rawMessages)
6192 if err != nil {
6193 return nil, err
6194 }
6195
6196 mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages))
6197
6198 for index, rawMessage := range rawMessages {
6199 mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage)
6200 if err != nil {
6201 return nil, err
6202 }
6203 mmcArray[index] = mmc
6204 }
6205 return mmcArray, nil
6206 }
6207
6208
6209 func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) {
6210 mmc.CriterionType = CriterionTypeMultiMetricCriteria
6211 objectMap := make(map[string]interface{})
6212 if mmc.Name != nil {
6213 objectMap["name"] = mmc.Name
6214 }
6215 if mmc.MetricName != nil {
6216 objectMap["metricName"] = mmc.MetricName
6217 }
6218 if mmc.MetricNamespace != nil {
6219 objectMap["metricNamespace"] = mmc.MetricNamespace
6220 }
6221 if mmc.TimeAggregation != "" {
6222 objectMap["timeAggregation"] = mmc.TimeAggregation
6223 }
6224 if mmc.Dimensions != nil {
6225 objectMap["dimensions"] = mmc.Dimensions
6226 }
6227 if mmc.SkipMetricValidation != nil {
6228 objectMap["skipMetricValidation"] = mmc.SkipMetricValidation
6229 }
6230 if mmc.CriterionType != "" {
6231 objectMap["criterionType"] = mmc.CriterionType
6232 }
6233 for k, v := range mmc.AdditionalProperties {
6234 objectMap[k] = v
6235 }
6236 return json.Marshal(objectMap)
6237 }
6238
6239
6240 func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) {
6241 return nil, false
6242 }
6243
6244
6245 func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) {
6246 return nil, false
6247 }
6248
6249
6250 func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) {
6251 return &mmc, true
6252 }
6253
6254
6255 func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) {
6256 return &mmc, true
6257 }
6258
6259
6260 func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error {
6261 var m map[string]*json.RawMessage
6262 err := json.Unmarshal(body, &m)
6263 if err != nil {
6264 return err
6265 }
6266 for k, v := range m {
6267 switch k {
6268 default:
6269 if v != nil {
6270 var additionalProperties interface{}
6271 err = json.Unmarshal(*v, &additionalProperties)
6272 if err != nil {
6273 return err
6274 }
6275 if mmc.AdditionalProperties == nil {
6276 mmc.AdditionalProperties = make(map[string]interface{})
6277 }
6278 mmc.AdditionalProperties[k] = additionalProperties
6279 }
6280 case "name":
6281 if v != nil {
6282 var name string
6283 err = json.Unmarshal(*v, &name)
6284 if err != nil {
6285 return err
6286 }
6287 mmc.Name = &name
6288 }
6289 case "metricName":
6290 if v != nil {
6291 var metricName string
6292 err = json.Unmarshal(*v, &metricName)
6293 if err != nil {
6294 return err
6295 }
6296 mmc.MetricName = &metricName
6297 }
6298 case "metricNamespace":
6299 if v != nil {
6300 var metricNamespace string
6301 err = json.Unmarshal(*v, &metricNamespace)
6302 if err != nil {
6303 return err
6304 }
6305 mmc.MetricNamespace = &metricNamespace
6306 }
6307 case "timeAggregation":
6308 if v != nil {
6309 var timeAggregation AggregationTypeEnum
6310 err = json.Unmarshal(*v, &timeAggregation)
6311 if err != nil {
6312 return err
6313 }
6314 mmc.TimeAggregation = timeAggregation
6315 }
6316 case "dimensions":
6317 if v != nil {
6318 var dimensions []MetricDimension
6319 err = json.Unmarshal(*v, &dimensions)
6320 if err != nil {
6321 return err
6322 }
6323 mmc.Dimensions = &dimensions
6324 }
6325 case "skipMetricValidation":
6326 if v != nil {
6327 var skipMetricValidation bool
6328 err = json.Unmarshal(*v, &skipMetricValidation)
6329 if err != nil {
6330 return err
6331 }
6332 mmc.SkipMetricValidation = &skipMetricValidation
6333 }
6334 case "criterionType":
6335 if v != nil {
6336 var criterionType CriterionType
6337 err = json.Unmarshal(*v, &criterionType)
6338 if err != nil {
6339 return err
6340 }
6341 mmc.CriterionType = criterionType
6342 }
6343 }
6344 }
6345
6346 return nil
6347 }
6348
6349
6350 type NetworkRuleSet struct {
6351
6352 PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"`
6353 }
6354
6355
6356 type Operation struct {
6357
6358 Name *string `json:"name,omitempty"`
6359
6360 Display *OperationDisplay `json:"display,omitempty"`
6361 }
6362
6363
6364 type OperationDisplay struct {
6365
6366 Provider *string `json:"provider,omitempty"`
6367
6368 Resource *string `json:"resource,omitempty"`
6369
6370 Operation *string `json:"operation,omitempty"`
6371 }
6372
6373
6374
6375 type OperationListResult struct {
6376 autorest.Response `json:"-"`
6377
6378 Value *[]Operation `json:"value,omitempty"`
6379
6380 NextLink *string `json:"nextLink,omitempty"`
6381 }
6382
6383
6384 type OperationStatus struct {
6385 autorest.Response `json:"-"`
6386
6387 ID *string `json:"id,omitempty"`
6388
6389 Name *string `json:"name,omitempty"`
6390
6391 StartTime *date.Time `json:"startTime,omitempty"`
6392
6393 EndTime *date.Time `json:"endTime,omitempty"`
6394
6395 Status *string `json:"status,omitempty"`
6396
6397 Error *ErrorResponseCommon `json:"error,omitempty"`
6398 }
6399
6400
6401
6402
6403 type PerfCounterDataSource struct {
6404
6405
6406 Streams *[]KnownPerfCounterDataSourceStreams `json:"streams,omitempty"`
6407
6408 SamplingFrequencyInSeconds *int32 `json:"samplingFrequencyInSeconds,omitempty"`
6409
6410
6411
6412 CounterSpecifiers *[]string `json:"counterSpecifiers,omitempty"`
6413
6414
6415 Name *string `json:"name,omitempty"`
6416 }
6417
6418
6419 type PrivateEndpointConnection struct {
6420 autorest.Response `json:"-"`
6421
6422 *PrivateEndpointConnectionProperties `json:"properties,omitempty"`
6423
6424 ID *string `json:"id,omitempty"`
6425
6426 Name *string `json:"name,omitempty"`
6427
6428 Type *string `json:"type,omitempty"`
6429 }
6430
6431
6432 func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) {
6433 objectMap := make(map[string]interface{})
6434 if pec.PrivateEndpointConnectionProperties != nil {
6435 objectMap["properties"] = pec.PrivateEndpointConnectionProperties
6436 }
6437 return json.Marshal(objectMap)
6438 }
6439
6440
6441 func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error {
6442 var m map[string]*json.RawMessage
6443 err := json.Unmarshal(body, &m)
6444 if err != nil {
6445 return err
6446 }
6447 for k, v := range m {
6448 switch k {
6449 case "properties":
6450 if v != nil {
6451 var privateEndpointConnectionProperties PrivateEndpointConnectionProperties
6452 err = json.Unmarshal(*v, &privateEndpointConnectionProperties)
6453 if err != nil {
6454 return err
6455 }
6456 pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties
6457 }
6458 case "id":
6459 if v != nil {
6460 var ID string
6461 err = json.Unmarshal(*v, &ID)
6462 if err != nil {
6463 return err
6464 }
6465 pec.ID = &ID
6466 }
6467 case "name":
6468 if v != nil {
6469 var name string
6470 err = json.Unmarshal(*v, &name)
6471 if err != nil {
6472 return err
6473 }
6474 pec.Name = &name
6475 }
6476 case "type":
6477 if v != nil {
6478 var typeVar string
6479 err = json.Unmarshal(*v, &typeVar)
6480 if err != nil {
6481 return err
6482 }
6483 pec.Type = &typeVar
6484 }
6485 }
6486 }
6487
6488 return nil
6489 }
6490
6491
6492 type PrivateEndpointConnectionListResult struct {
6493 autorest.Response `json:"-"`
6494
6495 Value *[]PrivateEndpointConnection `json:"value,omitempty"`
6496
6497 NextLink *string `json:"nextLink,omitempty"`
6498 }
6499
6500
6501 func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) {
6502 objectMap := make(map[string]interface{})
6503 return json.Marshal(objectMap)
6504 }
6505
6506
6507
6508 type PrivateEndpointConnectionListResultIterator struct {
6509 i int
6510 page PrivateEndpointConnectionListResultPage
6511 }
6512
6513
6514
6515 func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) {
6516 if tracing.IsEnabled() {
6517 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext")
6518 defer func() {
6519 sc := -1
6520 if iter.Response().Response.Response != nil {
6521 sc = iter.Response().Response.Response.StatusCode
6522 }
6523 tracing.EndSpan(ctx, sc, err)
6524 }()
6525 }
6526 iter.i++
6527 if iter.i < len(iter.page.Values()) {
6528 return nil
6529 }
6530 err = iter.page.NextWithContext(ctx)
6531 if err != nil {
6532 iter.i--
6533 return err
6534 }
6535 iter.i = 0
6536 return nil
6537 }
6538
6539
6540
6541
6542 func (iter *PrivateEndpointConnectionListResultIterator) Next() error {
6543 return iter.NextWithContext(context.Background())
6544 }
6545
6546
6547 func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool {
6548 return iter.page.NotDone() && iter.i < len(iter.page.Values())
6549 }
6550
6551
6552 func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult {
6553 return iter.page.Response()
6554 }
6555
6556
6557
6558 func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection {
6559 if !iter.page.NotDone() {
6560 return PrivateEndpointConnection{}
6561 }
6562 return iter.page.Values()[iter.i]
6563 }
6564
6565
6566 func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator {
6567 return PrivateEndpointConnectionListResultIterator{page: page}
6568 }
6569
6570
6571 func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool {
6572 return peclr.Value == nil || len(*peclr.Value) == 0
6573 }
6574
6575
6576 func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool {
6577 return peclr.NextLink != nil && len(*peclr.NextLink) != 0
6578 }
6579
6580
6581
6582 func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) {
6583 if !peclr.hasNextLink() {
6584 return nil, nil
6585 }
6586 return autorest.Prepare((&http.Request{}).WithContext(ctx),
6587 autorest.AsJSON(),
6588 autorest.AsGet(),
6589 autorest.WithBaseURL(to.String(peclr.NextLink)))
6590 }
6591
6592
6593 type PrivateEndpointConnectionListResultPage struct {
6594 fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)
6595 peclr PrivateEndpointConnectionListResult
6596 }
6597
6598
6599
6600 func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) {
6601 if tracing.IsEnabled() {
6602 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext")
6603 defer func() {
6604 sc := -1
6605 if page.Response().Response.Response != nil {
6606 sc = page.Response().Response.Response.StatusCode
6607 }
6608 tracing.EndSpan(ctx, sc, err)
6609 }()
6610 }
6611 for {
6612 next, err := page.fn(ctx, page.peclr)
6613 if err != nil {
6614 return err
6615 }
6616 page.peclr = next
6617 if !next.hasNextLink() || !next.IsEmpty() {
6618 break
6619 }
6620 }
6621 return nil
6622 }
6623
6624
6625
6626
6627 func (page *PrivateEndpointConnectionListResultPage) Next() error {
6628 return page.NextWithContext(context.Background())
6629 }
6630
6631
6632 func (page PrivateEndpointConnectionListResultPage) NotDone() bool {
6633 return !page.peclr.IsEmpty()
6634 }
6635
6636
6637 func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult {
6638 return page.peclr
6639 }
6640
6641
6642 func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection {
6643 if page.peclr.IsEmpty() {
6644 return nil
6645 }
6646 return *page.peclr.Value
6647 }
6648
6649
6650 func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage {
6651 return PrivateEndpointConnectionListResultPage{
6652 fn: getNextPage,
6653 peclr: cur,
6654 }
6655 }
6656
6657
6658 type PrivateEndpointConnectionProperties struct {
6659
6660 PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"`
6661
6662 PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"`
6663
6664 ProvisioningState *string `json:"provisioningState,omitempty"`
6665 }
6666
6667
6668 func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) {
6669 objectMap := make(map[string]interface{})
6670 if pecp.PrivateEndpoint != nil {
6671 objectMap["privateEndpoint"] = pecp.PrivateEndpoint
6672 }
6673 if pecp.PrivateLinkServiceConnectionState != nil {
6674 objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState
6675 }
6676 return json.Marshal(objectMap)
6677 }
6678
6679
6680
6681 type PrivateEndpointConnectionsCreateOrUpdateFuture struct {
6682 azure.FutureAPI
6683
6684
6685 Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error)
6686 }
6687
6688
6689 func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
6690 var azFuture azure.Future
6691 if err := json.Unmarshal(body, &azFuture); err != nil {
6692 return err
6693 }
6694 future.FutureAPI = &azFuture
6695 future.Result = future.result
6696 return nil
6697 }
6698
6699
6700 func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) {
6701 var done bool
6702 done, err = future.DoneWithContext(context.Background(), client)
6703 if err != nil {
6704 err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
6705 return
6706 }
6707 if !done {
6708 pec.Response.Response = future.Response()
6709 err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsCreateOrUpdateFuture")
6710 return
6711 }
6712 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
6713 if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent {
6714 pec, err = client.CreateOrUpdateResponder(pec.Response.Response)
6715 if err != nil {
6716 err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request")
6717 }
6718 }
6719 return
6720 }
6721
6722
6723
6724 type PrivateEndpointConnectionsDeleteFuture struct {
6725 azure.FutureAPI
6726
6727
6728 Result func(PrivateEndpointConnectionsClient) (autorest.Response, error)
6729 }
6730
6731
6732 func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error {
6733 var azFuture azure.Future
6734 if err := json.Unmarshal(body, &azFuture); err != nil {
6735 return err
6736 }
6737 future.FutureAPI = &azFuture
6738 future.Result = future.result
6739 return nil
6740 }
6741
6742
6743 func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) {
6744 var done bool
6745 done, err = future.DoneWithContext(context.Background(), client)
6746 if err != nil {
6747 err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure")
6748 return
6749 }
6750 if !done {
6751 ar.Response = future.Response()
6752 err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsDeleteFuture")
6753 return
6754 }
6755 ar.Response = future.Response()
6756 return
6757 }
6758
6759
6760 type PrivateEndpointProperty struct {
6761
6762 ID *string `json:"id,omitempty"`
6763 }
6764
6765
6766 type PrivateLinkResource struct {
6767 autorest.Response `json:"-"`
6768
6769 *PrivateLinkResourceProperties `json:"properties,omitempty"`
6770
6771 ID *string `json:"id,omitempty"`
6772
6773 Name *string `json:"name,omitempty"`
6774
6775 Type *string `json:"type,omitempty"`
6776 }
6777
6778
6779 func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) {
6780 objectMap := make(map[string]interface{})
6781 if plr.PrivateLinkResourceProperties != nil {
6782 objectMap["properties"] = plr.PrivateLinkResourceProperties
6783 }
6784 return json.Marshal(objectMap)
6785 }
6786
6787
6788 func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error {
6789 var m map[string]*json.RawMessage
6790 err := json.Unmarshal(body, &m)
6791 if err != nil {
6792 return err
6793 }
6794 for k, v := range m {
6795 switch k {
6796 case "properties":
6797 if v != nil {
6798 var privateLinkResourceProperties PrivateLinkResourceProperties
6799 err = json.Unmarshal(*v, &privateLinkResourceProperties)
6800 if err != nil {
6801 return err
6802 }
6803 plr.PrivateLinkResourceProperties = &privateLinkResourceProperties
6804 }
6805 case "id":
6806 if v != nil {
6807 var ID string
6808 err = json.Unmarshal(*v, &ID)
6809 if err != nil {
6810 return err
6811 }
6812 plr.ID = &ID
6813 }
6814 case "name":
6815 if v != nil {
6816 var name string
6817 err = json.Unmarshal(*v, &name)
6818 if err != nil {
6819 return err
6820 }
6821 plr.Name = &name
6822 }
6823 case "type":
6824 if v != nil {
6825 var typeVar string
6826 err = json.Unmarshal(*v, &typeVar)
6827 if err != nil {
6828 return err
6829 }
6830 plr.Type = &typeVar
6831 }
6832 }
6833 }
6834
6835 return nil
6836 }
6837
6838
6839 type PrivateLinkResourceListResult struct {
6840 autorest.Response `json:"-"`
6841
6842 Value *[]PrivateLinkResource `json:"value,omitempty"`
6843
6844 NextLink *string `json:"nextLink,omitempty"`
6845 }
6846
6847
6848 func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) {
6849 objectMap := make(map[string]interface{})
6850 return json.Marshal(objectMap)
6851 }
6852
6853
6854
6855 type PrivateLinkResourceListResultIterator struct {
6856 i int
6857 page PrivateLinkResourceListResultPage
6858 }
6859
6860
6861
6862 func (iter *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) {
6863 if tracing.IsEnabled() {
6864 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.NextWithContext")
6865 defer func() {
6866 sc := -1
6867 if iter.Response().Response.Response != nil {
6868 sc = iter.Response().Response.Response.StatusCode
6869 }
6870 tracing.EndSpan(ctx, sc, err)
6871 }()
6872 }
6873 iter.i++
6874 if iter.i < len(iter.page.Values()) {
6875 return nil
6876 }
6877 err = iter.page.NextWithContext(ctx)
6878 if err != nil {
6879 iter.i--
6880 return err
6881 }
6882 iter.i = 0
6883 return nil
6884 }
6885
6886
6887
6888
6889 func (iter *PrivateLinkResourceListResultIterator) Next() error {
6890 return iter.NextWithContext(context.Background())
6891 }
6892
6893
6894 func (iter PrivateLinkResourceListResultIterator) NotDone() bool {
6895 return iter.page.NotDone() && iter.i < len(iter.page.Values())
6896 }
6897
6898
6899 func (iter PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult {
6900 return iter.page.Response()
6901 }
6902
6903
6904
6905 func (iter PrivateLinkResourceListResultIterator) Value() PrivateLinkResource {
6906 if !iter.page.NotDone() {
6907 return PrivateLinkResource{}
6908 }
6909 return iter.page.Values()[iter.i]
6910 }
6911
6912
6913 func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator {
6914 return PrivateLinkResourceListResultIterator{page: page}
6915 }
6916
6917
6918 func (plrlr PrivateLinkResourceListResult) IsEmpty() bool {
6919 return plrlr.Value == nil || len(*plrlr.Value) == 0
6920 }
6921
6922
6923 func (plrlr PrivateLinkResourceListResult) hasNextLink() bool {
6924 return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0
6925 }
6926
6927
6928
6929 func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) {
6930 if !plrlr.hasNextLink() {
6931 return nil, nil
6932 }
6933 return autorest.Prepare((&http.Request{}).WithContext(ctx),
6934 autorest.AsJSON(),
6935 autorest.AsGet(),
6936 autorest.WithBaseURL(to.String(plrlr.NextLink)))
6937 }
6938
6939
6940 type PrivateLinkResourceListResultPage struct {
6941 fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)
6942 plrlr PrivateLinkResourceListResult
6943 }
6944
6945
6946
6947 func (page *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) {
6948 if tracing.IsEnabled() {
6949 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.NextWithContext")
6950 defer func() {
6951 sc := -1
6952 if page.Response().Response.Response != nil {
6953 sc = page.Response().Response.Response.StatusCode
6954 }
6955 tracing.EndSpan(ctx, sc, err)
6956 }()
6957 }
6958 for {
6959 next, err := page.fn(ctx, page.plrlr)
6960 if err != nil {
6961 return err
6962 }
6963 page.plrlr = next
6964 if !next.hasNextLink() || !next.IsEmpty() {
6965 break
6966 }
6967 }
6968 return nil
6969 }
6970
6971
6972
6973
6974 func (page *PrivateLinkResourceListResultPage) Next() error {
6975 return page.NextWithContext(context.Background())
6976 }
6977
6978
6979 func (page PrivateLinkResourceListResultPage) NotDone() bool {
6980 return !page.plrlr.IsEmpty()
6981 }
6982
6983
6984 func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult {
6985 return page.plrlr
6986 }
6987
6988
6989 func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource {
6990 if page.plrlr.IsEmpty() {
6991 return nil
6992 }
6993 return *page.plrlr.Value
6994 }
6995
6996
6997 func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage {
6998 return PrivateLinkResourceListResultPage{
6999 fn: getNextPage,
7000 plrlr: cur,
7001 }
7002 }
7003
7004
7005 type PrivateLinkResourceProperties struct {
7006
7007 GroupID *string `json:"groupId,omitempty"`
7008
7009 RequiredMembers *[]string `json:"requiredMembers,omitempty"`
7010 }
7011
7012
7013 func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) {
7014 objectMap := make(map[string]interface{})
7015 return json.Marshal(objectMap)
7016 }
7017
7018
7019
7020 type PrivateLinkScopedResourcesCreateOrUpdateFuture struct {
7021 azure.FutureAPI
7022
7023
7024 Result func(PrivateLinkScopedResourcesClient) (ScopedResource, error)
7025 }
7026
7027
7028 func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
7029 var azFuture azure.Future
7030 if err := json.Unmarshal(body, &azFuture); err != nil {
7031 return err
7032 }
7033 future.FutureAPI = &azFuture
7034 future.Result = future.result
7035 return nil
7036 }
7037
7038
7039 func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) result(client PrivateLinkScopedResourcesClient) (sr ScopedResource, err error) {
7040 var done bool
7041 done, err = future.DoneWithContext(context.Background(), client)
7042 if err != nil {
7043 err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
7044 return
7045 }
7046 if !done {
7047 sr.Response.Response = future.Response()
7048 err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesCreateOrUpdateFuture")
7049 return
7050 }
7051 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
7052 if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent {
7053 sr, err = client.CreateOrUpdateResponder(sr.Response.Response)
7054 if err != nil {
7055 err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request")
7056 }
7057 }
7058 return
7059 }
7060
7061
7062
7063 type PrivateLinkScopedResourcesDeleteFuture struct {
7064 azure.FutureAPI
7065
7066
7067 Result func(PrivateLinkScopedResourcesClient) (autorest.Response, error)
7068 }
7069
7070
7071 func (future *PrivateLinkScopedResourcesDeleteFuture) UnmarshalJSON(body []byte) error {
7072 var azFuture azure.Future
7073 if err := json.Unmarshal(body, &azFuture); err != nil {
7074 return err
7075 }
7076 future.FutureAPI = &azFuture
7077 future.Result = future.result
7078 return nil
7079 }
7080
7081
7082 func (future *PrivateLinkScopedResourcesDeleteFuture) result(client PrivateLinkScopedResourcesClient) (ar autorest.Response, err error) {
7083 var done bool
7084 done, err = future.DoneWithContext(context.Background(), client)
7085 if err != nil {
7086 err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesDeleteFuture", "Result", future.Response(), "Polling failure")
7087 return
7088 }
7089 if !done {
7090 ar.Response = future.Response()
7091 err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesDeleteFuture")
7092 return
7093 }
7094 ar.Response = future.Response()
7095 return
7096 }
7097
7098
7099
7100 type PrivateLinkScopesDeleteFuture struct {
7101 azure.FutureAPI
7102
7103
7104 Result func(PrivateLinkScopesClient) (autorest.Response, error)
7105 }
7106
7107
7108 func (future *PrivateLinkScopesDeleteFuture) UnmarshalJSON(body []byte) error {
7109 var azFuture azure.Future
7110 if err := json.Unmarshal(body, &azFuture); err != nil {
7111 return err
7112 }
7113 future.FutureAPI = &azFuture
7114 future.Result = future.result
7115 return nil
7116 }
7117
7118
7119 func (future *PrivateLinkScopesDeleteFuture) result(client PrivateLinkScopesClient) (ar autorest.Response, err error) {
7120 var done bool
7121 done, err = future.DoneWithContext(context.Background(), client)
7122 if err != nil {
7123 err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesDeleteFuture", "Result", future.Response(), "Polling failure")
7124 return
7125 }
7126 if !done {
7127 ar.Response = future.Response()
7128 err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopesDeleteFuture")
7129 return
7130 }
7131 ar.Response = future.Response()
7132 return
7133 }
7134
7135
7136 type PrivateLinkScopesResource struct {
7137
7138 ID *string `json:"id,omitempty"`
7139
7140 Name *string `json:"name,omitempty"`
7141
7142 Type *string `json:"type,omitempty"`
7143
7144 Location *string `json:"location,omitempty"`
7145
7146 Tags map[string]*string `json:"tags"`
7147 }
7148
7149
7150 func (plsr PrivateLinkScopesResource) MarshalJSON() ([]byte, error) {
7151 objectMap := make(map[string]interface{})
7152 if plsr.Location != nil {
7153 objectMap["location"] = plsr.Location
7154 }
7155 if plsr.Tags != nil {
7156 objectMap["tags"] = plsr.Tags
7157 }
7158 return json.Marshal(objectMap)
7159 }
7160
7161
7162 type PrivateLinkServiceConnectionStateProperty struct {
7163
7164 Status *string `json:"status,omitempty"`
7165
7166 Description *string `json:"description,omitempty"`
7167
7168 ActionsRequired *string `json:"actionsRequired,omitempty"`
7169 }
7170
7171
7172 func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) {
7173 objectMap := make(map[string]interface{})
7174 if plscsp.Status != nil {
7175 objectMap["status"] = plscsp.Status
7176 }
7177 if plscsp.Description != nil {
7178 objectMap["description"] = plscsp.Description
7179 }
7180 return json.Marshal(objectMap)
7181 }
7182
7183
7184 type ProxyOnlyResource struct {
7185
7186 ID *string `json:"id,omitempty"`
7187
7188 Name *string `json:"name,omitempty"`
7189
7190 Type *string `json:"type,omitempty"`
7191 }
7192
7193
7194 func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) {
7195 objectMap := make(map[string]interface{})
7196 return json.Marshal(objectMap)
7197 }
7198
7199
7200 type ProxyResource struct {
7201
7202 ID *string `json:"id,omitempty"`
7203
7204 Name *string `json:"name,omitempty"`
7205
7206 Type *string `json:"type,omitempty"`
7207 }
7208
7209
7210 func (pr ProxyResource) MarshalJSON() ([]byte, error) {
7211 objectMap := make(map[string]interface{})
7212 return json.Marshal(objectMap)
7213 }
7214
7215
7216
7217 type Recurrence struct {
7218
7219 Frequency RecurrenceFrequency `json:"frequency,omitempty"`
7220
7221 Schedule *RecurrentSchedule `json:"schedule,omitempty"`
7222 }
7223
7224
7225 type RecurrentSchedule struct {
7226
7227 TimeZone *string `json:"timeZone,omitempty"`
7228
7229 Days *[]string `json:"days,omitempty"`
7230
7231 Hours *[]int32 `json:"hours,omitempty"`
7232
7233 Minutes *[]int32 `json:"minutes,omitempty"`
7234 }
7235
7236
7237 type Resource struct {
7238
7239 ID *string `json:"id,omitempty"`
7240
7241 Name *string `json:"name,omitempty"`
7242
7243 Type *string `json:"type,omitempty"`
7244
7245 Location *string `json:"location,omitempty"`
7246
7247 Tags map[string]*string `json:"tags"`
7248
7249 Kind *string `json:"kind,omitempty"`
7250
7251 Etag *string `json:"etag,omitempty"`
7252 }
7253
7254
7255 func (r Resource) MarshalJSON() ([]byte, error) {
7256 objectMap := make(map[string]interface{})
7257 if r.Location != nil {
7258 objectMap["location"] = r.Location
7259 }
7260 if r.Tags != nil {
7261 objectMap["tags"] = r.Tags
7262 }
7263 return json.Marshal(objectMap)
7264 }
7265
7266
7267 type ResourceForUpdate struct {
7268
7269 Tags map[string]*string `json:"tags"`
7270 }
7271
7272
7273 func (rfu ResourceForUpdate) MarshalJSON() ([]byte, error) {
7274 objectMap := make(map[string]interface{})
7275 if rfu.Tags != nil {
7276 objectMap["tags"] = rfu.Tags
7277 }
7278 return json.Marshal(objectMap)
7279 }
7280
7281
7282 type Response struct {
7283 autorest.Response `json:"-"`
7284
7285 Cost *float64 `json:"cost,omitempty"`
7286
7287 Timespan *string `json:"timespan,omitempty"`
7288
7289 Interval *string `json:"interval,omitempty"`
7290
7291 Namespace *string `json:"namespace,omitempty"`
7292
7293 Resourceregion *string `json:"resourceregion,omitempty"`
7294
7295 Value *[]Metric `json:"value,omitempty"`
7296 }
7297
7298
7299 type ResponseWithError struct {
7300
7301 Error *Error `json:"error,omitempty"`
7302 }
7303
7304
7305 type RetentionPolicy struct {
7306
7307 Enabled *bool `json:"enabled,omitempty"`
7308
7309 Days *int32 `json:"days,omitempty"`
7310 }
7311
7312
7313
7314 type BasicRuleAction interface {
7315 AsRuleEmailAction() (*RuleEmailAction, bool)
7316 AsRuleWebhookAction() (*RuleWebhookAction, bool)
7317 AsRuleAction() (*RuleAction, bool)
7318 }
7319
7320
7321
7322 type RuleAction struct {
7323
7324 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"`
7325 }
7326
7327 func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) {
7328 var m map[string]interface{}
7329 err := json.Unmarshal(body, &m)
7330 if err != nil {
7331 return nil, err
7332 }
7333
7334 switch m["odata.type"] {
7335 case string(OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction):
7336 var rea RuleEmailAction
7337 err := json.Unmarshal(body, &rea)
7338 return rea, err
7339 case string(OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction):
7340 var rwa RuleWebhookAction
7341 err := json.Unmarshal(body, &rwa)
7342 return rwa, err
7343 default:
7344 var ra RuleAction
7345 err := json.Unmarshal(body, &ra)
7346 return ra, err
7347 }
7348 }
7349 func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) {
7350 var rawMessages []*json.RawMessage
7351 err := json.Unmarshal(body, &rawMessages)
7352 if err != nil {
7353 return nil, err
7354 }
7355
7356 raArray := make([]BasicRuleAction, len(rawMessages))
7357
7358 for index, rawMessage := range rawMessages {
7359 ra, err := unmarshalBasicRuleAction(*rawMessage)
7360 if err != nil {
7361 return nil, err
7362 }
7363 raArray[index] = ra
7364 }
7365 return raArray, nil
7366 }
7367
7368
7369 func (ra RuleAction) MarshalJSON() ([]byte, error) {
7370 ra.OdataType = OdataTypeBasicRuleActionOdataTypeRuleAction
7371 objectMap := make(map[string]interface{})
7372 if ra.OdataType != "" {
7373 objectMap["odata.type"] = ra.OdataType
7374 }
7375 return json.Marshal(objectMap)
7376 }
7377
7378
7379 func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) {
7380 return nil, false
7381 }
7382
7383
7384 func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) {
7385 return nil, false
7386 }
7387
7388
7389 func (ra RuleAction) AsRuleAction() (*RuleAction, bool) {
7390 return &ra, true
7391 }
7392
7393
7394 func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) {
7395 return &ra, true
7396 }
7397
7398
7399 type BasicRuleCondition interface {
7400 AsThresholdRuleCondition() (*ThresholdRuleCondition, bool)
7401 AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool)
7402 AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool)
7403 AsRuleCondition() (*RuleCondition, bool)
7404 }
7405
7406
7407 type RuleCondition struct {
7408
7409 DataSource BasicRuleDataSource `json:"dataSource,omitempty"`
7410
7411 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"`
7412 }
7413
7414 func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) {
7415 var m map[string]interface{}
7416 err := json.Unmarshal(body, &m)
7417 if err != nil {
7418 return nil, err
7419 }
7420
7421 switch m["odata.type"] {
7422 case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition):
7423 var trc ThresholdRuleCondition
7424 err := json.Unmarshal(body, &trc)
7425 return trc, err
7426 case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition):
7427 var ltrc LocationThresholdRuleCondition
7428 err := json.Unmarshal(body, <rc)
7429 return ltrc, err
7430 case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition):
7431 var merc ManagementEventRuleCondition
7432 err := json.Unmarshal(body, &merc)
7433 return merc, err
7434 default:
7435 var rc RuleCondition
7436 err := json.Unmarshal(body, &rc)
7437 return rc, err
7438 }
7439 }
7440 func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) {
7441 var rawMessages []*json.RawMessage
7442 err := json.Unmarshal(body, &rawMessages)
7443 if err != nil {
7444 return nil, err
7445 }
7446
7447 rcArray := make([]BasicRuleCondition, len(rawMessages))
7448
7449 for index, rawMessage := range rawMessages {
7450 rc, err := unmarshalBasicRuleCondition(*rawMessage)
7451 if err != nil {
7452 return nil, err
7453 }
7454 rcArray[index] = rc
7455 }
7456 return rcArray, nil
7457 }
7458
7459
7460 func (rc RuleCondition) MarshalJSON() ([]byte, error) {
7461 rc.OdataType = OdataTypeBasicRuleConditionOdataTypeRuleCondition
7462 objectMap := make(map[string]interface{})
7463 objectMap["dataSource"] = rc.DataSource
7464 if rc.OdataType != "" {
7465 objectMap["odata.type"] = rc.OdataType
7466 }
7467 return json.Marshal(objectMap)
7468 }
7469
7470
7471 func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
7472 return nil, false
7473 }
7474
7475
7476 func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
7477 return nil, false
7478 }
7479
7480
7481 func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
7482 return nil, false
7483 }
7484
7485
7486 func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) {
7487 return &rc, true
7488 }
7489
7490
7491 func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) {
7492 return &rc, true
7493 }
7494
7495
7496 func (rc *RuleCondition) UnmarshalJSON(body []byte) error {
7497 var m map[string]*json.RawMessage
7498 err := json.Unmarshal(body, &m)
7499 if err != nil {
7500 return err
7501 }
7502 for k, v := range m {
7503 switch k {
7504 case "dataSource":
7505 if v != nil {
7506 dataSource, err := unmarshalBasicRuleDataSource(*v)
7507 if err != nil {
7508 return err
7509 }
7510 rc.DataSource = dataSource
7511 }
7512 case "odata.type":
7513 if v != nil {
7514 var odataType OdataTypeBasicRuleCondition
7515 err = json.Unmarshal(*v, &odataType)
7516 if err != nil {
7517 return err
7518 }
7519 rc.OdataType = odataType
7520 }
7521 }
7522 }
7523
7524 return nil
7525 }
7526
7527
7528 type BasicRuleDataSource interface {
7529 AsRuleMetricDataSource() (*RuleMetricDataSource, bool)
7530 AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool)
7531 AsRuleDataSource() (*RuleDataSource, bool)
7532 }
7533
7534
7535 type RuleDataSource struct {
7536
7537 ResourceURI *string `json:"resourceUri,omitempty"`
7538
7539 LegacyResourceID *string `json:"legacyResourceId,omitempty"`
7540
7541 ResourceLocation *string `json:"resourceLocation,omitempty"`
7542
7543 MetricNamespace *string `json:"metricNamespace,omitempty"`
7544
7545 OdataType OdataType `json:"odata.type,omitempty"`
7546 }
7547
7548 func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) {
7549 var m map[string]interface{}
7550 err := json.Unmarshal(body, &m)
7551 if err != nil {
7552 return nil, err
7553 }
7554
7555 switch m["odata.type"] {
7556 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource):
7557 var rmds RuleMetricDataSource
7558 err := json.Unmarshal(body, &rmds)
7559 return rmds, err
7560 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource):
7561 var rmeds RuleManagementEventDataSource
7562 err := json.Unmarshal(body, &rmeds)
7563 return rmeds, err
7564 default:
7565 var rds RuleDataSource
7566 err := json.Unmarshal(body, &rds)
7567 return rds, err
7568 }
7569 }
7570 func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) {
7571 var rawMessages []*json.RawMessage
7572 err := json.Unmarshal(body, &rawMessages)
7573 if err != nil {
7574 return nil, err
7575 }
7576
7577 rdsArray := make([]BasicRuleDataSource, len(rawMessages))
7578
7579 for index, rawMessage := range rawMessages {
7580 rds, err := unmarshalBasicRuleDataSource(*rawMessage)
7581 if err != nil {
7582 return nil, err
7583 }
7584 rdsArray[index] = rds
7585 }
7586 return rdsArray, nil
7587 }
7588
7589
7590 func (rds RuleDataSource) MarshalJSON() ([]byte, error) {
7591 rds.OdataType = OdataTypeRuleDataSource
7592 objectMap := make(map[string]interface{})
7593 if rds.ResourceURI != nil {
7594 objectMap["resourceUri"] = rds.ResourceURI
7595 }
7596 if rds.LegacyResourceID != nil {
7597 objectMap["legacyResourceId"] = rds.LegacyResourceID
7598 }
7599 if rds.ResourceLocation != nil {
7600 objectMap["resourceLocation"] = rds.ResourceLocation
7601 }
7602 if rds.MetricNamespace != nil {
7603 objectMap["metricNamespace"] = rds.MetricNamespace
7604 }
7605 if rds.OdataType != "" {
7606 objectMap["odata.type"] = rds.OdataType
7607 }
7608 return json.Marshal(objectMap)
7609 }
7610
7611
7612 func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) {
7613 return nil, false
7614 }
7615
7616
7617 func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) {
7618 return nil, false
7619 }
7620
7621
7622 func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) {
7623 return &rds, true
7624 }
7625
7626
7627 func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) {
7628 return &rds, true
7629 }
7630
7631
7632
7633 type RuleEmailAction struct {
7634
7635 SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"`
7636
7637 CustomEmails *[]string `json:"customEmails,omitempty"`
7638
7639 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"`
7640 }
7641
7642
7643 func (rea RuleEmailAction) MarshalJSON() ([]byte, error) {
7644 rea.OdataType = OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction
7645 objectMap := make(map[string]interface{})
7646 if rea.SendToServiceOwners != nil {
7647 objectMap["sendToServiceOwners"] = rea.SendToServiceOwners
7648 }
7649 if rea.CustomEmails != nil {
7650 objectMap["customEmails"] = rea.CustomEmails
7651 }
7652 if rea.OdataType != "" {
7653 objectMap["odata.type"] = rea.OdataType
7654 }
7655 return json.Marshal(objectMap)
7656 }
7657
7658
7659 func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) {
7660 return &rea, true
7661 }
7662
7663
7664 func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) {
7665 return nil, false
7666 }
7667
7668
7669 func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) {
7670 return nil, false
7671 }
7672
7673
7674 func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) {
7675 return &rea, true
7676 }
7677
7678
7679 type RuleManagementEventClaimsDataSource struct {
7680
7681 EmailAddress *string `json:"emailAddress,omitempty"`
7682 }
7683
7684
7685
7686 type RuleManagementEventDataSource struct {
7687
7688 EventName *string `json:"eventName,omitempty"`
7689
7690 EventSource *string `json:"eventSource,omitempty"`
7691
7692 Level *string `json:"level,omitempty"`
7693
7694 OperationName *string `json:"operationName,omitempty"`
7695
7696 ResourceGroupName *string `json:"resourceGroupName,omitempty"`
7697
7698 ResourceProviderName *string `json:"resourceProviderName,omitempty"`
7699
7700 Status *string `json:"status,omitempty"`
7701
7702 SubStatus *string `json:"subStatus,omitempty"`
7703
7704 Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"`
7705
7706 ResourceURI *string `json:"resourceUri,omitempty"`
7707
7708 LegacyResourceID *string `json:"legacyResourceId,omitempty"`
7709
7710 ResourceLocation *string `json:"resourceLocation,omitempty"`
7711
7712 MetricNamespace *string `json:"metricNamespace,omitempty"`
7713
7714 OdataType OdataType `json:"odata.type,omitempty"`
7715 }
7716
7717
7718 func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) {
7719 rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource
7720 objectMap := make(map[string]interface{})
7721 if rmeds.EventName != nil {
7722 objectMap["eventName"] = rmeds.EventName
7723 }
7724 if rmeds.EventSource != nil {
7725 objectMap["eventSource"] = rmeds.EventSource
7726 }
7727 if rmeds.Level != nil {
7728 objectMap["level"] = rmeds.Level
7729 }
7730 if rmeds.OperationName != nil {
7731 objectMap["operationName"] = rmeds.OperationName
7732 }
7733 if rmeds.ResourceGroupName != nil {
7734 objectMap["resourceGroupName"] = rmeds.ResourceGroupName
7735 }
7736 if rmeds.ResourceProviderName != nil {
7737 objectMap["resourceProviderName"] = rmeds.ResourceProviderName
7738 }
7739 if rmeds.Status != nil {
7740 objectMap["status"] = rmeds.Status
7741 }
7742 if rmeds.SubStatus != nil {
7743 objectMap["subStatus"] = rmeds.SubStatus
7744 }
7745 if rmeds.Claims != nil {
7746 objectMap["claims"] = rmeds.Claims
7747 }
7748 if rmeds.ResourceURI != nil {
7749 objectMap["resourceUri"] = rmeds.ResourceURI
7750 }
7751 if rmeds.LegacyResourceID != nil {
7752 objectMap["legacyResourceId"] = rmeds.LegacyResourceID
7753 }
7754 if rmeds.ResourceLocation != nil {
7755 objectMap["resourceLocation"] = rmeds.ResourceLocation
7756 }
7757 if rmeds.MetricNamespace != nil {
7758 objectMap["metricNamespace"] = rmeds.MetricNamespace
7759 }
7760 if rmeds.OdataType != "" {
7761 objectMap["odata.type"] = rmeds.OdataType
7762 }
7763 return json.Marshal(objectMap)
7764 }
7765
7766
7767 func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) {
7768 return nil, false
7769 }
7770
7771
7772 func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) {
7773 return &rmeds, true
7774 }
7775
7776
7777 func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) {
7778 return nil, false
7779 }
7780
7781
7782 func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) {
7783 return &rmeds, true
7784 }
7785
7786
7787
7788 type RuleMetricDataSource struct {
7789
7790 MetricName *string `json:"metricName,omitempty"`
7791
7792 ResourceURI *string `json:"resourceUri,omitempty"`
7793
7794 LegacyResourceID *string `json:"legacyResourceId,omitempty"`
7795
7796 ResourceLocation *string `json:"resourceLocation,omitempty"`
7797
7798 MetricNamespace *string `json:"metricNamespace,omitempty"`
7799
7800 OdataType OdataType `json:"odata.type,omitempty"`
7801 }
7802
7803
7804 func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) {
7805 rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource
7806 objectMap := make(map[string]interface{})
7807 if rmds.MetricName != nil {
7808 objectMap["metricName"] = rmds.MetricName
7809 }
7810 if rmds.ResourceURI != nil {
7811 objectMap["resourceUri"] = rmds.ResourceURI
7812 }
7813 if rmds.LegacyResourceID != nil {
7814 objectMap["legacyResourceId"] = rmds.LegacyResourceID
7815 }
7816 if rmds.ResourceLocation != nil {
7817 objectMap["resourceLocation"] = rmds.ResourceLocation
7818 }
7819 if rmds.MetricNamespace != nil {
7820 objectMap["metricNamespace"] = rmds.MetricNamespace
7821 }
7822 if rmds.OdataType != "" {
7823 objectMap["odata.type"] = rmds.OdataType
7824 }
7825 return json.Marshal(objectMap)
7826 }
7827
7828
7829 func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) {
7830 return &rmds, true
7831 }
7832
7833
7834 func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) {
7835 return nil, false
7836 }
7837
7838
7839 func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) {
7840 return nil, false
7841 }
7842
7843
7844 func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) {
7845 return &rmds, true
7846 }
7847
7848
7849
7850 type RuleWebhookAction struct {
7851
7852 ServiceURI *string `json:"serviceUri,omitempty"`
7853
7854 Properties map[string]*string `json:"properties"`
7855
7856 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"`
7857 }
7858
7859
7860 func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) {
7861 rwa.OdataType = OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction
7862 objectMap := make(map[string]interface{})
7863 if rwa.ServiceURI != nil {
7864 objectMap["serviceUri"] = rwa.ServiceURI
7865 }
7866 if rwa.Properties != nil {
7867 objectMap["properties"] = rwa.Properties
7868 }
7869 if rwa.OdataType != "" {
7870 objectMap["odata.type"] = rwa.OdataType
7871 }
7872 return json.Marshal(objectMap)
7873 }
7874
7875
7876 func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) {
7877 return nil, false
7878 }
7879
7880
7881 func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) {
7882 return &rwa, true
7883 }
7884
7885
7886 func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) {
7887 return nil, false
7888 }
7889
7890
7891 func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) {
7892 return &rwa, true
7893 }
7894
7895
7896 type ScaleAction struct {
7897
7898 Direction ScaleDirection `json:"direction,omitempty"`
7899
7900 Type ScaleType `json:"type,omitempty"`
7901
7902 Value *string `json:"value,omitempty"`
7903
7904 Cooldown *string `json:"cooldown,omitempty"`
7905 }
7906
7907
7908 type ScaleCapacity struct {
7909
7910 Minimum *string `json:"minimum,omitempty"`
7911
7912 Maximum *string `json:"maximum,omitempty"`
7913
7914 Default *string `json:"default,omitempty"`
7915 }
7916
7917
7918 type ScaleRule struct {
7919
7920 MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"`
7921
7922 ScaleAction *ScaleAction `json:"scaleAction,omitempty"`
7923 }
7924
7925
7926 type ScaleRuleMetricDimension struct {
7927
7928 DimensionName *string `json:"DimensionName,omitempty"`
7929
7930 Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"`
7931
7932 Values *[]string `json:"Values,omitempty"`
7933 }
7934
7935
7936 type Schedule struct {
7937
7938 FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"`
7939
7940 TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"`
7941 }
7942
7943
7944 type ScopedResource struct {
7945 autorest.Response `json:"-"`
7946
7947 *ScopedResourceProperties `json:"properties,omitempty"`
7948
7949 ID *string `json:"id,omitempty"`
7950
7951 Name *string `json:"name,omitempty"`
7952
7953 Type *string `json:"type,omitempty"`
7954 }
7955
7956
7957 func (sr ScopedResource) MarshalJSON() ([]byte, error) {
7958 objectMap := make(map[string]interface{})
7959 if sr.ScopedResourceProperties != nil {
7960 objectMap["properties"] = sr.ScopedResourceProperties
7961 }
7962 return json.Marshal(objectMap)
7963 }
7964
7965
7966 func (sr *ScopedResource) UnmarshalJSON(body []byte) error {
7967 var m map[string]*json.RawMessage
7968 err := json.Unmarshal(body, &m)
7969 if err != nil {
7970 return err
7971 }
7972 for k, v := range m {
7973 switch k {
7974 case "properties":
7975 if v != nil {
7976 var scopedResourceProperties ScopedResourceProperties
7977 err = json.Unmarshal(*v, &scopedResourceProperties)
7978 if err != nil {
7979 return err
7980 }
7981 sr.ScopedResourceProperties = &scopedResourceProperties
7982 }
7983 case "id":
7984 if v != nil {
7985 var ID string
7986 err = json.Unmarshal(*v, &ID)
7987 if err != nil {
7988 return err
7989 }
7990 sr.ID = &ID
7991 }
7992 case "name":
7993 if v != nil {
7994 var name string
7995 err = json.Unmarshal(*v, &name)
7996 if err != nil {
7997 return err
7998 }
7999 sr.Name = &name
8000 }
8001 case "type":
8002 if v != nil {
8003 var typeVar string
8004 err = json.Unmarshal(*v, &typeVar)
8005 if err != nil {
8006 return err
8007 }
8008 sr.Type = &typeVar
8009 }
8010 }
8011 }
8012
8013 return nil
8014 }
8015
8016
8017 type ScopedResourceListResult struct {
8018 autorest.Response `json:"-"`
8019
8020 Value *[]ScopedResource `json:"value,omitempty"`
8021
8022 NextLink *string `json:"nextLink,omitempty"`
8023 }
8024
8025
8026 func (srlr ScopedResourceListResult) MarshalJSON() ([]byte, error) {
8027 objectMap := make(map[string]interface{})
8028 return json.Marshal(objectMap)
8029 }
8030
8031
8032 type ScopedResourceListResultIterator struct {
8033 i int
8034 page ScopedResourceListResultPage
8035 }
8036
8037
8038
8039 func (iter *ScopedResourceListResultIterator) NextWithContext(ctx context.Context) (err error) {
8040 if tracing.IsEnabled() {
8041 ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultIterator.NextWithContext")
8042 defer func() {
8043 sc := -1
8044 if iter.Response().Response.Response != nil {
8045 sc = iter.Response().Response.Response.StatusCode
8046 }
8047 tracing.EndSpan(ctx, sc, err)
8048 }()
8049 }
8050 iter.i++
8051 if iter.i < len(iter.page.Values()) {
8052 return nil
8053 }
8054 err = iter.page.NextWithContext(ctx)
8055 if err != nil {
8056 iter.i--
8057 return err
8058 }
8059 iter.i = 0
8060 return nil
8061 }
8062
8063
8064
8065
8066 func (iter *ScopedResourceListResultIterator) Next() error {
8067 return iter.NextWithContext(context.Background())
8068 }
8069
8070
8071 func (iter ScopedResourceListResultIterator) NotDone() bool {
8072 return iter.page.NotDone() && iter.i < len(iter.page.Values())
8073 }
8074
8075
8076 func (iter ScopedResourceListResultIterator) Response() ScopedResourceListResult {
8077 return iter.page.Response()
8078 }
8079
8080
8081
8082 func (iter ScopedResourceListResultIterator) Value() ScopedResource {
8083 if !iter.page.NotDone() {
8084 return ScopedResource{}
8085 }
8086 return iter.page.Values()[iter.i]
8087 }
8088
8089
8090 func NewScopedResourceListResultIterator(page ScopedResourceListResultPage) ScopedResourceListResultIterator {
8091 return ScopedResourceListResultIterator{page: page}
8092 }
8093
8094
8095 func (srlr ScopedResourceListResult) IsEmpty() bool {
8096 return srlr.Value == nil || len(*srlr.Value) == 0
8097 }
8098
8099
8100 func (srlr ScopedResourceListResult) hasNextLink() bool {
8101 return srlr.NextLink != nil && len(*srlr.NextLink) != 0
8102 }
8103
8104
8105
8106 func (srlr ScopedResourceListResult) scopedResourceListResultPreparer(ctx context.Context) (*http.Request, error) {
8107 if !srlr.hasNextLink() {
8108 return nil, nil
8109 }
8110 return autorest.Prepare((&http.Request{}).WithContext(ctx),
8111 autorest.AsJSON(),
8112 autorest.AsGet(),
8113 autorest.WithBaseURL(to.String(srlr.NextLink)))
8114 }
8115
8116
8117 type ScopedResourceListResultPage struct {
8118 fn func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error)
8119 srlr ScopedResourceListResult
8120 }
8121
8122
8123
8124 func (page *ScopedResourceListResultPage) NextWithContext(ctx context.Context) (err error) {
8125 if tracing.IsEnabled() {
8126 ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultPage.NextWithContext")
8127 defer func() {
8128 sc := -1
8129 if page.Response().Response.Response != nil {
8130 sc = page.Response().Response.Response.StatusCode
8131 }
8132 tracing.EndSpan(ctx, sc, err)
8133 }()
8134 }
8135 for {
8136 next, err := page.fn(ctx, page.srlr)
8137 if err != nil {
8138 return err
8139 }
8140 page.srlr = next
8141 if !next.hasNextLink() || !next.IsEmpty() {
8142 break
8143 }
8144 }
8145 return nil
8146 }
8147
8148
8149
8150
8151 func (page *ScopedResourceListResultPage) Next() error {
8152 return page.NextWithContext(context.Background())
8153 }
8154
8155
8156 func (page ScopedResourceListResultPage) NotDone() bool {
8157 return !page.srlr.IsEmpty()
8158 }
8159
8160
8161 func (page ScopedResourceListResultPage) Response() ScopedResourceListResult {
8162 return page.srlr
8163 }
8164
8165
8166 func (page ScopedResourceListResultPage) Values() []ScopedResource {
8167 if page.srlr.IsEmpty() {
8168 return nil
8169 }
8170 return *page.srlr.Value
8171 }
8172
8173
8174 func NewScopedResourceListResultPage(cur ScopedResourceListResult, getNextPage func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error)) ScopedResourceListResultPage {
8175 return ScopedResourceListResultPage{
8176 fn: getNextPage,
8177 srlr: cur,
8178 }
8179 }
8180
8181
8182 type ScopedResourceProperties struct {
8183
8184 LinkedResourceID *string `json:"linkedResourceId,omitempty"`
8185
8186 ProvisioningState *string `json:"provisioningState,omitempty"`
8187 }
8188
8189
8190 func (srp ScopedResourceProperties) MarshalJSON() ([]byte, error) {
8191 objectMap := make(map[string]interface{})
8192 if srp.LinkedResourceID != nil {
8193 objectMap["linkedResourceId"] = srp.LinkedResourceID
8194 }
8195 return json.Marshal(objectMap)
8196 }
8197
8198
8199
8200
8201 type SenderAuthorization struct {
8202
8203 Action *string `json:"action,omitempty"`
8204
8205 Role *string `json:"role,omitempty"`
8206
8207 Scope *string `json:"scope,omitempty"`
8208 }
8209
8210
8211 type SingleBaseline struct {
8212
8213 Sensitivity BaselineSensitivity `json:"sensitivity,omitempty"`
8214
8215 LowThresholds *[]float64 `json:"lowThresholds,omitempty"`
8216
8217 HighThresholds *[]float64 `json:"highThresholds,omitempty"`
8218 }
8219
8220
8221 type SingleMetricBaseline struct {
8222
8223 ID *string `json:"id,omitempty"`
8224
8225 Type *string `json:"type,omitempty"`
8226
8227 Name *string `json:"name,omitempty"`
8228
8229 *MetricBaselinesProperties `json:"properties,omitempty"`
8230 }
8231
8232
8233 func (smb SingleMetricBaseline) MarshalJSON() ([]byte, error) {
8234 objectMap := make(map[string]interface{})
8235 if smb.ID != nil {
8236 objectMap["id"] = smb.ID
8237 }
8238 if smb.Type != nil {
8239 objectMap["type"] = smb.Type
8240 }
8241 if smb.Name != nil {
8242 objectMap["name"] = smb.Name
8243 }
8244 if smb.MetricBaselinesProperties != nil {
8245 objectMap["properties"] = smb.MetricBaselinesProperties
8246 }
8247 return json.Marshal(objectMap)
8248 }
8249
8250
8251 func (smb *SingleMetricBaseline) UnmarshalJSON(body []byte) error {
8252 var m map[string]*json.RawMessage
8253 err := json.Unmarshal(body, &m)
8254 if err != nil {
8255 return err
8256 }
8257 for k, v := range m {
8258 switch k {
8259 case "id":
8260 if v != nil {
8261 var ID string
8262 err = json.Unmarshal(*v, &ID)
8263 if err != nil {
8264 return err
8265 }
8266 smb.ID = &ID
8267 }
8268 case "type":
8269 if v != nil {
8270 var typeVar string
8271 err = json.Unmarshal(*v, &typeVar)
8272 if err != nil {
8273 return err
8274 }
8275 smb.Type = &typeVar
8276 }
8277 case "name":
8278 if v != nil {
8279 var name string
8280 err = json.Unmarshal(*v, &name)
8281 if err != nil {
8282 return err
8283 }
8284 smb.Name = &name
8285 }
8286 case "properties":
8287 if v != nil {
8288 var metricBaselinesProperties MetricBaselinesProperties
8289 err = json.Unmarshal(*v, &metricBaselinesProperties)
8290 if err != nil {
8291 return err
8292 }
8293 smb.MetricBaselinesProperties = &metricBaselinesProperties
8294 }
8295 }
8296 }
8297
8298 return nil
8299 }
8300
8301
8302 type SmsReceiver struct {
8303
8304 Name *string `json:"name,omitempty"`
8305
8306 CountryCode *string `json:"countryCode,omitempty"`
8307
8308 PhoneNumber *string `json:"phoneNumber,omitempty"`
8309
8310 Status ReceiverStatus `json:"status,omitempty"`
8311 }
8312
8313
8314 func (sr SmsReceiver) MarshalJSON() ([]byte, error) {
8315 objectMap := make(map[string]interface{})
8316 if sr.Name != nil {
8317 objectMap["name"] = sr.Name
8318 }
8319 if sr.CountryCode != nil {
8320 objectMap["countryCode"] = sr.CountryCode
8321 }
8322 if sr.PhoneNumber != nil {
8323 objectMap["phoneNumber"] = sr.PhoneNumber
8324 }
8325 return json.Marshal(objectMap)
8326 }
8327
8328
8329 type Source struct {
8330
8331 Query *string `json:"query,omitempty"`
8332
8333 AuthorizedResources *[]string `json:"authorizedResources,omitempty"`
8334
8335 DataSourceID *string `json:"dataSourceId,omitempty"`
8336
8337 QueryType QueryType `json:"queryType,omitempty"`
8338 }
8339
8340
8341
8342 type SyslogDataSource struct {
8343
8344
8345 Streams *[]KnownSyslogDataSourceStreams `json:"streams,omitempty"`
8346
8347 FacilityNames *[]KnownSyslogDataSourceFacilityNames `json:"facilityNames,omitempty"`
8348
8349 LogLevels *[]KnownSyslogDataSourceLogLevels `json:"logLevels,omitempty"`
8350
8351
8352 Name *string `json:"name,omitempty"`
8353 }
8354
8355
8356 type SystemData struct {
8357
8358 CreatedBy *string `json:"createdBy,omitempty"`
8359
8360 CreatedByType CreatedByType `json:"createdByType,omitempty"`
8361
8362 CreatedAt *date.Time `json:"createdAt,omitempty"`
8363
8364 LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
8365
8366 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
8367
8368 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
8369 }
8370
8371
8372
8373 type TagsResource struct {
8374
8375 Tags map[string]*string `json:"tags"`
8376 }
8377
8378
8379 func (tr TagsResource) MarshalJSON() ([]byte, error) {
8380 objectMap := make(map[string]interface{})
8381 if tr.Tags != nil {
8382 objectMap["tags"] = tr.Tags
8383 }
8384 return json.Marshal(objectMap)
8385 }
8386
8387
8388 type ThresholdRuleCondition struct {
8389
8390 Operator ConditionOperator `json:"operator,omitempty"`
8391
8392 Threshold *float64 `json:"threshold,omitempty"`
8393
8394 WindowSize *string `json:"windowSize,omitempty"`
8395
8396 TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"`
8397
8398 DataSource BasicRuleDataSource `json:"dataSource,omitempty"`
8399
8400 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"`
8401 }
8402
8403
8404 func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) {
8405 trc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition
8406 objectMap := make(map[string]interface{})
8407 if trc.Operator != "" {
8408 objectMap["operator"] = trc.Operator
8409 }
8410 if trc.Threshold != nil {
8411 objectMap["threshold"] = trc.Threshold
8412 }
8413 if trc.WindowSize != nil {
8414 objectMap["windowSize"] = trc.WindowSize
8415 }
8416 if trc.TimeAggregation != "" {
8417 objectMap["timeAggregation"] = trc.TimeAggregation
8418 }
8419 objectMap["dataSource"] = trc.DataSource
8420 if trc.OdataType != "" {
8421 objectMap["odata.type"] = trc.OdataType
8422 }
8423 return json.Marshal(objectMap)
8424 }
8425
8426
8427 func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
8428 return &trc, true
8429 }
8430
8431
8432 func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
8433 return nil, false
8434 }
8435
8436
8437 func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
8438 return nil, false
8439 }
8440
8441
8442 func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) {
8443 return nil, false
8444 }
8445
8446
8447 func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) {
8448 return &trc, true
8449 }
8450
8451
8452 func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error {
8453 var m map[string]*json.RawMessage
8454 err := json.Unmarshal(body, &m)
8455 if err != nil {
8456 return err
8457 }
8458 for k, v := range m {
8459 switch k {
8460 case "operator":
8461 if v != nil {
8462 var operator ConditionOperator
8463 err = json.Unmarshal(*v, &operator)
8464 if err != nil {
8465 return err
8466 }
8467 trc.Operator = operator
8468 }
8469 case "threshold":
8470 if v != nil {
8471 var threshold float64
8472 err = json.Unmarshal(*v, &threshold)
8473 if err != nil {
8474 return err
8475 }
8476 trc.Threshold = &threshold
8477 }
8478 case "windowSize":
8479 if v != nil {
8480 var windowSize string
8481 err = json.Unmarshal(*v, &windowSize)
8482 if err != nil {
8483 return err
8484 }
8485 trc.WindowSize = &windowSize
8486 }
8487 case "timeAggregation":
8488 if v != nil {
8489 var timeAggregation TimeAggregationOperator
8490 err = json.Unmarshal(*v, &timeAggregation)
8491 if err != nil {
8492 return err
8493 }
8494 trc.TimeAggregation = timeAggregation
8495 }
8496 case "dataSource":
8497 if v != nil {
8498 dataSource, err := unmarshalBasicRuleDataSource(*v)
8499 if err != nil {
8500 return err
8501 }
8502 trc.DataSource = dataSource
8503 }
8504 case "odata.type":
8505 if v != nil {
8506 var odataType OdataTypeBasicRuleCondition
8507 err = json.Unmarshal(*v, &odataType)
8508 if err != nil {
8509 return err
8510 }
8511 trc.OdataType = odataType
8512 }
8513 }
8514 }
8515
8516 return nil
8517 }
8518
8519
8520 type TimeSeriesBaseline struct {
8521
8522 Aggregation *string `json:"aggregation,omitempty"`
8523
8524 Dimensions *[]MetricSingleDimension `json:"dimensions,omitempty"`
8525
8526 Timestamps *[]date.Time `json:"timestamps,omitempty"`
8527
8528 Data *[]SingleBaseline `json:"data,omitempty"`
8529
8530 MetadataValues *[]BaselineMetadata `json:"metadataValues,omitempty"`
8531 }
8532
8533
8534 type TimeSeriesElement struct {
8535
8536 Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"`
8537
8538 Data *[]MetricValue `json:"data,omitempty"`
8539 }
8540
8541
8542 type TimeWindow struct {
8543
8544 TimeZone *string `json:"timeZone,omitempty"`
8545
8546 Start *date.Time `json:"start,omitempty"`
8547
8548 End *date.Time `json:"end,omitempty"`
8549 }
8550
8551
8552 type TriggerCondition struct {
8553
8554 ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"`
8555
8556 Threshold *float64 `json:"threshold,omitempty"`
8557
8558 MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"`
8559 }
8560
8561
8562 type VMInsightsOnboardingStatus struct {
8563 autorest.Response `json:"-"`
8564
8565 *VMInsightsOnboardingStatusProperties `json:"properties,omitempty"`
8566
8567 ID *string `json:"id,omitempty"`
8568
8569 Name *string `json:"name,omitempty"`
8570
8571 Type *string `json:"type,omitempty"`
8572 }
8573
8574
8575 func (vios VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) {
8576 objectMap := make(map[string]interface{})
8577 if vios.VMInsightsOnboardingStatusProperties != nil {
8578 objectMap["properties"] = vios.VMInsightsOnboardingStatusProperties
8579 }
8580 return json.Marshal(objectMap)
8581 }
8582
8583
8584 func (vios *VMInsightsOnboardingStatus) UnmarshalJSON(body []byte) error {
8585 var m map[string]*json.RawMessage
8586 err := json.Unmarshal(body, &m)
8587 if err != nil {
8588 return err
8589 }
8590 for k, v := range m {
8591 switch k {
8592 case "properties":
8593 if v != nil {
8594 var VMInsightsOnboardingStatusProperties VMInsightsOnboardingStatusProperties
8595 err = json.Unmarshal(*v, &VMInsightsOnboardingStatusProperties)
8596 if err != nil {
8597 return err
8598 }
8599 vios.VMInsightsOnboardingStatusProperties = &VMInsightsOnboardingStatusProperties
8600 }
8601 case "id":
8602 if v != nil {
8603 var ID string
8604 err = json.Unmarshal(*v, &ID)
8605 if err != nil {
8606 return err
8607 }
8608 vios.ID = &ID
8609 }
8610 case "name":
8611 if v != nil {
8612 var name string
8613 err = json.Unmarshal(*v, &name)
8614 if err != nil {
8615 return err
8616 }
8617 vios.Name = &name
8618 }
8619 case "type":
8620 if v != nil {
8621 var typeVar string
8622 err = json.Unmarshal(*v, &typeVar)
8623 if err != nil {
8624 return err
8625 }
8626 vios.Type = &typeVar
8627 }
8628 }
8629 }
8630
8631 return nil
8632 }
8633
8634
8635 type VMInsightsOnboardingStatusProperties struct {
8636
8637 ResourceID *string `json:"resourceId,omitempty"`
8638
8639 OnboardingStatus OnboardingStatus `json:"onboardingStatus,omitempty"`
8640
8641 DataStatus DataStatus `json:"dataStatus,omitempty"`
8642
8643 Data *[]DataContainer `json:"data,omitempty"`
8644 }
8645
8646
8647 type VoiceReceiver struct {
8648
8649 Name *string `json:"name,omitempty"`
8650
8651 CountryCode *string `json:"countryCode,omitempty"`
8652
8653 PhoneNumber *string `json:"phoneNumber,omitempty"`
8654 }
8655
8656
8657 type WebhookNotification struct {
8658
8659 ServiceURI *string `json:"serviceUri,omitempty"`
8660
8661 Properties map[string]*string `json:"properties"`
8662 }
8663
8664
8665 func (wn WebhookNotification) MarshalJSON() ([]byte, error) {
8666 objectMap := make(map[string]interface{})
8667 if wn.ServiceURI != nil {
8668 objectMap["serviceUri"] = wn.ServiceURI
8669 }
8670 if wn.Properties != nil {
8671 objectMap["properties"] = wn.Properties
8672 }
8673 return json.Marshal(objectMap)
8674 }
8675
8676
8677 type WebhookReceiver struct {
8678
8679 Name *string `json:"name,omitempty"`
8680
8681 ServiceURI *string `json:"serviceUri,omitempty"`
8682
8683 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"`
8684
8685 UseAadAuth *bool `json:"useAadAuth,omitempty"`
8686
8687 ObjectID *string `json:"objectId,omitempty"`
8688
8689 IdentifierURI *string `json:"identifierUri,omitempty"`
8690
8691 TenantID *string `json:"tenantId,omitempty"`
8692 }
8693
8694
8695 type WebtestLocationAvailabilityCriteria struct {
8696
8697 WebTestID *string `json:"webTestId,omitempty"`
8698
8699 ComponentID *string `json:"componentId,omitempty"`
8700
8701 FailedLocationCount *float64 `json:"failedLocationCount,omitempty"`
8702
8703 AdditionalProperties map[string]interface{} `json:""`
8704
8705 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"`
8706 }
8707
8708
8709 func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) {
8710 wlac.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria
8711 objectMap := make(map[string]interface{})
8712 if wlac.WebTestID != nil {
8713 objectMap["webTestId"] = wlac.WebTestID
8714 }
8715 if wlac.ComponentID != nil {
8716 objectMap["componentId"] = wlac.ComponentID
8717 }
8718 if wlac.FailedLocationCount != nil {
8719 objectMap["failedLocationCount"] = wlac.FailedLocationCount
8720 }
8721 if wlac.OdataType != "" {
8722 objectMap["odata.type"] = wlac.OdataType
8723 }
8724 for k, v := range wlac.AdditionalProperties {
8725 objectMap[k] = v
8726 }
8727 return json.Marshal(objectMap)
8728 }
8729
8730
8731 func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) {
8732 return nil, false
8733 }
8734
8735
8736 func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) {
8737 return &wlac, true
8738 }
8739
8740
8741 func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) {
8742 return nil, false
8743 }
8744
8745
8746 func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) {
8747 return nil, false
8748 }
8749
8750
8751 func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) {
8752 return &wlac, true
8753 }
8754
8755
8756 func (wlac *WebtestLocationAvailabilityCriteria) UnmarshalJSON(body []byte) error {
8757 var m map[string]*json.RawMessage
8758 err := json.Unmarshal(body, &m)
8759 if err != nil {
8760 return err
8761 }
8762 for k, v := range m {
8763 switch k {
8764 case "webTestId":
8765 if v != nil {
8766 var webTestID string
8767 err = json.Unmarshal(*v, &webTestID)
8768 if err != nil {
8769 return err
8770 }
8771 wlac.WebTestID = &webTestID
8772 }
8773 case "componentId":
8774 if v != nil {
8775 var componentID string
8776 err = json.Unmarshal(*v, &componentID)
8777 if err != nil {
8778 return err
8779 }
8780 wlac.ComponentID = &componentID
8781 }
8782 case "failedLocationCount":
8783 if v != nil {
8784 var failedLocationCount float64
8785 err = json.Unmarshal(*v, &failedLocationCount)
8786 if err != nil {
8787 return err
8788 }
8789 wlac.FailedLocationCount = &failedLocationCount
8790 }
8791 default:
8792 if v != nil {
8793 var additionalProperties interface{}
8794 err = json.Unmarshal(*v, &additionalProperties)
8795 if err != nil {
8796 return err
8797 }
8798 if wlac.AdditionalProperties == nil {
8799 wlac.AdditionalProperties = make(map[string]interface{})
8800 }
8801 wlac.AdditionalProperties[k] = additionalProperties
8802 }
8803 case "odata.type":
8804 if v != nil {
8805 var odataType OdataTypeBasicMetricAlertCriteria
8806 err = json.Unmarshal(*v, &odataType)
8807 if err != nil {
8808 return err
8809 }
8810 wlac.OdataType = odataType
8811 }
8812 }
8813 }
8814
8815 return nil
8816 }
8817
8818
8819
8820
8821 type WindowsEventLogDataSource struct {
8822
8823
8824 Streams *[]KnownWindowsEventLogDataSourceStreams `json:"streams,omitempty"`
8825
8826 XPathQueries *[]string `json:"xPathQueries,omitempty"`
8827
8828
8829 Name *string `json:"name,omitempty"`
8830 }
8831
8832
8833 type WorkspaceInfo struct {
8834
8835 ID *string `json:"id,omitempty"`
8836
8837 Location *string `json:"location,omitempty"`
8838
8839 *WorkspaceInfoProperties `json:"properties,omitempty"`
8840 }
8841
8842
8843 func (wi WorkspaceInfo) MarshalJSON() ([]byte, error) {
8844 objectMap := make(map[string]interface{})
8845 if wi.ID != nil {
8846 objectMap["id"] = wi.ID
8847 }
8848 if wi.Location != nil {
8849 objectMap["location"] = wi.Location
8850 }
8851 if wi.WorkspaceInfoProperties != nil {
8852 objectMap["properties"] = wi.WorkspaceInfoProperties
8853 }
8854 return json.Marshal(objectMap)
8855 }
8856
8857
8858 func (wi *WorkspaceInfo) UnmarshalJSON(body []byte) error {
8859 var m map[string]*json.RawMessage
8860 err := json.Unmarshal(body, &m)
8861 if err != nil {
8862 return err
8863 }
8864 for k, v := range m {
8865 switch k {
8866 case "id":
8867 if v != nil {
8868 var ID string
8869 err = json.Unmarshal(*v, &ID)
8870 if err != nil {
8871 return err
8872 }
8873 wi.ID = &ID
8874 }
8875 case "location":
8876 if v != nil {
8877 var location string
8878 err = json.Unmarshal(*v, &location)
8879 if err != nil {
8880 return err
8881 }
8882 wi.Location = &location
8883 }
8884 case "properties":
8885 if v != nil {
8886 var workspaceInfoProperties WorkspaceInfoProperties
8887 err = json.Unmarshal(*v, &workspaceInfoProperties)
8888 if err != nil {
8889 return err
8890 }
8891 wi.WorkspaceInfoProperties = &workspaceInfoProperties
8892 }
8893 }
8894 }
8895
8896 return nil
8897 }
8898
8899
8900 type WorkspaceInfoProperties struct {
8901
8902 CustomerID *string `json:"customerId,omitempty"`
8903 }
8904
View as plain text