forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
1260 lines (1100 loc) · 46.3 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package insights
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"encoding/json"
"errors"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"net/http"
)
// CategoryType enumerates the values for category type.
type CategoryType string
const (
// Logs specifies the logs state for category type.
Logs CategoryType = "Logs"
// Metrics specifies the metrics state for category type.
Metrics CategoryType = "Metrics"
)
// ComparisonOperationType enumerates the values for comparison operation type.
type ComparisonOperationType string
const (
// Equals specifies the equals state for comparison operation type.
Equals ComparisonOperationType = "Equals"
// GreaterThan specifies the greater than state for comparison operation type.
GreaterThan ComparisonOperationType = "GreaterThan"
// GreaterThanOrEqual specifies the greater than or equal state for comparison operation type.
GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual"
// LessThan specifies the less than state for comparison operation type.
LessThan ComparisonOperationType = "LessThan"
// LessThanOrEqual specifies the less than or equal state for comparison operation type.
LessThanOrEqual ComparisonOperationType = "LessThanOrEqual"
// NotEquals specifies the not equals state for comparison operation type.
NotEquals ComparisonOperationType = "NotEquals"
)
// ConditionOperator enumerates the values for condition operator.
type ConditionOperator string
const (
// ConditionOperatorGreaterThan specifies the condition operator greater than state for condition operator.
ConditionOperatorGreaterThan ConditionOperator = "GreaterThan"
// ConditionOperatorGreaterThanOrEqual specifies the condition operator greater than or equal state for condition
// operator.
ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual"
// ConditionOperatorLessThan specifies the condition operator less than state for condition operator.
ConditionOperatorLessThan ConditionOperator = "LessThan"
// ConditionOperatorLessThanOrEqual specifies the condition operator less than or equal state for condition operator.
ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual"
)
// MetricStatisticType enumerates the values for metric statistic type.
type MetricStatisticType string
const (
// Average specifies the average state for metric statistic type.
Average MetricStatisticType = "Average"
// Max specifies the max state for metric statistic type.
Max MetricStatisticType = "Max"
// Min specifies the min state for metric statistic type.
Min MetricStatisticType = "Min"
// Sum specifies the sum state for metric statistic type.
Sum MetricStatisticType = "Sum"
)
// OdataType enumerates the values for odata type.
type OdataType string
const (
// OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource specifies the odata type microsoft
// azure management insights models rule management event data source state for odata type.
OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource"
// OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource specifies the odata type microsoft azure
// management insights models rule metric data source state for odata type.
OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"
)
// OdataType1 enumerates the values for odata type 1.
type OdataType1 string
const (
// OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition specifies the odata type microsoft
// azure management insights models location threshold rule condition state for odata type 1.
OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataType1 = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition"
// OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition specifies the odata type microsoft azure
// management insights models management event rule condition state for odata type 1.
OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataType1 = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition"
// OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition specifies the odata type microsoft azure
// management insights models threshold rule condition state for odata type 1.
OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataType1 = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"
)
// OdataType2 enumerates the values for odata type 2.
type OdataType2 string
const (
// OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction specifies the odata type microsoft azure management
// insights models rule email action state for odata type 2.
OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataType2 = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction"
// OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction specifies the odata type microsoft azure management
// insights models rule webhook action state for odata type 2.
OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataType2 = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction"
)
// ReceiverStatus enumerates the values for receiver status.
type ReceiverStatus string
const (
// Disabled specifies the disabled state for receiver status.
Disabled ReceiverStatus = "Disabled"
// Enabled specifies the enabled state for receiver status.
Enabled ReceiverStatus = "Enabled"
// NotSpecified specifies the not specified state for receiver status.
NotSpecified ReceiverStatus = "NotSpecified"
)
// RecurrenceFrequency enumerates the values for recurrence frequency.
type RecurrenceFrequency string
const (
// Day specifies the day state for recurrence frequency.
Day RecurrenceFrequency = "Day"
// Hour specifies the hour state for recurrence frequency.
Hour RecurrenceFrequency = "Hour"
// Minute specifies the minute state for recurrence frequency.
Minute RecurrenceFrequency = "Minute"
// Month specifies the month state for recurrence frequency.
Month RecurrenceFrequency = "Month"
// None specifies the none state for recurrence frequency.
None RecurrenceFrequency = "None"
// Second specifies the second state for recurrence frequency.
Second RecurrenceFrequency = "Second"
// Week specifies the week state for recurrence frequency.
Week RecurrenceFrequency = "Week"
// Year specifies the year state for recurrence frequency.
Year RecurrenceFrequency = "Year"
)
// ScaleDirection enumerates the values for scale direction.
type ScaleDirection string
const (
// ScaleDirectionDecrease specifies the scale direction decrease state for scale direction.
ScaleDirectionDecrease ScaleDirection = "Decrease"
// ScaleDirectionIncrease specifies the scale direction increase state for scale direction.
ScaleDirectionIncrease ScaleDirection = "Increase"
// ScaleDirectionNone specifies the scale direction none state for scale direction.
ScaleDirectionNone ScaleDirection = "None"
)
// ScaleType enumerates the values for scale type.
type ScaleType string
const (
// ChangeCount specifies the change count state for scale type.
ChangeCount ScaleType = "ChangeCount"
// ExactCount specifies the exact count state for scale type.
ExactCount ScaleType = "ExactCount"
// PercentChangeCount specifies the percent change count state for scale type.
PercentChangeCount ScaleType = "PercentChangeCount"
)
// TimeAggregationOperator enumerates the values for time aggregation operator.
type TimeAggregationOperator string
const (
// TimeAggregationOperatorAverage specifies the time aggregation operator average state for time aggregation operator.
TimeAggregationOperatorAverage TimeAggregationOperator = "Average"
// TimeAggregationOperatorLast specifies the time aggregation operator last state for time aggregation operator.
TimeAggregationOperatorLast TimeAggregationOperator = "Last"
// TimeAggregationOperatorMaximum specifies the time aggregation operator maximum state for time aggregation operator.
TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum"
// TimeAggregationOperatorMinimum specifies the time aggregation operator minimum state for time aggregation operator.
TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum"
// TimeAggregationOperatorTotal specifies the time aggregation operator total state for time aggregation operator.
TimeAggregationOperatorTotal TimeAggregationOperator = "Total"
)
// TimeAggregationType enumerates the values for time aggregation type.
type TimeAggregationType string
const (
// TimeAggregationTypeAverage specifies the time aggregation type average state for time aggregation type.
TimeAggregationTypeAverage TimeAggregationType = "Average"
// TimeAggregationTypeCount specifies the time aggregation type count state for time aggregation type.
TimeAggregationTypeCount TimeAggregationType = "Count"
// TimeAggregationTypeMaximum specifies the time aggregation type maximum state for time aggregation type.
TimeAggregationTypeMaximum TimeAggregationType = "Maximum"
// TimeAggregationTypeMinimum specifies the time aggregation type minimum state for time aggregation type.
TimeAggregationTypeMinimum TimeAggregationType = "Minimum"
// TimeAggregationTypeTotal specifies the time aggregation type total state for time aggregation type.
TimeAggregationTypeTotal TimeAggregationType = "Total"
)
// ActionGroup is an Azure action group.
type ActionGroup struct {
GroupShortName *string `json:"groupShortName,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"`
SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"`
WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"`
}
// ActionGroupList is a list of action groups.
type ActionGroupList struct {
autorest.Response `json:"-"`
Value *[]ActionGroupResource `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ActionGroupResource is an action group resource.
type ActionGroupResource struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*ActionGroup `json:"properties,omitempty"`
}
// ActivityLogAlert is an Azure activity log alert.
type ActivityLogAlert struct {
Scopes *[]string `json:"scopes,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"`
Actions *ActivityLogAlertActionList `json:"actions,omitempty"`
Description *string `json:"description,omitempty"`
}
// ActivityLogAlertActionGroup is a pointer to an Azure Action Group.
type ActivityLogAlertActionGroup struct {
ActionGroupID *string `json:"actionGroupId,omitempty"`
WebhookProperties *map[string]*string `json:"webhookProperties,omitempty"`
}
// ActivityLogAlertActionList is a list of activity log alert actions.
type ActivityLogAlertActionList struct {
ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"`
}
// ActivityLogAlertAllOfCondition is an Activity Log alert condition that is met when all its member conditions are
// met.
type ActivityLogAlertAllOfCondition struct {
AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"`
}
// ActivityLogAlertLeafCondition is an Activity Log alert condition that is met by comparing an activity log field and
// value.
type ActivityLogAlertLeafCondition struct {
Field *string `json:"field,omitempty"`
Equals *string `json:"equals,omitempty"`
}
// ActivityLogAlertList is a list of activity log alerts.
type ActivityLogAlertList struct {
autorest.Response `json:"-"`
Value *[]ActivityLogAlertResource `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ActivityLogAlertPatch is an Azure activity log alert for patch operations.
type ActivityLogAlertPatch struct {
Enabled *bool `json:"enabled,omitempty"`
}
// ActivityLogAlertPatchBody is an activity log alert object for the body of patch operations.
type ActivityLogAlertPatchBody struct {
Tags *map[string]*string `json:"tags,omitempty"`
*ActivityLogAlertPatch `json:"properties,omitempty"`
}
// ActivityLogAlertResource is an activity log alert resource.
type ActivityLogAlertResource struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*ActivityLogAlert `json:"properties,omitempty"`
}
// AlertRule is an alert rule.
type AlertRule struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
IsEnabled *bool `json:"isEnabled,omitempty"`
Condition RuleCondition `json:"condition,omitempty"`
Actions *[]RuleAction `json:"actions,omitempty"`
LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for AlertRule struct.
func (ar *AlertRule) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
var v *json.RawMessage
v = m["name"]
if v != nil {
var name string
err = json.Unmarshal(*m["name"], &name)
if err != nil {
return err
}
ar.Name = &name
}
v = m["description"]
if v != nil {
var description string
err = json.Unmarshal(*m["description"], &description)
if err != nil {
return err
}
ar.Description = &description
}
v = m["isEnabled"]
if v != nil {
var isEnabled bool
err = json.Unmarshal(*m["isEnabled"], &isEnabled)
if err != nil {
return err
}
ar.IsEnabled = &isEnabled
}
v = m["condition"]
if v != nil {
condition, err := unmarshalRuleCondition(*m["condition"])
if err != nil {
return err
}
ar.Condition = condition
}
v = m["actions"]
if v != nil {
actions, err := unmarshalRuleActionArray(*m["actions"])
if err != nil {
return err
}
ar.Actions = &actions
}
v = m["lastUpdatedTime"]
if v != nil {
var lastUpdatedTime date.Time
err = json.Unmarshal(*m["lastUpdatedTime"], &lastUpdatedTime)
if err != nil {
return err
}
ar.LastUpdatedTime = &lastUpdatedTime
}
return nil
}
// AlertRuleResource is the alert rule resource.
type AlertRuleResource struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*AlertRule `json:"properties,omitempty"`
}
// AlertRuleResourceCollection is represents a collection of alert rule resources.
type AlertRuleResourceCollection struct {
autorest.Response `json:"-"`
Value *[]AlertRuleResource `json:"value,omitempty"`
}
// AlertRuleResourcePatch is the alert rule object for patch operations.
type AlertRuleResourcePatch struct {
Tags *map[string]*string `json:"tags,omitempty"`
*AlertRule `json:"properties,omitempty"`
}
// AutoscaleNotification is autoscale notification.
type AutoscaleNotification struct {
Operation *string `json:"operation,omitempty"`
Email *EmailNotification `json:"email,omitempty"`
Webhooks *[]WebhookNotification `json:"webhooks,omitempty"`
}
// AutoscaleProfile is autoscale profile.
type AutoscaleProfile struct {
Name *string `json:"name,omitempty"`
Capacity *ScaleCapacity `json:"capacity,omitempty"`
Rules *[]ScaleRule `json:"rules,omitempty"`
FixedDate *TimeWindow `json:"fixedDate,omitempty"`
Recurrence *Recurrence `json:"recurrence,omitempty"`
}
// AutoscaleSetting is a setting that contains all of the configuration for the automatic scaling of a resource.
type AutoscaleSetting struct {
Profiles *[]AutoscaleProfile `json:"profiles,omitempty"`
Notifications *[]AutoscaleNotification `json:"notifications,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Name *string `json:"name,omitempty"`
TargetResourceURI *string `json:"targetResourceUri,omitempty"`
}
// AutoscaleSettingResource is the autoscale setting resource.
type AutoscaleSettingResource struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*AutoscaleSetting `json:"properties,omitempty"`
}
// AutoscaleSettingResourceCollection is represents a collection of autoscale setting resources.
type AutoscaleSettingResourceCollection struct {
autorest.Response `json:"-"`
Value *[]AutoscaleSettingResource `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// AutoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client AutoscaleSettingResourceCollection) AutoscaleSettingResourceCollectionPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// AutoscaleSettingResourcePatch is the autoscale setting object for patch operations.
type AutoscaleSettingResourcePatch struct {
Tags *map[string]*string `json:"tags,omitempty"`
*AutoscaleSetting `json:"properties,omitempty"`
}
// DiagnosticSettings is the diagnostic settings.
type DiagnosticSettings struct {
StorageAccountID *string `json:"storageAccountId,omitempty"`
EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"`
EventHubName *string `json:"eventHubName,omitempty"`
Metrics *[]MetricSettings `json:"metrics,omitempty"`
Logs *[]LogSettings `json:"logs,omitempty"`
WorkspaceID *string `json:"workspaceId,omitempty"`
}
// DiagnosticSettingsCategory is the diagnostic settings Category.
type DiagnosticSettingsCategory struct {
CategoryType CategoryType `json:"categoryType,omitempty"`
}
// DiagnosticSettingsCategoryResource is the diagnostic settings category resource.
type DiagnosticSettingsCategoryResource struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
*DiagnosticSettingsCategory `json:"properties,omitempty"`
}
// DiagnosticSettingsCategoryResourceCollection is represents a collection of diagnostic setting category resources.
type DiagnosticSettingsCategoryResourceCollection struct {
autorest.Response `json:"-"`
Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"`
}
// DiagnosticSettingsResource is the diagnostic setting resource.
type DiagnosticSettingsResource struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
*DiagnosticSettings `json:"properties,omitempty"`
}
// DiagnosticSettingsResourceCollection is represents a collection of alert rule resources.
type DiagnosticSettingsResourceCollection struct {
autorest.Response `json:"-"`
Value *[]DiagnosticSettingsResource `json:"value,omitempty"`
}
// EmailNotification is email notification of an autoscale event.
type EmailNotification struct {
SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"`
SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"`
CustomEmails *[]string `json:"customEmails,omitempty"`
}
// EmailReceiver is an email receiver.
type EmailReceiver struct {
Name *string `json:"name,omitempty"`
EmailAddress *string `json:"emailAddress,omitempty"`
Status ReceiverStatus `json:"status,omitempty"`
}
// EnableRequest is describes a receiver that should be resubscribed.
type EnableRequest struct {
ReceiverName *string `json:"receiverName,omitempty"`
}
// ErrorResponse is describes the format of Error response.
type ErrorResponse struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
}
// Incident is an alert incident indicates the activation status of an alert rule.
type Incident struct {
autorest.Response `json:"-"`
Name *string `json:"name,omitempty"`
RuleName *string `json:"ruleName,omitempty"`
IsActive *bool `json:"isActive,omitempty"`
ActivatedTime *date.Time `json:"activatedTime,omitempty"`
ResolvedTime *date.Time `json:"resolvedTime,omitempty"`
}
// IncidentListResult is the List incidents operation response.
type IncidentListResult struct {
autorest.Response `json:"-"`
Value *[]Incident `json:"value,omitempty"`
}
// LocationThresholdRuleCondition is a rule condition based on a certain number of locations failing.
type LocationThresholdRuleCondition struct {
DataSource RuleDataSource `json:"dataSource,omitempty"`
OdataType OdataType1 `json:"odata.type,omitempty"`
WindowSize *string `json:"windowSize,omitempty"`
FailedLocationCount *int32 `json:"failedLocationCount,omitempty"`
}
// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition.
func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) {
ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition
type Alias LocationThresholdRuleCondition
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(ltrc),
})
}
// AsThresholdRuleCondition is the RuleCondition implementation for LocationThresholdRuleCondition.
func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
return nil, false
}
// AsLocationThresholdRuleCondition is the RuleCondition implementation for LocationThresholdRuleCondition.
func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
return <rc, true
}
// AsManagementEventRuleCondition is the RuleCondition implementation for LocationThresholdRuleCondition.
func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
return nil, false
}
// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct.
func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
var v *json.RawMessage
v = m["windowSize"]
if v != nil {
var windowSize string
err = json.Unmarshal(*m["windowSize"], &windowSize)
if err != nil {
return err
}
ltrc.WindowSize = &windowSize
}
v = m["failedLocationCount"]
if v != nil {
var failedLocationCount int32
err = json.Unmarshal(*m["failedLocationCount"], &failedLocationCount)
if err != nil {
return err
}
ltrc.FailedLocationCount = &failedLocationCount
}
v = m["dataSource"]
if v != nil {
dataSource, err := unmarshalRuleDataSource(*m["dataSource"])
if err != nil {
return err
}
ltrc.DataSource = dataSource
}
v = m["odata.type"]
if v != nil {
var odatatype OdataType1
err = json.Unmarshal(*m["odata.type"], &odatatype)
if err != nil {
return err
}
ltrc.OdataType = odatatype
}
return nil
}
// LogProfileCollection is represents a collection of log profiles.
type LogProfileCollection struct {
autorest.Response `json:"-"`
Value *[]LogProfileResource `json:"value,omitempty"`
}
// LogProfileProperties is the log profile properties.
type LogProfileProperties struct {
StorageAccountID *string `json:"storageAccountId,omitempty"`
ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"`
Locations *[]string `json:"locations,omitempty"`
Categories *[]string `json:"categories,omitempty"`
RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
}
// LogProfileResource is the log profile resource.
type LogProfileResource struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*LogProfileProperties `json:"properties,omitempty"`
}
// LogProfileResourcePatch is the log profile resource for patch operations.
type LogProfileResourcePatch struct {
Tags *map[string]*string `json:"tags,omitempty"`
*LogProfileProperties `json:"properties,omitempty"`
}
// LogSettings is part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log.
type LogSettings struct {
Category *string `json:"category,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
}
// ManagementEventAggregationCondition is how the data that is collected should be combined over time.
type ManagementEventAggregationCondition struct {
Operator ConditionOperator `json:"operator,omitempty"`
Threshold *float64 `json:"threshold,omitempty"`
WindowSize *string `json:"windowSize,omitempty"`
}
// ManagementEventRuleCondition is a management event rule condition.
type ManagementEventRuleCondition struct {
DataSource RuleDataSource `json:"dataSource,omitempty"`
OdataType OdataType1 `json:"odata.type,omitempty"`
Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"`
}
// MarshalJSON is the custom marshaler for ManagementEventRuleCondition.
func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) {
merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition
type Alias ManagementEventRuleCondition
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(merc),
})
}
// AsThresholdRuleCondition is the RuleCondition implementation for ManagementEventRuleCondition.
func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
return nil, false
}
// AsLocationThresholdRuleCondition is the RuleCondition implementation for ManagementEventRuleCondition.
func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
return nil, false
}
// AsManagementEventRuleCondition is the RuleCondition implementation for ManagementEventRuleCondition.
func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
return &merc, true
}
// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct.
func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
var v *json.RawMessage
v = m["aggregation"]
if v != nil {
var aggregation ManagementEventAggregationCondition
err = json.Unmarshal(*m["aggregation"], &aggregation)
if err != nil {
return err
}
merc.Aggregation = &aggregation
}
v = m["dataSource"]
if v != nil {
dataSource, err := unmarshalRuleDataSource(*m["dataSource"])
if err != nil {
return err
}
merc.DataSource = dataSource
}
v = m["odata.type"]
if v != nil {
var odatatype OdataType1
err = json.Unmarshal(*m["odata.type"], &odatatype)
if err != nil {
return err
}
merc.OdataType = odatatype
}
return nil
}
// MetricSettings is part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric.
type MetricSettings struct {
TimeGrain *string `json:"timeGrain,omitempty"`
Category *string `json:"category,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
}
// MetricTrigger is the trigger that results in a scaling action.
type MetricTrigger struct {
MetricName *string `json:"metricName,omitempty"`
MetricResourceURI *string `json:"metricResourceUri,omitempty"`
TimeGrain *string `json:"timeGrain,omitempty"`
Statistic MetricStatisticType `json:"statistic,omitempty"`
TimeWindow *string `json:"timeWindow,omitempty"`
TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"`
Operator ComparisonOperationType `json:"operator,omitempty"`
Threshold *float64 `json:"threshold,omitempty"`
}
// Operation is microsoft Insights API operation definition.
type Operation struct {
Name *string `json:"name,omitempty"`
Display *OperationDisplay `json:"display,omitempty"`
}
// OperationDisplay is display metadata associated with the operation.
type OperationDisplay struct {
Provider *string `json:"provider,omitempty"`
Resource *string `json:"resource,omitempty"`
Operation *string `json:"operation,omitempty"`
}
// OperationListResult is result of the request to list Microsoft.Insights operations. It contains a list of operations
// and a URL link to get the next set of results.
type OperationListResult struct {
autorest.Response `json:"-"`
Value *[]Operation `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ProxyOnlyResource is a proxy only azure resource object
type ProxyOnlyResource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
}
// Recurrence is the repeating times at which this profile begins. This element is not used if the FixedDate element is
// used.
type Recurrence struct {
Frequency RecurrenceFrequency `json:"frequency,omitempty"`
Schedule *RecurrentSchedule `json:"schedule,omitempty"`
}
// RecurrentSchedule is the scheduling constraints for when the profile begins.
type RecurrentSchedule struct {
TimeZone *string `json:"timeZone,omitempty"`
Days *[]string `json:"days,omitempty"`
Hours *[]int32 `json:"hours,omitempty"`
Minutes *[]int32 `json:"minutes,omitempty"`
}
// Resource is an azure resource object
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// RetentionPolicy is specifies the retention policy for the log.
type RetentionPolicy struct {
Enabled *bool `json:"enabled,omitempty"`
Days *int32 `json:"days,omitempty"`
}
// RuleAction is the action that is performed when the alert rule becomes active, and when an alert condition is
// resolved.
type RuleAction interface {
AsRuleEmailAction() (*RuleEmailAction, bool)
AsRuleWebhookAction() (*RuleWebhookAction, bool)
}
func unmarshalRuleAction(body []byte) (RuleAction, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["odata.type"] {
case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction):
var rea RuleEmailAction
err := json.Unmarshal(body, &rea)
return rea, err
case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction):
var rwa RuleWebhookAction
err := json.Unmarshal(body, &rwa)
return rwa, err
default:
return nil, errors.New("Unsupported type")
}
}
func unmarshalRuleActionArray(body []byte) ([]RuleAction, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
raArray := make([]RuleAction, len(rawMessages))
for index, rawMessage := range rawMessages {
ra, err := unmarshalRuleAction(*rawMessage)
if err != nil {
return nil, err
}
raArray[index] = ra
}
return raArray, nil
}
// RuleCondition is the condition that results in the alert rule being activated.
type RuleCondition interface {
AsThresholdRuleCondition() (*ThresholdRuleCondition, bool)
AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool)
AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool)
}
func unmarshalRuleCondition(body []byte) (RuleCondition, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["odata.type"] {
case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition):
var trc ThresholdRuleCondition
err := json.Unmarshal(body, &trc)
return trc, err
case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition):
var ltrc LocationThresholdRuleCondition
err := json.Unmarshal(body, <rc)
return ltrc, err
case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition):
var merc ManagementEventRuleCondition
err := json.Unmarshal(body, &merc)
return merc, err
default:
return nil, errors.New("Unsupported type")
}
}
func unmarshalRuleConditionArray(body []byte) ([]RuleCondition, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
rcArray := make([]RuleCondition, len(rawMessages))
for index, rawMessage := range rawMessages {
rc, err := unmarshalRuleCondition(*rawMessage)
if err != nil {
return nil, err
}
rcArray[index] = rc
}
return rcArray, nil
}
// RuleDataSource is the resource from which the rule collects its data.
type RuleDataSource interface {
AsRuleMetricDataSource() (*RuleMetricDataSource, bool)
AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool)
}
func unmarshalRuleDataSource(body []byte) (RuleDataSource, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["odata.type"] {
case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource):
var rmds RuleMetricDataSource
err := json.Unmarshal(body, &rmds)
return rmds, err
case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource):
var rmeds RuleManagementEventDataSource
err := json.Unmarshal(body, &rmeds)
return rmeds, err
default:
return nil, errors.New("Unsupported type")
}
}
func unmarshalRuleDataSourceArray(body []byte) ([]RuleDataSource, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
rdsArray := make([]RuleDataSource, len(rawMessages))
for index, rawMessage := range rawMessages {
rds, err := unmarshalRuleDataSource(*rawMessage)
if err != nil {
return nil, err
}
rdsArray[index] = rds
}
return rdsArray, nil
}
// RuleEmailAction is specifies the action to send email when the rule condition is evaluated. The discriminator is
// always RuleEmailAction in this case.
type RuleEmailAction struct {
OdataType OdataType2 `json:"odata.type,omitempty"`
SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"`
CustomEmails *[]string `json:"customEmails,omitempty"`
}
// MarshalJSON is the custom marshaler for RuleEmailAction.
func (rea RuleEmailAction) MarshalJSON() ([]byte, error) {
rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction
type Alias RuleEmailAction
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(rea),
})
}
// AsRuleEmailAction is the RuleAction implementation for RuleEmailAction.
func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) {
return &rea, true
}