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/date"
14 "github.com/Azure/go-autorest/autorest/to"
15 "github.com/Azure/go-autorest/tracing"
16 "net/http"
17 )
18
19
20 const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights"
21
22
23 type BasicAction interface {
24 AsAlertingAction() (*AlertingAction, bool)
25 AsLogToMetricAction() (*LogToMetricAction, bool)
26 AsAction() (*Action, bool)
27 }
28
29
30 type Action struct {
31
32 OdataType OdataTypeBasicAction `json:"odata.type,omitempty"`
33 }
34
35 func unmarshalBasicAction(body []byte) (BasicAction, error) {
36 var m map[string]interface{}
37 err := json.Unmarshal(body, &m)
38 if err != nil {
39 return nil, err
40 }
41
42 switch m["odata.type"] {
43 case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction):
44 var aa AlertingAction
45 err := json.Unmarshal(body, &aa)
46 return aa, err
47 case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction):
48 var ltma LogToMetricAction
49 err := json.Unmarshal(body, <ma)
50 return ltma, err
51 default:
52 var a Action
53 err := json.Unmarshal(body, &a)
54 return a, err
55 }
56 }
57 func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) {
58 var rawMessages []*json.RawMessage
59 err := json.Unmarshal(body, &rawMessages)
60 if err != nil {
61 return nil, err
62 }
63
64 aArray := make([]BasicAction, len(rawMessages))
65
66 for index, rawMessage := range rawMessages {
67 a, err := unmarshalBasicAction(*rawMessage)
68 if err != nil {
69 return nil, err
70 }
71 aArray[index] = a
72 }
73 return aArray, nil
74 }
75
76
77 func (a Action) MarshalJSON() ([]byte, error) {
78 a.OdataType = OdataTypeAction
79 objectMap := make(map[string]interface{})
80 if a.OdataType != "" {
81 objectMap["odata.type"] = a.OdataType
82 }
83 return json.Marshal(objectMap)
84 }
85
86
87 func (a Action) AsAlertingAction() (*AlertingAction, bool) {
88 return nil, false
89 }
90
91
92 func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) {
93 return nil, false
94 }
95
96
97 func (a Action) AsAction() (*Action, bool) {
98 return &a, true
99 }
100
101
102 func (a Action) AsBasicAction() (BasicAction, bool) {
103 return &a, true
104 }
105
106
107 type ActionGroup struct {
108
109 GroupShortName *string `json:"groupShortName,omitempty"`
110
111 Enabled *bool `json:"enabled,omitempty"`
112
113 EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"`
114
115 SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"`
116
117 WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"`
118
119 ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"`
120
121 AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"`
122
123 AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"`
124
125 VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"`
126
127 LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"`
128
129 AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"`
130 }
131
132
133 type ActionGroupList struct {
134 autorest.Response `json:"-"`
135
136 Value *[]ActionGroupResource `json:"value,omitempty"`
137
138 NextLink *string `json:"nextLink,omitempty"`
139 }
140
141
142 type ActionGroupPatch struct {
143
144 Enabled *bool `json:"enabled,omitempty"`
145 }
146
147
148 type ActionGroupPatchBody struct {
149
150 Tags map[string]*string `json:"tags"`
151
152 *ActionGroupPatch `json:"properties,omitempty"`
153 }
154
155
156 func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) {
157 objectMap := make(map[string]interface{})
158 if agpb.Tags != nil {
159 objectMap["tags"] = agpb.Tags
160 }
161 if agpb.ActionGroupPatch != nil {
162 objectMap["properties"] = agpb.ActionGroupPatch
163 }
164 return json.Marshal(objectMap)
165 }
166
167
168 func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error {
169 var m map[string]*json.RawMessage
170 err := json.Unmarshal(body, &m)
171 if err != nil {
172 return err
173 }
174 for k, v := range m {
175 switch k {
176 case "tags":
177 if v != nil {
178 var tags map[string]*string
179 err = json.Unmarshal(*v, &tags)
180 if err != nil {
181 return err
182 }
183 agpb.Tags = tags
184 }
185 case "properties":
186 if v != nil {
187 var actionGroupPatch ActionGroupPatch
188 err = json.Unmarshal(*v, &actionGroupPatch)
189 if err != nil {
190 return err
191 }
192 agpb.ActionGroupPatch = &actionGroupPatch
193 }
194 }
195 }
196
197 return nil
198 }
199
200
201 type ActionGroupResource struct {
202 autorest.Response `json:"-"`
203
204 *ActionGroup `json:"properties,omitempty"`
205
206 ID *string `json:"id,omitempty"`
207
208 Name *string `json:"name,omitempty"`
209
210 Type *string `json:"type,omitempty"`
211
212 Location *string `json:"location,omitempty"`
213
214 Tags map[string]*string `json:"tags"`
215 }
216
217
218 func (agr ActionGroupResource) MarshalJSON() ([]byte, error) {
219 objectMap := make(map[string]interface{})
220 if agr.ActionGroup != nil {
221 objectMap["properties"] = agr.ActionGroup
222 }
223 if agr.Location != nil {
224 objectMap["location"] = agr.Location
225 }
226 if agr.Tags != nil {
227 objectMap["tags"] = agr.Tags
228 }
229 return json.Marshal(objectMap)
230 }
231
232
233 func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error {
234 var m map[string]*json.RawMessage
235 err := json.Unmarshal(body, &m)
236 if err != nil {
237 return err
238 }
239 for k, v := range m {
240 switch k {
241 case "properties":
242 if v != nil {
243 var actionGroup ActionGroup
244 err = json.Unmarshal(*v, &actionGroup)
245 if err != nil {
246 return err
247 }
248 agr.ActionGroup = &actionGroup
249 }
250 case "id":
251 if v != nil {
252 var ID string
253 err = json.Unmarshal(*v, &ID)
254 if err != nil {
255 return err
256 }
257 agr.ID = &ID
258 }
259 case "name":
260 if v != nil {
261 var name string
262 err = json.Unmarshal(*v, &name)
263 if err != nil {
264 return err
265 }
266 agr.Name = &name
267 }
268 case "type":
269 if v != nil {
270 var typeVar string
271 err = json.Unmarshal(*v, &typeVar)
272 if err != nil {
273 return err
274 }
275 agr.Type = &typeVar
276 }
277 case "location":
278 if v != nil {
279 var location string
280 err = json.Unmarshal(*v, &location)
281 if err != nil {
282 return err
283 }
284 agr.Location = &location
285 }
286 case "tags":
287 if v != nil {
288 var tags map[string]*string
289 err = json.Unmarshal(*v, &tags)
290 if err != nil {
291 return err
292 }
293 agr.Tags = tags
294 }
295 }
296 }
297
298 return nil
299 }
300
301
302 type ActivityLogAlert struct {
303
304 Scopes *[]string `json:"scopes,omitempty"`
305
306 Enabled *bool `json:"enabled,omitempty"`
307
308 Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"`
309
310 Actions *ActivityLogAlertActionList `json:"actions,omitempty"`
311
312 Description *string `json:"description,omitempty"`
313 }
314
315
316 type ActivityLogAlertActionGroup struct {
317
318 ActionGroupID *string `json:"actionGroupId,omitempty"`
319
320 WebhookProperties map[string]*string `json:"webhookProperties"`
321 }
322
323
324 func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) {
325 objectMap := make(map[string]interface{})
326 if alaag.ActionGroupID != nil {
327 objectMap["actionGroupId"] = alaag.ActionGroupID
328 }
329 if alaag.WebhookProperties != nil {
330 objectMap["webhookProperties"] = alaag.WebhookProperties
331 }
332 return json.Marshal(objectMap)
333 }
334
335
336 type ActivityLogAlertActionList struct {
337
338 ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"`
339 }
340
341
342
343 type ActivityLogAlertAllOfCondition struct {
344
345 AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"`
346 }
347
348
349
350 type ActivityLogAlertLeafCondition struct {
351
352 Field *string `json:"field,omitempty"`
353
354 Equals *string `json:"equals,omitempty"`
355 }
356
357
358 type ActivityLogAlertList struct {
359 autorest.Response `json:"-"`
360
361 Value *[]ActivityLogAlertResource `json:"value,omitempty"`
362
363 NextLink *string `json:"nextLink,omitempty"`
364 }
365
366
367 type ActivityLogAlertPatch struct {
368
369 Enabled *bool `json:"enabled,omitempty"`
370 }
371
372
373 type ActivityLogAlertPatchBody struct {
374
375 Tags map[string]*string `json:"tags"`
376
377 *ActivityLogAlertPatch `json:"properties,omitempty"`
378 }
379
380
381 func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) {
382 objectMap := make(map[string]interface{})
383 if alapb.Tags != nil {
384 objectMap["tags"] = alapb.Tags
385 }
386 if alapb.ActivityLogAlertPatch != nil {
387 objectMap["properties"] = alapb.ActivityLogAlertPatch
388 }
389 return json.Marshal(objectMap)
390 }
391
392
393 func (alapb *ActivityLogAlertPatchBody) UnmarshalJSON(body []byte) error {
394 var m map[string]*json.RawMessage
395 err := json.Unmarshal(body, &m)
396 if err != nil {
397 return err
398 }
399 for k, v := range m {
400 switch k {
401 case "tags":
402 if v != nil {
403 var tags map[string]*string
404 err = json.Unmarshal(*v, &tags)
405 if err != nil {
406 return err
407 }
408 alapb.Tags = tags
409 }
410 case "properties":
411 if v != nil {
412 var activityLogAlertPatch ActivityLogAlertPatch
413 err = json.Unmarshal(*v, &activityLogAlertPatch)
414 if err != nil {
415 return err
416 }
417 alapb.ActivityLogAlertPatch = &activityLogAlertPatch
418 }
419 }
420 }
421
422 return nil
423 }
424
425
426 type ActivityLogAlertResource struct {
427 autorest.Response `json:"-"`
428
429 *ActivityLogAlert `json:"properties,omitempty"`
430
431 ID *string `json:"id,omitempty"`
432
433 Name *string `json:"name,omitempty"`
434
435 Type *string `json:"type,omitempty"`
436
437 Location *string `json:"location,omitempty"`
438
439 Tags map[string]*string `json:"tags"`
440 }
441
442
443 func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) {
444 objectMap := make(map[string]interface{})
445 if alar.ActivityLogAlert != nil {
446 objectMap["properties"] = alar.ActivityLogAlert
447 }
448 if alar.Location != nil {
449 objectMap["location"] = alar.Location
450 }
451 if alar.Tags != nil {
452 objectMap["tags"] = alar.Tags
453 }
454 return json.Marshal(objectMap)
455 }
456
457
458 func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error {
459 var m map[string]*json.RawMessage
460 err := json.Unmarshal(body, &m)
461 if err != nil {
462 return err
463 }
464 for k, v := range m {
465 switch k {
466 case "properties":
467 if v != nil {
468 var activityLogAlert ActivityLogAlert
469 err = json.Unmarshal(*v, &activityLogAlert)
470 if err != nil {
471 return err
472 }
473 alar.ActivityLogAlert = &activityLogAlert
474 }
475 case "id":
476 if v != nil {
477 var ID string
478 err = json.Unmarshal(*v, &ID)
479 if err != nil {
480 return err
481 }
482 alar.ID = &ID
483 }
484 case "name":
485 if v != nil {
486 var name string
487 err = json.Unmarshal(*v, &name)
488 if err != nil {
489 return err
490 }
491 alar.Name = &name
492 }
493 case "type":
494 if v != nil {
495 var typeVar string
496 err = json.Unmarshal(*v, &typeVar)
497 if err != nil {
498 return err
499 }
500 alar.Type = &typeVar
501 }
502 case "location":
503 if v != nil {
504 var location string
505 err = json.Unmarshal(*v, &location)
506 if err != nil {
507 return err
508 }
509 alar.Location = &location
510 }
511 case "tags":
512 if v != nil {
513 var tags map[string]*string
514 err = json.Unmarshal(*v, &tags)
515 if err != nil {
516 return err
517 }
518 alar.Tags = tags
519 }
520 }
521 }
522
523 return nil
524 }
525
526
527 type AlertingAction struct {
528
529 Severity AlertSeverity `json:"severity,omitempty"`
530
531 AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"`
532
533 ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"`
534
535 Trigger *TriggerCondition `json:"trigger,omitempty"`
536
537 OdataType OdataTypeBasicAction `json:"odata.type,omitempty"`
538 }
539
540
541 func (aa AlertingAction) MarshalJSON() ([]byte, error) {
542 aa.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction
543 objectMap := make(map[string]interface{})
544 if aa.Severity != "" {
545 objectMap["severity"] = aa.Severity
546 }
547 if aa.AznsAction != nil {
548 objectMap["aznsAction"] = aa.AznsAction
549 }
550 if aa.ThrottlingInMin != nil {
551 objectMap["throttlingInMin"] = aa.ThrottlingInMin
552 }
553 if aa.Trigger != nil {
554 objectMap["trigger"] = aa.Trigger
555 }
556 if aa.OdataType != "" {
557 objectMap["odata.type"] = aa.OdataType
558 }
559 return json.Marshal(objectMap)
560 }
561
562
563 func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) {
564 return &aa, true
565 }
566
567
568 func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) {
569 return nil, false
570 }
571
572
573 func (aa AlertingAction) AsAction() (*Action, bool) {
574 return nil, false
575 }
576
577
578 func (aa AlertingAction) AsBasicAction() (BasicAction, bool) {
579 return &aa, true
580 }
581
582
583 type AlertRule struct {
584
585 Name *string `json:"name,omitempty"`
586
587 Description *string `json:"description,omitempty"`
588
589 IsEnabled *bool `json:"isEnabled,omitempty"`
590
591 Condition BasicRuleCondition `json:"condition,omitempty"`
592
593 Actions *[]BasicRuleAction `json:"actions,omitempty"`
594
595 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
596 }
597
598
599 func (ar AlertRule) MarshalJSON() ([]byte, error) {
600 objectMap := make(map[string]interface{})
601 if ar.Name != nil {
602 objectMap["name"] = ar.Name
603 }
604 if ar.Description != nil {
605 objectMap["description"] = ar.Description
606 }
607 if ar.IsEnabled != nil {
608 objectMap["isEnabled"] = ar.IsEnabled
609 }
610 objectMap["condition"] = ar.Condition
611 if ar.Actions != nil {
612 objectMap["actions"] = ar.Actions
613 }
614 return json.Marshal(objectMap)
615 }
616
617
618 func (ar *AlertRule) UnmarshalJSON(body []byte) error {
619 var m map[string]*json.RawMessage
620 err := json.Unmarshal(body, &m)
621 if err != nil {
622 return err
623 }
624 for k, v := range m {
625 switch k {
626 case "name":
627 if v != nil {
628 var name string
629 err = json.Unmarshal(*v, &name)
630 if err != nil {
631 return err
632 }
633 ar.Name = &name
634 }
635 case "description":
636 if v != nil {
637 var description string
638 err = json.Unmarshal(*v, &description)
639 if err != nil {
640 return err
641 }
642 ar.Description = &description
643 }
644 case "isEnabled":
645 if v != nil {
646 var isEnabled bool
647 err = json.Unmarshal(*v, &isEnabled)
648 if err != nil {
649 return err
650 }
651 ar.IsEnabled = &isEnabled
652 }
653 case "condition":
654 if v != nil {
655 condition, err := unmarshalBasicRuleCondition(*v)
656 if err != nil {
657 return err
658 }
659 ar.Condition = condition
660 }
661 case "actions":
662 if v != nil {
663 actions, err := unmarshalBasicRuleActionArray(*v)
664 if err != nil {
665 return err
666 }
667 ar.Actions = &actions
668 }
669 case "lastUpdatedTime":
670 if v != nil {
671 var lastUpdatedTime date.Time
672 err = json.Unmarshal(*v, &lastUpdatedTime)
673 if err != nil {
674 return err
675 }
676 ar.LastUpdatedTime = &lastUpdatedTime
677 }
678 }
679 }
680
681 return nil
682 }
683
684
685 type AlertRuleResource struct {
686 autorest.Response `json:"-"`
687
688 *AlertRule `json:"properties,omitempty"`
689
690 ID *string `json:"id,omitempty"`
691
692 Name *string `json:"name,omitempty"`
693
694 Type *string `json:"type,omitempty"`
695
696 Location *string `json:"location,omitempty"`
697
698 Tags map[string]*string `json:"tags"`
699 }
700
701
702 func (arr AlertRuleResource) MarshalJSON() ([]byte, error) {
703 objectMap := make(map[string]interface{})
704 if arr.AlertRule != nil {
705 objectMap["properties"] = arr.AlertRule
706 }
707 if arr.Location != nil {
708 objectMap["location"] = arr.Location
709 }
710 if arr.Tags != nil {
711 objectMap["tags"] = arr.Tags
712 }
713 return json.Marshal(objectMap)
714 }
715
716
717 func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error {
718 var m map[string]*json.RawMessage
719 err := json.Unmarshal(body, &m)
720 if err != nil {
721 return err
722 }
723 for k, v := range m {
724 switch k {
725 case "properties":
726 if v != nil {
727 var alertRule AlertRule
728 err = json.Unmarshal(*v, &alertRule)
729 if err != nil {
730 return err
731 }
732 arr.AlertRule = &alertRule
733 }
734 case "id":
735 if v != nil {
736 var ID string
737 err = json.Unmarshal(*v, &ID)
738 if err != nil {
739 return err
740 }
741 arr.ID = &ID
742 }
743 case "name":
744 if v != nil {
745 var name string
746 err = json.Unmarshal(*v, &name)
747 if err != nil {
748 return err
749 }
750 arr.Name = &name
751 }
752 case "type":
753 if v != nil {
754 var typeVar string
755 err = json.Unmarshal(*v, &typeVar)
756 if err != nil {
757 return err
758 }
759 arr.Type = &typeVar
760 }
761 case "location":
762 if v != nil {
763 var location string
764 err = json.Unmarshal(*v, &location)
765 if err != nil {
766 return err
767 }
768 arr.Location = &location
769 }
770 case "tags":
771 if v != nil {
772 var tags map[string]*string
773 err = json.Unmarshal(*v, &tags)
774 if err != nil {
775 return err
776 }
777 arr.Tags = tags
778 }
779 }
780 }
781
782 return nil
783 }
784
785
786 type AlertRuleResourceCollection struct {
787 autorest.Response `json:"-"`
788
789 Value *[]AlertRuleResource `json:"value,omitempty"`
790 }
791
792
793 type AlertRuleResourcePatch struct {
794
795 Tags map[string]*string `json:"tags"`
796
797 *AlertRule `json:"properties,omitempty"`
798 }
799
800
801 func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) {
802 objectMap := make(map[string]interface{})
803 if arrp.Tags != nil {
804 objectMap["tags"] = arrp.Tags
805 }
806 if arrp.AlertRule != nil {
807 objectMap["properties"] = arrp.AlertRule
808 }
809 return json.Marshal(objectMap)
810 }
811
812
813 func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error {
814 var m map[string]*json.RawMessage
815 err := json.Unmarshal(body, &m)
816 if err != nil {
817 return err
818 }
819 for k, v := range m {
820 switch k {
821 case "tags":
822 if v != nil {
823 var tags map[string]*string
824 err = json.Unmarshal(*v, &tags)
825 if err != nil {
826 return err
827 }
828 arrp.Tags = tags
829 }
830 case "properties":
831 if v != nil {
832 var alertRule AlertRule
833 err = json.Unmarshal(*v, &alertRule)
834 if err != nil {
835 return err
836 }
837 arrp.AlertRule = &alertRule
838 }
839 }
840 }
841
842 return nil
843 }
844
845
846 type AutomationRunbookReceiver struct {
847
848 AutomationAccountID *string `json:"automationAccountId,omitempty"`
849
850 RunbookName *string `json:"runbookName,omitempty"`
851
852 WebhookResourceID *string `json:"webhookResourceId,omitempty"`
853
854 IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"`
855
856 Name *string `json:"name,omitempty"`
857
858 ServiceURI *string `json:"serviceUri,omitempty"`
859 }
860
861
862 type AutoscaleNotification struct {
863
864 Operation *string `json:"operation,omitempty"`
865
866 Email *EmailNotification `json:"email,omitempty"`
867
868 Webhooks *[]WebhookNotification `json:"webhooks,omitempty"`
869 }
870
871
872 type AutoscaleProfile struct {
873
874 Name *string `json:"name,omitempty"`
875
876 Capacity *ScaleCapacity `json:"capacity,omitempty"`
877
878 Rules *[]ScaleRule `json:"rules,omitempty"`
879
880 FixedDate *TimeWindow `json:"fixedDate,omitempty"`
881
882 Recurrence *Recurrence `json:"recurrence,omitempty"`
883 }
884
885
886
887 type AutoscaleSetting struct {
888
889 Profiles *[]AutoscaleProfile `json:"profiles,omitempty"`
890
891 Notifications *[]AutoscaleNotification `json:"notifications,omitempty"`
892
893 Enabled *bool `json:"enabled,omitempty"`
894
895 Name *string `json:"name,omitempty"`
896
897 TargetResourceURI *string `json:"targetResourceUri,omitempty"`
898 }
899
900
901 type AutoscaleSettingResource struct {
902 autorest.Response `json:"-"`
903
904 *AutoscaleSetting `json:"properties,omitempty"`
905
906 ID *string `json:"id,omitempty"`
907
908 Name *string `json:"name,omitempty"`
909
910 Type *string `json:"type,omitempty"`
911
912 Location *string `json:"location,omitempty"`
913
914 Tags map[string]*string `json:"tags"`
915 }
916
917
918 func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) {
919 objectMap := make(map[string]interface{})
920 if asr.AutoscaleSetting != nil {
921 objectMap["properties"] = asr.AutoscaleSetting
922 }
923 if asr.Location != nil {
924 objectMap["location"] = asr.Location
925 }
926 if asr.Tags != nil {
927 objectMap["tags"] = asr.Tags
928 }
929 return json.Marshal(objectMap)
930 }
931
932
933 func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error {
934 var m map[string]*json.RawMessage
935 err := json.Unmarshal(body, &m)
936 if err != nil {
937 return err
938 }
939 for k, v := range m {
940 switch k {
941 case "properties":
942 if v != nil {
943 var autoscaleSetting AutoscaleSetting
944 err = json.Unmarshal(*v, &autoscaleSetting)
945 if err != nil {
946 return err
947 }
948 asr.AutoscaleSetting = &autoscaleSetting
949 }
950 case "id":
951 if v != nil {
952 var ID string
953 err = json.Unmarshal(*v, &ID)
954 if err != nil {
955 return err
956 }
957 asr.ID = &ID
958 }
959 case "name":
960 if v != nil {
961 var name string
962 err = json.Unmarshal(*v, &name)
963 if err != nil {
964 return err
965 }
966 asr.Name = &name
967 }
968 case "type":
969 if v != nil {
970 var typeVar string
971 err = json.Unmarshal(*v, &typeVar)
972 if err != nil {
973 return err
974 }
975 asr.Type = &typeVar
976 }
977 case "location":
978 if v != nil {
979 var location string
980 err = json.Unmarshal(*v, &location)
981 if err != nil {
982 return err
983 }
984 asr.Location = &location
985 }
986 case "tags":
987 if v != nil {
988 var tags map[string]*string
989 err = json.Unmarshal(*v, &tags)
990 if err != nil {
991 return err
992 }
993 asr.Tags = tags
994 }
995 }
996 }
997
998 return nil
999 }
1000
1001
1002 type AutoscaleSettingResourceCollection struct {
1003 autorest.Response `json:"-"`
1004
1005 Value *[]AutoscaleSettingResource `json:"value,omitempty"`
1006
1007 NextLink *string `json:"nextLink,omitempty"`
1008 }
1009
1010
1011
1012 type AutoscaleSettingResourceCollectionIterator struct {
1013 i int
1014 page AutoscaleSettingResourceCollectionPage
1015 }
1016
1017
1018
1019 func (iter *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) {
1020 if tracing.IsEnabled() {
1021 ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.NextWithContext")
1022 defer func() {
1023 sc := -1
1024 if iter.Response().Response.Response != nil {
1025 sc = iter.Response().Response.Response.StatusCode
1026 }
1027 tracing.EndSpan(ctx, sc, err)
1028 }()
1029 }
1030 iter.i++
1031 if iter.i < len(iter.page.Values()) {
1032 return nil
1033 }
1034 err = iter.page.NextWithContext(ctx)
1035 if err != nil {
1036 iter.i--
1037 return err
1038 }
1039 iter.i = 0
1040 return nil
1041 }
1042
1043
1044
1045
1046 func (iter *AutoscaleSettingResourceCollectionIterator) Next() error {
1047 return iter.NextWithContext(context.Background())
1048 }
1049
1050
1051 func (iter AutoscaleSettingResourceCollectionIterator) NotDone() bool {
1052 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1053 }
1054
1055
1056 func (iter AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection {
1057 return iter.page.Response()
1058 }
1059
1060
1061
1062 func (iter AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource {
1063 if !iter.page.NotDone() {
1064 return AutoscaleSettingResource{}
1065 }
1066 return iter.page.Values()[iter.i]
1067 }
1068
1069
1070 func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator {
1071 return AutoscaleSettingResourceCollectionIterator{page: page}
1072 }
1073
1074
1075 func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool {
1076 return asrc.Value == nil || len(*asrc.Value) == 0
1077 }
1078
1079
1080 func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool {
1081 return asrc.NextLink != nil && len(*asrc.NextLink) != 0
1082 }
1083
1084
1085
1086 func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) {
1087 if !asrc.hasNextLink() {
1088 return nil, nil
1089 }
1090 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1091 autorest.AsJSON(),
1092 autorest.AsGet(),
1093 autorest.WithBaseURL(to.String(asrc.NextLink)))
1094 }
1095
1096
1097 type AutoscaleSettingResourceCollectionPage struct {
1098 fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)
1099 asrc AutoscaleSettingResourceCollection
1100 }
1101
1102
1103
1104 func (page *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) {
1105 if tracing.IsEnabled() {
1106 ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.NextWithContext")
1107 defer func() {
1108 sc := -1
1109 if page.Response().Response.Response != nil {
1110 sc = page.Response().Response.Response.StatusCode
1111 }
1112 tracing.EndSpan(ctx, sc, err)
1113 }()
1114 }
1115 for {
1116 next, err := page.fn(ctx, page.asrc)
1117 if err != nil {
1118 return err
1119 }
1120 page.asrc = next
1121 if !next.hasNextLink() || !next.IsEmpty() {
1122 break
1123 }
1124 }
1125 return nil
1126 }
1127
1128
1129
1130
1131 func (page *AutoscaleSettingResourceCollectionPage) Next() error {
1132 return page.NextWithContext(context.Background())
1133 }
1134
1135
1136 func (page AutoscaleSettingResourceCollectionPage) NotDone() bool {
1137 return !page.asrc.IsEmpty()
1138 }
1139
1140
1141 func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection {
1142 return page.asrc
1143 }
1144
1145
1146 func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource {
1147 if page.asrc.IsEmpty() {
1148 return nil
1149 }
1150 return *page.asrc.Value
1151 }
1152
1153
1154 func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage {
1155 return AutoscaleSettingResourceCollectionPage{
1156 fn: getNextPage,
1157 asrc: cur,
1158 }
1159 }
1160
1161
1162 type AutoscaleSettingResourcePatch struct {
1163
1164 Tags map[string]*string `json:"tags"`
1165
1166 *AutoscaleSetting `json:"properties,omitempty"`
1167 }
1168
1169
1170 func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) {
1171 objectMap := make(map[string]interface{})
1172 if asrp.Tags != nil {
1173 objectMap["tags"] = asrp.Tags
1174 }
1175 if asrp.AutoscaleSetting != nil {
1176 objectMap["properties"] = asrp.AutoscaleSetting
1177 }
1178 return json.Marshal(objectMap)
1179 }
1180
1181
1182 func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error {
1183 var m map[string]*json.RawMessage
1184 err := json.Unmarshal(body, &m)
1185 if err != nil {
1186 return err
1187 }
1188 for k, v := range m {
1189 switch k {
1190 case "tags":
1191 if v != nil {
1192 var tags map[string]*string
1193 err = json.Unmarshal(*v, &tags)
1194 if err != nil {
1195 return err
1196 }
1197 asrp.Tags = tags
1198 }
1199 case "properties":
1200 if v != nil {
1201 var autoscaleSetting AutoscaleSetting
1202 err = json.Unmarshal(*v, &autoscaleSetting)
1203 if err != nil {
1204 return err
1205 }
1206 asrp.AutoscaleSetting = &autoscaleSetting
1207 }
1208 }
1209 }
1210
1211 return nil
1212 }
1213
1214
1215 type AzNsActionGroup struct {
1216
1217 ActionGroup *[]string `json:"actionGroup,omitempty"`
1218
1219 EmailSubject *string `json:"emailSubject,omitempty"`
1220
1221 CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"`
1222 }
1223
1224
1225 type AzureAppPushReceiver struct {
1226
1227 Name *string `json:"name,omitempty"`
1228
1229 EmailAddress *string `json:"emailAddress,omitempty"`
1230 }
1231
1232
1233 type AzureFunctionReceiver struct {
1234
1235 Name *string `json:"name,omitempty"`
1236
1237 FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"`
1238
1239 FunctionName *string `json:"functionName,omitempty"`
1240
1241 HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"`
1242 }
1243
1244
1245 type Baseline struct {
1246
1247 Sensitivity Sensitivity `json:"sensitivity,omitempty"`
1248
1249 LowThresholds *[]float64 `json:"lowThresholds,omitempty"`
1250
1251 HighThresholds *[]float64 `json:"highThresholds,omitempty"`
1252 }
1253
1254
1255 type BaselineMetadataValue struct {
1256
1257 Name *LocalizableString `json:"name,omitempty"`
1258
1259 Value *string `json:"value,omitempty"`
1260 }
1261
1262
1263 type BaselineProperties struct {
1264
1265 Timespan *string `json:"timespan,omitempty"`
1266
1267 Interval *string `json:"interval,omitempty"`
1268
1269 Aggregation *string `json:"aggregation,omitempty"`
1270
1271 Timestamps *[]date.Time `json:"timestamps,omitempty"`
1272
1273 Baseline *[]Baseline `json:"baseline,omitempty"`
1274
1275 Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"`
1276 }
1277
1278
1279 type BaselineResponse struct {
1280 autorest.Response `json:"-"`
1281
1282 ID *string `json:"id,omitempty"`
1283
1284 Type *string `json:"type,omitempty"`
1285
1286 Name *LocalizableString `json:"name,omitempty"`
1287
1288 *BaselineProperties `json:"properties,omitempty"`
1289 }
1290
1291
1292 func (br BaselineResponse) MarshalJSON() ([]byte, error) {
1293 objectMap := make(map[string]interface{})
1294 if br.BaselineProperties != nil {
1295 objectMap["properties"] = br.BaselineProperties
1296 }
1297 return json.Marshal(objectMap)
1298 }
1299
1300
1301 func (br *BaselineResponse) UnmarshalJSON(body []byte) error {
1302 var m map[string]*json.RawMessage
1303 err := json.Unmarshal(body, &m)
1304 if err != nil {
1305 return err
1306 }
1307 for k, v := range m {
1308 switch k {
1309 case "id":
1310 if v != nil {
1311 var ID string
1312 err = json.Unmarshal(*v, &ID)
1313 if err != nil {
1314 return err
1315 }
1316 br.ID = &ID
1317 }
1318 case "type":
1319 if v != nil {
1320 var typeVar string
1321 err = json.Unmarshal(*v, &typeVar)
1322 if err != nil {
1323 return err
1324 }
1325 br.Type = &typeVar
1326 }
1327 case "name":
1328 if v != nil {
1329 var name LocalizableString
1330 err = json.Unmarshal(*v, &name)
1331 if err != nil {
1332 return err
1333 }
1334 br.Name = &name
1335 }
1336 case "properties":
1337 if v != nil {
1338 var baselineProperties BaselineProperties
1339 err = json.Unmarshal(*v, &baselineProperties)
1340 if err != nil {
1341 return err
1342 }
1343 br.BaselineProperties = &baselineProperties
1344 }
1345 }
1346 }
1347
1348 return nil
1349 }
1350
1351
1352 type CalculateBaselineResponse struct {
1353 autorest.Response `json:"-"`
1354
1355 Type *string `json:"type,omitempty"`
1356
1357 Timestamps *[]date.Time `json:"timestamps,omitempty"`
1358
1359 Baseline *[]Baseline `json:"baseline,omitempty"`
1360 }
1361
1362
1363 type Criteria struct {
1364
1365 MetricName *string `json:"metricName,omitempty"`
1366
1367 Dimensions *[]Dimension `json:"dimensions,omitempty"`
1368 }
1369
1370
1371 type DiagnosticSettings struct {
1372
1373 StorageAccountID *string `json:"storageAccountId,omitempty"`
1374
1375 ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"`
1376
1377 EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"`
1378
1379 EventHubName *string `json:"eventHubName,omitempty"`
1380
1381 Metrics *[]MetricSettings `json:"metrics,omitempty"`
1382
1383 Logs *[]LogSettings `json:"logs,omitempty"`
1384
1385 WorkspaceID *string `json:"workspaceId,omitempty"`
1386
1387 LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"`
1388 }
1389
1390
1391 type DiagnosticSettingsCategory struct {
1392
1393 CategoryType CategoryType `json:"categoryType,omitempty"`
1394 }
1395
1396
1397 type DiagnosticSettingsCategoryResource struct {
1398 autorest.Response `json:"-"`
1399
1400 *DiagnosticSettingsCategory `json:"properties,omitempty"`
1401
1402 ID *string `json:"id,omitempty"`
1403
1404 Name *string `json:"name,omitempty"`
1405
1406 Type *string `json:"type,omitempty"`
1407 }
1408
1409
1410 func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) {
1411 objectMap := make(map[string]interface{})
1412 if dscr.DiagnosticSettingsCategory != nil {
1413 objectMap["properties"] = dscr.DiagnosticSettingsCategory
1414 }
1415 return json.Marshal(objectMap)
1416 }
1417
1418
1419 func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error {
1420 var m map[string]*json.RawMessage
1421 err := json.Unmarshal(body, &m)
1422 if err != nil {
1423 return err
1424 }
1425 for k, v := range m {
1426 switch k {
1427 case "properties":
1428 if v != nil {
1429 var diagnosticSettingsCategory DiagnosticSettingsCategory
1430 err = json.Unmarshal(*v, &diagnosticSettingsCategory)
1431 if err != nil {
1432 return err
1433 }
1434 dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory
1435 }
1436 case "id":
1437 if v != nil {
1438 var ID string
1439 err = json.Unmarshal(*v, &ID)
1440 if err != nil {
1441 return err
1442 }
1443 dscr.ID = &ID
1444 }
1445 case "name":
1446 if v != nil {
1447 var name string
1448 err = json.Unmarshal(*v, &name)
1449 if err != nil {
1450 return err
1451 }
1452 dscr.Name = &name
1453 }
1454 case "type":
1455 if v != nil {
1456 var typeVar string
1457 err = json.Unmarshal(*v, &typeVar)
1458 if err != nil {
1459 return err
1460 }
1461 dscr.Type = &typeVar
1462 }
1463 }
1464 }
1465
1466 return nil
1467 }
1468
1469
1470
1471 type DiagnosticSettingsCategoryResourceCollection struct {
1472 autorest.Response `json:"-"`
1473
1474 Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"`
1475 }
1476
1477
1478 type DiagnosticSettingsResource struct {
1479 autorest.Response `json:"-"`
1480
1481 *DiagnosticSettings `json:"properties,omitempty"`
1482
1483 ID *string `json:"id,omitempty"`
1484
1485 Name *string `json:"name,omitempty"`
1486
1487 Type *string `json:"type,omitempty"`
1488 }
1489
1490
1491 func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) {
1492 objectMap := make(map[string]interface{})
1493 if dsr.DiagnosticSettings != nil {
1494 objectMap["properties"] = dsr.DiagnosticSettings
1495 }
1496 return json.Marshal(objectMap)
1497 }
1498
1499
1500 func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error {
1501 var m map[string]*json.RawMessage
1502 err := json.Unmarshal(body, &m)
1503 if err != nil {
1504 return err
1505 }
1506 for k, v := range m {
1507 switch k {
1508 case "properties":
1509 if v != nil {
1510 var diagnosticSettings DiagnosticSettings
1511 err = json.Unmarshal(*v, &diagnosticSettings)
1512 if err != nil {
1513 return err
1514 }
1515 dsr.DiagnosticSettings = &diagnosticSettings
1516 }
1517 case "id":
1518 if v != nil {
1519 var ID string
1520 err = json.Unmarshal(*v, &ID)
1521 if err != nil {
1522 return err
1523 }
1524 dsr.ID = &ID
1525 }
1526 case "name":
1527 if v != nil {
1528 var name string
1529 err = json.Unmarshal(*v, &name)
1530 if err != nil {
1531 return err
1532 }
1533 dsr.Name = &name
1534 }
1535 case "type":
1536 if v != nil {
1537 var typeVar string
1538 err = json.Unmarshal(*v, &typeVar)
1539 if err != nil {
1540 return err
1541 }
1542 dsr.Type = &typeVar
1543 }
1544 }
1545 }
1546
1547 return nil
1548 }
1549
1550
1551 type DiagnosticSettingsResourceCollection struct {
1552 autorest.Response `json:"-"`
1553
1554 Value *[]DiagnosticSettingsResource `json:"value,omitempty"`
1555 }
1556
1557
1558 type Dimension struct {
1559
1560 Name *string `json:"name,omitempty"`
1561
1562 Operator *string `json:"operator,omitempty"`
1563
1564 Values *[]string `json:"values,omitempty"`
1565 }
1566
1567
1568 type DynamicMetricCriteria struct {
1569
1570 Operator DynamicThresholdOperator `json:"operator,omitempty"`
1571
1572 AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"`
1573
1574 FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"`
1575
1576 IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"`
1577
1578 AdditionalProperties map[string]interface{} `json:""`
1579
1580 Name *string `json:"name,omitempty"`
1581
1582 MetricName *string `json:"metricName,omitempty"`
1583
1584 MetricNamespace *string `json:"metricNamespace,omitempty"`
1585
1586 TimeAggregation interface{} `json:"timeAggregation,omitempty"`
1587
1588 Dimensions *[]MetricDimension `json:"dimensions,omitempty"`
1589
1590 SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"`
1591
1592 CriterionType CriterionType `json:"criterionType,omitempty"`
1593 }
1594
1595
1596 func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) {
1597 dmc.CriterionType = CriterionTypeDynamicThresholdCriterion
1598 objectMap := make(map[string]interface{})
1599 if dmc.Operator != "" {
1600 objectMap["operator"] = dmc.Operator
1601 }
1602 if dmc.AlertSensitivity != "" {
1603 objectMap["alertSensitivity"] = dmc.AlertSensitivity
1604 }
1605 if dmc.FailingPeriods != nil {
1606 objectMap["failingPeriods"] = dmc.FailingPeriods
1607 }
1608 if dmc.IgnoreDataBefore != nil {
1609 objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore
1610 }
1611 if dmc.Name != nil {
1612 objectMap["name"] = dmc.Name
1613 }
1614 if dmc.MetricName != nil {
1615 objectMap["metricName"] = dmc.MetricName
1616 }
1617 if dmc.MetricNamespace != nil {
1618 objectMap["metricNamespace"] = dmc.MetricNamespace
1619 }
1620 if dmc.TimeAggregation != nil {
1621 objectMap["timeAggregation"] = dmc.TimeAggregation
1622 }
1623 if dmc.Dimensions != nil {
1624 objectMap["dimensions"] = dmc.Dimensions
1625 }
1626 if dmc.SkipMetricValidation != nil {
1627 objectMap["skipMetricValidation"] = dmc.SkipMetricValidation
1628 }
1629 if dmc.CriterionType != "" {
1630 objectMap["criterionType"] = dmc.CriterionType
1631 }
1632 for k, v := range dmc.AdditionalProperties {
1633 objectMap[k] = v
1634 }
1635 return json.Marshal(objectMap)
1636 }
1637
1638
1639 func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) {
1640 return nil, false
1641 }
1642
1643
1644 func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) {
1645 return &dmc, true
1646 }
1647
1648
1649 func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) {
1650 return nil, false
1651 }
1652
1653
1654 func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) {
1655 return &dmc, true
1656 }
1657
1658
1659 func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error {
1660 var m map[string]*json.RawMessage
1661 err := json.Unmarshal(body, &m)
1662 if err != nil {
1663 return err
1664 }
1665 for k, v := range m {
1666 switch k {
1667 case "operator":
1668 if v != nil {
1669 var operator DynamicThresholdOperator
1670 err = json.Unmarshal(*v, &operator)
1671 if err != nil {
1672 return err
1673 }
1674 dmc.Operator = operator
1675 }
1676 case "alertSensitivity":
1677 if v != nil {
1678 var alertSensitivity DynamicThresholdSensitivity
1679 err = json.Unmarshal(*v, &alertSensitivity)
1680 if err != nil {
1681 return err
1682 }
1683 dmc.AlertSensitivity = alertSensitivity
1684 }
1685 case "failingPeriods":
1686 if v != nil {
1687 var failingPeriods DynamicThresholdFailingPeriods
1688 err = json.Unmarshal(*v, &failingPeriods)
1689 if err != nil {
1690 return err
1691 }
1692 dmc.FailingPeriods = &failingPeriods
1693 }
1694 case "ignoreDataBefore":
1695 if v != nil {
1696 var ignoreDataBefore date.Time
1697 err = json.Unmarshal(*v, &ignoreDataBefore)
1698 if err != nil {
1699 return err
1700 }
1701 dmc.IgnoreDataBefore = &ignoreDataBefore
1702 }
1703 default:
1704 if v != nil {
1705 var additionalProperties interface{}
1706 err = json.Unmarshal(*v, &additionalProperties)
1707 if err != nil {
1708 return err
1709 }
1710 if dmc.AdditionalProperties == nil {
1711 dmc.AdditionalProperties = make(map[string]interface{})
1712 }
1713 dmc.AdditionalProperties[k] = additionalProperties
1714 }
1715 case "name":
1716 if v != nil {
1717 var name string
1718 err = json.Unmarshal(*v, &name)
1719 if err != nil {
1720 return err
1721 }
1722 dmc.Name = &name
1723 }
1724 case "metricName":
1725 if v != nil {
1726 var metricName string
1727 err = json.Unmarshal(*v, &metricName)
1728 if err != nil {
1729 return err
1730 }
1731 dmc.MetricName = &metricName
1732 }
1733 case "metricNamespace":
1734 if v != nil {
1735 var metricNamespace string
1736 err = json.Unmarshal(*v, &metricNamespace)
1737 if err != nil {
1738 return err
1739 }
1740 dmc.MetricNamespace = &metricNamespace
1741 }
1742 case "timeAggregation":
1743 if v != nil {
1744 var timeAggregation interface{}
1745 err = json.Unmarshal(*v, &timeAggregation)
1746 if err != nil {
1747 return err
1748 }
1749 dmc.TimeAggregation = timeAggregation
1750 }
1751 case "dimensions":
1752 if v != nil {
1753 var dimensions []MetricDimension
1754 err = json.Unmarshal(*v, &dimensions)
1755 if err != nil {
1756 return err
1757 }
1758 dmc.Dimensions = &dimensions
1759 }
1760 case "skipMetricValidation":
1761 if v != nil {
1762 var skipMetricValidation bool
1763 err = json.Unmarshal(*v, &skipMetricValidation)
1764 if err != nil {
1765 return err
1766 }
1767 dmc.SkipMetricValidation = &skipMetricValidation
1768 }
1769 case "criterionType":
1770 if v != nil {
1771 var criterionType CriterionType
1772 err = json.Unmarshal(*v, &criterionType)
1773 if err != nil {
1774 return err
1775 }
1776 dmc.CriterionType = criterionType
1777 }
1778 }
1779 }
1780
1781 return nil
1782 }
1783
1784
1785
1786 type DynamicThresholdFailingPeriods struct {
1787
1788 NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"`
1789
1790 MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"`
1791 }
1792
1793
1794 type EmailNotification struct {
1795
1796 SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"`
1797
1798 SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"`
1799
1800 CustomEmails *[]string `json:"customEmails,omitempty"`
1801 }
1802
1803
1804 type EmailReceiver struct {
1805
1806 Name *string `json:"name,omitempty"`
1807
1808 EmailAddress *string `json:"emailAddress,omitempty"`
1809
1810 Status ReceiverStatus `json:"status,omitempty"`
1811 }
1812
1813
1814 func (er EmailReceiver) MarshalJSON() ([]byte, error) {
1815 objectMap := make(map[string]interface{})
1816 if er.Name != nil {
1817 objectMap["name"] = er.Name
1818 }
1819 if er.EmailAddress != nil {
1820 objectMap["emailAddress"] = er.EmailAddress
1821 }
1822 return json.Marshal(objectMap)
1823 }
1824
1825
1826 type EnableRequest struct {
1827
1828 ReceiverName *string `json:"receiverName,omitempty"`
1829 }
1830
1831
1832 type ErrorResponse struct {
1833
1834 Code *string `json:"code,omitempty"`
1835
1836 Message *string `json:"message,omitempty"`
1837 }
1838
1839
1840
1841 type EventCategoryCollection struct {
1842 autorest.Response `json:"-"`
1843
1844 Value *[]LocalizableString `json:"value,omitempty"`
1845 }
1846
1847
1848 type EventData struct {
1849
1850 Authorization *SenderAuthorization `json:"authorization,omitempty"`
1851
1852 Claims map[string]*string `json:"claims"`
1853
1854 Caller *string `json:"caller,omitempty"`
1855
1856 Description *string `json:"description,omitempty"`
1857
1858 ID *string `json:"id,omitempty"`
1859
1860 EventDataID *string `json:"eventDataId,omitempty"`
1861
1862 CorrelationID *string `json:"correlationId,omitempty"`
1863
1864 EventName *LocalizableString `json:"eventName,omitempty"`
1865
1866 Category *LocalizableString `json:"category,omitempty"`
1867
1868 HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"`
1869
1870 Level EventLevel `json:"level,omitempty"`
1871
1872 ResourceGroupName *string `json:"resourceGroupName,omitempty"`
1873
1874 ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"`
1875
1876 ResourceID *string `json:"resourceId,omitempty"`
1877
1878 ResourceType *LocalizableString `json:"resourceType,omitempty"`
1879
1880 OperationID *string `json:"operationId,omitempty"`
1881
1882 OperationName *LocalizableString `json:"operationName,omitempty"`
1883
1884 Properties map[string]*string `json:"properties"`
1885
1886 Status *LocalizableString `json:"status,omitempty"`
1887
1888 SubStatus *LocalizableString `json:"subStatus,omitempty"`
1889
1890 EventTimestamp *date.Time `json:"eventTimestamp,omitempty"`
1891
1892 SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"`
1893
1894 SubscriptionID *string `json:"subscriptionId,omitempty"`
1895
1896 TenantID *string `json:"tenantId,omitempty"`
1897 }
1898
1899
1900 func (ed EventData) MarshalJSON() ([]byte, error) {
1901 objectMap := make(map[string]interface{})
1902 return json.Marshal(objectMap)
1903 }
1904
1905
1906 type EventDataCollection struct {
1907 autorest.Response `json:"-"`
1908
1909 Value *[]EventData `json:"value,omitempty"`
1910
1911 NextLink *string `json:"nextLink,omitempty"`
1912 }
1913
1914
1915 type EventDataCollectionIterator struct {
1916 i int
1917 page EventDataCollectionPage
1918 }
1919
1920
1921
1922 func (iter *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) {
1923 if tracing.IsEnabled() {
1924 ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.NextWithContext")
1925 defer func() {
1926 sc := -1
1927 if iter.Response().Response.Response != nil {
1928 sc = iter.Response().Response.Response.StatusCode
1929 }
1930 tracing.EndSpan(ctx, sc, err)
1931 }()
1932 }
1933 iter.i++
1934 if iter.i < len(iter.page.Values()) {
1935 return nil
1936 }
1937 err = iter.page.NextWithContext(ctx)
1938 if err != nil {
1939 iter.i--
1940 return err
1941 }
1942 iter.i = 0
1943 return nil
1944 }
1945
1946
1947
1948
1949 func (iter *EventDataCollectionIterator) Next() error {
1950 return iter.NextWithContext(context.Background())
1951 }
1952
1953
1954 func (iter EventDataCollectionIterator) NotDone() bool {
1955 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1956 }
1957
1958
1959 func (iter EventDataCollectionIterator) Response() EventDataCollection {
1960 return iter.page.Response()
1961 }
1962
1963
1964
1965 func (iter EventDataCollectionIterator) Value() EventData {
1966 if !iter.page.NotDone() {
1967 return EventData{}
1968 }
1969 return iter.page.Values()[iter.i]
1970 }
1971
1972
1973 func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator {
1974 return EventDataCollectionIterator{page: page}
1975 }
1976
1977
1978 func (edc EventDataCollection) IsEmpty() bool {
1979 return edc.Value == nil || len(*edc.Value) == 0
1980 }
1981
1982
1983 func (edc EventDataCollection) hasNextLink() bool {
1984 return edc.NextLink != nil && len(*edc.NextLink) != 0
1985 }
1986
1987
1988
1989 func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) {
1990 if !edc.hasNextLink() {
1991 return nil, nil
1992 }
1993 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1994 autorest.AsJSON(),
1995 autorest.AsGet(),
1996 autorest.WithBaseURL(to.String(edc.NextLink)))
1997 }
1998
1999
2000 type EventDataCollectionPage struct {
2001 fn func(context.Context, EventDataCollection) (EventDataCollection, error)
2002 edc EventDataCollection
2003 }
2004
2005
2006
2007 func (page *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) {
2008 if tracing.IsEnabled() {
2009 ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.NextWithContext")
2010 defer func() {
2011 sc := -1
2012 if page.Response().Response.Response != nil {
2013 sc = page.Response().Response.Response.StatusCode
2014 }
2015 tracing.EndSpan(ctx, sc, err)
2016 }()
2017 }
2018 for {
2019 next, err := page.fn(ctx, page.edc)
2020 if err != nil {
2021 return err
2022 }
2023 page.edc = next
2024 if !next.hasNextLink() || !next.IsEmpty() {
2025 break
2026 }
2027 }
2028 return nil
2029 }
2030
2031
2032
2033
2034 func (page *EventDataCollectionPage) Next() error {
2035 return page.NextWithContext(context.Background())
2036 }
2037
2038
2039 func (page EventDataCollectionPage) NotDone() bool {
2040 return !page.edc.IsEmpty()
2041 }
2042
2043
2044 func (page EventDataCollectionPage) Response() EventDataCollection {
2045 return page.edc
2046 }
2047
2048
2049 func (page EventDataCollectionPage) Values() []EventData {
2050 if page.edc.IsEmpty() {
2051 return nil
2052 }
2053 return *page.edc.Value
2054 }
2055
2056
2057 func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage {
2058 return EventDataCollectionPage{
2059 fn: getNextPage,
2060 edc: cur,
2061 }
2062 }
2063
2064
2065 type HTTPRequestInfo struct {
2066
2067 ClientRequestID *string `json:"clientRequestId,omitempty"`
2068
2069 ClientIPAddress *string `json:"clientIpAddress,omitempty"`
2070
2071 Method *string `json:"method,omitempty"`
2072
2073 URI *string `json:"uri,omitempty"`
2074 }
2075
2076
2077 type Incident struct {
2078 autorest.Response `json:"-"`
2079
2080 Name *string `json:"name,omitempty"`
2081
2082 RuleName *string `json:"ruleName,omitempty"`
2083
2084 IsActive *bool `json:"isActive,omitempty"`
2085
2086 ActivatedTime *date.Time `json:"activatedTime,omitempty"`
2087
2088 ResolvedTime *date.Time `json:"resolvedTime,omitempty"`
2089 }
2090
2091
2092 func (i Incident) MarshalJSON() ([]byte, error) {
2093 objectMap := make(map[string]interface{})
2094 return json.Marshal(objectMap)
2095 }
2096
2097
2098 type IncidentListResult struct {
2099 autorest.Response `json:"-"`
2100
2101 Value *[]Incident `json:"value,omitempty"`
2102 }
2103
2104
2105 type ItsmReceiver struct {
2106
2107 Name *string `json:"name,omitempty"`
2108
2109 WorkspaceID *string `json:"workspaceId,omitempty"`
2110
2111 ConnectionID *string `json:"connectionId,omitempty"`
2112
2113 TicketConfiguration *string `json:"ticketConfiguration,omitempty"`
2114
2115 Region *string `json:"region,omitempty"`
2116 }
2117
2118
2119 type LocalizableString struct {
2120
2121 Value *string `json:"value,omitempty"`
2122
2123 LocalizedValue *string `json:"localizedValue,omitempty"`
2124 }
2125
2126
2127 type LocationThresholdRuleCondition struct {
2128
2129 WindowSize *string `json:"windowSize,omitempty"`
2130
2131 FailedLocationCount *int32 `json:"failedLocationCount,omitempty"`
2132
2133 DataSource BasicRuleDataSource `json:"dataSource,omitempty"`
2134
2135 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"`
2136 }
2137
2138
2139 func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) {
2140 ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition
2141 objectMap := make(map[string]interface{})
2142 if ltrc.WindowSize != nil {
2143 objectMap["windowSize"] = ltrc.WindowSize
2144 }
2145 if ltrc.FailedLocationCount != nil {
2146 objectMap["failedLocationCount"] = ltrc.FailedLocationCount
2147 }
2148 objectMap["dataSource"] = ltrc.DataSource
2149 if ltrc.OdataType != "" {
2150 objectMap["odata.type"] = ltrc.OdataType
2151 }
2152 return json.Marshal(objectMap)
2153 }
2154
2155
2156 func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
2157 return nil, false
2158 }
2159
2160
2161 func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
2162 return <rc, true
2163 }
2164
2165
2166 func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
2167 return nil, false
2168 }
2169
2170
2171 func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) {
2172 return nil, false
2173 }
2174
2175
2176 func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) {
2177 return <rc, true
2178 }
2179
2180
2181 func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error {
2182 var m map[string]*json.RawMessage
2183 err := json.Unmarshal(body, &m)
2184 if err != nil {
2185 return err
2186 }
2187 for k, v := range m {
2188 switch k {
2189 case "windowSize":
2190 if v != nil {
2191 var windowSize string
2192 err = json.Unmarshal(*v, &windowSize)
2193 if err != nil {
2194 return err
2195 }
2196 ltrc.WindowSize = &windowSize
2197 }
2198 case "failedLocationCount":
2199 if v != nil {
2200 var failedLocationCount int32
2201 err = json.Unmarshal(*v, &failedLocationCount)
2202 if err != nil {
2203 return err
2204 }
2205 ltrc.FailedLocationCount = &failedLocationCount
2206 }
2207 case "dataSource":
2208 if v != nil {
2209 dataSource, err := unmarshalBasicRuleDataSource(*v)
2210 if err != nil {
2211 return err
2212 }
2213 ltrc.DataSource = dataSource
2214 }
2215 case "odata.type":
2216 if v != nil {
2217 var odataType OdataTypeBasicRuleCondition
2218 err = json.Unmarshal(*v, &odataType)
2219 if err != nil {
2220 return err
2221 }
2222 ltrc.OdataType = odataType
2223 }
2224 }
2225 }
2226
2227 return nil
2228 }
2229
2230
2231 type LogicAppReceiver struct {
2232
2233 Name *string `json:"name,omitempty"`
2234
2235 ResourceID *string `json:"resourceId,omitempty"`
2236
2237 CallbackURL *string `json:"callbackUrl,omitempty"`
2238 }
2239
2240
2241 type LogMetricTrigger struct {
2242
2243 ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"`
2244
2245 Threshold *float64 `json:"threshold,omitempty"`
2246
2247 MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"`
2248
2249 MetricColumn *string `json:"metricColumn,omitempty"`
2250 }
2251
2252
2253 type LogProfileCollection struct {
2254 autorest.Response `json:"-"`
2255
2256 Value *[]LogProfileResource `json:"value,omitempty"`
2257 }
2258
2259
2260 type LogProfileProperties struct {
2261
2262 StorageAccountID *string `json:"storageAccountId,omitempty"`
2263
2264 ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"`
2265
2266 Locations *[]string `json:"locations,omitempty"`
2267
2268 Categories *[]string `json:"categories,omitempty"`
2269
2270 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
2271 }
2272
2273
2274 type LogProfileResource struct {
2275 autorest.Response `json:"-"`
2276
2277 *LogProfileProperties `json:"properties,omitempty"`
2278
2279 ID *string `json:"id,omitempty"`
2280
2281 Name *string `json:"name,omitempty"`
2282
2283 Type *string `json:"type,omitempty"`
2284
2285 Location *string `json:"location,omitempty"`
2286
2287 Tags map[string]*string `json:"tags"`
2288 }
2289
2290
2291 func (lpr LogProfileResource) MarshalJSON() ([]byte, error) {
2292 objectMap := make(map[string]interface{})
2293 if lpr.LogProfileProperties != nil {
2294 objectMap["properties"] = lpr.LogProfileProperties
2295 }
2296 if lpr.Location != nil {
2297 objectMap["location"] = lpr.Location
2298 }
2299 if lpr.Tags != nil {
2300 objectMap["tags"] = lpr.Tags
2301 }
2302 return json.Marshal(objectMap)
2303 }
2304
2305
2306 func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error {
2307 var m map[string]*json.RawMessage
2308 err := json.Unmarshal(body, &m)
2309 if err != nil {
2310 return err
2311 }
2312 for k, v := range m {
2313 switch k {
2314 case "properties":
2315 if v != nil {
2316 var logProfileProperties LogProfileProperties
2317 err = json.Unmarshal(*v, &logProfileProperties)
2318 if err != nil {
2319 return err
2320 }
2321 lpr.LogProfileProperties = &logProfileProperties
2322 }
2323 case "id":
2324 if v != nil {
2325 var ID string
2326 err = json.Unmarshal(*v, &ID)
2327 if err != nil {
2328 return err
2329 }
2330 lpr.ID = &ID
2331 }
2332 case "name":
2333 if v != nil {
2334 var name string
2335 err = json.Unmarshal(*v, &name)
2336 if err != nil {
2337 return err
2338 }
2339 lpr.Name = &name
2340 }
2341 case "type":
2342 if v != nil {
2343 var typeVar string
2344 err = json.Unmarshal(*v, &typeVar)
2345 if err != nil {
2346 return err
2347 }
2348 lpr.Type = &typeVar
2349 }
2350 case "location":
2351 if v != nil {
2352 var location string
2353 err = json.Unmarshal(*v, &location)
2354 if err != nil {
2355 return err
2356 }
2357 lpr.Location = &location
2358 }
2359 case "tags":
2360 if v != nil {
2361 var tags map[string]*string
2362 err = json.Unmarshal(*v, &tags)
2363 if err != nil {
2364 return err
2365 }
2366 lpr.Tags = tags
2367 }
2368 }
2369 }
2370
2371 return nil
2372 }
2373
2374
2375 type LogProfileResourcePatch struct {
2376
2377 Tags map[string]*string `json:"tags"`
2378
2379 *LogProfileProperties `json:"properties,omitempty"`
2380 }
2381
2382
2383 func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) {
2384 objectMap := make(map[string]interface{})
2385 if lprp.Tags != nil {
2386 objectMap["tags"] = lprp.Tags
2387 }
2388 if lprp.LogProfileProperties != nil {
2389 objectMap["properties"] = lprp.LogProfileProperties
2390 }
2391 return json.Marshal(objectMap)
2392 }
2393
2394
2395 func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error {
2396 var m map[string]*json.RawMessage
2397 err := json.Unmarshal(body, &m)
2398 if err != nil {
2399 return err
2400 }
2401 for k, v := range m {
2402 switch k {
2403 case "tags":
2404 if v != nil {
2405 var tags map[string]*string
2406 err = json.Unmarshal(*v, &tags)
2407 if err != nil {
2408 return err
2409 }
2410 lprp.Tags = tags
2411 }
2412 case "properties":
2413 if v != nil {
2414 var logProfileProperties LogProfileProperties
2415 err = json.Unmarshal(*v, &logProfileProperties)
2416 if err != nil {
2417 return err
2418 }
2419 lprp.LogProfileProperties = &logProfileProperties
2420 }
2421 }
2422 }
2423
2424 return nil
2425 }
2426
2427
2428 type LogSearchRule struct {
2429
2430 Description *string `json:"description,omitempty"`
2431
2432 Enabled Enabled `json:"enabled,omitempty"`
2433
2434 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
2435
2436 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
2437
2438 Source *Source `json:"source,omitempty"`
2439
2440 Schedule *Schedule `json:"schedule,omitempty"`
2441
2442 Action BasicAction `json:"action,omitempty"`
2443 }
2444
2445
2446 func (lsr LogSearchRule) MarshalJSON() ([]byte, error) {
2447 objectMap := make(map[string]interface{})
2448 if lsr.Description != nil {
2449 objectMap["description"] = lsr.Description
2450 }
2451 if lsr.Enabled != "" {
2452 objectMap["enabled"] = lsr.Enabled
2453 }
2454 if lsr.Source != nil {
2455 objectMap["source"] = lsr.Source
2456 }
2457 if lsr.Schedule != nil {
2458 objectMap["schedule"] = lsr.Schedule
2459 }
2460 objectMap["action"] = lsr.Action
2461 return json.Marshal(objectMap)
2462 }
2463
2464
2465 func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error {
2466 var m map[string]*json.RawMessage
2467 err := json.Unmarshal(body, &m)
2468 if err != nil {
2469 return err
2470 }
2471 for k, v := range m {
2472 switch k {
2473 case "description":
2474 if v != nil {
2475 var description string
2476 err = json.Unmarshal(*v, &description)
2477 if err != nil {
2478 return err
2479 }
2480 lsr.Description = &description
2481 }
2482 case "enabled":
2483 if v != nil {
2484 var enabled Enabled
2485 err = json.Unmarshal(*v, &enabled)
2486 if err != nil {
2487 return err
2488 }
2489 lsr.Enabled = enabled
2490 }
2491 case "lastUpdatedTime":
2492 if v != nil {
2493 var lastUpdatedTime date.Time
2494 err = json.Unmarshal(*v, &lastUpdatedTime)
2495 if err != nil {
2496 return err
2497 }
2498 lsr.LastUpdatedTime = &lastUpdatedTime
2499 }
2500 case "provisioningState":
2501 if v != nil {
2502 var provisioningState ProvisioningState
2503 err = json.Unmarshal(*v, &provisioningState)
2504 if err != nil {
2505 return err
2506 }
2507 lsr.ProvisioningState = provisioningState
2508 }
2509 case "source":
2510 if v != nil {
2511 var source Source
2512 err = json.Unmarshal(*v, &source)
2513 if err != nil {
2514 return err
2515 }
2516 lsr.Source = &source
2517 }
2518 case "schedule":
2519 if v != nil {
2520 var schedule Schedule
2521 err = json.Unmarshal(*v, &schedule)
2522 if err != nil {
2523 return err
2524 }
2525 lsr.Schedule = &schedule
2526 }
2527 case "action":
2528 if v != nil {
2529 action, err := unmarshalBasicAction(*v)
2530 if err != nil {
2531 return err
2532 }
2533 lsr.Action = action
2534 }
2535 }
2536 }
2537
2538 return nil
2539 }
2540
2541
2542 type LogSearchRulePatch struct {
2543
2544 Enabled Enabled `json:"enabled,omitempty"`
2545 }
2546
2547
2548 type LogSearchRuleResource struct {
2549 autorest.Response `json:"-"`
2550
2551 *LogSearchRule `json:"properties,omitempty"`
2552
2553 ID *string `json:"id,omitempty"`
2554
2555 Name *string `json:"name,omitempty"`
2556
2557 Type *string `json:"type,omitempty"`
2558
2559 Location *string `json:"location,omitempty"`
2560
2561 Tags map[string]*string `json:"tags"`
2562 }
2563
2564
2565 func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) {
2566 objectMap := make(map[string]interface{})
2567 if lsrr.LogSearchRule != nil {
2568 objectMap["properties"] = lsrr.LogSearchRule
2569 }
2570 if lsrr.Location != nil {
2571 objectMap["location"] = lsrr.Location
2572 }
2573 if lsrr.Tags != nil {
2574 objectMap["tags"] = lsrr.Tags
2575 }
2576 return json.Marshal(objectMap)
2577 }
2578
2579
2580 func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error {
2581 var m map[string]*json.RawMessage
2582 err := json.Unmarshal(body, &m)
2583 if err != nil {
2584 return err
2585 }
2586 for k, v := range m {
2587 switch k {
2588 case "properties":
2589 if v != nil {
2590 var logSearchRule LogSearchRule
2591 err = json.Unmarshal(*v, &logSearchRule)
2592 if err != nil {
2593 return err
2594 }
2595 lsrr.LogSearchRule = &logSearchRule
2596 }
2597 case "id":
2598 if v != nil {
2599 var ID string
2600 err = json.Unmarshal(*v, &ID)
2601 if err != nil {
2602 return err
2603 }
2604 lsrr.ID = &ID
2605 }
2606 case "name":
2607 if v != nil {
2608 var name string
2609 err = json.Unmarshal(*v, &name)
2610 if err != nil {
2611 return err
2612 }
2613 lsrr.Name = &name
2614 }
2615 case "type":
2616 if v != nil {
2617 var typeVar string
2618 err = json.Unmarshal(*v, &typeVar)
2619 if err != nil {
2620 return err
2621 }
2622 lsrr.Type = &typeVar
2623 }
2624 case "location":
2625 if v != nil {
2626 var location string
2627 err = json.Unmarshal(*v, &location)
2628 if err != nil {
2629 return err
2630 }
2631 lsrr.Location = &location
2632 }
2633 case "tags":
2634 if v != nil {
2635 var tags map[string]*string
2636 err = json.Unmarshal(*v, &tags)
2637 if err != nil {
2638 return err
2639 }
2640 lsrr.Tags = tags
2641 }
2642 }
2643 }
2644
2645 return nil
2646 }
2647
2648
2649 type LogSearchRuleResourceCollection struct {
2650 autorest.Response `json:"-"`
2651
2652 Value *[]LogSearchRuleResource `json:"value,omitempty"`
2653 }
2654
2655
2656 type LogSearchRuleResourcePatch struct {
2657
2658 Tags map[string]*string `json:"tags"`
2659
2660 *LogSearchRulePatch `json:"properties,omitempty"`
2661 }
2662
2663
2664 func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) {
2665 objectMap := make(map[string]interface{})
2666 if lsrrp.Tags != nil {
2667 objectMap["tags"] = lsrrp.Tags
2668 }
2669 if lsrrp.LogSearchRulePatch != nil {
2670 objectMap["properties"] = lsrrp.LogSearchRulePatch
2671 }
2672 return json.Marshal(objectMap)
2673 }
2674
2675
2676 func (lsrrp *LogSearchRuleResourcePatch) UnmarshalJSON(body []byte) error {
2677 var m map[string]*json.RawMessage
2678 err := json.Unmarshal(body, &m)
2679 if err != nil {
2680 return err
2681 }
2682 for k, v := range m {
2683 switch k {
2684 case "tags":
2685 if v != nil {
2686 var tags map[string]*string
2687 err = json.Unmarshal(*v, &tags)
2688 if err != nil {
2689 return err
2690 }
2691 lsrrp.Tags = tags
2692 }
2693 case "properties":
2694 if v != nil {
2695 var logSearchRulePatch LogSearchRulePatch
2696 err = json.Unmarshal(*v, &logSearchRulePatch)
2697 if err != nil {
2698 return err
2699 }
2700 lsrrp.LogSearchRulePatch = &logSearchRulePatch
2701 }
2702 }
2703 }
2704
2705 return nil
2706 }
2707
2708
2709 type LogSettings struct {
2710
2711 Category *string `json:"category,omitempty"`
2712
2713 Enabled *bool `json:"enabled,omitempty"`
2714
2715 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
2716 }
2717
2718
2719 type LogToMetricAction struct {
2720
2721 Criteria *[]Criteria `json:"criteria,omitempty"`
2722
2723 OdataType OdataTypeBasicAction `json:"odata.type,omitempty"`
2724 }
2725
2726
2727 func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) {
2728 ltma.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction
2729 objectMap := make(map[string]interface{})
2730 if ltma.Criteria != nil {
2731 objectMap["criteria"] = ltma.Criteria
2732 }
2733 if ltma.OdataType != "" {
2734 objectMap["odata.type"] = ltma.OdataType
2735 }
2736 return json.Marshal(objectMap)
2737 }
2738
2739
2740 func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) {
2741 return nil, false
2742 }
2743
2744
2745 func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) {
2746 return <ma, true
2747 }
2748
2749
2750 func (ltma LogToMetricAction) AsAction() (*Action, bool) {
2751 return nil, false
2752 }
2753
2754
2755 func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) {
2756 return <ma, true
2757 }
2758
2759
2760 type ManagementEventAggregationCondition struct {
2761
2762 Operator ConditionOperator `json:"operator,omitempty"`
2763
2764 Threshold *float64 `json:"threshold,omitempty"`
2765
2766 WindowSize *string `json:"windowSize,omitempty"`
2767 }
2768
2769
2770 type ManagementEventRuleCondition struct {
2771
2772 Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"`
2773
2774 DataSource BasicRuleDataSource `json:"dataSource,omitempty"`
2775
2776 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"`
2777 }
2778
2779
2780 func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) {
2781 merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition
2782 objectMap := make(map[string]interface{})
2783 if merc.Aggregation != nil {
2784 objectMap["aggregation"] = merc.Aggregation
2785 }
2786 objectMap["dataSource"] = merc.DataSource
2787 if merc.OdataType != "" {
2788 objectMap["odata.type"] = merc.OdataType
2789 }
2790 return json.Marshal(objectMap)
2791 }
2792
2793
2794 func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
2795 return nil, false
2796 }
2797
2798
2799 func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
2800 return nil, false
2801 }
2802
2803
2804 func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
2805 return &merc, true
2806 }
2807
2808
2809 func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) {
2810 return nil, false
2811 }
2812
2813
2814 func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) {
2815 return &merc, true
2816 }
2817
2818
2819 func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error {
2820 var m map[string]*json.RawMessage
2821 err := json.Unmarshal(body, &m)
2822 if err != nil {
2823 return err
2824 }
2825 for k, v := range m {
2826 switch k {
2827 case "aggregation":
2828 if v != nil {
2829 var aggregation ManagementEventAggregationCondition
2830 err = json.Unmarshal(*v, &aggregation)
2831 if err != nil {
2832 return err
2833 }
2834 merc.Aggregation = &aggregation
2835 }
2836 case "dataSource":
2837 if v != nil {
2838 dataSource, err := unmarshalBasicRuleDataSource(*v)
2839 if err != nil {
2840 return err
2841 }
2842 merc.DataSource = dataSource
2843 }
2844 case "odata.type":
2845 if v != nil {
2846 var odataType OdataTypeBasicRuleCondition
2847 err = json.Unmarshal(*v, &odataType)
2848 if err != nil {
2849 return err
2850 }
2851 merc.OdataType = odataType
2852 }
2853 }
2854 }
2855
2856 return nil
2857 }
2858
2859
2860 type MetadataValue struct {
2861
2862 Name *LocalizableString `json:"name,omitempty"`
2863
2864 Value *string `json:"value,omitempty"`
2865 }
2866
2867
2868 type Metric struct {
2869
2870 ID *string `json:"id,omitempty"`
2871
2872 Type *string `json:"type,omitempty"`
2873
2874 Name *LocalizableString `json:"name,omitempty"`
2875
2876 Unit Unit `json:"unit,omitempty"`
2877
2878 Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"`
2879 }
2880
2881
2882 type MetricAlertAction struct {
2883
2884 ActionGroupID *string `json:"actionGroupId,omitempty"`
2885
2886 WebHookProperties map[string]*string `json:"webHookProperties"`
2887 }
2888
2889
2890 func (maa MetricAlertAction) MarshalJSON() ([]byte, error) {
2891 objectMap := make(map[string]interface{})
2892 if maa.ActionGroupID != nil {
2893 objectMap["actionGroupId"] = maa.ActionGroupID
2894 }
2895 if maa.WebHookProperties != nil {
2896 objectMap["webHookProperties"] = maa.WebHookProperties
2897 }
2898 return json.Marshal(objectMap)
2899 }
2900
2901
2902 type BasicMetricAlertCriteria interface {
2903 AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool)
2904 AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool)
2905 AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool)
2906 AsMetricAlertCriteria() (*MetricAlertCriteria, bool)
2907 }
2908
2909
2910 type MetricAlertCriteria struct {
2911
2912 AdditionalProperties map[string]interface{} `json:""`
2913
2914 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"`
2915 }
2916
2917 func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) {
2918 var m map[string]interface{}
2919 err := json.Unmarshal(body, &m)
2920 if err != nil {
2921 return nil, err
2922 }
2923
2924 switch m["odata.type"] {
2925 case string(OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria):
2926 var masrmmc MetricAlertSingleResourceMultipleMetricCriteria
2927 err := json.Unmarshal(body, &masrmmc)
2928 return masrmmc, err
2929 case string(OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria):
2930 var wlac WebtestLocationAvailabilityCriteria
2931 err := json.Unmarshal(body, &wlac)
2932 return wlac, err
2933 case string(OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria):
2934 var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria
2935 err := json.Unmarshal(body, &mamrmmc)
2936 return mamrmmc, err
2937 default:
2938 var mac MetricAlertCriteria
2939 err := json.Unmarshal(body, &mac)
2940 return mac, err
2941 }
2942 }
2943 func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) {
2944 var rawMessages []*json.RawMessage
2945 err := json.Unmarshal(body, &rawMessages)
2946 if err != nil {
2947 return nil, err
2948 }
2949
2950 macArray := make([]BasicMetricAlertCriteria, len(rawMessages))
2951
2952 for index, rawMessage := range rawMessages {
2953 mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage)
2954 if err != nil {
2955 return nil, err
2956 }
2957 macArray[index] = mac
2958 }
2959 return macArray, nil
2960 }
2961
2962
2963 func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) {
2964 mac.OdataType = OdataTypeMetricAlertCriteria
2965 objectMap := make(map[string]interface{})
2966 if mac.OdataType != "" {
2967 objectMap["odata.type"] = mac.OdataType
2968 }
2969 for k, v := range mac.AdditionalProperties {
2970 objectMap[k] = v
2971 }
2972 return json.Marshal(objectMap)
2973 }
2974
2975
2976 func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) {
2977 return nil, false
2978 }
2979
2980
2981 func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) {
2982 return nil, false
2983 }
2984
2985
2986 func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) {
2987 return nil, false
2988 }
2989
2990
2991 func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) {
2992 return &mac, true
2993 }
2994
2995
2996 func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) {
2997 return &mac, true
2998 }
2999
3000
3001 func (mac *MetricAlertCriteria) UnmarshalJSON(body []byte) error {
3002 var m map[string]*json.RawMessage
3003 err := json.Unmarshal(body, &m)
3004 if err != nil {
3005 return err
3006 }
3007 for k, v := range m {
3008 switch k {
3009 default:
3010 if v != nil {
3011 var additionalProperties interface{}
3012 err = json.Unmarshal(*v, &additionalProperties)
3013 if err != nil {
3014 return err
3015 }
3016 if mac.AdditionalProperties == nil {
3017 mac.AdditionalProperties = make(map[string]interface{})
3018 }
3019 mac.AdditionalProperties[k] = additionalProperties
3020 }
3021 case "odata.type":
3022 if v != nil {
3023 var odataType OdataTypeBasicMetricAlertCriteria
3024 err = json.Unmarshal(*v, &odataType)
3025 if err != nil {
3026 return err
3027 }
3028 mac.OdataType = odataType
3029 }
3030 }
3031 }
3032
3033 return nil
3034 }
3035
3036
3037
3038 type MetricAlertMultipleResourceMultipleMetricCriteria struct {
3039
3040 AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"`
3041
3042 AdditionalProperties map[string]interface{} `json:""`
3043
3044 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"`
3045 }
3046
3047
3048 func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) {
3049 mamrmmc.OdataType = OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria
3050 objectMap := make(map[string]interface{})
3051 if mamrmmc.AllOf != nil {
3052 objectMap["allOf"] = mamrmmc.AllOf
3053 }
3054 if mamrmmc.OdataType != "" {
3055 objectMap["odata.type"] = mamrmmc.OdataType
3056 }
3057 for k, v := range mamrmmc.AdditionalProperties {
3058 objectMap[k] = v
3059 }
3060 return json.Marshal(objectMap)
3061 }
3062
3063
3064 func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) {
3065 return nil, false
3066 }
3067
3068
3069 func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) {
3070 return nil, false
3071 }
3072
3073
3074 func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) {
3075 return &mamrmmc, true
3076 }
3077
3078
3079 func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) {
3080 return nil, false
3081 }
3082
3083
3084 func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) {
3085 return &mamrmmc, true
3086 }
3087
3088
3089 func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error {
3090 var m map[string]*json.RawMessage
3091 err := json.Unmarshal(body, &m)
3092 if err != nil {
3093 return err
3094 }
3095 for k, v := range m {
3096 switch k {
3097 case "allOf":
3098 if v != nil {
3099 allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v)
3100 if err != nil {
3101 return err
3102 }
3103 mamrmmc.AllOf = &allOf
3104 }
3105 default:
3106 if v != nil {
3107 var additionalProperties interface{}
3108 err = json.Unmarshal(*v, &additionalProperties)
3109 if err != nil {
3110 return err
3111 }
3112 if mamrmmc.AdditionalProperties == nil {
3113 mamrmmc.AdditionalProperties = make(map[string]interface{})
3114 }
3115 mamrmmc.AdditionalProperties[k] = additionalProperties
3116 }
3117 case "odata.type":
3118 if v != nil {
3119 var odataType OdataTypeBasicMetricAlertCriteria
3120 err = json.Unmarshal(*v, &odataType)
3121 if err != nil {
3122 return err
3123 }
3124 mamrmmc.OdataType = odataType
3125 }
3126 }
3127 }
3128
3129 return nil
3130 }
3131
3132
3133 type MetricAlertProperties struct {
3134
3135 Description *string `json:"description,omitempty"`
3136
3137 Severity *int32 `json:"severity,omitempty"`
3138
3139 Enabled *bool `json:"enabled,omitempty"`
3140
3141 Scopes *[]string `json:"scopes,omitempty"`
3142
3143 EvaluationFrequency *string `json:"evaluationFrequency,omitempty"`
3144
3145 WindowSize *string `json:"windowSize,omitempty"`
3146
3147 TargetResourceType *string `json:"targetResourceType,omitempty"`
3148
3149 TargetResourceRegion *string `json:"targetResourceRegion,omitempty"`
3150
3151 Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"`
3152
3153 AutoMitigate *bool `json:"autoMitigate,omitempty"`
3154
3155 Actions *[]MetricAlertAction `json:"actions,omitempty"`
3156
3157 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
3158 }
3159
3160
3161 func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) {
3162 objectMap := make(map[string]interface{})
3163 if mapVar.Description != nil {
3164 objectMap["description"] = mapVar.Description
3165 }
3166 if mapVar.Severity != nil {
3167 objectMap["severity"] = mapVar.Severity
3168 }
3169 if mapVar.Enabled != nil {
3170 objectMap["enabled"] = mapVar.Enabled
3171 }
3172 if mapVar.Scopes != nil {
3173 objectMap["scopes"] = mapVar.Scopes
3174 }
3175 if mapVar.EvaluationFrequency != nil {
3176 objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency
3177 }
3178 if mapVar.WindowSize != nil {
3179 objectMap["windowSize"] = mapVar.WindowSize
3180 }
3181 if mapVar.TargetResourceType != nil {
3182 objectMap["targetResourceType"] = mapVar.TargetResourceType
3183 }
3184 if mapVar.TargetResourceRegion != nil {
3185 objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion
3186 }
3187 objectMap["criteria"] = mapVar.Criteria
3188 if mapVar.AutoMitigate != nil {
3189 objectMap["autoMitigate"] = mapVar.AutoMitigate
3190 }
3191 if mapVar.Actions != nil {
3192 objectMap["actions"] = mapVar.Actions
3193 }
3194 return json.Marshal(objectMap)
3195 }
3196
3197
3198 func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error {
3199 var m map[string]*json.RawMessage
3200 err := json.Unmarshal(body, &m)
3201 if err != nil {
3202 return err
3203 }
3204 for k, v := range m {
3205 switch k {
3206 case "description":
3207 if v != nil {
3208 var description string
3209 err = json.Unmarshal(*v, &description)
3210 if err != nil {
3211 return err
3212 }
3213 mapVar.Description = &description
3214 }
3215 case "severity":
3216 if v != nil {
3217 var severity int32
3218 err = json.Unmarshal(*v, &severity)
3219 if err != nil {
3220 return err
3221 }
3222 mapVar.Severity = &severity
3223 }
3224 case "enabled":
3225 if v != nil {
3226 var enabled bool
3227 err = json.Unmarshal(*v, &enabled)
3228 if err != nil {
3229 return err
3230 }
3231 mapVar.Enabled = &enabled
3232 }
3233 case "scopes":
3234 if v != nil {
3235 var scopes []string
3236 err = json.Unmarshal(*v, &scopes)
3237 if err != nil {
3238 return err
3239 }
3240 mapVar.Scopes = &scopes
3241 }
3242 case "evaluationFrequency":
3243 if v != nil {
3244 var evaluationFrequency string
3245 err = json.Unmarshal(*v, &evaluationFrequency)
3246 if err != nil {
3247 return err
3248 }
3249 mapVar.EvaluationFrequency = &evaluationFrequency
3250 }
3251 case "windowSize":
3252 if v != nil {
3253 var windowSize string
3254 err = json.Unmarshal(*v, &windowSize)
3255 if err != nil {
3256 return err
3257 }
3258 mapVar.WindowSize = &windowSize
3259 }
3260 case "targetResourceType":
3261 if v != nil {
3262 var targetResourceType string
3263 err = json.Unmarshal(*v, &targetResourceType)
3264 if err != nil {
3265 return err
3266 }
3267 mapVar.TargetResourceType = &targetResourceType
3268 }
3269 case "targetResourceRegion":
3270 if v != nil {
3271 var targetResourceRegion string
3272 err = json.Unmarshal(*v, &targetResourceRegion)
3273 if err != nil {
3274 return err
3275 }
3276 mapVar.TargetResourceRegion = &targetResourceRegion
3277 }
3278 case "criteria":
3279 if v != nil {
3280 criteria, err := unmarshalBasicMetricAlertCriteria(*v)
3281 if err != nil {
3282 return err
3283 }
3284 mapVar.Criteria = criteria
3285 }
3286 case "autoMitigate":
3287 if v != nil {
3288 var autoMitigate bool
3289 err = json.Unmarshal(*v, &autoMitigate)
3290 if err != nil {
3291 return err
3292 }
3293 mapVar.AutoMitigate = &autoMitigate
3294 }
3295 case "actions":
3296 if v != nil {
3297 var actions []MetricAlertAction
3298 err = json.Unmarshal(*v, &actions)
3299 if err != nil {
3300 return err
3301 }
3302 mapVar.Actions = &actions
3303 }
3304 case "lastUpdatedTime":
3305 if v != nil {
3306 var lastUpdatedTime date.Time
3307 err = json.Unmarshal(*v, &lastUpdatedTime)
3308 if err != nil {
3309 return err
3310 }
3311 mapVar.LastUpdatedTime = &lastUpdatedTime
3312 }
3313 }
3314 }
3315
3316 return nil
3317 }
3318
3319
3320 type MetricAlertResource struct {
3321 autorest.Response `json:"-"`
3322
3323 *MetricAlertProperties `json:"properties,omitempty"`
3324
3325 ID *string `json:"id,omitempty"`
3326
3327 Name *string `json:"name,omitempty"`
3328
3329 Type *string `json:"type,omitempty"`
3330
3331 Location *string `json:"location,omitempty"`
3332
3333 Tags map[string]*string `json:"tags"`
3334 }
3335
3336
3337 func (mar MetricAlertResource) MarshalJSON() ([]byte, error) {
3338 objectMap := make(map[string]interface{})
3339 if mar.MetricAlertProperties != nil {
3340 objectMap["properties"] = mar.MetricAlertProperties
3341 }
3342 if mar.Location != nil {
3343 objectMap["location"] = mar.Location
3344 }
3345 if mar.Tags != nil {
3346 objectMap["tags"] = mar.Tags
3347 }
3348 return json.Marshal(objectMap)
3349 }
3350
3351
3352 func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error {
3353 var m map[string]*json.RawMessage
3354 err := json.Unmarshal(body, &m)
3355 if err != nil {
3356 return err
3357 }
3358 for k, v := range m {
3359 switch k {
3360 case "properties":
3361 if v != nil {
3362 var metricAlertProperties MetricAlertProperties
3363 err = json.Unmarshal(*v, &metricAlertProperties)
3364 if err != nil {
3365 return err
3366 }
3367 mar.MetricAlertProperties = &metricAlertProperties
3368 }
3369 case "id":
3370 if v != nil {
3371 var ID string
3372 err = json.Unmarshal(*v, &ID)
3373 if err != nil {
3374 return err
3375 }
3376 mar.ID = &ID
3377 }
3378 case "name":
3379 if v != nil {
3380 var name string
3381 err = json.Unmarshal(*v, &name)
3382 if err != nil {
3383 return err
3384 }
3385 mar.Name = &name
3386 }
3387 case "type":
3388 if v != nil {
3389 var typeVar string
3390 err = json.Unmarshal(*v, &typeVar)
3391 if err != nil {
3392 return err
3393 }
3394 mar.Type = &typeVar
3395 }
3396 case "location":
3397 if v != nil {
3398 var location string
3399 err = json.Unmarshal(*v, &location)
3400 if err != nil {
3401 return err
3402 }
3403 mar.Location = &location
3404 }
3405 case "tags":
3406 if v != nil {
3407 var tags map[string]*string
3408 err = json.Unmarshal(*v, &tags)
3409 if err != nil {
3410 return err
3411 }
3412 mar.Tags = tags
3413 }
3414 }
3415 }
3416
3417 return nil
3418 }
3419
3420
3421 type MetricAlertResourceCollection struct {
3422 autorest.Response `json:"-"`
3423
3424 Value *[]MetricAlertResource `json:"value,omitempty"`
3425 }
3426
3427
3428 type MetricAlertResourcePatch struct {
3429
3430 Tags map[string]*string `json:"tags"`
3431
3432 *MetricAlertProperties `json:"properties,omitempty"`
3433 }
3434
3435
3436 func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) {
3437 objectMap := make(map[string]interface{})
3438 if marp.Tags != nil {
3439 objectMap["tags"] = marp.Tags
3440 }
3441 if marp.MetricAlertProperties != nil {
3442 objectMap["properties"] = marp.MetricAlertProperties
3443 }
3444 return json.Marshal(objectMap)
3445 }
3446
3447
3448 func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error {
3449 var m map[string]*json.RawMessage
3450 err := json.Unmarshal(body, &m)
3451 if err != nil {
3452 return err
3453 }
3454 for k, v := range m {
3455 switch k {
3456 case "tags":
3457 if v != nil {
3458 var tags map[string]*string
3459 err = json.Unmarshal(*v, &tags)
3460 if err != nil {
3461 return err
3462 }
3463 marp.Tags = tags
3464 }
3465 case "properties":
3466 if v != nil {
3467 var metricAlertProperties MetricAlertProperties
3468 err = json.Unmarshal(*v, &metricAlertProperties)
3469 if err != nil {
3470 return err
3471 }
3472 marp.MetricAlertProperties = &metricAlertProperties
3473 }
3474 }
3475 }
3476
3477 return nil
3478 }
3479
3480
3481
3482 type MetricAlertSingleResourceMultipleMetricCriteria struct {
3483
3484 AllOf *[]MetricCriteria `json:"allOf,omitempty"`
3485
3486 AdditionalProperties map[string]interface{} `json:""`
3487
3488 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"`
3489 }
3490
3491
3492 func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) {
3493 masrmmc.OdataType = OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria
3494 objectMap := make(map[string]interface{})
3495 if masrmmc.AllOf != nil {
3496 objectMap["allOf"] = masrmmc.AllOf
3497 }
3498 if masrmmc.OdataType != "" {
3499 objectMap["odata.type"] = masrmmc.OdataType
3500 }
3501 for k, v := range masrmmc.AdditionalProperties {
3502 objectMap[k] = v
3503 }
3504 return json.Marshal(objectMap)
3505 }
3506
3507
3508 func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) {
3509 return &masrmmc, true
3510 }
3511
3512
3513 func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) {
3514 return nil, false
3515 }
3516
3517
3518 func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) {
3519 return nil, false
3520 }
3521
3522
3523 func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) {
3524 return nil, false
3525 }
3526
3527
3528 func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) {
3529 return &masrmmc, true
3530 }
3531
3532
3533 func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error {
3534 var m map[string]*json.RawMessage
3535 err := json.Unmarshal(body, &m)
3536 if err != nil {
3537 return err
3538 }
3539 for k, v := range m {
3540 switch k {
3541 case "allOf":
3542 if v != nil {
3543 var allOf []MetricCriteria
3544 err = json.Unmarshal(*v, &allOf)
3545 if err != nil {
3546 return err
3547 }
3548 masrmmc.AllOf = &allOf
3549 }
3550 default:
3551 if v != nil {
3552 var additionalProperties interface{}
3553 err = json.Unmarshal(*v, &additionalProperties)
3554 if err != nil {
3555 return err
3556 }
3557 if masrmmc.AdditionalProperties == nil {
3558 masrmmc.AdditionalProperties = make(map[string]interface{})
3559 }
3560 masrmmc.AdditionalProperties[k] = additionalProperties
3561 }
3562 case "odata.type":
3563 if v != nil {
3564 var odataType OdataTypeBasicMetricAlertCriteria
3565 err = json.Unmarshal(*v, &odataType)
3566 if err != nil {
3567 return err
3568 }
3569 masrmmc.OdataType = odataType
3570 }
3571 }
3572 }
3573
3574 return nil
3575 }
3576
3577
3578 type MetricAlertStatus struct {
3579
3580 Name *string `json:"name,omitempty"`
3581
3582 ID *string `json:"id,omitempty"`
3583
3584 Type *string `json:"type,omitempty"`
3585
3586 Properties *MetricAlertStatusProperties `json:"properties,omitempty"`
3587 }
3588
3589
3590 type MetricAlertStatusCollection struct {
3591 autorest.Response `json:"-"`
3592
3593 Value *[]MetricAlertStatus `json:"value,omitempty"`
3594 }
3595
3596
3597 type MetricAlertStatusProperties struct {
3598
3599 Dimensions map[string]*string `json:"dimensions"`
3600
3601 Status *string `json:"status,omitempty"`
3602
3603 Timestamp *date.Time `json:"timestamp,omitempty"`
3604 }
3605
3606
3607 func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) {
3608 objectMap := make(map[string]interface{})
3609 if masp.Dimensions != nil {
3610 objectMap["dimensions"] = masp.Dimensions
3611 }
3612 if masp.Status != nil {
3613 objectMap["status"] = masp.Status
3614 }
3615 if masp.Timestamp != nil {
3616 objectMap["timestamp"] = masp.Timestamp
3617 }
3618 return json.Marshal(objectMap)
3619 }
3620
3621
3622
3623 type MetricAvailability struct {
3624
3625 TimeGrain *string `json:"timeGrain,omitempty"`
3626
3627 Retention *string `json:"retention,omitempty"`
3628 }
3629
3630
3631 type MetricCriteria struct {
3632
3633 Operator Operator `json:"operator,omitempty"`
3634
3635 Threshold *float64 `json:"threshold,omitempty"`
3636
3637 AdditionalProperties map[string]interface{} `json:""`
3638
3639 Name *string `json:"name,omitempty"`
3640
3641 MetricName *string `json:"metricName,omitempty"`
3642
3643 MetricNamespace *string `json:"metricNamespace,omitempty"`
3644
3645 TimeAggregation interface{} `json:"timeAggregation,omitempty"`
3646
3647 Dimensions *[]MetricDimension `json:"dimensions,omitempty"`
3648
3649 SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"`
3650
3651 CriterionType CriterionType `json:"criterionType,omitempty"`
3652 }
3653
3654
3655 func (mc MetricCriteria) MarshalJSON() ([]byte, error) {
3656 mc.CriterionType = CriterionTypeStaticThresholdCriterion
3657 objectMap := make(map[string]interface{})
3658 if mc.Operator != "" {
3659 objectMap["operator"] = mc.Operator
3660 }
3661 if mc.Threshold != nil {
3662 objectMap["threshold"] = mc.Threshold
3663 }
3664 if mc.Name != nil {
3665 objectMap["name"] = mc.Name
3666 }
3667 if mc.MetricName != nil {
3668 objectMap["metricName"] = mc.MetricName
3669 }
3670 if mc.MetricNamespace != nil {
3671 objectMap["metricNamespace"] = mc.MetricNamespace
3672 }
3673 if mc.TimeAggregation != nil {
3674 objectMap["timeAggregation"] = mc.TimeAggregation
3675 }
3676 if mc.Dimensions != nil {
3677 objectMap["dimensions"] = mc.Dimensions
3678 }
3679 if mc.SkipMetricValidation != nil {
3680 objectMap["skipMetricValidation"] = mc.SkipMetricValidation
3681 }
3682 if mc.CriterionType != "" {
3683 objectMap["criterionType"] = mc.CriterionType
3684 }
3685 for k, v := range mc.AdditionalProperties {
3686 objectMap[k] = v
3687 }
3688 return json.Marshal(objectMap)
3689 }
3690
3691
3692 func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) {
3693 return &mc, true
3694 }
3695
3696
3697 func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) {
3698 return nil, false
3699 }
3700
3701
3702 func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) {
3703 return nil, false
3704 }
3705
3706
3707 func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) {
3708 return &mc, true
3709 }
3710
3711
3712 func (mc *MetricCriteria) UnmarshalJSON(body []byte) error {
3713 var m map[string]*json.RawMessage
3714 err := json.Unmarshal(body, &m)
3715 if err != nil {
3716 return err
3717 }
3718 for k, v := range m {
3719 switch k {
3720 case "operator":
3721 if v != nil {
3722 var operator Operator
3723 err = json.Unmarshal(*v, &operator)
3724 if err != nil {
3725 return err
3726 }
3727 mc.Operator = operator
3728 }
3729 case "threshold":
3730 if v != nil {
3731 var threshold float64
3732 err = json.Unmarshal(*v, &threshold)
3733 if err != nil {
3734 return err
3735 }
3736 mc.Threshold = &threshold
3737 }
3738 default:
3739 if v != nil {
3740 var additionalProperties interface{}
3741 err = json.Unmarshal(*v, &additionalProperties)
3742 if err != nil {
3743 return err
3744 }
3745 if mc.AdditionalProperties == nil {
3746 mc.AdditionalProperties = make(map[string]interface{})
3747 }
3748 mc.AdditionalProperties[k] = additionalProperties
3749 }
3750 case "name":
3751 if v != nil {
3752 var name string
3753 err = json.Unmarshal(*v, &name)
3754 if err != nil {
3755 return err
3756 }
3757 mc.Name = &name
3758 }
3759 case "metricName":
3760 if v != nil {
3761 var metricName string
3762 err = json.Unmarshal(*v, &metricName)
3763 if err != nil {
3764 return err
3765 }
3766 mc.MetricName = &metricName
3767 }
3768 case "metricNamespace":
3769 if v != nil {
3770 var metricNamespace string
3771 err = json.Unmarshal(*v, &metricNamespace)
3772 if err != nil {
3773 return err
3774 }
3775 mc.MetricNamespace = &metricNamespace
3776 }
3777 case "timeAggregation":
3778 if v != nil {
3779 var timeAggregation interface{}
3780 err = json.Unmarshal(*v, &timeAggregation)
3781 if err != nil {
3782 return err
3783 }
3784 mc.TimeAggregation = timeAggregation
3785 }
3786 case "dimensions":
3787 if v != nil {
3788 var dimensions []MetricDimension
3789 err = json.Unmarshal(*v, &dimensions)
3790 if err != nil {
3791 return err
3792 }
3793 mc.Dimensions = &dimensions
3794 }
3795 case "skipMetricValidation":
3796 if v != nil {
3797 var skipMetricValidation bool
3798 err = json.Unmarshal(*v, &skipMetricValidation)
3799 if err != nil {
3800 return err
3801 }
3802 mc.SkipMetricValidation = &skipMetricValidation
3803 }
3804 case "criterionType":
3805 if v != nil {
3806 var criterionType CriterionType
3807 err = json.Unmarshal(*v, &criterionType)
3808 if err != nil {
3809 return err
3810 }
3811 mc.CriterionType = criterionType
3812 }
3813 }
3814 }
3815
3816 return nil
3817 }
3818
3819
3820 type MetricDefinition struct {
3821
3822 IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"`
3823
3824 ResourceID *string `json:"resourceId,omitempty"`
3825
3826 Namespace *string `json:"namespace,omitempty"`
3827
3828 Name *LocalizableString `json:"name,omitempty"`
3829
3830 Unit Unit `json:"unit,omitempty"`
3831
3832 PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"`
3833
3834 SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"`
3835
3836 MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"`
3837
3838 ID *string `json:"id,omitempty"`
3839
3840 Dimensions *[]LocalizableString `json:"dimensions,omitempty"`
3841 }
3842
3843
3844 type MetricDefinitionCollection struct {
3845 autorest.Response `json:"-"`
3846
3847 Value *[]MetricDefinition `json:"value,omitempty"`
3848 }
3849
3850
3851 type MetricDimension struct {
3852
3853 Name *string `json:"name,omitempty"`
3854
3855 Operator *string `json:"operator,omitempty"`
3856
3857 Values *[]string `json:"values,omitempty"`
3858 }
3859
3860
3861 type MetricSettings struct {
3862
3863 TimeGrain *string `json:"timeGrain,omitempty"`
3864
3865 Category *string `json:"category,omitempty"`
3866
3867 Enabled *bool `json:"enabled,omitempty"`
3868
3869 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
3870 }
3871
3872
3873 type MetricTrigger struct {
3874
3875 MetricName *string `json:"metricName,omitempty"`
3876
3877 MetricNamespace *string `json:"metricNamespace,omitempty"`
3878
3879 MetricResourceURI *string `json:"metricResourceUri,omitempty"`
3880
3881 TimeGrain *string `json:"timeGrain,omitempty"`
3882
3883 Statistic MetricStatisticType `json:"statistic,omitempty"`
3884
3885 TimeWindow *string `json:"timeWindow,omitempty"`
3886
3887 TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"`
3888
3889 Operator ComparisonOperationType `json:"operator,omitempty"`
3890
3891 Threshold *float64 `json:"threshold,omitempty"`
3892
3893 Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"`
3894 }
3895
3896
3897 type MetricValue struct {
3898
3899 TimeStamp *date.Time `json:"timeStamp,omitempty"`
3900
3901 Average *float64 `json:"average,omitempty"`
3902
3903 Minimum *float64 `json:"minimum,omitempty"`
3904
3905 Maximum *float64 `json:"maximum,omitempty"`
3906
3907 Total *float64 `json:"total,omitempty"`
3908
3909 Count *float64 `json:"count,omitempty"`
3910 }
3911
3912
3913 type BasicMultiMetricCriteria interface {
3914 AsMetricCriteria() (*MetricCriteria, bool)
3915 AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool)
3916 AsMultiMetricCriteria() (*MultiMetricCriteria, bool)
3917 }
3918
3919
3920 type MultiMetricCriteria struct {
3921
3922 AdditionalProperties map[string]interface{} `json:""`
3923
3924 Name *string `json:"name,omitempty"`
3925
3926 MetricName *string `json:"metricName,omitempty"`
3927
3928 MetricNamespace *string `json:"metricNamespace,omitempty"`
3929
3930 TimeAggregation interface{} `json:"timeAggregation,omitempty"`
3931
3932 Dimensions *[]MetricDimension `json:"dimensions,omitempty"`
3933
3934 SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"`
3935
3936 CriterionType CriterionType `json:"criterionType,omitempty"`
3937 }
3938
3939 func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) {
3940 var m map[string]interface{}
3941 err := json.Unmarshal(body, &m)
3942 if err != nil {
3943 return nil, err
3944 }
3945
3946 switch m["criterionType"] {
3947 case string(CriterionTypeStaticThresholdCriterion):
3948 var mc MetricCriteria
3949 err := json.Unmarshal(body, &mc)
3950 return mc, err
3951 case string(CriterionTypeDynamicThresholdCriterion):
3952 var dmc DynamicMetricCriteria
3953 err := json.Unmarshal(body, &dmc)
3954 return dmc, err
3955 default:
3956 var mmc MultiMetricCriteria
3957 err := json.Unmarshal(body, &mmc)
3958 return mmc, err
3959 }
3960 }
3961 func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) {
3962 var rawMessages []*json.RawMessage
3963 err := json.Unmarshal(body, &rawMessages)
3964 if err != nil {
3965 return nil, err
3966 }
3967
3968 mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages))
3969
3970 for index, rawMessage := range rawMessages {
3971 mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage)
3972 if err != nil {
3973 return nil, err
3974 }
3975 mmcArray[index] = mmc
3976 }
3977 return mmcArray, nil
3978 }
3979
3980
3981 func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) {
3982 mmc.CriterionType = CriterionTypeMultiMetricCriteria
3983 objectMap := make(map[string]interface{})
3984 if mmc.Name != nil {
3985 objectMap["name"] = mmc.Name
3986 }
3987 if mmc.MetricName != nil {
3988 objectMap["metricName"] = mmc.MetricName
3989 }
3990 if mmc.MetricNamespace != nil {
3991 objectMap["metricNamespace"] = mmc.MetricNamespace
3992 }
3993 if mmc.TimeAggregation != nil {
3994 objectMap["timeAggregation"] = mmc.TimeAggregation
3995 }
3996 if mmc.Dimensions != nil {
3997 objectMap["dimensions"] = mmc.Dimensions
3998 }
3999 if mmc.SkipMetricValidation != nil {
4000 objectMap["skipMetricValidation"] = mmc.SkipMetricValidation
4001 }
4002 if mmc.CriterionType != "" {
4003 objectMap["criterionType"] = mmc.CriterionType
4004 }
4005 for k, v := range mmc.AdditionalProperties {
4006 objectMap[k] = v
4007 }
4008 return json.Marshal(objectMap)
4009 }
4010
4011
4012 func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) {
4013 return nil, false
4014 }
4015
4016
4017 func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) {
4018 return nil, false
4019 }
4020
4021
4022 func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) {
4023 return &mmc, true
4024 }
4025
4026
4027 func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) {
4028 return &mmc, true
4029 }
4030
4031
4032 func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error {
4033 var m map[string]*json.RawMessage
4034 err := json.Unmarshal(body, &m)
4035 if err != nil {
4036 return err
4037 }
4038 for k, v := range m {
4039 switch k {
4040 default:
4041 if v != nil {
4042 var additionalProperties interface{}
4043 err = json.Unmarshal(*v, &additionalProperties)
4044 if err != nil {
4045 return err
4046 }
4047 if mmc.AdditionalProperties == nil {
4048 mmc.AdditionalProperties = make(map[string]interface{})
4049 }
4050 mmc.AdditionalProperties[k] = additionalProperties
4051 }
4052 case "name":
4053 if v != nil {
4054 var name string
4055 err = json.Unmarshal(*v, &name)
4056 if err != nil {
4057 return err
4058 }
4059 mmc.Name = &name
4060 }
4061 case "metricName":
4062 if v != nil {
4063 var metricName string
4064 err = json.Unmarshal(*v, &metricName)
4065 if err != nil {
4066 return err
4067 }
4068 mmc.MetricName = &metricName
4069 }
4070 case "metricNamespace":
4071 if v != nil {
4072 var metricNamespace string
4073 err = json.Unmarshal(*v, &metricNamespace)
4074 if err != nil {
4075 return err
4076 }
4077 mmc.MetricNamespace = &metricNamespace
4078 }
4079 case "timeAggregation":
4080 if v != nil {
4081 var timeAggregation interface{}
4082 err = json.Unmarshal(*v, &timeAggregation)
4083 if err != nil {
4084 return err
4085 }
4086 mmc.TimeAggregation = timeAggregation
4087 }
4088 case "dimensions":
4089 if v != nil {
4090 var dimensions []MetricDimension
4091 err = json.Unmarshal(*v, &dimensions)
4092 if err != nil {
4093 return err
4094 }
4095 mmc.Dimensions = &dimensions
4096 }
4097 case "skipMetricValidation":
4098 if v != nil {
4099 var skipMetricValidation bool
4100 err = json.Unmarshal(*v, &skipMetricValidation)
4101 if err != nil {
4102 return err
4103 }
4104 mmc.SkipMetricValidation = &skipMetricValidation
4105 }
4106 case "criterionType":
4107 if v != nil {
4108 var criterionType CriterionType
4109 err = json.Unmarshal(*v, &criterionType)
4110 if err != nil {
4111 return err
4112 }
4113 mmc.CriterionType = criterionType
4114 }
4115 }
4116 }
4117
4118 return nil
4119 }
4120
4121
4122 type Operation struct {
4123
4124 Name *string `json:"name,omitempty"`
4125
4126 Display *OperationDisplay `json:"display,omitempty"`
4127 }
4128
4129
4130 type OperationDisplay struct {
4131
4132 Provider *string `json:"provider,omitempty"`
4133
4134 Resource *string `json:"resource,omitempty"`
4135
4136 Operation *string `json:"operation,omitempty"`
4137 }
4138
4139
4140
4141 type OperationListResult struct {
4142 autorest.Response `json:"-"`
4143
4144 Value *[]Operation `json:"value,omitempty"`
4145
4146 NextLink *string `json:"nextLink,omitempty"`
4147 }
4148
4149
4150 type ProxyOnlyResource struct {
4151
4152 ID *string `json:"id,omitempty"`
4153
4154 Name *string `json:"name,omitempty"`
4155
4156 Type *string `json:"type,omitempty"`
4157 }
4158
4159
4160 func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) {
4161 objectMap := make(map[string]interface{})
4162 return json.Marshal(objectMap)
4163 }
4164
4165
4166
4167 type Recurrence struct {
4168
4169 Frequency RecurrenceFrequency `json:"frequency,omitempty"`
4170
4171 Schedule *RecurrentSchedule `json:"schedule,omitempty"`
4172 }
4173
4174
4175 type RecurrentSchedule struct {
4176
4177 TimeZone *string `json:"timeZone,omitempty"`
4178
4179 Days *[]string `json:"days,omitempty"`
4180
4181 Hours *[]int32 `json:"hours,omitempty"`
4182
4183 Minutes *[]int32 `json:"minutes,omitempty"`
4184 }
4185
4186
4187 type Resource struct {
4188
4189 ID *string `json:"id,omitempty"`
4190
4191 Name *string `json:"name,omitempty"`
4192
4193 Type *string `json:"type,omitempty"`
4194
4195 Location *string `json:"location,omitempty"`
4196
4197 Tags map[string]*string `json:"tags"`
4198 }
4199
4200
4201 func (r Resource) MarshalJSON() ([]byte, error) {
4202 objectMap := make(map[string]interface{})
4203 if r.Location != nil {
4204 objectMap["location"] = r.Location
4205 }
4206 if r.Tags != nil {
4207 objectMap["tags"] = r.Tags
4208 }
4209 return json.Marshal(objectMap)
4210 }
4211
4212
4213 type Response struct {
4214 autorest.Response `json:"-"`
4215
4216 Cost *float64 `json:"cost,omitempty"`
4217
4218 Timespan *string `json:"timespan,omitempty"`
4219
4220 Interval *string `json:"interval,omitempty"`
4221
4222 Namespace *string `json:"namespace,omitempty"`
4223
4224 Resourceregion *string `json:"resourceregion,omitempty"`
4225
4226 Value *[]Metric `json:"value,omitempty"`
4227 }
4228
4229
4230 type RetentionPolicy struct {
4231
4232 Enabled *bool `json:"enabled,omitempty"`
4233
4234 Days *int32 `json:"days,omitempty"`
4235 }
4236
4237
4238
4239 type BasicRuleAction interface {
4240 AsRuleEmailAction() (*RuleEmailAction, bool)
4241 AsRuleWebhookAction() (*RuleWebhookAction, bool)
4242 AsRuleAction() (*RuleAction, bool)
4243 }
4244
4245
4246
4247 type RuleAction struct {
4248
4249 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"`
4250 }
4251
4252 func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) {
4253 var m map[string]interface{}
4254 err := json.Unmarshal(body, &m)
4255 if err != nil {
4256 return nil, err
4257 }
4258
4259 switch m["odata.type"] {
4260 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction):
4261 var rea RuleEmailAction
4262 err := json.Unmarshal(body, &rea)
4263 return rea, err
4264 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction):
4265 var rwa RuleWebhookAction
4266 err := json.Unmarshal(body, &rwa)
4267 return rwa, err
4268 default:
4269 var ra RuleAction
4270 err := json.Unmarshal(body, &ra)
4271 return ra, err
4272 }
4273 }
4274 func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) {
4275 var rawMessages []*json.RawMessage
4276 err := json.Unmarshal(body, &rawMessages)
4277 if err != nil {
4278 return nil, err
4279 }
4280
4281 raArray := make([]BasicRuleAction, len(rawMessages))
4282
4283 for index, rawMessage := range rawMessages {
4284 ra, err := unmarshalBasicRuleAction(*rawMessage)
4285 if err != nil {
4286 return nil, err
4287 }
4288 raArray[index] = ra
4289 }
4290 return raArray, nil
4291 }
4292
4293
4294 func (ra RuleAction) MarshalJSON() ([]byte, error) {
4295 ra.OdataType = OdataTypeRuleAction
4296 objectMap := make(map[string]interface{})
4297 if ra.OdataType != "" {
4298 objectMap["odata.type"] = ra.OdataType
4299 }
4300 return json.Marshal(objectMap)
4301 }
4302
4303
4304 func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) {
4305 return nil, false
4306 }
4307
4308
4309 func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) {
4310 return nil, false
4311 }
4312
4313
4314 func (ra RuleAction) AsRuleAction() (*RuleAction, bool) {
4315 return &ra, true
4316 }
4317
4318
4319 func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) {
4320 return &ra, true
4321 }
4322
4323
4324 type BasicRuleCondition interface {
4325 AsThresholdRuleCondition() (*ThresholdRuleCondition, bool)
4326 AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool)
4327 AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool)
4328 AsRuleCondition() (*RuleCondition, bool)
4329 }
4330
4331
4332 type RuleCondition struct {
4333
4334 DataSource BasicRuleDataSource `json:"dataSource,omitempty"`
4335
4336 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"`
4337 }
4338
4339 func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) {
4340 var m map[string]interface{}
4341 err := json.Unmarshal(body, &m)
4342 if err != nil {
4343 return nil, err
4344 }
4345
4346 switch m["odata.type"] {
4347 case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition):
4348 var trc ThresholdRuleCondition
4349 err := json.Unmarshal(body, &trc)
4350 return trc, err
4351 case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition):
4352 var ltrc LocationThresholdRuleCondition
4353 err := json.Unmarshal(body, <rc)
4354 return ltrc, err
4355 case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition):
4356 var merc ManagementEventRuleCondition
4357 err := json.Unmarshal(body, &merc)
4358 return merc, err
4359 default:
4360 var rc RuleCondition
4361 err := json.Unmarshal(body, &rc)
4362 return rc, err
4363 }
4364 }
4365 func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) {
4366 var rawMessages []*json.RawMessage
4367 err := json.Unmarshal(body, &rawMessages)
4368 if err != nil {
4369 return nil, err
4370 }
4371
4372 rcArray := make([]BasicRuleCondition, len(rawMessages))
4373
4374 for index, rawMessage := range rawMessages {
4375 rc, err := unmarshalBasicRuleCondition(*rawMessage)
4376 if err != nil {
4377 return nil, err
4378 }
4379 rcArray[index] = rc
4380 }
4381 return rcArray, nil
4382 }
4383
4384
4385 func (rc RuleCondition) MarshalJSON() ([]byte, error) {
4386 rc.OdataType = OdataTypeRuleCondition
4387 objectMap := make(map[string]interface{})
4388 objectMap["dataSource"] = rc.DataSource
4389 if rc.OdataType != "" {
4390 objectMap["odata.type"] = rc.OdataType
4391 }
4392 return json.Marshal(objectMap)
4393 }
4394
4395
4396 func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
4397 return nil, false
4398 }
4399
4400
4401 func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
4402 return nil, false
4403 }
4404
4405
4406 func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
4407 return nil, false
4408 }
4409
4410
4411 func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) {
4412 return &rc, true
4413 }
4414
4415
4416 func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) {
4417 return &rc, true
4418 }
4419
4420
4421 func (rc *RuleCondition) UnmarshalJSON(body []byte) error {
4422 var m map[string]*json.RawMessage
4423 err := json.Unmarshal(body, &m)
4424 if err != nil {
4425 return err
4426 }
4427 for k, v := range m {
4428 switch k {
4429 case "dataSource":
4430 if v != nil {
4431 dataSource, err := unmarshalBasicRuleDataSource(*v)
4432 if err != nil {
4433 return err
4434 }
4435 rc.DataSource = dataSource
4436 }
4437 case "odata.type":
4438 if v != nil {
4439 var odataType OdataTypeBasicRuleCondition
4440 err = json.Unmarshal(*v, &odataType)
4441 if err != nil {
4442 return err
4443 }
4444 rc.OdataType = odataType
4445 }
4446 }
4447 }
4448
4449 return nil
4450 }
4451
4452
4453 type BasicRuleDataSource interface {
4454 AsRuleMetricDataSource() (*RuleMetricDataSource, bool)
4455 AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool)
4456 AsRuleDataSource() (*RuleDataSource, bool)
4457 }
4458
4459
4460 type RuleDataSource struct {
4461
4462 ResourceURI *string `json:"resourceUri,omitempty"`
4463
4464 OdataType OdataType `json:"odata.type,omitempty"`
4465 }
4466
4467 func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) {
4468 var m map[string]interface{}
4469 err := json.Unmarshal(body, &m)
4470 if err != nil {
4471 return nil, err
4472 }
4473
4474 switch m["odata.type"] {
4475 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource):
4476 var rmds RuleMetricDataSource
4477 err := json.Unmarshal(body, &rmds)
4478 return rmds, err
4479 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource):
4480 var rmeds RuleManagementEventDataSource
4481 err := json.Unmarshal(body, &rmeds)
4482 return rmeds, err
4483 default:
4484 var rds RuleDataSource
4485 err := json.Unmarshal(body, &rds)
4486 return rds, err
4487 }
4488 }
4489 func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) {
4490 var rawMessages []*json.RawMessage
4491 err := json.Unmarshal(body, &rawMessages)
4492 if err != nil {
4493 return nil, err
4494 }
4495
4496 rdsArray := make([]BasicRuleDataSource, len(rawMessages))
4497
4498 for index, rawMessage := range rawMessages {
4499 rds, err := unmarshalBasicRuleDataSource(*rawMessage)
4500 if err != nil {
4501 return nil, err
4502 }
4503 rdsArray[index] = rds
4504 }
4505 return rdsArray, nil
4506 }
4507
4508
4509 func (rds RuleDataSource) MarshalJSON() ([]byte, error) {
4510 rds.OdataType = OdataTypeRuleDataSource
4511 objectMap := make(map[string]interface{})
4512 if rds.ResourceURI != nil {
4513 objectMap["resourceUri"] = rds.ResourceURI
4514 }
4515 if rds.OdataType != "" {
4516 objectMap["odata.type"] = rds.OdataType
4517 }
4518 return json.Marshal(objectMap)
4519 }
4520
4521
4522 func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) {
4523 return nil, false
4524 }
4525
4526
4527 func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) {
4528 return nil, false
4529 }
4530
4531
4532 func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) {
4533 return &rds, true
4534 }
4535
4536
4537 func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) {
4538 return &rds, true
4539 }
4540
4541
4542
4543 type RuleEmailAction struct {
4544
4545 SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"`
4546
4547 CustomEmails *[]string `json:"customEmails,omitempty"`
4548
4549 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"`
4550 }
4551
4552
4553 func (rea RuleEmailAction) MarshalJSON() ([]byte, error) {
4554 rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction
4555 objectMap := make(map[string]interface{})
4556 if rea.SendToServiceOwners != nil {
4557 objectMap["sendToServiceOwners"] = rea.SendToServiceOwners
4558 }
4559 if rea.CustomEmails != nil {
4560 objectMap["customEmails"] = rea.CustomEmails
4561 }
4562 if rea.OdataType != "" {
4563 objectMap["odata.type"] = rea.OdataType
4564 }
4565 return json.Marshal(objectMap)
4566 }
4567
4568
4569 func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) {
4570 return &rea, true
4571 }
4572
4573
4574 func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) {
4575 return nil, false
4576 }
4577
4578
4579 func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) {
4580 return nil, false
4581 }
4582
4583
4584 func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) {
4585 return &rea, true
4586 }
4587
4588
4589 type RuleManagementEventClaimsDataSource struct {
4590
4591 EmailAddress *string `json:"emailAddress,omitempty"`
4592 }
4593
4594
4595
4596 type RuleManagementEventDataSource struct {
4597
4598 EventName *string `json:"eventName,omitempty"`
4599
4600 EventSource *string `json:"eventSource,omitempty"`
4601
4602 Level *string `json:"level,omitempty"`
4603
4604 OperationName *string `json:"operationName,omitempty"`
4605
4606 ResourceGroupName *string `json:"resourceGroupName,omitempty"`
4607
4608 ResourceProviderName *string `json:"resourceProviderName,omitempty"`
4609
4610 Status *string `json:"status,omitempty"`
4611
4612 SubStatus *string `json:"subStatus,omitempty"`
4613
4614 Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"`
4615
4616 ResourceURI *string `json:"resourceUri,omitempty"`
4617
4618 OdataType OdataType `json:"odata.type,omitempty"`
4619 }
4620
4621
4622 func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) {
4623 rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource
4624 objectMap := make(map[string]interface{})
4625 if rmeds.EventName != nil {
4626 objectMap["eventName"] = rmeds.EventName
4627 }
4628 if rmeds.EventSource != nil {
4629 objectMap["eventSource"] = rmeds.EventSource
4630 }
4631 if rmeds.Level != nil {
4632 objectMap["level"] = rmeds.Level
4633 }
4634 if rmeds.OperationName != nil {
4635 objectMap["operationName"] = rmeds.OperationName
4636 }
4637 if rmeds.ResourceGroupName != nil {
4638 objectMap["resourceGroupName"] = rmeds.ResourceGroupName
4639 }
4640 if rmeds.ResourceProviderName != nil {
4641 objectMap["resourceProviderName"] = rmeds.ResourceProviderName
4642 }
4643 if rmeds.Status != nil {
4644 objectMap["status"] = rmeds.Status
4645 }
4646 if rmeds.SubStatus != nil {
4647 objectMap["subStatus"] = rmeds.SubStatus
4648 }
4649 if rmeds.Claims != nil {
4650 objectMap["claims"] = rmeds.Claims
4651 }
4652 if rmeds.ResourceURI != nil {
4653 objectMap["resourceUri"] = rmeds.ResourceURI
4654 }
4655 if rmeds.OdataType != "" {
4656 objectMap["odata.type"] = rmeds.OdataType
4657 }
4658 return json.Marshal(objectMap)
4659 }
4660
4661
4662 func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) {
4663 return nil, false
4664 }
4665
4666
4667 func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) {
4668 return &rmeds, true
4669 }
4670
4671
4672 func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) {
4673 return nil, false
4674 }
4675
4676
4677 func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) {
4678 return &rmeds, true
4679 }
4680
4681
4682
4683 type RuleMetricDataSource struct {
4684
4685 MetricName *string `json:"metricName,omitempty"`
4686
4687 ResourceURI *string `json:"resourceUri,omitempty"`
4688
4689 OdataType OdataType `json:"odata.type,omitempty"`
4690 }
4691
4692
4693 func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) {
4694 rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource
4695 objectMap := make(map[string]interface{})
4696 if rmds.MetricName != nil {
4697 objectMap["metricName"] = rmds.MetricName
4698 }
4699 if rmds.ResourceURI != nil {
4700 objectMap["resourceUri"] = rmds.ResourceURI
4701 }
4702 if rmds.OdataType != "" {
4703 objectMap["odata.type"] = rmds.OdataType
4704 }
4705 return json.Marshal(objectMap)
4706 }
4707
4708
4709 func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) {
4710 return &rmds, true
4711 }
4712
4713
4714 func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) {
4715 return nil, false
4716 }
4717
4718
4719 func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) {
4720 return nil, false
4721 }
4722
4723
4724 func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) {
4725 return &rmds, true
4726 }
4727
4728
4729
4730 type RuleWebhookAction struct {
4731
4732 ServiceURI *string `json:"serviceUri,omitempty"`
4733
4734 Properties map[string]*string `json:"properties"`
4735
4736 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"`
4737 }
4738
4739
4740 func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) {
4741 rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction
4742 objectMap := make(map[string]interface{})
4743 if rwa.ServiceURI != nil {
4744 objectMap["serviceUri"] = rwa.ServiceURI
4745 }
4746 if rwa.Properties != nil {
4747 objectMap["properties"] = rwa.Properties
4748 }
4749 if rwa.OdataType != "" {
4750 objectMap["odata.type"] = rwa.OdataType
4751 }
4752 return json.Marshal(objectMap)
4753 }
4754
4755
4756 func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) {
4757 return nil, false
4758 }
4759
4760
4761 func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) {
4762 return &rwa, true
4763 }
4764
4765
4766 func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) {
4767 return nil, false
4768 }
4769
4770
4771 func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) {
4772 return &rwa, true
4773 }
4774
4775
4776 type ScaleAction struct {
4777
4778 Direction ScaleDirection `json:"direction,omitempty"`
4779
4780 Type ScaleType `json:"type,omitempty"`
4781
4782 Value *string `json:"value,omitempty"`
4783
4784 Cooldown *string `json:"cooldown,omitempty"`
4785 }
4786
4787
4788 type ScaleCapacity struct {
4789
4790 Minimum *string `json:"minimum,omitempty"`
4791
4792 Maximum *string `json:"maximum,omitempty"`
4793
4794 Default *string `json:"default,omitempty"`
4795 }
4796
4797
4798 type ScaleRule struct {
4799
4800 MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"`
4801
4802 ScaleAction *ScaleAction `json:"scaleAction,omitempty"`
4803 }
4804
4805
4806 type ScaleRuleMetricDimension struct {
4807
4808 DimensionName *string `json:"DimensionName,omitempty"`
4809
4810 Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"`
4811
4812 Values *[]string `json:"Values,omitempty"`
4813 }
4814
4815
4816 type Schedule struct {
4817
4818 FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"`
4819
4820 TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"`
4821 }
4822
4823
4824
4825
4826 type SenderAuthorization struct {
4827
4828 Action *string `json:"action,omitempty"`
4829
4830 Role *string `json:"role,omitempty"`
4831
4832 Scope *string `json:"scope,omitempty"`
4833 }
4834
4835
4836 type SmsReceiver struct {
4837
4838 Name *string `json:"name,omitempty"`
4839
4840 CountryCode *string `json:"countryCode,omitempty"`
4841
4842 PhoneNumber *string `json:"phoneNumber,omitempty"`
4843
4844 Status ReceiverStatus `json:"status,omitempty"`
4845 }
4846
4847
4848 func (sr SmsReceiver) MarshalJSON() ([]byte, error) {
4849 objectMap := make(map[string]interface{})
4850 if sr.Name != nil {
4851 objectMap["name"] = sr.Name
4852 }
4853 if sr.CountryCode != nil {
4854 objectMap["countryCode"] = sr.CountryCode
4855 }
4856 if sr.PhoneNumber != nil {
4857 objectMap["phoneNumber"] = sr.PhoneNumber
4858 }
4859 return json.Marshal(objectMap)
4860 }
4861
4862
4863 type Source struct {
4864
4865 Query *string `json:"query,omitempty"`
4866
4867 AuthorizedResources *[]string `json:"authorizedResources,omitempty"`
4868
4869 DataSourceID *string `json:"dataSourceId,omitempty"`
4870
4871 QueryType QueryType `json:"queryType,omitempty"`
4872 }
4873
4874
4875 type ThresholdRuleCondition struct {
4876
4877 Operator ConditionOperator `json:"operator,omitempty"`
4878
4879 Threshold *float64 `json:"threshold,omitempty"`
4880
4881 WindowSize *string `json:"windowSize,omitempty"`
4882
4883 TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"`
4884
4885 DataSource BasicRuleDataSource `json:"dataSource,omitempty"`
4886
4887 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"`
4888 }
4889
4890
4891 func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) {
4892 trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition
4893 objectMap := make(map[string]interface{})
4894 if trc.Operator != "" {
4895 objectMap["operator"] = trc.Operator
4896 }
4897 if trc.Threshold != nil {
4898 objectMap["threshold"] = trc.Threshold
4899 }
4900 if trc.WindowSize != nil {
4901 objectMap["windowSize"] = trc.WindowSize
4902 }
4903 if trc.TimeAggregation != "" {
4904 objectMap["timeAggregation"] = trc.TimeAggregation
4905 }
4906 objectMap["dataSource"] = trc.DataSource
4907 if trc.OdataType != "" {
4908 objectMap["odata.type"] = trc.OdataType
4909 }
4910 return json.Marshal(objectMap)
4911 }
4912
4913
4914 func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
4915 return &trc, true
4916 }
4917
4918
4919 func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
4920 return nil, false
4921 }
4922
4923
4924 func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
4925 return nil, false
4926 }
4927
4928
4929 func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) {
4930 return nil, false
4931 }
4932
4933
4934 func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) {
4935 return &trc, true
4936 }
4937
4938
4939 func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error {
4940 var m map[string]*json.RawMessage
4941 err := json.Unmarshal(body, &m)
4942 if err != nil {
4943 return err
4944 }
4945 for k, v := range m {
4946 switch k {
4947 case "operator":
4948 if v != nil {
4949 var operator ConditionOperator
4950 err = json.Unmarshal(*v, &operator)
4951 if err != nil {
4952 return err
4953 }
4954 trc.Operator = operator
4955 }
4956 case "threshold":
4957 if v != nil {
4958 var threshold float64
4959 err = json.Unmarshal(*v, &threshold)
4960 if err != nil {
4961 return err
4962 }
4963 trc.Threshold = &threshold
4964 }
4965 case "windowSize":
4966 if v != nil {
4967 var windowSize string
4968 err = json.Unmarshal(*v, &windowSize)
4969 if err != nil {
4970 return err
4971 }
4972 trc.WindowSize = &windowSize
4973 }
4974 case "timeAggregation":
4975 if v != nil {
4976 var timeAggregation TimeAggregationOperator
4977 err = json.Unmarshal(*v, &timeAggregation)
4978 if err != nil {
4979 return err
4980 }
4981 trc.TimeAggregation = timeAggregation
4982 }
4983 case "dataSource":
4984 if v != nil {
4985 dataSource, err := unmarshalBasicRuleDataSource(*v)
4986 if err != nil {
4987 return err
4988 }
4989 trc.DataSource = dataSource
4990 }
4991 case "odata.type":
4992 if v != nil {
4993 var odataType OdataTypeBasicRuleCondition
4994 err = json.Unmarshal(*v, &odataType)
4995 if err != nil {
4996 return err
4997 }
4998 trc.OdataType = odataType
4999 }
5000 }
5001 }
5002
5003 return nil
5004 }
5005
5006
5007 type TimeSeriesElement struct {
5008
5009 Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"`
5010
5011 Data *[]MetricValue `json:"data,omitempty"`
5012 }
5013
5014
5015 type TimeSeriesInformation struct {
5016
5017 Sensitivities *[]string `json:"sensitivities,omitempty"`
5018
5019 Values *[]float64 `json:"values,omitempty"`
5020
5021 Timestamps *[]date.Time `json:"timestamps,omitempty"`
5022 }
5023
5024
5025 type TimeWindow struct {
5026
5027 TimeZone *string `json:"timeZone,omitempty"`
5028
5029 Start *date.Time `json:"start,omitempty"`
5030
5031 End *date.Time `json:"end,omitempty"`
5032 }
5033
5034
5035 type TriggerCondition struct {
5036
5037 ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"`
5038
5039 Threshold *float64 `json:"threshold,omitempty"`
5040
5041 MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"`
5042 }
5043
5044
5045 type VoiceReceiver struct {
5046
5047 Name *string `json:"name,omitempty"`
5048
5049 CountryCode *string `json:"countryCode,omitempty"`
5050
5051 PhoneNumber *string `json:"phoneNumber,omitempty"`
5052 }
5053
5054
5055 type WebhookNotification struct {
5056
5057 ServiceURI *string `json:"serviceUri,omitempty"`
5058
5059 Properties map[string]*string `json:"properties"`
5060 }
5061
5062
5063 func (wn WebhookNotification) MarshalJSON() ([]byte, error) {
5064 objectMap := make(map[string]interface{})
5065 if wn.ServiceURI != nil {
5066 objectMap["serviceUri"] = wn.ServiceURI
5067 }
5068 if wn.Properties != nil {
5069 objectMap["properties"] = wn.Properties
5070 }
5071 return json.Marshal(objectMap)
5072 }
5073
5074
5075 type WebhookReceiver struct {
5076
5077 Name *string `json:"name,omitempty"`
5078
5079 ServiceURI *string `json:"serviceUri,omitempty"`
5080 }
5081
5082
5083 type WebtestLocationAvailabilityCriteria struct {
5084
5085 WebTestID *string `json:"webTestId,omitempty"`
5086
5087 ComponentID *string `json:"componentId,omitempty"`
5088
5089 FailedLocationCount *float64 `json:"failedLocationCount,omitempty"`
5090
5091 AdditionalProperties map[string]interface{} `json:""`
5092
5093 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"`
5094 }
5095
5096
5097 func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) {
5098 wlac.OdataType = OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria
5099 objectMap := make(map[string]interface{})
5100 if wlac.WebTestID != nil {
5101 objectMap["webTestId"] = wlac.WebTestID
5102 }
5103 if wlac.ComponentID != nil {
5104 objectMap["componentId"] = wlac.ComponentID
5105 }
5106 if wlac.FailedLocationCount != nil {
5107 objectMap["failedLocationCount"] = wlac.FailedLocationCount
5108 }
5109 if wlac.OdataType != "" {
5110 objectMap["odata.type"] = wlac.OdataType
5111 }
5112 for k, v := range wlac.AdditionalProperties {
5113 objectMap[k] = v
5114 }
5115 return json.Marshal(objectMap)
5116 }
5117
5118
5119 func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) {
5120 return nil, false
5121 }
5122
5123
5124 func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) {
5125 return &wlac, true
5126 }
5127
5128
5129 func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) {
5130 return nil, false
5131 }
5132
5133
5134 func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) {
5135 return nil, false
5136 }
5137
5138
5139 func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) {
5140 return &wlac, true
5141 }
5142
5143
5144 func (wlac *WebtestLocationAvailabilityCriteria) UnmarshalJSON(body []byte) error {
5145 var m map[string]*json.RawMessage
5146 err := json.Unmarshal(body, &m)
5147 if err != nil {
5148 return err
5149 }
5150 for k, v := range m {
5151 switch k {
5152 case "webTestId":
5153 if v != nil {
5154 var webTestID string
5155 err = json.Unmarshal(*v, &webTestID)
5156 if err != nil {
5157 return err
5158 }
5159 wlac.WebTestID = &webTestID
5160 }
5161 case "componentId":
5162 if v != nil {
5163 var componentID string
5164 err = json.Unmarshal(*v, &componentID)
5165 if err != nil {
5166 return err
5167 }
5168 wlac.ComponentID = &componentID
5169 }
5170 case "failedLocationCount":
5171 if v != nil {
5172 var failedLocationCount float64
5173 err = json.Unmarshal(*v, &failedLocationCount)
5174 if err != nil {
5175 return err
5176 }
5177 wlac.FailedLocationCount = &failedLocationCount
5178 }
5179 default:
5180 if v != nil {
5181 var additionalProperties interface{}
5182 err = json.Unmarshal(*v, &additionalProperties)
5183 if err != nil {
5184 return err
5185 }
5186 if wlac.AdditionalProperties == nil {
5187 wlac.AdditionalProperties = make(map[string]interface{})
5188 }
5189 wlac.AdditionalProperties[k] = additionalProperties
5190 }
5191 case "odata.type":
5192 if v != nil {
5193 var odataType OdataTypeBasicMetricAlertCriteria
5194 err = json.Unmarshal(*v, &odataType)
5195 if err != nil {
5196 return err
5197 }
5198 wlac.OdataType = odataType
5199 }
5200 }
5201 }
5202
5203 return nil
5204 }
5205
View as plain text