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