1package insights 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "encoding/json" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/date" 24 "github.com/Azure/go-autorest/autorest/to" 25 "net/http" 26) 27 28// AggregationType enumerates the values for aggregation type. 29type AggregationType string 30 31const ( 32 // Average ... 33 Average AggregationType = "Average" 34 // Count ... 35 Count AggregationType = "Count" 36 // Maximum ... 37 Maximum AggregationType = "Maximum" 38 // Minimum ... 39 Minimum AggregationType = "Minimum" 40 // None ... 41 None AggregationType = "None" 42 // Total ... 43 Total AggregationType = "Total" 44) 45 46// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. 47func PossibleAggregationTypeValues() []AggregationType { 48 return []AggregationType{Average, Count, Maximum, Minimum, None, Total} 49} 50 51// AlertSeverity enumerates the values for alert severity. 52type AlertSeverity string 53 54const ( 55 // Four ... 56 Four AlertSeverity = "4" 57 // One ... 58 One AlertSeverity = "1" 59 // Three ... 60 Three AlertSeverity = "3" 61 // Two ... 62 Two AlertSeverity = "2" 63 // Zero ... 64 Zero AlertSeverity = "0" 65) 66 67// PossibleAlertSeverityValues returns an array of possible values for the AlertSeverity const type. 68func PossibleAlertSeverityValues() []AlertSeverity { 69 return []AlertSeverity{Four, One, Three, Two, Zero} 70} 71 72// CategoryType enumerates the values for category type. 73type CategoryType string 74 75const ( 76 // Logs ... 77 Logs CategoryType = "Logs" 78 // Metrics ... 79 Metrics CategoryType = "Metrics" 80) 81 82// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. 83func PossibleCategoryTypeValues() []CategoryType { 84 return []CategoryType{Logs, Metrics} 85} 86 87// ComparisonOperationType enumerates the values for comparison operation type. 88type ComparisonOperationType string 89 90const ( 91 // Equals ... 92 Equals ComparisonOperationType = "Equals" 93 // GreaterThan ... 94 GreaterThan ComparisonOperationType = "GreaterThan" 95 // GreaterThanOrEqual ... 96 GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" 97 // LessThan ... 98 LessThan ComparisonOperationType = "LessThan" 99 // LessThanOrEqual ... 100 LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" 101 // NotEquals ... 102 NotEquals ComparisonOperationType = "NotEquals" 103) 104 105// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. 106func PossibleComparisonOperationTypeValues() []ComparisonOperationType { 107 return []ComparisonOperationType{Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals} 108} 109 110// ConditionalOperator enumerates the values for conditional operator. 111type ConditionalOperator string 112 113const ( 114 // ConditionalOperatorEqual ... 115 ConditionalOperatorEqual ConditionalOperator = "Equal" 116 // ConditionalOperatorGreaterThan ... 117 ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" 118 // ConditionalOperatorLessThan ... 119 ConditionalOperatorLessThan ConditionalOperator = "LessThan" 120) 121 122// PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. 123func PossibleConditionalOperatorValues() []ConditionalOperator { 124 return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} 125} 126 127// ConditionOperator enumerates the values for condition operator. 128type ConditionOperator string 129 130const ( 131 // ConditionOperatorGreaterThan ... 132 ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" 133 // ConditionOperatorGreaterThanOrEqual ... 134 ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" 135 // ConditionOperatorLessThan ... 136 ConditionOperatorLessThan ConditionOperator = "LessThan" 137 // ConditionOperatorLessThanOrEqual ... 138 ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" 139) 140 141// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. 142func PossibleConditionOperatorValues() []ConditionOperator { 143 return []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} 144} 145 146// Enabled enumerates the values for enabled. 147type Enabled string 148 149const ( 150 // False ... 151 False Enabled = "false" 152 // True ... 153 True Enabled = "true" 154) 155 156// PossibleEnabledValues returns an array of possible values for the Enabled const type. 157func PossibleEnabledValues() []Enabled { 158 return []Enabled{False, True} 159} 160 161// EventLevel enumerates the values for event level. 162type EventLevel string 163 164const ( 165 // Critical ... 166 Critical EventLevel = "Critical" 167 // Error ... 168 Error EventLevel = "Error" 169 // Informational ... 170 Informational EventLevel = "Informational" 171 // Verbose ... 172 Verbose EventLevel = "Verbose" 173 // Warning ... 174 Warning EventLevel = "Warning" 175) 176 177// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. 178func PossibleEventLevelValues() []EventLevel { 179 return []EventLevel{Critical, Error, Informational, Verbose, Warning} 180} 181 182// MetricStatisticType enumerates the values for metric statistic type. 183type MetricStatisticType string 184 185const ( 186 // MetricStatisticTypeAverage ... 187 MetricStatisticTypeAverage MetricStatisticType = "Average" 188 // MetricStatisticTypeMax ... 189 MetricStatisticTypeMax MetricStatisticType = "Max" 190 // MetricStatisticTypeMin ... 191 MetricStatisticTypeMin MetricStatisticType = "Min" 192 // MetricStatisticTypeSum ... 193 MetricStatisticTypeSum MetricStatisticType = "Sum" 194) 195 196// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. 197func PossibleMetricStatisticTypeValues() []MetricStatisticType { 198 return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} 199} 200 201// MetricTriggerType enumerates the values for metric trigger type. 202type MetricTriggerType string 203 204const ( 205 // MetricTriggerTypeConsecutive ... 206 MetricTriggerTypeConsecutive MetricTriggerType = "Consecutive" 207 // MetricTriggerTypeTotal ... 208 MetricTriggerTypeTotal MetricTriggerType = "Total" 209) 210 211// PossibleMetricTriggerTypeValues returns an array of possible values for the MetricTriggerType const type. 212func PossibleMetricTriggerTypeValues() []MetricTriggerType { 213 return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} 214} 215 216// OdataType enumerates the values for odata type. 217type OdataType string 218 219const ( 220 // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... 221 OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" 222 // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... 223 OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" 224 // OdataTypeRuleDataSource ... 225 OdataTypeRuleDataSource OdataType = "RuleDataSource" 226) 227 228// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. 229func PossibleOdataTypeValues() []OdataType { 230 return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} 231} 232 233// OdataTypeBasicAction enumerates the values for odata type basic action. 234type OdataTypeBasicAction string 235 236const ( 237 // OdataTypeAction ... 238 OdataTypeAction OdataTypeBasicAction = "Action" 239 // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction ... 240 OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" 241) 242 243// PossibleOdataTypeBasicActionValues returns an array of possible values for the OdataTypeBasicAction const type. 244func PossibleOdataTypeBasicActionValues() []OdataTypeBasicAction { 245 return []OdataTypeBasicAction{OdataTypeAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction} 246} 247 248// OdataTypeBasicMetricAlertCriteria enumerates the values for odata type basic metric alert criteria. 249type OdataTypeBasicMetricAlertCriteria string 250 251const ( 252 // OdataTypeMetricAlertCriteria ... 253 OdataTypeMetricAlertCriteria OdataTypeBasicMetricAlertCriteria = "MetricAlertCriteria" 254 // OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria ... 255 OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" 256) 257 258// PossibleOdataTypeBasicMetricAlertCriteriaValues returns an array of possible values for the OdataTypeBasicMetricAlertCriteria const type. 259func PossibleOdataTypeBasicMetricAlertCriteriaValues() []OdataTypeBasicMetricAlertCriteria { 260 return []OdataTypeBasicMetricAlertCriteria{OdataTypeMetricAlertCriteria, OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria} 261} 262 263// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. 264type OdataTypeBasicRuleAction string 265 266const ( 267 // OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... 268 OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" 269 // OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... 270 OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" 271 // OdataTypeRuleAction ... 272 OdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" 273) 274 275// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. 276func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { 277 return []OdataTypeBasicRuleAction{OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeRuleAction} 278} 279 280// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. 281type OdataTypeBasicRuleCondition string 282 283const ( 284 // OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... 285 OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" 286 // OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... 287 OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" 288 // OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... 289 OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" 290 // OdataTypeRuleCondition ... 291 OdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" 292) 293 294// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. 295func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { 296 return []OdataTypeBasicRuleCondition{OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeRuleCondition} 297} 298 299// ProvisioningState enumerates the values for provisioning state. 300type ProvisioningState string 301 302const ( 303 // Canceled ... 304 Canceled ProvisioningState = "Canceled" 305 // Deploying ... 306 Deploying ProvisioningState = "Deploying" 307 // Failed ... 308 Failed ProvisioningState = "Failed" 309 // Succeeded ... 310 Succeeded ProvisioningState = "Succeeded" 311) 312 313// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. 314func PossibleProvisioningStateValues() []ProvisioningState { 315 return []ProvisioningState{Canceled, Deploying, Failed, Succeeded} 316} 317 318// QueryType enumerates the values for query type. 319type QueryType string 320 321const ( 322 // ResultCount ... 323 ResultCount QueryType = "ResultCount" 324) 325 326// PossibleQueryTypeValues returns an array of possible values for the QueryType const type. 327func PossibleQueryTypeValues() []QueryType { 328 return []QueryType{ResultCount} 329} 330 331// ReceiverStatus enumerates the values for receiver status. 332type ReceiverStatus string 333 334const ( 335 // ReceiverStatusDisabled ... 336 ReceiverStatusDisabled ReceiverStatus = "Disabled" 337 // ReceiverStatusEnabled ... 338 ReceiverStatusEnabled ReceiverStatus = "Enabled" 339 // ReceiverStatusNotSpecified ... 340 ReceiverStatusNotSpecified ReceiverStatus = "NotSpecified" 341) 342 343// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. 344func PossibleReceiverStatusValues() []ReceiverStatus { 345 return []ReceiverStatus{ReceiverStatusDisabled, ReceiverStatusEnabled, ReceiverStatusNotSpecified} 346} 347 348// RecurrenceFrequency enumerates the values for recurrence frequency. 349type RecurrenceFrequency string 350 351const ( 352 // RecurrenceFrequencyDay ... 353 RecurrenceFrequencyDay RecurrenceFrequency = "Day" 354 // RecurrenceFrequencyHour ... 355 RecurrenceFrequencyHour RecurrenceFrequency = "Hour" 356 // RecurrenceFrequencyMinute ... 357 RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" 358 // RecurrenceFrequencyMonth ... 359 RecurrenceFrequencyMonth RecurrenceFrequency = "Month" 360 // RecurrenceFrequencyNone ... 361 RecurrenceFrequencyNone RecurrenceFrequency = "None" 362 // RecurrenceFrequencySecond ... 363 RecurrenceFrequencySecond RecurrenceFrequency = "Second" 364 // RecurrenceFrequencyWeek ... 365 RecurrenceFrequencyWeek RecurrenceFrequency = "Week" 366 // RecurrenceFrequencyYear ... 367 RecurrenceFrequencyYear RecurrenceFrequency = "Year" 368) 369 370// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. 371func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { 372 return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} 373} 374 375// ResultType enumerates the values for result type. 376type ResultType string 377 378const ( 379 // Data ... 380 Data ResultType = "Data" 381 // Metadata ... 382 Metadata ResultType = "Metadata" 383) 384 385// PossibleResultTypeValues returns an array of possible values for the ResultType const type. 386func PossibleResultTypeValues() []ResultType { 387 return []ResultType{Data, Metadata} 388} 389 390// ScaleDirection enumerates the values for scale direction. 391type ScaleDirection string 392 393const ( 394 // ScaleDirectionDecrease ... 395 ScaleDirectionDecrease ScaleDirection = "Decrease" 396 // ScaleDirectionIncrease ... 397 ScaleDirectionIncrease ScaleDirection = "Increase" 398 // ScaleDirectionNone ... 399 ScaleDirectionNone ScaleDirection = "None" 400) 401 402// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. 403func PossibleScaleDirectionValues() []ScaleDirection { 404 return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} 405} 406 407// ScaleType enumerates the values for scale type. 408type ScaleType string 409 410const ( 411 // ChangeCount ... 412 ChangeCount ScaleType = "ChangeCount" 413 // ExactCount ... 414 ExactCount ScaleType = "ExactCount" 415 // PercentChangeCount ... 416 PercentChangeCount ScaleType = "PercentChangeCount" 417) 418 419// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. 420func PossibleScaleTypeValues() []ScaleType { 421 return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} 422} 423 424// Sensitivity enumerates the values for sensitivity. 425type Sensitivity string 426 427const ( 428 // High ... 429 High Sensitivity = "High" 430 // Low ... 431 Low Sensitivity = "Low" 432 // Medium ... 433 Medium Sensitivity = "Medium" 434) 435 436// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. 437func PossibleSensitivityValues() []Sensitivity { 438 return []Sensitivity{High, Low, Medium} 439} 440 441// TimeAggregationOperator enumerates the values for time aggregation operator. 442type TimeAggregationOperator string 443 444const ( 445 // TimeAggregationOperatorAverage ... 446 TimeAggregationOperatorAverage TimeAggregationOperator = "Average" 447 // TimeAggregationOperatorLast ... 448 TimeAggregationOperatorLast TimeAggregationOperator = "Last" 449 // TimeAggregationOperatorMaximum ... 450 TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" 451 // TimeAggregationOperatorMinimum ... 452 TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" 453 // TimeAggregationOperatorTotal ... 454 TimeAggregationOperatorTotal TimeAggregationOperator = "Total" 455) 456 457// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. 458func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { 459 return []TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} 460} 461 462// TimeAggregationType enumerates the values for time aggregation type. 463type TimeAggregationType string 464 465const ( 466 // TimeAggregationTypeAverage ... 467 TimeAggregationTypeAverage TimeAggregationType = "Average" 468 // TimeAggregationTypeCount ... 469 TimeAggregationTypeCount TimeAggregationType = "Count" 470 // TimeAggregationTypeLast ... 471 TimeAggregationTypeLast TimeAggregationType = "Last" 472 // TimeAggregationTypeMaximum ... 473 TimeAggregationTypeMaximum TimeAggregationType = "Maximum" 474 // TimeAggregationTypeMinimum ... 475 TimeAggregationTypeMinimum TimeAggregationType = "Minimum" 476 // TimeAggregationTypeTotal ... 477 TimeAggregationTypeTotal TimeAggregationType = "Total" 478) 479 480// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. 481func PossibleTimeAggregationTypeValues() []TimeAggregationType { 482 return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} 483} 484 485// Unit enumerates the values for unit. 486type Unit string 487 488const ( 489 // UnitBytes ... 490 UnitBytes Unit = "Bytes" 491 // UnitByteSeconds ... 492 UnitByteSeconds Unit = "ByteSeconds" 493 // UnitBytesPerSecond ... 494 UnitBytesPerSecond Unit = "BytesPerSecond" 495 // UnitCount ... 496 UnitCount Unit = "Count" 497 // UnitCountPerSecond ... 498 UnitCountPerSecond Unit = "CountPerSecond" 499 // UnitMilliSeconds ... 500 UnitMilliSeconds Unit = "MilliSeconds" 501 // UnitPercent ... 502 UnitPercent Unit = "Percent" 503 // UnitSeconds ... 504 UnitSeconds Unit = "Seconds" 505 // UnitUnspecified ... 506 UnitUnspecified Unit = "Unspecified" 507) 508 509// PossibleUnitValues returns an array of possible values for the Unit const type. 510func PossibleUnitValues() []Unit { 511 return []Unit{UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCount, UnitCountPerSecond, UnitMilliSeconds, UnitPercent, UnitSeconds, UnitUnspecified} 512} 513 514// BasicAction action descriptor. 515type BasicAction interface { 516 AsAlertingAction() (*AlertingAction, bool) 517 AsAction() (*Action, bool) 518} 519 520// Action action descriptor. 521type Action struct { 522 // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction' 523 OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` 524} 525 526func unmarshalBasicAction(body []byte) (BasicAction, error) { 527 var m map[string]interface{} 528 err := json.Unmarshal(body, &m) 529 if err != nil { 530 return nil, err 531 } 532 533 switch m["odata.type"] { 534 case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction): 535 var aa AlertingAction 536 err := json.Unmarshal(body, &aa) 537 return aa, err 538 default: 539 var a Action 540 err := json.Unmarshal(body, &a) 541 return a, err 542 } 543} 544func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) { 545 var rawMessages []*json.RawMessage 546 err := json.Unmarshal(body, &rawMessages) 547 if err != nil { 548 return nil, err 549 } 550 551 aArray := make([]BasicAction, len(rawMessages)) 552 553 for index, rawMessage := range rawMessages { 554 a, err := unmarshalBasicAction(*rawMessage) 555 if err != nil { 556 return nil, err 557 } 558 aArray[index] = a 559 } 560 return aArray, nil 561} 562 563// MarshalJSON is the custom marshaler for Action. 564func (a Action) MarshalJSON() ([]byte, error) { 565 a.OdataType = OdataTypeAction 566 objectMap := make(map[string]interface{}) 567 if a.OdataType != "" { 568 objectMap["odata.type"] = a.OdataType 569 } 570 return json.Marshal(objectMap) 571} 572 573// AsAlertingAction is the BasicAction implementation for Action. 574func (a Action) AsAlertingAction() (*AlertingAction, bool) { 575 return nil, false 576} 577 578// AsAction is the BasicAction implementation for Action. 579func (a Action) AsAction() (*Action, bool) { 580 return &a, true 581} 582 583// AsBasicAction is the BasicAction implementation for Action. 584func (a Action) AsBasicAction() (BasicAction, bool) { 585 return &a, true 586} 587 588// ActionGroup an Azure action group. 589type ActionGroup struct { 590 // GroupShortName - The short name of the action group. This will be used in SMS messages. 591 GroupShortName *string `json:"groupShortName,omitempty"` 592 // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. 593 Enabled *bool `json:"enabled,omitempty"` 594 // EmailReceivers - The list of email receivers that are part of this action group. 595 EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` 596 // SmsReceivers - The list of SMS receivers that are part of this action group. 597 SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` 598 // WebhookReceivers - The list of webhook receivers that are part of this action group. 599 WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` 600 // ItsmReceivers - The list of ITSM receivers that are part of this action group. 601 ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` 602 // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. 603 AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` 604 // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. 605 AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` 606 // VoiceReceivers - The list of voice receivers that are part of this action group. 607 VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` 608 // LogicAppReceivers - The list of logic app receivers that are part of this action group. 609 LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` 610 // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. 611 AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` 612} 613 614// ActionGroupList a list of action groups. 615type ActionGroupList struct { 616 autorest.Response `json:"-"` 617 // Value - The list of action groups. 618 Value *[]ActionGroupResource `json:"value,omitempty"` 619 // NextLink - Provides the link to retrieve the next set of elements. 620 NextLink *string `json:"nextLink,omitempty"` 621} 622 623// ActionGroupPatch an Azure action group for patch operations. 624type ActionGroupPatch struct { 625 // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. 626 Enabled *bool `json:"enabled,omitempty"` 627} 628 629// ActionGroupPatchBody an action group object for the body of patch operations. 630type ActionGroupPatchBody struct { 631 // Tags - Resource tags 632 Tags map[string]*string `json:"tags"` 633 // ActionGroupPatch - The action group settings for an update operation. 634 *ActionGroupPatch `json:"properties,omitempty"` 635} 636 637// MarshalJSON is the custom marshaler for ActionGroupPatchBody. 638func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { 639 objectMap := make(map[string]interface{}) 640 if agpb.Tags != nil { 641 objectMap["tags"] = agpb.Tags 642 } 643 if agpb.ActionGroupPatch != nil { 644 objectMap["properties"] = agpb.ActionGroupPatch 645 } 646 return json.Marshal(objectMap) 647} 648 649// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. 650func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error { 651 var m map[string]*json.RawMessage 652 err := json.Unmarshal(body, &m) 653 if err != nil { 654 return err 655 } 656 for k, v := range m { 657 switch k { 658 case "tags": 659 if v != nil { 660 var tags map[string]*string 661 err = json.Unmarshal(*v, &tags) 662 if err != nil { 663 return err 664 } 665 agpb.Tags = tags 666 } 667 case "properties": 668 if v != nil { 669 var actionGroupPatch ActionGroupPatch 670 err = json.Unmarshal(*v, &actionGroupPatch) 671 if err != nil { 672 return err 673 } 674 agpb.ActionGroupPatch = &actionGroupPatch 675 } 676 } 677 } 678 679 return nil 680} 681 682// ActionGroupResource an action group resource. 683type ActionGroupResource struct { 684 autorest.Response `json:"-"` 685 // ActionGroup - The action groups properties of the resource. 686 *ActionGroup `json:"properties,omitempty"` 687 // ID - Azure resource Id 688 ID *string `json:"id,omitempty"` 689 // Name - Azure resource name 690 Name *string `json:"name,omitempty"` 691 // Type - Azure resource type 692 Type *string `json:"type,omitempty"` 693 // Location - Resource location 694 Location *string `json:"location,omitempty"` 695 // Tags - Resource tags 696 Tags map[string]*string `json:"tags"` 697} 698 699// MarshalJSON is the custom marshaler for ActionGroupResource. 700func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { 701 objectMap := make(map[string]interface{}) 702 if agr.ActionGroup != nil { 703 objectMap["properties"] = agr.ActionGroup 704 } 705 if agr.ID != nil { 706 objectMap["id"] = agr.ID 707 } 708 if agr.Name != nil { 709 objectMap["name"] = agr.Name 710 } 711 if agr.Type != nil { 712 objectMap["type"] = agr.Type 713 } 714 if agr.Location != nil { 715 objectMap["location"] = agr.Location 716 } 717 if agr.Tags != nil { 718 objectMap["tags"] = agr.Tags 719 } 720 return json.Marshal(objectMap) 721} 722 723// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. 724func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { 725 var m map[string]*json.RawMessage 726 err := json.Unmarshal(body, &m) 727 if err != nil { 728 return err 729 } 730 for k, v := range m { 731 switch k { 732 case "properties": 733 if v != nil { 734 var actionGroup ActionGroup 735 err = json.Unmarshal(*v, &actionGroup) 736 if err != nil { 737 return err 738 } 739 agr.ActionGroup = &actionGroup 740 } 741 case "id": 742 if v != nil { 743 var ID string 744 err = json.Unmarshal(*v, &ID) 745 if err != nil { 746 return err 747 } 748 agr.ID = &ID 749 } 750 case "name": 751 if v != nil { 752 var name string 753 err = json.Unmarshal(*v, &name) 754 if err != nil { 755 return err 756 } 757 agr.Name = &name 758 } 759 case "type": 760 if v != nil { 761 var typeVar string 762 err = json.Unmarshal(*v, &typeVar) 763 if err != nil { 764 return err 765 } 766 agr.Type = &typeVar 767 } 768 case "location": 769 if v != nil { 770 var location string 771 err = json.Unmarshal(*v, &location) 772 if err != nil { 773 return err 774 } 775 agr.Location = &location 776 } 777 case "tags": 778 if v != nil { 779 var tags map[string]*string 780 err = json.Unmarshal(*v, &tags) 781 if err != nil { 782 return err 783 } 784 agr.Tags = tags 785 } 786 } 787 } 788 789 return nil 790} 791 792// ActivityLogAlert an Azure activity log alert. 793type ActivityLogAlert struct { 794 // Scopes - A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. 795 Scopes *[]string `json:"scopes,omitempty"` 796 // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. 797 Enabled *bool `json:"enabled,omitempty"` 798 // Condition - The condition that will cause this alert to activate. 799 Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` 800 // Actions - The actions that will activate when the condition is met. 801 Actions *ActivityLogAlertActionList `json:"actions,omitempty"` 802 // Description - A description of this activity log alert. 803 Description *string `json:"description,omitempty"` 804} 805 806// ActivityLogAlertActionGroup a pointer to an Azure Action Group. 807type ActivityLogAlertActionGroup struct { 808 // ActionGroupID - The resourceId of the action group. This cannot be null or empty. 809 ActionGroupID *string `json:"actionGroupId,omitempty"` 810 // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. 811 WebhookProperties map[string]*string `json:"webhookProperties"` 812} 813 814// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. 815func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { 816 objectMap := make(map[string]interface{}) 817 if alaag.ActionGroupID != nil { 818 objectMap["actionGroupId"] = alaag.ActionGroupID 819 } 820 if alaag.WebhookProperties != nil { 821 objectMap["webhookProperties"] = alaag.WebhookProperties 822 } 823 return json.Marshal(objectMap) 824} 825 826// ActivityLogAlertActionList a list of activity log alert actions. 827type ActivityLogAlertActionList struct { 828 // ActionGroups - The list of activity log alerts. 829 ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` 830} 831 832// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member conditions are 833// met. 834type ActivityLogAlertAllOfCondition struct { 835 // AllOf - The list of activity log alert conditions. 836 AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` 837} 838 839// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log field and 840// value. 841type ActivityLogAlertLeafCondition struct { 842 // Field - The name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. 843 Field *string `json:"field,omitempty"` 844 // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. 845 Equals *string `json:"equals,omitempty"` 846} 847 848// ActivityLogAlertList a list of activity log alerts. 849type ActivityLogAlertList struct { 850 autorest.Response `json:"-"` 851 // Value - The list of activity log alerts. 852 Value *[]ActivityLogAlertResource `json:"value,omitempty"` 853 // NextLink - Provides the link to retrieve the next set of elements. 854 NextLink *string `json:"nextLink,omitempty"` 855} 856 857// ActivityLogAlertPatch an Azure activity log alert for patch operations. 858type ActivityLogAlertPatch struct { 859 // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. 860 Enabled *bool `json:"enabled,omitempty"` 861} 862 863// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. 864type ActivityLogAlertPatchBody struct { 865 // Tags - Resource tags 866 Tags map[string]*string `json:"tags"` 867 // ActivityLogAlertPatch - The activity log alert settings for an update operation. 868 *ActivityLogAlertPatch `json:"properties,omitempty"` 869} 870 871// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. 872func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { 873 objectMap := make(map[string]interface{}) 874 if alapb.Tags != nil { 875 objectMap["tags"] = alapb.Tags 876 } 877 if alapb.ActivityLogAlertPatch != nil { 878 objectMap["properties"] = alapb.ActivityLogAlertPatch 879 } 880 return json.Marshal(objectMap) 881} 882 883// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. 884func (alapb *ActivityLogAlertPatchBody) UnmarshalJSON(body []byte) error { 885 var m map[string]*json.RawMessage 886 err := json.Unmarshal(body, &m) 887 if err != nil { 888 return err 889 } 890 for k, v := range m { 891 switch k { 892 case "tags": 893 if v != nil { 894 var tags map[string]*string 895 err = json.Unmarshal(*v, &tags) 896 if err != nil { 897 return err 898 } 899 alapb.Tags = tags 900 } 901 case "properties": 902 if v != nil { 903 var activityLogAlertPatch ActivityLogAlertPatch 904 err = json.Unmarshal(*v, &activityLogAlertPatch) 905 if err != nil { 906 return err 907 } 908 alapb.ActivityLogAlertPatch = &activityLogAlertPatch 909 } 910 } 911 } 912 913 return nil 914} 915 916// ActivityLogAlertResource an activity log alert resource. 917type ActivityLogAlertResource struct { 918 autorest.Response `json:"-"` 919 // ActivityLogAlert - The activity log alert properties of the resource. 920 *ActivityLogAlert `json:"properties,omitempty"` 921 // ID - Azure resource Id 922 ID *string `json:"id,omitempty"` 923 // Name - Azure resource name 924 Name *string `json:"name,omitempty"` 925 // Type - Azure resource type 926 Type *string `json:"type,omitempty"` 927 // Location - Resource location 928 Location *string `json:"location,omitempty"` 929 // Tags - Resource tags 930 Tags map[string]*string `json:"tags"` 931} 932 933// MarshalJSON is the custom marshaler for ActivityLogAlertResource. 934func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { 935 objectMap := make(map[string]interface{}) 936 if alar.ActivityLogAlert != nil { 937 objectMap["properties"] = alar.ActivityLogAlert 938 } 939 if alar.ID != nil { 940 objectMap["id"] = alar.ID 941 } 942 if alar.Name != nil { 943 objectMap["name"] = alar.Name 944 } 945 if alar.Type != nil { 946 objectMap["type"] = alar.Type 947 } 948 if alar.Location != nil { 949 objectMap["location"] = alar.Location 950 } 951 if alar.Tags != nil { 952 objectMap["tags"] = alar.Tags 953 } 954 return json.Marshal(objectMap) 955} 956 957// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. 958func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { 959 var m map[string]*json.RawMessage 960 err := json.Unmarshal(body, &m) 961 if err != nil { 962 return err 963 } 964 for k, v := range m { 965 switch k { 966 case "properties": 967 if v != nil { 968 var activityLogAlert ActivityLogAlert 969 err = json.Unmarshal(*v, &activityLogAlert) 970 if err != nil { 971 return err 972 } 973 alar.ActivityLogAlert = &activityLogAlert 974 } 975 case "id": 976 if v != nil { 977 var ID string 978 err = json.Unmarshal(*v, &ID) 979 if err != nil { 980 return err 981 } 982 alar.ID = &ID 983 } 984 case "name": 985 if v != nil { 986 var name string 987 err = json.Unmarshal(*v, &name) 988 if err != nil { 989 return err 990 } 991 alar.Name = &name 992 } 993 case "type": 994 if v != nil { 995 var typeVar string 996 err = json.Unmarshal(*v, &typeVar) 997 if err != nil { 998 return err 999 } 1000 alar.Type = &typeVar 1001 } 1002 case "location": 1003 if v != nil { 1004 var location string 1005 err = json.Unmarshal(*v, &location) 1006 if err != nil { 1007 return err 1008 } 1009 alar.Location = &location 1010 } 1011 case "tags": 1012 if v != nil { 1013 var tags map[string]*string 1014 err = json.Unmarshal(*v, &tags) 1015 if err != nil { 1016 return err 1017 } 1018 alar.Tags = tags 1019 } 1020 } 1021 } 1022 1023 return nil 1024} 1025 1026// AlertingAction specifiy action need to be taken when rule type is Alert 1027type AlertingAction struct { 1028 // Severity - Severity of the alert. Possible values include: 'Zero', 'One', 'Two', 'Three', 'Four' 1029 Severity AlertSeverity `json:"severity,omitempty"` 1030 // AznsAction - Azure action group reference. 1031 AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"` 1032 // ThrottlingInMin - time (in minutes) for which Alerts should be throttled or suppressed. 1033 ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` 1034 // Trigger - The trigger condition that results in the alert rule being. 1035 Trigger *TriggerCondition `json:"trigger,omitempty"` 1036 // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction' 1037 OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` 1038} 1039 1040// MarshalJSON is the custom marshaler for AlertingAction. 1041func (aa AlertingAction) MarshalJSON() ([]byte, error) { 1042 aa.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction 1043 objectMap := make(map[string]interface{}) 1044 if aa.Severity != "" { 1045 objectMap["severity"] = aa.Severity 1046 } 1047 if aa.AznsAction != nil { 1048 objectMap["aznsAction"] = aa.AznsAction 1049 } 1050 if aa.ThrottlingInMin != nil { 1051 objectMap["throttlingInMin"] = aa.ThrottlingInMin 1052 } 1053 if aa.Trigger != nil { 1054 objectMap["trigger"] = aa.Trigger 1055 } 1056 if aa.OdataType != "" { 1057 objectMap["odata.type"] = aa.OdataType 1058 } 1059 return json.Marshal(objectMap) 1060} 1061 1062// AsAlertingAction is the BasicAction implementation for AlertingAction. 1063func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { 1064 return &aa, true 1065} 1066 1067// AsAction is the BasicAction implementation for AlertingAction. 1068func (aa AlertingAction) AsAction() (*Action, bool) { 1069 return nil, false 1070} 1071 1072// AsBasicAction is the BasicAction implementation for AlertingAction. 1073func (aa AlertingAction) AsBasicAction() (BasicAction, bool) { 1074 return &aa, true 1075} 1076 1077// AlertRule an alert rule. 1078type AlertRule struct { 1079 // Name - the name of the alert rule. 1080 Name *string `json:"name,omitempty"` 1081 // Description - the description of the alert rule that will be included in the alert email. 1082 Description *string `json:"description,omitempty"` 1083 // IsEnabled - the flag that indicates whether the alert rule is enabled. 1084 IsEnabled *bool `json:"isEnabled,omitempty"` 1085 // Condition - the condition that results in the alert rule being activated. 1086 Condition BasicRuleCondition `json:"condition,omitempty"` 1087 // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. 1088 Actions *[]BasicRuleAction `json:"actions,omitempty"` 1089 // LastUpdatedTime - Last time the rule was updated in ISO8601 format. 1090 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 1091} 1092 1093// UnmarshalJSON is the custom unmarshaler for AlertRule struct. 1094func (ar *AlertRule) UnmarshalJSON(body []byte) error { 1095 var m map[string]*json.RawMessage 1096 err := json.Unmarshal(body, &m) 1097 if err != nil { 1098 return err 1099 } 1100 for k, v := range m { 1101 switch k { 1102 case "name": 1103 if v != nil { 1104 var name string 1105 err = json.Unmarshal(*v, &name) 1106 if err != nil { 1107 return err 1108 } 1109 ar.Name = &name 1110 } 1111 case "description": 1112 if v != nil { 1113 var description string 1114 err = json.Unmarshal(*v, &description) 1115 if err != nil { 1116 return err 1117 } 1118 ar.Description = &description 1119 } 1120 case "isEnabled": 1121 if v != nil { 1122 var isEnabled bool 1123 err = json.Unmarshal(*v, &isEnabled) 1124 if err != nil { 1125 return err 1126 } 1127 ar.IsEnabled = &isEnabled 1128 } 1129 case "condition": 1130 if v != nil { 1131 condition, err := unmarshalBasicRuleCondition(*v) 1132 if err != nil { 1133 return err 1134 } 1135 ar.Condition = condition 1136 } 1137 case "actions": 1138 if v != nil { 1139 actions, err := unmarshalBasicRuleActionArray(*v) 1140 if err != nil { 1141 return err 1142 } 1143 ar.Actions = &actions 1144 } 1145 case "lastUpdatedTime": 1146 if v != nil { 1147 var lastUpdatedTime date.Time 1148 err = json.Unmarshal(*v, &lastUpdatedTime) 1149 if err != nil { 1150 return err 1151 } 1152 ar.LastUpdatedTime = &lastUpdatedTime 1153 } 1154 } 1155 } 1156 1157 return nil 1158} 1159 1160// AlertRuleResource the alert rule resource. 1161type AlertRuleResource struct { 1162 autorest.Response `json:"-"` 1163 // AlertRule - The alert rule properties of the resource. 1164 *AlertRule `json:"properties,omitempty"` 1165 // ID - Azure resource Id 1166 ID *string `json:"id,omitempty"` 1167 // Name - Azure resource name 1168 Name *string `json:"name,omitempty"` 1169 // Type - Azure resource type 1170 Type *string `json:"type,omitempty"` 1171 // Location - Resource location 1172 Location *string `json:"location,omitempty"` 1173 // Tags - Resource tags 1174 Tags map[string]*string `json:"tags"` 1175} 1176 1177// MarshalJSON is the custom marshaler for AlertRuleResource. 1178func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { 1179 objectMap := make(map[string]interface{}) 1180 if arr.AlertRule != nil { 1181 objectMap["properties"] = arr.AlertRule 1182 } 1183 if arr.ID != nil { 1184 objectMap["id"] = arr.ID 1185 } 1186 if arr.Name != nil { 1187 objectMap["name"] = arr.Name 1188 } 1189 if arr.Type != nil { 1190 objectMap["type"] = arr.Type 1191 } 1192 if arr.Location != nil { 1193 objectMap["location"] = arr.Location 1194 } 1195 if arr.Tags != nil { 1196 objectMap["tags"] = arr.Tags 1197 } 1198 return json.Marshal(objectMap) 1199} 1200 1201// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. 1202func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { 1203 var m map[string]*json.RawMessage 1204 err := json.Unmarshal(body, &m) 1205 if err != nil { 1206 return err 1207 } 1208 for k, v := range m { 1209 switch k { 1210 case "properties": 1211 if v != nil { 1212 var alertRule AlertRule 1213 err = json.Unmarshal(*v, &alertRule) 1214 if err != nil { 1215 return err 1216 } 1217 arr.AlertRule = &alertRule 1218 } 1219 case "id": 1220 if v != nil { 1221 var ID string 1222 err = json.Unmarshal(*v, &ID) 1223 if err != nil { 1224 return err 1225 } 1226 arr.ID = &ID 1227 } 1228 case "name": 1229 if v != nil { 1230 var name string 1231 err = json.Unmarshal(*v, &name) 1232 if err != nil { 1233 return err 1234 } 1235 arr.Name = &name 1236 } 1237 case "type": 1238 if v != nil { 1239 var typeVar string 1240 err = json.Unmarshal(*v, &typeVar) 1241 if err != nil { 1242 return err 1243 } 1244 arr.Type = &typeVar 1245 } 1246 case "location": 1247 if v != nil { 1248 var location string 1249 err = json.Unmarshal(*v, &location) 1250 if err != nil { 1251 return err 1252 } 1253 arr.Location = &location 1254 } 1255 case "tags": 1256 if v != nil { 1257 var tags map[string]*string 1258 err = json.Unmarshal(*v, &tags) 1259 if err != nil { 1260 return err 1261 } 1262 arr.Tags = tags 1263 } 1264 } 1265 } 1266 1267 return nil 1268} 1269 1270// AlertRuleResourceCollection represents a collection of alert rule resources. 1271type AlertRuleResourceCollection struct { 1272 autorest.Response `json:"-"` 1273 // Value - the values for the alert rule resources. 1274 Value *[]AlertRuleResource `json:"value,omitempty"` 1275} 1276 1277// AlertRuleResourcePatch the alert rule object for patch operations. 1278type AlertRuleResourcePatch struct { 1279 // Tags - Resource tags 1280 Tags map[string]*string `json:"tags"` 1281 // AlertRule - The properties of an alert rule. 1282 *AlertRule `json:"properties,omitempty"` 1283} 1284 1285// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. 1286func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { 1287 objectMap := make(map[string]interface{}) 1288 if arrp.Tags != nil { 1289 objectMap["tags"] = arrp.Tags 1290 } 1291 if arrp.AlertRule != nil { 1292 objectMap["properties"] = arrp.AlertRule 1293 } 1294 return json.Marshal(objectMap) 1295} 1296 1297// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. 1298func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error { 1299 var m map[string]*json.RawMessage 1300 err := json.Unmarshal(body, &m) 1301 if err != nil { 1302 return err 1303 } 1304 for k, v := range m { 1305 switch k { 1306 case "tags": 1307 if v != nil { 1308 var tags map[string]*string 1309 err = json.Unmarshal(*v, &tags) 1310 if err != nil { 1311 return err 1312 } 1313 arrp.Tags = tags 1314 } 1315 case "properties": 1316 if v != nil { 1317 var alertRule AlertRule 1318 err = json.Unmarshal(*v, &alertRule) 1319 if err != nil { 1320 return err 1321 } 1322 arrp.AlertRule = &alertRule 1323 } 1324 } 1325 } 1326 1327 return nil 1328} 1329 1330// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. 1331type AutomationRunbookReceiver struct { 1332 // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. 1333 AutomationAccountID *string `json:"automationAccountId,omitempty"` 1334 // RunbookName - The name for this runbook. 1335 RunbookName *string `json:"runbookName,omitempty"` 1336 // WebhookResourceID - The resource id for webhook linked to this runbook. 1337 WebhookResourceID *string `json:"webhookResourceId,omitempty"` 1338 // IsGlobalRunbook - Indicates whether this instance is global runbook. 1339 IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` 1340 // Name - Indicates name of the webhook. 1341 Name *string `json:"name,omitempty"` 1342 // ServiceURI - The URI where webhooks should be sent. 1343 ServiceURI *string `json:"serviceUri,omitempty"` 1344} 1345 1346// AutoscaleNotification autoscale notification. 1347type AutoscaleNotification struct { 1348 // Operation - the operation associated with the notification and its value must be "scale" 1349 Operation *string `json:"operation,omitempty"` 1350 // Email - the email notification. 1351 Email *EmailNotification `json:"email,omitempty"` 1352 // Webhooks - the collection of webhook notifications. 1353 Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` 1354} 1355 1356// AutoscaleProfile autoscale profile. 1357type AutoscaleProfile struct { 1358 // Name - the name of the profile. 1359 Name *string `json:"name,omitempty"` 1360 // Capacity - the number of instances that can be used during this profile. 1361 Capacity *ScaleCapacity `json:"capacity,omitempty"` 1362 // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. 1363 Rules *[]ScaleRule `json:"rules,omitempty"` 1364 // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. 1365 FixedDate *TimeWindow `json:"fixedDate,omitempty"` 1366 // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. 1367 Recurrence *Recurrence `json:"recurrence,omitempty"` 1368} 1369 1370// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a resource. 1371type AutoscaleSetting struct { 1372 // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. 1373 Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` 1374 // Notifications - the collection of notifications. 1375 Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` 1376 // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. 1377 Enabled *bool `json:"enabled,omitempty"` 1378 // Name - the name of the autoscale setting. 1379 Name *string `json:"name,omitempty"` 1380 // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. 1381 TargetResourceURI *string `json:"targetResourceUri,omitempty"` 1382} 1383 1384// AutoscaleSettingResource the autoscale setting resource. 1385type AutoscaleSettingResource struct { 1386 autorest.Response `json:"-"` 1387 // AutoscaleSetting - The autoscale setting of the resource. 1388 *AutoscaleSetting `json:"properties,omitempty"` 1389 // ID - Azure resource Id 1390 ID *string `json:"id,omitempty"` 1391 // Name - Azure resource name 1392 Name *string `json:"name,omitempty"` 1393 // Type - Azure resource type 1394 Type *string `json:"type,omitempty"` 1395 // Location - Resource location 1396 Location *string `json:"location,omitempty"` 1397 // Tags - Resource tags 1398 Tags map[string]*string `json:"tags"` 1399} 1400 1401// MarshalJSON is the custom marshaler for AutoscaleSettingResource. 1402func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { 1403 objectMap := make(map[string]interface{}) 1404 if asr.AutoscaleSetting != nil { 1405 objectMap["properties"] = asr.AutoscaleSetting 1406 } 1407 if asr.ID != nil { 1408 objectMap["id"] = asr.ID 1409 } 1410 if asr.Name != nil { 1411 objectMap["name"] = asr.Name 1412 } 1413 if asr.Type != nil { 1414 objectMap["type"] = asr.Type 1415 } 1416 if asr.Location != nil { 1417 objectMap["location"] = asr.Location 1418 } 1419 if asr.Tags != nil { 1420 objectMap["tags"] = asr.Tags 1421 } 1422 return json.Marshal(objectMap) 1423} 1424 1425// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. 1426func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { 1427 var m map[string]*json.RawMessage 1428 err := json.Unmarshal(body, &m) 1429 if err != nil { 1430 return err 1431 } 1432 for k, v := range m { 1433 switch k { 1434 case "properties": 1435 if v != nil { 1436 var autoscaleSetting AutoscaleSetting 1437 err = json.Unmarshal(*v, &autoscaleSetting) 1438 if err != nil { 1439 return err 1440 } 1441 asr.AutoscaleSetting = &autoscaleSetting 1442 } 1443 case "id": 1444 if v != nil { 1445 var ID string 1446 err = json.Unmarshal(*v, &ID) 1447 if err != nil { 1448 return err 1449 } 1450 asr.ID = &ID 1451 } 1452 case "name": 1453 if v != nil { 1454 var name string 1455 err = json.Unmarshal(*v, &name) 1456 if err != nil { 1457 return err 1458 } 1459 asr.Name = &name 1460 } 1461 case "type": 1462 if v != nil { 1463 var typeVar string 1464 err = json.Unmarshal(*v, &typeVar) 1465 if err != nil { 1466 return err 1467 } 1468 asr.Type = &typeVar 1469 } 1470 case "location": 1471 if v != nil { 1472 var location string 1473 err = json.Unmarshal(*v, &location) 1474 if err != nil { 1475 return err 1476 } 1477 asr.Location = &location 1478 } 1479 case "tags": 1480 if v != nil { 1481 var tags map[string]*string 1482 err = json.Unmarshal(*v, &tags) 1483 if err != nil { 1484 return err 1485 } 1486 asr.Tags = tags 1487 } 1488 } 1489 } 1490 1491 return nil 1492} 1493 1494// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. 1495type AutoscaleSettingResourceCollection struct { 1496 autorest.Response `json:"-"` 1497 // Value - the values for the autoscale setting resources. 1498 Value *[]AutoscaleSettingResource `json:"value,omitempty"` 1499 // NextLink - URL to get the next set of results. 1500 NextLink *string `json:"nextLink,omitempty"` 1501} 1502 1503// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of AutoscaleSettingResource 1504// values. 1505type AutoscaleSettingResourceCollectionIterator struct { 1506 i int 1507 page AutoscaleSettingResourceCollectionPage 1508} 1509 1510// Next advances to the next value. If there was an error making 1511// the request the iterator does not advance and the error is returned. 1512func (iter *AutoscaleSettingResourceCollectionIterator) Next() error { 1513 iter.i++ 1514 if iter.i < len(iter.page.Values()) { 1515 return nil 1516 } 1517 err := iter.page.Next() 1518 if err != nil { 1519 iter.i-- 1520 return err 1521 } 1522 iter.i = 0 1523 return nil 1524} 1525 1526// NotDone returns true if the enumeration should be started or is not yet complete. 1527func (iter AutoscaleSettingResourceCollectionIterator) NotDone() bool { 1528 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1529} 1530 1531// Response returns the raw server response from the last page request. 1532func (iter AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { 1533 return iter.page.Response() 1534} 1535 1536// Value returns the current value or a zero-initialized value if the 1537// iterator has advanced beyond the end of the collection. 1538func (iter AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { 1539 if !iter.page.NotDone() { 1540 return AutoscaleSettingResource{} 1541 } 1542 return iter.page.Values()[iter.i] 1543} 1544 1545// IsEmpty returns true if the ListResult contains no values. 1546func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { 1547 return asrc.Value == nil || len(*asrc.Value) == 0 1548} 1549 1550// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. 1551// It returns nil if no more results exist. 1552func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer() (*http.Request, error) { 1553 if asrc.NextLink == nil || len(to.String(asrc.NextLink)) < 1 { 1554 return nil, nil 1555 } 1556 return autorest.Prepare(&http.Request{}, 1557 autorest.AsJSON(), 1558 autorest.AsGet(), 1559 autorest.WithBaseURL(to.String(asrc.NextLink))) 1560} 1561 1562// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. 1563type AutoscaleSettingResourceCollectionPage struct { 1564 fn func(AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) 1565 asrc AutoscaleSettingResourceCollection 1566} 1567 1568// Next advances to the next page of values. If there was an error making 1569// the request the page does not advance and the error is returned. 1570func (page *AutoscaleSettingResourceCollectionPage) Next() error { 1571 next, err := page.fn(page.asrc) 1572 if err != nil { 1573 return err 1574 } 1575 page.asrc = next 1576 return nil 1577} 1578 1579// NotDone returns true if the page enumeration should be started or is not yet complete. 1580func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { 1581 return !page.asrc.IsEmpty() 1582} 1583 1584// Response returns the raw server response from the last page request. 1585func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { 1586 return page.asrc 1587} 1588 1589// Values returns the slice of values for the current page or nil if there are no values. 1590func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { 1591 if page.asrc.IsEmpty() { 1592 return nil 1593 } 1594 return *page.asrc.Value 1595} 1596 1597// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. 1598type AutoscaleSettingResourcePatch struct { 1599 // Tags - Resource tags 1600 Tags map[string]*string `json:"tags"` 1601 // AutoscaleSetting - The autoscale setting properties of the update operation. 1602 *AutoscaleSetting `json:"properties,omitempty"` 1603} 1604 1605// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. 1606func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { 1607 objectMap := make(map[string]interface{}) 1608 if asrp.Tags != nil { 1609 objectMap["tags"] = asrp.Tags 1610 } 1611 if asrp.AutoscaleSetting != nil { 1612 objectMap["properties"] = asrp.AutoscaleSetting 1613 } 1614 return json.Marshal(objectMap) 1615} 1616 1617// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. 1618func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error { 1619 var m map[string]*json.RawMessage 1620 err := json.Unmarshal(body, &m) 1621 if err != nil { 1622 return err 1623 } 1624 for k, v := range m { 1625 switch k { 1626 case "tags": 1627 if v != nil { 1628 var tags map[string]*string 1629 err = json.Unmarshal(*v, &tags) 1630 if err != nil { 1631 return err 1632 } 1633 asrp.Tags = tags 1634 } 1635 case "properties": 1636 if v != nil { 1637 var autoscaleSetting AutoscaleSetting 1638 err = json.Unmarshal(*v, &autoscaleSetting) 1639 if err != nil { 1640 return err 1641 } 1642 asrp.AutoscaleSetting = &autoscaleSetting 1643 } 1644 } 1645 } 1646 1647 return nil 1648} 1649 1650// AzNsActionGroup azure action group 1651type AzNsActionGroup struct { 1652 // ActionGroup - Azure Action Group reference. 1653 ActionGroup *[]string `json:"actionGroup,omitempty"` 1654 // EmailSubject - Custom subject override for all email ids in Azure action group 1655 EmailSubject *string `json:"emailSubject,omitempty"` 1656 // CustomWebhookPayload - Custom payload to be sent for all webook URI in Azure action group 1657 CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"` 1658} 1659 1660// AzureAppPushReceiver the Azure mobile App push notification receiver. 1661type AzureAppPushReceiver struct { 1662 // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. 1663 Name *string `json:"name,omitempty"` 1664 // EmailAddress - The email address registered for the Azure mobile app. 1665 EmailAddress *string `json:"emailAddress,omitempty"` 1666} 1667 1668// AzureFunctionReceiver an azure function receiver. 1669type AzureFunctionReceiver struct { 1670 // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. 1671 Name *string `json:"name,omitempty"` 1672 // FunctionAppResourceID - The azure resource id of the function app. 1673 FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` 1674 // FunctionName - The function name in the function app. 1675 FunctionName *string `json:"functionName,omitempty"` 1676 // HTTPTriggerURL - The http trigger url where http request sent to. 1677 HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` 1678} 1679 1680// Baseline the baseline values for a single sensitivity value. 1681type Baseline struct { 1682 // Sensitivity - the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' 1683 Sensitivity Sensitivity `json:"sensitivity,omitempty"` 1684 // LowThresholds - The low thresholds of the baseline. 1685 LowThresholds *[]float64 `json:"lowThresholds,omitempty"` 1686 // HighThresholds - The high thresholds of the baseline. 1687 HighThresholds *[]float64 `json:"highThresholds,omitempty"` 1688} 1689 1690// BaselineMetadataValue represents a baseline metadata value. 1691type BaselineMetadataValue struct { 1692 // Name - the name of the metadata. 1693 Name *LocalizableString `json:"name,omitempty"` 1694 // Value - the value of the metadata. 1695 Value *string `json:"value,omitempty"` 1696} 1697 1698// BaselineProperties the baseline properties class. 1699type BaselineProperties struct { 1700 // Timespan - The timespan for which the data was retrieved. Its value consists of two datatimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. 1701 Timespan *string `json:"timespan,omitempty"` 1702 // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. 1703 Interval *string `json:"interval,omitempty"` 1704 // Aggregation - The aggregation type of the metric. 1705 Aggregation *string `json:"aggregation,omitempty"` 1706 // Timestamps - the array of timestamps of the baselines. 1707 Timestamps *[]date.Time `json:"timestamps,omitempty"` 1708 // Baseline - the baseline values for each sensitivity. 1709 Baseline *[]Baseline `json:"baseline,omitempty"` 1710 // Metadata - the baseline metadata values. 1711 Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` 1712} 1713 1714// BaselineResponse the response to a baseline query. 1715type BaselineResponse struct { 1716 autorest.Response `json:"-"` 1717 // ID - the metric baseline Id. 1718 ID *string `json:"id,omitempty"` 1719 // Type - the resource type of the baseline resource. 1720 Type *string `json:"type,omitempty"` 1721 // Name - the name and the display name of the metric, i.e. it is localizable string. 1722 Name *LocalizableString `json:"name,omitempty"` 1723 // BaselineProperties - the properties of the baseline. 1724 *BaselineProperties `json:"properties,omitempty"` 1725} 1726 1727// MarshalJSON is the custom marshaler for BaselineResponse. 1728func (br BaselineResponse) MarshalJSON() ([]byte, error) { 1729 objectMap := make(map[string]interface{}) 1730 if br.ID != nil { 1731 objectMap["id"] = br.ID 1732 } 1733 if br.Type != nil { 1734 objectMap["type"] = br.Type 1735 } 1736 if br.Name != nil { 1737 objectMap["name"] = br.Name 1738 } 1739 if br.BaselineProperties != nil { 1740 objectMap["properties"] = br.BaselineProperties 1741 } 1742 return json.Marshal(objectMap) 1743} 1744 1745// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. 1746func (br *BaselineResponse) UnmarshalJSON(body []byte) error { 1747 var m map[string]*json.RawMessage 1748 err := json.Unmarshal(body, &m) 1749 if err != nil { 1750 return err 1751 } 1752 for k, v := range m { 1753 switch k { 1754 case "id": 1755 if v != nil { 1756 var ID string 1757 err = json.Unmarshal(*v, &ID) 1758 if err != nil { 1759 return err 1760 } 1761 br.ID = &ID 1762 } 1763 case "type": 1764 if v != nil { 1765 var typeVar string 1766 err = json.Unmarshal(*v, &typeVar) 1767 if err != nil { 1768 return err 1769 } 1770 br.Type = &typeVar 1771 } 1772 case "name": 1773 if v != nil { 1774 var name LocalizableString 1775 err = json.Unmarshal(*v, &name) 1776 if err != nil { 1777 return err 1778 } 1779 br.Name = &name 1780 } 1781 case "properties": 1782 if v != nil { 1783 var baselineProperties BaselineProperties 1784 err = json.Unmarshal(*v, &baselineProperties) 1785 if err != nil { 1786 return err 1787 } 1788 br.BaselineProperties = &baselineProperties 1789 } 1790 } 1791 } 1792 1793 return nil 1794} 1795 1796// CalculateBaselineResponse the response to a calcualte baseline call. 1797type CalculateBaselineResponse struct { 1798 autorest.Response `json:"-"` 1799 // Type - the resource type of the baseline resource. 1800 Type *string `json:"type,omitempty"` 1801 // Timestamps - the array of timestamps of the baselines. 1802 Timestamps *[]date.Time `json:"timestamps,omitempty"` 1803 // Baseline - the baseline values for each sensitivity. 1804 Baseline *[]Baseline `json:"baseline,omitempty"` 1805} 1806 1807// DiagnosticSettings the diagnostic settings. 1808type DiagnosticSettings struct { 1809 // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. 1810 StorageAccountID *string `json:"storageAccountId,omitempty"` 1811 // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. 1812 ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` 1813 // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. 1814 EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` 1815 // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. 1816 EventHubName *string `json:"eventHubName,omitempty"` 1817 // Metrics - the list of metric settings. 1818 Metrics *[]MetricSettings `json:"metrics,omitempty"` 1819 // Logs - the list of logs settings. 1820 Logs *[]LogSettings `json:"logs,omitempty"` 1821 // WorkspaceID - The workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 1822 WorkspaceID *string `json:"workspaceId,omitempty"` 1823} 1824 1825// DiagnosticSettingsCategory the diagnostic settings Category. 1826type DiagnosticSettingsCategory struct { 1827 // CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs' 1828 CategoryType CategoryType `json:"categoryType,omitempty"` 1829} 1830 1831// DiagnosticSettingsCategoryResource the diagnostic settings category resource. 1832type DiagnosticSettingsCategoryResource struct { 1833 autorest.Response `json:"-"` 1834 // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. 1835 *DiagnosticSettingsCategory `json:"properties,omitempty"` 1836 // ID - Azure resource Id 1837 ID *string `json:"id,omitempty"` 1838 // Name - Azure resource name 1839 Name *string `json:"name,omitempty"` 1840 // Type - Azure resource type 1841 Type *string `json:"type,omitempty"` 1842} 1843 1844// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. 1845func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { 1846 objectMap := make(map[string]interface{}) 1847 if dscr.DiagnosticSettingsCategory != nil { 1848 objectMap["properties"] = dscr.DiagnosticSettingsCategory 1849 } 1850 if dscr.ID != nil { 1851 objectMap["id"] = dscr.ID 1852 } 1853 if dscr.Name != nil { 1854 objectMap["name"] = dscr.Name 1855 } 1856 if dscr.Type != nil { 1857 objectMap["type"] = dscr.Type 1858 } 1859 return json.Marshal(objectMap) 1860} 1861 1862// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. 1863func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error { 1864 var m map[string]*json.RawMessage 1865 err := json.Unmarshal(body, &m) 1866 if err != nil { 1867 return err 1868 } 1869 for k, v := range m { 1870 switch k { 1871 case "properties": 1872 if v != nil { 1873 var diagnosticSettingsCategory DiagnosticSettingsCategory 1874 err = json.Unmarshal(*v, &diagnosticSettingsCategory) 1875 if err != nil { 1876 return err 1877 } 1878 dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory 1879 } 1880 case "id": 1881 if v != nil { 1882 var ID string 1883 err = json.Unmarshal(*v, &ID) 1884 if err != nil { 1885 return err 1886 } 1887 dscr.ID = &ID 1888 } 1889 case "name": 1890 if v != nil { 1891 var name string 1892 err = json.Unmarshal(*v, &name) 1893 if err != nil { 1894 return err 1895 } 1896 dscr.Name = &name 1897 } 1898 case "type": 1899 if v != nil { 1900 var typeVar string 1901 err = json.Unmarshal(*v, &typeVar) 1902 if err != nil { 1903 return err 1904 } 1905 dscr.Type = &typeVar 1906 } 1907 } 1908 } 1909 1910 return nil 1911} 1912 1913// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category resources. 1914type DiagnosticSettingsCategoryResourceCollection struct { 1915 autorest.Response `json:"-"` 1916 // Value - The collection of diagnostic settings category resources. 1917 Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` 1918} 1919 1920// DiagnosticSettingsResource the diagnostic setting resource. 1921type DiagnosticSettingsResource struct { 1922 autorest.Response `json:"-"` 1923 // DiagnosticSettings - Properties of a Diagnostic Settings Resource. 1924 *DiagnosticSettings `json:"properties,omitempty"` 1925 // ID - Azure resource Id 1926 ID *string `json:"id,omitempty"` 1927 // Name - Azure resource name 1928 Name *string `json:"name,omitempty"` 1929 // Type - Azure resource type 1930 Type *string `json:"type,omitempty"` 1931} 1932 1933// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. 1934func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { 1935 objectMap := make(map[string]interface{}) 1936 if dsr.DiagnosticSettings != nil { 1937 objectMap["properties"] = dsr.DiagnosticSettings 1938 } 1939 if dsr.ID != nil { 1940 objectMap["id"] = dsr.ID 1941 } 1942 if dsr.Name != nil { 1943 objectMap["name"] = dsr.Name 1944 } 1945 if dsr.Type != nil { 1946 objectMap["type"] = dsr.Type 1947 } 1948 return json.Marshal(objectMap) 1949} 1950 1951// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. 1952func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error { 1953 var m map[string]*json.RawMessage 1954 err := json.Unmarshal(body, &m) 1955 if err != nil { 1956 return err 1957 } 1958 for k, v := range m { 1959 switch k { 1960 case "properties": 1961 if v != nil { 1962 var diagnosticSettings DiagnosticSettings 1963 err = json.Unmarshal(*v, &diagnosticSettings) 1964 if err != nil { 1965 return err 1966 } 1967 dsr.DiagnosticSettings = &diagnosticSettings 1968 } 1969 case "id": 1970 if v != nil { 1971 var ID string 1972 err = json.Unmarshal(*v, &ID) 1973 if err != nil { 1974 return err 1975 } 1976 dsr.ID = &ID 1977 } 1978 case "name": 1979 if v != nil { 1980 var name string 1981 err = json.Unmarshal(*v, &name) 1982 if err != nil { 1983 return err 1984 } 1985 dsr.Name = &name 1986 } 1987 case "type": 1988 if v != nil { 1989 var typeVar string 1990 err = json.Unmarshal(*v, &typeVar) 1991 if err != nil { 1992 return err 1993 } 1994 dsr.Type = &typeVar 1995 } 1996 } 1997 } 1998 1999 return nil 2000} 2001 2002// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. 2003type DiagnosticSettingsResourceCollection struct { 2004 autorest.Response `json:"-"` 2005 // Value - The collection of diagnostic settings resources;. 2006 Value *[]DiagnosticSettingsResource `json:"value,omitempty"` 2007} 2008 2009// EmailNotification email notification of an autoscale event. 2010type EmailNotification struct { 2011 // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. 2012 SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` 2013 // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. 2014 SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` 2015 // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. 2016 CustomEmails *[]string `json:"customEmails,omitempty"` 2017} 2018 2019// EmailReceiver an email receiver. 2020type EmailReceiver struct { 2021 // Name - The name of the email receiver. Names must be unique across all receivers within an action group. 2022 Name *string `json:"name,omitempty"` 2023 // EmailAddress - The email address of this receiver. 2024 EmailAddress *string `json:"emailAddress,omitempty"` 2025 // Status - The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' 2026 Status ReceiverStatus `json:"status,omitempty"` 2027} 2028 2029// EnableRequest describes a receiver that should be resubscribed. 2030type EnableRequest struct { 2031 // ReceiverName - The name of the receiver to resubscribe. 2032 ReceiverName *string `json:"receiverName,omitempty"` 2033} 2034 2035// ErrorResponse describes the format of Error response. 2036type ErrorResponse struct { 2037 // Code - Error code 2038 Code *string `json:"code,omitempty"` 2039 // Message - Error message indicating why the operation failed. 2040 Message *string `json:"message,omitempty"` 2041} 2042 2043// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, 2044// Security, ServiceHealth, Alert, Recommendation, Policy. 2045type EventCategoryCollection struct { 2046 autorest.Response `json:"-"` 2047 // Value - the list that includes the Azure event categories. 2048 Value *[]LocalizableString `json:"value,omitempty"` 2049} 2050 2051// EventData the Azure event log entries are of type EventData 2052type EventData struct { 2053 // Authorization - The sender authorization information. 2054 Authorization *SenderAuthorization `json:"authorization,omitempty"` 2055 // Claims - key value pairs to identify ARM permissions. 2056 Claims map[string]*string `json:"claims"` 2057 // Caller - the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. 2058 Caller *string `json:"caller,omitempty"` 2059 // Description - the description of the event. 2060 Description *string `json:"description,omitempty"` 2061 // ID - the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. 2062 ID *string `json:"id,omitempty"` 2063 // EventDataID - the event data Id. This is a unique identifier for an event. 2064 EventDataID *string `json:"eventDataId,omitempty"` 2065 // CorrelationID - the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. 2066 CorrelationID *string `json:"correlationId,omitempty"` 2067 // EventName - the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. 2068 EventName *LocalizableString `json:"eventName,omitempty"` 2069 // Category - the event category. 2070 Category *LocalizableString `json:"category,omitempty"` 2071 // HTTPRequest - the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). 2072 HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` 2073 // Level - the event level. Possible values include: 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' 2074 Level EventLevel `json:"level,omitempty"` 2075 // ResourceGroupName - the resource group name of the impacted resource. 2076 ResourceGroupName *string `json:"resourceGroupName,omitempty"` 2077 // ResourceProviderName - the resource provider name of the impacted resource. 2078 ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` 2079 // ResourceID - the resource uri that uniquely identifies the resource that caused this event. 2080 ResourceID *string `json:"resourceId,omitempty"` 2081 // ResourceType - the resource type 2082 ResourceType *LocalizableString `json:"resourceType,omitempty"` 2083 // OperationID - It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. 2084 OperationID *string `json:"operationId,omitempty"` 2085 // OperationName - the operation name. 2086 OperationName *LocalizableString `json:"operationName,omitempty"` 2087 // Properties - the set of <Key, Value> pairs (usually a Dictionary<String, String>) that includes details about the event. 2088 Properties map[string]*string `json:"properties"` 2089 // Status - a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. 2090 Status *LocalizableString `json:"status,omitempty"` 2091 // SubStatus - the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) 2092 SubStatus *LocalizableString `json:"subStatus,omitempty"` 2093 // EventTimestamp - the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. 2094 EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` 2095 // SubmissionTimestamp - the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. 2096 SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` 2097 // SubscriptionID - the Azure subscription Id usually a GUID. 2098 SubscriptionID *string `json:"subscriptionId,omitempty"` 2099 // TenantID - the Azure tenant Id 2100 TenantID *string `json:"tenantId,omitempty"` 2101} 2102 2103// MarshalJSON is the custom marshaler for EventData. 2104func (ed EventData) MarshalJSON() ([]byte, error) { 2105 objectMap := make(map[string]interface{}) 2106 if ed.Authorization != nil { 2107 objectMap["authorization"] = ed.Authorization 2108 } 2109 if ed.Claims != nil { 2110 objectMap["claims"] = ed.Claims 2111 } 2112 if ed.Caller != nil { 2113 objectMap["caller"] = ed.Caller 2114 } 2115 if ed.Description != nil { 2116 objectMap["description"] = ed.Description 2117 } 2118 if ed.ID != nil { 2119 objectMap["id"] = ed.ID 2120 } 2121 if ed.EventDataID != nil { 2122 objectMap["eventDataId"] = ed.EventDataID 2123 } 2124 if ed.CorrelationID != nil { 2125 objectMap["correlationId"] = ed.CorrelationID 2126 } 2127 if ed.EventName != nil { 2128 objectMap["eventName"] = ed.EventName 2129 } 2130 if ed.Category != nil { 2131 objectMap["category"] = ed.Category 2132 } 2133 if ed.HTTPRequest != nil { 2134 objectMap["httpRequest"] = ed.HTTPRequest 2135 } 2136 if ed.Level != "" { 2137 objectMap["level"] = ed.Level 2138 } 2139 if ed.ResourceGroupName != nil { 2140 objectMap["resourceGroupName"] = ed.ResourceGroupName 2141 } 2142 if ed.ResourceProviderName != nil { 2143 objectMap["resourceProviderName"] = ed.ResourceProviderName 2144 } 2145 if ed.ResourceID != nil { 2146 objectMap["resourceId"] = ed.ResourceID 2147 } 2148 if ed.ResourceType != nil { 2149 objectMap["resourceType"] = ed.ResourceType 2150 } 2151 if ed.OperationID != nil { 2152 objectMap["operationId"] = ed.OperationID 2153 } 2154 if ed.OperationName != nil { 2155 objectMap["operationName"] = ed.OperationName 2156 } 2157 if ed.Properties != nil { 2158 objectMap["properties"] = ed.Properties 2159 } 2160 if ed.Status != nil { 2161 objectMap["status"] = ed.Status 2162 } 2163 if ed.SubStatus != nil { 2164 objectMap["subStatus"] = ed.SubStatus 2165 } 2166 if ed.EventTimestamp != nil { 2167 objectMap["eventTimestamp"] = ed.EventTimestamp 2168 } 2169 if ed.SubmissionTimestamp != nil { 2170 objectMap["submissionTimestamp"] = ed.SubmissionTimestamp 2171 } 2172 if ed.SubscriptionID != nil { 2173 objectMap["subscriptionId"] = ed.SubscriptionID 2174 } 2175 if ed.TenantID != nil { 2176 objectMap["tenantId"] = ed.TenantID 2177 } 2178 return json.Marshal(objectMap) 2179} 2180 2181// EventDataCollection represents collection of events. 2182type EventDataCollection struct { 2183 autorest.Response `json:"-"` 2184 // Value - this list that includes the Azure audit logs. 2185 Value *[]EventData `json:"value,omitempty"` 2186 // NextLink - Provides the link to retrieve the next set of events. 2187 NextLink *string `json:"nextLink,omitempty"` 2188} 2189 2190// EventDataCollectionIterator provides access to a complete listing of EventData values. 2191type EventDataCollectionIterator struct { 2192 i int 2193 page EventDataCollectionPage 2194} 2195 2196// Next advances to the next value. If there was an error making 2197// the request the iterator does not advance and the error is returned. 2198func (iter *EventDataCollectionIterator) Next() error { 2199 iter.i++ 2200 if iter.i < len(iter.page.Values()) { 2201 return nil 2202 } 2203 err := iter.page.Next() 2204 if err != nil { 2205 iter.i-- 2206 return err 2207 } 2208 iter.i = 0 2209 return nil 2210} 2211 2212// NotDone returns true if the enumeration should be started or is not yet complete. 2213func (iter EventDataCollectionIterator) NotDone() bool { 2214 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2215} 2216 2217// Response returns the raw server response from the last page request. 2218func (iter EventDataCollectionIterator) Response() EventDataCollection { 2219 return iter.page.Response() 2220} 2221 2222// Value returns the current value or a zero-initialized value if the 2223// iterator has advanced beyond the end of the collection. 2224func (iter EventDataCollectionIterator) Value() EventData { 2225 if !iter.page.NotDone() { 2226 return EventData{} 2227 } 2228 return iter.page.Values()[iter.i] 2229} 2230 2231// IsEmpty returns true if the ListResult contains no values. 2232func (edc EventDataCollection) IsEmpty() bool { 2233 return edc.Value == nil || len(*edc.Value) == 0 2234} 2235 2236// eventDataCollectionPreparer prepares a request to retrieve the next set of results. 2237// It returns nil if no more results exist. 2238func (edc EventDataCollection) eventDataCollectionPreparer() (*http.Request, error) { 2239 if edc.NextLink == nil || len(to.String(edc.NextLink)) < 1 { 2240 return nil, nil 2241 } 2242 return autorest.Prepare(&http.Request{}, 2243 autorest.AsJSON(), 2244 autorest.AsGet(), 2245 autorest.WithBaseURL(to.String(edc.NextLink))) 2246} 2247 2248// EventDataCollectionPage contains a page of EventData values. 2249type EventDataCollectionPage struct { 2250 fn func(EventDataCollection) (EventDataCollection, error) 2251 edc EventDataCollection 2252} 2253 2254// Next advances to the next page of values. If there was an error making 2255// the request the page does not advance and the error is returned. 2256func (page *EventDataCollectionPage) Next() error { 2257 next, err := page.fn(page.edc) 2258 if err != nil { 2259 return err 2260 } 2261 page.edc = next 2262 return nil 2263} 2264 2265// NotDone returns true if the page enumeration should be started or is not yet complete. 2266func (page EventDataCollectionPage) NotDone() bool { 2267 return !page.edc.IsEmpty() 2268} 2269 2270// Response returns the raw server response from the last page request. 2271func (page EventDataCollectionPage) Response() EventDataCollection { 2272 return page.edc 2273} 2274 2275// Values returns the slice of values for the current page or nil if there are no values. 2276func (page EventDataCollectionPage) Values() []EventData { 2277 if page.edc.IsEmpty() { 2278 return nil 2279 } 2280 return *page.edc.Value 2281} 2282 2283// HTTPRequestInfo the Http request info. 2284type HTTPRequestInfo struct { 2285 // ClientRequestID - the client request id. 2286 ClientRequestID *string `json:"clientRequestId,omitempty"` 2287 // ClientIPAddress - the client Ip Address 2288 ClientIPAddress *string `json:"clientIpAddress,omitempty"` 2289 // Method - the Http request method. 2290 Method *string `json:"method,omitempty"` 2291 // URI - the Uri. 2292 URI *string `json:"uri,omitempty"` 2293} 2294 2295// Incident an alert incident indicates the activation status of an alert rule. 2296type Incident struct { 2297 autorest.Response `json:"-"` 2298 // Name - Incident name. 2299 Name *string `json:"name,omitempty"` 2300 // RuleName - Rule name that is associated with the incident. 2301 RuleName *string `json:"ruleName,omitempty"` 2302 // IsActive - A boolean to indicate whether the incident is active or resolved. 2303 IsActive *bool `json:"isActive,omitempty"` 2304 // ActivatedTime - The time at which the incident was activated in ISO8601 format. 2305 ActivatedTime *date.Time `json:"activatedTime,omitempty"` 2306 // ResolvedTime - The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. 2307 ResolvedTime *date.Time `json:"resolvedTime,omitempty"` 2308} 2309 2310// IncidentListResult the List incidents operation response. 2311type IncidentListResult struct { 2312 autorest.Response `json:"-"` 2313 // Value - the incident collection. 2314 Value *[]Incident `json:"value,omitempty"` 2315} 2316 2317// ItsmReceiver an Itsm receiver. 2318type ItsmReceiver struct { 2319 // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. 2320 Name *string `json:"name,omitempty"` 2321 // WorkspaceID - OMS LA instance identifier. 2322 WorkspaceID *string `json:"workspaceId,omitempty"` 2323 // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. 2324 ConnectionID *string `json:"connectionId,omitempty"` 2325 // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. 2326 TicketConfiguration *string `json:"ticketConfiguration,omitempty"` 2327 // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' 2328 Region *string `json:"region,omitempty"` 2329} 2330 2331// LocalizableString the localizable string class. 2332type LocalizableString struct { 2333 // Value - the invariant value. 2334 Value *string `json:"value,omitempty"` 2335 // LocalizedValue - the locale specific value. 2336 LocalizedValue *string `json:"localizedValue,omitempty"` 2337} 2338 2339// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. 2340type LocationThresholdRuleCondition struct { 2341 // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. 2342 WindowSize *string `json:"windowSize,omitempty"` 2343 // FailedLocationCount - the number of locations that must fail to activate the alert. 2344 FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` 2345 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 2346 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 2347 // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 2348 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 2349} 2350 2351// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. 2352func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { 2353 ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition 2354 objectMap := make(map[string]interface{}) 2355 if ltrc.WindowSize != nil { 2356 objectMap["windowSize"] = ltrc.WindowSize 2357 } 2358 if ltrc.FailedLocationCount != nil { 2359 objectMap["failedLocationCount"] = ltrc.FailedLocationCount 2360 } 2361 objectMap["dataSource"] = ltrc.DataSource 2362 if ltrc.OdataType != "" { 2363 objectMap["odata.type"] = ltrc.OdataType 2364 } 2365 return json.Marshal(objectMap) 2366} 2367 2368// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 2369func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 2370 return nil, false 2371} 2372 2373// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 2374func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 2375 return <rc, true 2376} 2377 2378// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 2379func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 2380 return nil, false 2381} 2382 2383// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 2384func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { 2385 return nil, false 2386} 2387 2388// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 2389func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 2390 return <rc, true 2391} 2392 2393// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. 2394func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error { 2395 var m map[string]*json.RawMessage 2396 err := json.Unmarshal(body, &m) 2397 if err != nil { 2398 return err 2399 } 2400 for k, v := range m { 2401 switch k { 2402 case "windowSize": 2403 if v != nil { 2404 var windowSize string 2405 err = json.Unmarshal(*v, &windowSize) 2406 if err != nil { 2407 return err 2408 } 2409 ltrc.WindowSize = &windowSize 2410 } 2411 case "failedLocationCount": 2412 if v != nil { 2413 var failedLocationCount int32 2414 err = json.Unmarshal(*v, &failedLocationCount) 2415 if err != nil { 2416 return err 2417 } 2418 ltrc.FailedLocationCount = &failedLocationCount 2419 } 2420 case "dataSource": 2421 if v != nil { 2422 dataSource, err := unmarshalBasicRuleDataSource(*v) 2423 if err != nil { 2424 return err 2425 } 2426 ltrc.DataSource = dataSource 2427 } 2428 case "odata.type": 2429 if v != nil { 2430 var odataType OdataTypeBasicRuleCondition 2431 err = json.Unmarshal(*v, &odataType) 2432 if err != nil { 2433 return err 2434 } 2435 ltrc.OdataType = odataType 2436 } 2437 } 2438 } 2439 2440 return nil 2441} 2442 2443// LogicAppReceiver a logic app receiver. 2444type LogicAppReceiver struct { 2445 // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. 2446 Name *string `json:"name,omitempty"` 2447 // ResourceID - The azure resource id of the logic app receiver. 2448 ResourceID *string `json:"resourceId,omitempty"` 2449 // CallbackURL - The callback url where http request sent to. 2450 CallbackURL *string `json:"callbackUrl,omitempty"` 2451} 2452 2453// LogMetricTrigger a log metrics trigger descriptor. 2454type LogMetricTrigger struct { 2455 // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' 2456 ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` 2457 // Threshold - The threshold of the metric trigger. 2458 Threshold *float64 `json:"threshold,omitempty"` 2459 // MetricTriggerType - Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'MetricTriggerTypeConsecutive', 'MetricTriggerTypeTotal' 2460 MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"` 2461 // MetricColumn - Evaluation of metric on a particular column 2462 MetricColumn *string `json:"metricColumn,omitempty"` 2463} 2464 2465// LogProfileCollection represents a collection of log profiles. 2466type LogProfileCollection struct { 2467 autorest.Response `json:"-"` 2468 // Value - the values of the log profiles. 2469 Value *[]LogProfileResource `json:"value,omitempty"` 2470} 2471 2472// LogProfileProperties the log profile properties. 2473type LogProfileProperties struct { 2474 // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. 2475 StorageAccountID *string `json:"storageAccountId,omitempty"` 2476 // ServiceBusRuleID - The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. 2477 ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` 2478 // Locations - List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. 2479 Locations *[]string `json:"locations,omitempty"` 2480 // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' 2481 Categories *[]string `json:"categories,omitempty"` 2482 // RetentionPolicy - the retention policy for the events in the log. 2483 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 2484} 2485 2486// LogProfileResource the log profile resource. 2487type LogProfileResource struct { 2488 autorest.Response `json:"-"` 2489 // LogProfileProperties - The log profile properties of the resource. 2490 *LogProfileProperties `json:"properties,omitempty"` 2491 // ID - Azure resource Id 2492 ID *string `json:"id,omitempty"` 2493 // Name - Azure resource name 2494 Name *string `json:"name,omitempty"` 2495 // Type - Azure resource type 2496 Type *string `json:"type,omitempty"` 2497 // Location - Resource location 2498 Location *string `json:"location,omitempty"` 2499 // Tags - Resource tags 2500 Tags map[string]*string `json:"tags"` 2501} 2502 2503// MarshalJSON is the custom marshaler for LogProfileResource. 2504func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { 2505 objectMap := make(map[string]interface{}) 2506 if lpr.LogProfileProperties != nil { 2507 objectMap["properties"] = lpr.LogProfileProperties 2508 } 2509 if lpr.ID != nil { 2510 objectMap["id"] = lpr.ID 2511 } 2512 if lpr.Name != nil { 2513 objectMap["name"] = lpr.Name 2514 } 2515 if lpr.Type != nil { 2516 objectMap["type"] = lpr.Type 2517 } 2518 if lpr.Location != nil { 2519 objectMap["location"] = lpr.Location 2520 } 2521 if lpr.Tags != nil { 2522 objectMap["tags"] = lpr.Tags 2523 } 2524 return json.Marshal(objectMap) 2525} 2526 2527// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. 2528func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { 2529 var m map[string]*json.RawMessage 2530 err := json.Unmarshal(body, &m) 2531 if err != nil { 2532 return err 2533 } 2534 for k, v := range m { 2535 switch k { 2536 case "properties": 2537 if v != nil { 2538 var logProfileProperties LogProfileProperties 2539 err = json.Unmarshal(*v, &logProfileProperties) 2540 if err != nil { 2541 return err 2542 } 2543 lpr.LogProfileProperties = &logProfileProperties 2544 } 2545 case "id": 2546 if v != nil { 2547 var ID string 2548 err = json.Unmarshal(*v, &ID) 2549 if err != nil { 2550 return err 2551 } 2552 lpr.ID = &ID 2553 } 2554 case "name": 2555 if v != nil { 2556 var name string 2557 err = json.Unmarshal(*v, &name) 2558 if err != nil { 2559 return err 2560 } 2561 lpr.Name = &name 2562 } 2563 case "type": 2564 if v != nil { 2565 var typeVar string 2566 err = json.Unmarshal(*v, &typeVar) 2567 if err != nil { 2568 return err 2569 } 2570 lpr.Type = &typeVar 2571 } 2572 case "location": 2573 if v != nil { 2574 var location string 2575 err = json.Unmarshal(*v, &location) 2576 if err != nil { 2577 return err 2578 } 2579 lpr.Location = &location 2580 } 2581 case "tags": 2582 if v != nil { 2583 var tags map[string]*string 2584 err = json.Unmarshal(*v, &tags) 2585 if err != nil { 2586 return err 2587 } 2588 lpr.Tags = tags 2589 } 2590 } 2591 } 2592 2593 return nil 2594} 2595 2596// LogProfileResourcePatch the log profile resource for patch operations. 2597type LogProfileResourcePatch struct { 2598 // Tags - Resource tags 2599 Tags map[string]*string `json:"tags"` 2600 // LogProfileProperties - The log profile properties for an update operation. 2601 *LogProfileProperties `json:"properties,omitempty"` 2602} 2603 2604// MarshalJSON is the custom marshaler for LogProfileResourcePatch. 2605func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { 2606 objectMap := make(map[string]interface{}) 2607 if lprp.Tags != nil { 2608 objectMap["tags"] = lprp.Tags 2609 } 2610 if lprp.LogProfileProperties != nil { 2611 objectMap["properties"] = lprp.LogProfileProperties 2612 } 2613 return json.Marshal(objectMap) 2614} 2615 2616// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. 2617func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { 2618 var m map[string]*json.RawMessage 2619 err := json.Unmarshal(body, &m) 2620 if err != nil { 2621 return err 2622 } 2623 for k, v := range m { 2624 switch k { 2625 case "tags": 2626 if v != nil { 2627 var tags map[string]*string 2628 err = json.Unmarshal(*v, &tags) 2629 if err != nil { 2630 return err 2631 } 2632 lprp.Tags = tags 2633 } 2634 case "properties": 2635 if v != nil { 2636 var logProfileProperties LogProfileProperties 2637 err = json.Unmarshal(*v, &logProfileProperties) 2638 if err != nil { 2639 return err 2640 } 2641 lprp.LogProfileProperties = &logProfileProperties 2642 } 2643 } 2644 } 2645 2646 return nil 2647} 2648 2649// LogSearchRule log Search Rule Definition 2650type LogSearchRule struct { 2651 // Description - The description of the Log Search rule. 2652 Description *string `json:"description,omitempty"` 2653 // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' 2654 Enabled Enabled `json:"enabled,omitempty"` 2655 // LastUpdatedTime - Last time the rule was updated in IS08601 format. 2656 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 2657 // ProvisioningState - Provisioning state of the scheduledquery rule. Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' 2658 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2659 // Source - Data Source against which rule will Query Data 2660 Source *Source `json:"source,omitempty"` 2661 // Schedule - Schedule (Frequnecy, Time Window) for rule. 2662 Schedule *Schedule `json:"schedule,omitempty"` 2663 // Action - Action needs to be taken on rule execution. 2664 Action BasicAction `json:"action,omitempty"` 2665} 2666 2667// UnmarshalJSON is the custom unmarshaler for LogSearchRule struct. 2668func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { 2669 var m map[string]*json.RawMessage 2670 err := json.Unmarshal(body, &m) 2671 if err != nil { 2672 return err 2673 } 2674 for k, v := range m { 2675 switch k { 2676 case "description": 2677 if v != nil { 2678 var description string 2679 err = json.Unmarshal(*v, &description) 2680 if err != nil { 2681 return err 2682 } 2683 lsr.Description = &description 2684 } 2685 case "enabled": 2686 if v != nil { 2687 var enabled Enabled 2688 err = json.Unmarshal(*v, &enabled) 2689 if err != nil { 2690 return err 2691 } 2692 lsr.Enabled = enabled 2693 } 2694 case "lastUpdatedTime": 2695 if v != nil { 2696 var lastUpdatedTime date.Time 2697 err = json.Unmarshal(*v, &lastUpdatedTime) 2698 if err != nil { 2699 return err 2700 } 2701 lsr.LastUpdatedTime = &lastUpdatedTime 2702 } 2703 case "provisioningState": 2704 if v != nil { 2705 var provisioningState ProvisioningState 2706 err = json.Unmarshal(*v, &provisioningState) 2707 if err != nil { 2708 return err 2709 } 2710 lsr.ProvisioningState = provisioningState 2711 } 2712 case "source": 2713 if v != nil { 2714 var source Source 2715 err = json.Unmarshal(*v, &source) 2716 if err != nil { 2717 return err 2718 } 2719 lsr.Source = &source 2720 } 2721 case "schedule": 2722 if v != nil { 2723 var schedule Schedule 2724 err = json.Unmarshal(*v, &schedule) 2725 if err != nil { 2726 return err 2727 } 2728 lsr.Schedule = &schedule 2729 } 2730 case "action": 2731 if v != nil { 2732 action, err := unmarshalBasicAction(*v) 2733 if err != nil { 2734 return err 2735 } 2736 lsr.Action = action 2737 } 2738 } 2739 } 2740 2741 return nil 2742} 2743 2744// LogSearchRulePatch log Search Rule Definition for Patching 2745type LogSearchRulePatch struct { 2746 // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' 2747 Enabled Enabled `json:"enabled,omitempty"` 2748} 2749 2750// LogSearchRuleResource the Log Search Rule resource. 2751type LogSearchRuleResource struct { 2752 autorest.Response `json:"-"` 2753 // LogSearchRule - The rule properties of the resource. 2754 *LogSearchRule `json:"properties,omitempty"` 2755 // ID - Azure resource Id 2756 ID *string `json:"id,omitempty"` 2757 // Name - Azure resource name 2758 Name *string `json:"name,omitempty"` 2759 // Type - Azure resource type 2760 Type *string `json:"type,omitempty"` 2761 // Location - Resource location 2762 Location *string `json:"location,omitempty"` 2763 // Tags - Resource tags 2764 Tags map[string]*string `json:"tags"` 2765} 2766 2767// MarshalJSON is the custom marshaler for LogSearchRuleResource. 2768func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) { 2769 objectMap := make(map[string]interface{}) 2770 if lsrr.LogSearchRule != nil { 2771 objectMap["properties"] = lsrr.LogSearchRule 2772 } 2773 if lsrr.ID != nil { 2774 objectMap["id"] = lsrr.ID 2775 } 2776 if lsrr.Name != nil { 2777 objectMap["name"] = lsrr.Name 2778 } 2779 if lsrr.Type != nil { 2780 objectMap["type"] = lsrr.Type 2781 } 2782 if lsrr.Location != nil { 2783 objectMap["location"] = lsrr.Location 2784 } 2785 if lsrr.Tags != nil { 2786 objectMap["tags"] = lsrr.Tags 2787 } 2788 return json.Marshal(objectMap) 2789} 2790 2791// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResource struct. 2792func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error { 2793 var m map[string]*json.RawMessage 2794 err := json.Unmarshal(body, &m) 2795 if err != nil { 2796 return err 2797 } 2798 for k, v := range m { 2799 switch k { 2800 case "properties": 2801 if v != nil { 2802 var logSearchRule LogSearchRule 2803 err = json.Unmarshal(*v, &logSearchRule) 2804 if err != nil { 2805 return err 2806 } 2807 lsrr.LogSearchRule = &logSearchRule 2808 } 2809 case "id": 2810 if v != nil { 2811 var ID string 2812 err = json.Unmarshal(*v, &ID) 2813 if err != nil { 2814 return err 2815 } 2816 lsrr.ID = &ID 2817 } 2818 case "name": 2819 if v != nil { 2820 var name string 2821 err = json.Unmarshal(*v, &name) 2822 if err != nil { 2823 return err 2824 } 2825 lsrr.Name = &name 2826 } 2827 case "type": 2828 if v != nil { 2829 var typeVar string 2830 err = json.Unmarshal(*v, &typeVar) 2831 if err != nil { 2832 return err 2833 } 2834 lsrr.Type = &typeVar 2835 } 2836 case "location": 2837 if v != nil { 2838 var location string 2839 err = json.Unmarshal(*v, &location) 2840 if err != nil { 2841 return err 2842 } 2843 lsrr.Location = &location 2844 } 2845 case "tags": 2846 if v != nil { 2847 var tags map[string]*string 2848 err = json.Unmarshal(*v, &tags) 2849 if err != nil { 2850 return err 2851 } 2852 lsrr.Tags = tags 2853 } 2854 } 2855 } 2856 2857 return nil 2858} 2859 2860// LogSearchRuleResourceCollection represents a collection of Log Search rule resources. 2861type LogSearchRuleResourceCollection struct { 2862 autorest.Response `json:"-"` 2863 // Value - The values for the Log Search Rule resources. 2864 Value *[]LogSearchRuleResource `json:"value,omitempty"` 2865} 2866 2867// LogSearchRuleResourcePatch the log search rule resource for patch operations. 2868type LogSearchRuleResourcePatch struct { 2869 // Tags - Resource tags 2870 Tags map[string]*string `json:"tags"` 2871 // LogSearchRulePatch - The log search rule properties of the resource. 2872 *LogSearchRulePatch `json:"properties,omitempty"` 2873} 2874 2875// MarshalJSON is the custom marshaler for LogSearchRuleResourcePatch. 2876func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) { 2877 objectMap := make(map[string]interface{}) 2878 if lsrrp.Tags != nil { 2879 objectMap["tags"] = lsrrp.Tags 2880 } 2881 if lsrrp.LogSearchRulePatch != nil { 2882 objectMap["properties"] = lsrrp.LogSearchRulePatch 2883 } 2884 return json.Marshal(objectMap) 2885} 2886 2887// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResourcePatch struct. 2888func (lsrrp *LogSearchRuleResourcePatch) UnmarshalJSON(body []byte) error { 2889 var m map[string]*json.RawMessage 2890 err := json.Unmarshal(body, &m) 2891 if err != nil { 2892 return err 2893 } 2894 for k, v := range m { 2895 switch k { 2896 case "tags": 2897 if v != nil { 2898 var tags map[string]*string 2899 err = json.Unmarshal(*v, &tags) 2900 if err != nil { 2901 return err 2902 } 2903 lsrrp.Tags = tags 2904 } 2905 case "properties": 2906 if v != nil { 2907 var logSearchRulePatch LogSearchRulePatch 2908 err = json.Unmarshal(*v, &logSearchRulePatch) 2909 if err != nil { 2910 return err 2911 } 2912 lsrrp.LogSearchRulePatch = &logSearchRulePatch 2913 } 2914 } 2915 } 2916 2917 return nil 2918} 2919 2920// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. 2921type LogSettings struct { 2922 // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. 2923 Category *string `json:"category,omitempty"` 2924 // Enabled - a value indicating whether this log is enabled. 2925 Enabled *bool `json:"enabled,omitempty"` 2926 // RetentionPolicy - the retention policy for this log. 2927 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 2928} 2929 2930// ManagementEventAggregationCondition how the data that is collected should be combined over time. 2931type ManagementEventAggregationCondition struct { 2932 // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' 2933 Operator ConditionOperator `json:"operator,omitempty"` 2934 // Threshold - The threshold value that activates the alert. 2935 Threshold *float64 `json:"threshold,omitempty"` 2936 // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. 2937 WindowSize *string `json:"windowSize,omitempty"` 2938} 2939 2940// ManagementEventRuleCondition a management event rule condition. 2941type ManagementEventRuleCondition struct { 2942 // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. 2943 Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` 2944 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 2945 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 2946 // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 2947 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 2948} 2949 2950// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. 2951func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { 2952 merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition 2953 objectMap := make(map[string]interface{}) 2954 if merc.Aggregation != nil { 2955 objectMap["aggregation"] = merc.Aggregation 2956 } 2957 objectMap["dataSource"] = merc.DataSource 2958 if merc.OdataType != "" { 2959 objectMap["odata.type"] = merc.OdataType 2960 } 2961 return json.Marshal(objectMap) 2962} 2963 2964// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 2965func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 2966 return nil, false 2967} 2968 2969// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 2970func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 2971 return nil, false 2972} 2973 2974// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 2975func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 2976 return &merc, true 2977} 2978 2979// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 2980func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { 2981 return nil, false 2982} 2983 2984// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 2985func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 2986 return &merc, true 2987} 2988 2989// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. 2990func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error { 2991 var m map[string]*json.RawMessage 2992 err := json.Unmarshal(body, &m) 2993 if err != nil { 2994 return err 2995 } 2996 for k, v := range m { 2997 switch k { 2998 case "aggregation": 2999 if v != nil { 3000 var aggregation ManagementEventAggregationCondition 3001 err = json.Unmarshal(*v, &aggregation) 3002 if err != nil { 3003 return err 3004 } 3005 merc.Aggregation = &aggregation 3006 } 3007 case "dataSource": 3008 if v != nil { 3009 dataSource, err := unmarshalBasicRuleDataSource(*v) 3010 if err != nil { 3011 return err 3012 } 3013 merc.DataSource = dataSource 3014 } 3015 case "odata.type": 3016 if v != nil { 3017 var odataType OdataTypeBasicRuleCondition 3018 err = json.Unmarshal(*v, &odataType) 3019 if err != nil { 3020 return err 3021 } 3022 merc.OdataType = odataType 3023 } 3024 } 3025 } 3026 3027 return nil 3028} 3029 3030// MetadataValue represents a metric metadata value. 3031type MetadataValue struct { 3032 // Name - the name of the metadata. 3033 Name *LocalizableString `json:"name,omitempty"` 3034 // Value - the value of the metadata. 3035 Value *string `json:"value,omitempty"` 3036} 3037 3038// Metric the result data of a query. 3039type Metric struct { 3040 // ID - the metric Id. 3041 ID *string `json:"id,omitempty"` 3042 // Type - the resource type of the metric resource. 3043 Type *string `json:"type,omitempty"` 3044 // Name - the name and the display name of the metric, i.e. it is localizable string. 3045 Name *LocalizableString `json:"name,omitempty"` 3046 // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified' 3047 Unit Unit `json:"unit,omitempty"` 3048 // Timeseries - the time series returned when a data query is performed. 3049 Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` 3050} 3051 3052// MetricAlertAction an alert action. 3053type MetricAlertAction struct { 3054 // ActionGroupID - the id of the action group to use. 3055 ActionGroupID *string `json:"actionGroupId,omitempty"` 3056 // WebhookProperties - The properties of a webhook object. 3057 WebhookProperties map[string]*string `json:"webhookProperties"` 3058} 3059 3060// MarshalJSON is the custom marshaler for MetricAlertAction. 3061func (maa MetricAlertAction) MarshalJSON() ([]byte, error) { 3062 objectMap := make(map[string]interface{}) 3063 if maa.ActionGroupID != nil { 3064 objectMap["actionGroupId"] = maa.ActionGroupID 3065 } 3066 if maa.WebhookProperties != nil { 3067 objectMap["webhookProperties"] = maa.WebhookProperties 3068 } 3069 return json.Marshal(objectMap) 3070} 3071 3072// BasicMetricAlertCriteria the rule criteria that defines the conditions of the alert rule. 3073type BasicMetricAlertCriteria interface { 3074 AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) 3075 AsMetricAlertCriteria() (*MetricAlertCriteria, bool) 3076} 3077 3078// MetricAlertCriteria the rule criteria that defines the conditions of the alert rule. 3079type MetricAlertCriteria struct { 3080 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 3081 AdditionalProperties map[string]interface{} `json:""` 3082 // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria' 3083 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` 3084} 3085 3086func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) { 3087 var m map[string]interface{} 3088 err := json.Unmarshal(body, &m) 3089 if err != nil { 3090 return nil, err 3091 } 3092 3093 switch m["odata.type"] { 3094 case string(OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): 3095 var masrmmc MetricAlertSingleResourceMultipleMetricCriteria 3096 err := json.Unmarshal(body, &masrmmc) 3097 return masrmmc, err 3098 default: 3099 var mac MetricAlertCriteria 3100 err := json.Unmarshal(body, &mac) 3101 return mac, err 3102 } 3103} 3104func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) { 3105 var rawMessages []*json.RawMessage 3106 err := json.Unmarshal(body, &rawMessages) 3107 if err != nil { 3108 return nil, err 3109 } 3110 3111 macArray := make([]BasicMetricAlertCriteria, len(rawMessages)) 3112 3113 for index, rawMessage := range rawMessages { 3114 mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage) 3115 if err != nil { 3116 return nil, err 3117 } 3118 macArray[index] = mac 3119 } 3120 return macArray, nil 3121} 3122 3123// MarshalJSON is the custom marshaler for MetricAlertCriteria. 3124func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) { 3125 mac.OdataType = OdataTypeMetricAlertCriteria 3126 objectMap := make(map[string]interface{}) 3127 if mac.OdataType != "" { 3128 objectMap["odata.type"] = mac.OdataType 3129 } 3130 for k, v := range mac.AdditionalProperties { 3131 objectMap[k] = v 3132 } 3133 return json.Marshal(objectMap) 3134} 3135 3136// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. 3137func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { 3138 return nil, false 3139} 3140 3141// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. 3142func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { 3143 return &mac, true 3144} 3145 3146// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. 3147func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { 3148 return &mac, true 3149} 3150 3151// UnmarshalJSON is the custom unmarshaler for MetricAlertCriteria struct. 3152func (mac *MetricAlertCriteria) UnmarshalJSON(body []byte) error { 3153 var m map[string]*json.RawMessage 3154 err := json.Unmarshal(body, &m) 3155 if err != nil { 3156 return err 3157 } 3158 for k, v := range m { 3159 switch k { 3160 default: 3161 if v != nil { 3162 var additionalProperties interface{} 3163 err = json.Unmarshal(*v, &additionalProperties) 3164 if err != nil { 3165 return err 3166 } 3167 if mac.AdditionalProperties == nil { 3168 mac.AdditionalProperties = make(map[string]interface{}) 3169 } 3170 mac.AdditionalProperties[k] = additionalProperties 3171 } 3172 case "odata.type": 3173 if v != nil { 3174 var odataType OdataTypeBasicMetricAlertCriteria 3175 err = json.Unmarshal(*v, &odataType) 3176 if err != nil { 3177 return err 3178 } 3179 mac.OdataType = odataType 3180 } 3181 } 3182 } 3183 3184 return nil 3185} 3186 3187// MetricAlertProperties an alert rule. 3188type MetricAlertProperties struct { 3189 // Description - the description of the metric alert that will be included in the alert email. 3190 Description *string `json:"description,omitempty"` 3191 // Severity - Alert severity {0, 1, 2, 3, 4} 3192 Severity *int32 `json:"severity,omitempty"` 3193 // Enabled - the flag that indicates whether the metric alert is enabled. 3194 Enabled *bool `json:"enabled,omitempty"` 3195 // Scopes - the list of resource id's that this metric alert is scoped to. 3196 Scopes *[]string `json:"scopes,omitempty"` 3197 // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. 3198 EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` 3199 // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. 3200 WindowSize *string `json:"windowSize,omitempty"` 3201 // Criteria - defines the specific alert criteria information. 3202 Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` 3203 // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. 3204 AutoMitigate *bool `json:"autoMitigate,omitempty"` 3205 // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. 3206 Actions *[]MetricAlertAction `json:"actions,omitempty"` 3207 // LastUpdatedTime - Last time the rule was updated in ISO8601 format. 3208 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 3209} 3210 3211// UnmarshalJSON is the custom unmarshaler for MetricAlertProperties struct. 3212func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error { 3213 var m map[string]*json.RawMessage 3214 err := json.Unmarshal(body, &m) 3215 if err != nil { 3216 return err 3217 } 3218 for k, v := range m { 3219 switch k { 3220 case "description": 3221 if v != nil { 3222 var description string 3223 err = json.Unmarshal(*v, &description) 3224 if err != nil { 3225 return err 3226 } 3227 mapVar.Description = &description 3228 } 3229 case "severity": 3230 if v != nil { 3231 var severity int32 3232 err = json.Unmarshal(*v, &severity) 3233 if err != nil { 3234 return err 3235 } 3236 mapVar.Severity = &severity 3237 } 3238 case "enabled": 3239 if v != nil { 3240 var enabled bool 3241 err = json.Unmarshal(*v, &enabled) 3242 if err != nil { 3243 return err 3244 } 3245 mapVar.Enabled = &enabled 3246 } 3247 case "scopes": 3248 if v != nil { 3249 var scopes []string 3250 err = json.Unmarshal(*v, &scopes) 3251 if err != nil { 3252 return err 3253 } 3254 mapVar.Scopes = &scopes 3255 } 3256 case "evaluationFrequency": 3257 if v != nil { 3258 var evaluationFrequency string 3259 err = json.Unmarshal(*v, &evaluationFrequency) 3260 if err != nil { 3261 return err 3262 } 3263 mapVar.EvaluationFrequency = &evaluationFrequency 3264 } 3265 case "windowSize": 3266 if v != nil { 3267 var windowSize string 3268 err = json.Unmarshal(*v, &windowSize) 3269 if err != nil { 3270 return err 3271 } 3272 mapVar.WindowSize = &windowSize 3273 } 3274 case "criteria": 3275 if v != nil { 3276 criteria, err := unmarshalBasicMetricAlertCriteria(*v) 3277 if err != nil { 3278 return err 3279 } 3280 mapVar.Criteria = criteria 3281 } 3282 case "autoMitigate": 3283 if v != nil { 3284 var autoMitigate bool 3285 err = json.Unmarshal(*v, &autoMitigate) 3286 if err != nil { 3287 return err 3288 } 3289 mapVar.AutoMitigate = &autoMitigate 3290 } 3291 case "actions": 3292 if v != nil { 3293 var actions []MetricAlertAction 3294 err = json.Unmarshal(*v, &actions) 3295 if err != nil { 3296 return err 3297 } 3298 mapVar.Actions = &actions 3299 } 3300 case "lastUpdatedTime": 3301 if v != nil { 3302 var lastUpdatedTime date.Time 3303 err = json.Unmarshal(*v, &lastUpdatedTime) 3304 if err != nil { 3305 return err 3306 } 3307 mapVar.LastUpdatedTime = &lastUpdatedTime 3308 } 3309 } 3310 } 3311 3312 return nil 3313} 3314 3315// MetricAlertResource the metric alert resource. 3316type MetricAlertResource struct { 3317 autorest.Response `json:"-"` 3318 // MetricAlertProperties - The alert rule properties of the resource. 3319 *MetricAlertProperties `json:"properties,omitempty"` 3320 // ID - Azure resource Id 3321 ID *string `json:"id,omitempty"` 3322 // Name - Azure resource name 3323 Name *string `json:"name,omitempty"` 3324 // Type - Azure resource type 3325 Type *string `json:"type,omitempty"` 3326 // Location - Resource location 3327 Location *string `json:"location,omitempty"` 3328 // Tags - Resource tags 3329 Tags map[string]*string `json:"tags"` 3330} 3331 3332// MarshalJSON is the custom marshaler for MetricAlertResource. 3333func (mar MetricAlertResource) MarshalJSON() ([]byte, error) { 3334 objectMap := make(map[string]interface{}) 3335 if mar.MetricAlertProperties != nil { 3336 objectMap["properties"] = mar.MetricAlertProperties 3337 } 3338 if mar.ID != nil { 3339 objectMap["id"] = mar.ID 3340 } 3341 if mar.Name != nil { 3342 objectMap["name"] = mar.Name 3343 } 3344 if mar.Type != nil { 3345 objectMap["type"] = mar.Type 3346 } 3347 if mar.Location != nil { 3348 objectMap["location"] = mar.Location 3349 } 3350 if mar.Tags != nil { 3351 objectMap["tags"] = mar.Tags 3352 } 3353 return json.Marshal(objectMap) 3354} 3355 3356// UnmarshalJSON is the custom unmarshaler for MetricAlertResource struct. 3357func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error { 3358 var m map[string]*json.RawMessage 3359 err := json.Unmarshal(body, &m) 3360 if err != nil { 3361 return err 3362 } 3363 for k, v := range m { 3364 switch k { 3365 case "properties": 3366 if v != nil { 3367 var metricAlertProperties MetricAlertProperties 3368 err = json.Unmarshal(*v, &metricAlertProperties) 3369 if err != nil { 3370 return err 3371 } 3372 mar.MetricAlertProperties = &metricAlertProperties 3373 } 3374 case "id": 3375 if v != nil { 3376 var ID string 3377 err = json.Unmarshal(*v, &ID) 3378 if err != nil { 3379 return err 3380 } 3381 mar.ID = &ID 3382 } 3383 case "name": 3384 if v != nil { 3385 var name string 3386 err = json.Unmarshal(*v, &name) 3387 if err != nil { 3388 return err 3389 } 3390 mar.Name = &name 3391 } 3392 case "type": 3393 if v != nil { 3394 var typeVar string 3395 err = json.Unmarshal(*v, &typeVar) 3396 if err != nil { 3397 return err 3398 } 3399 mar.Type = &typeVar 3400 } 3401 case "location": 3402 if v != nil { 3403 var location string 3404 err = json.Unmarshal(*v, &location) 3405 if err != nil { 3406 return err 3407 } 3408 mar.Location = &location 3409 } 3410 case "tags": 3411 if v != nil { 3412 var tags map[string]*string 3413 err = json.Unmarshal(*v, &tags) 3414 if err != nil { 3415 return err 3416 } 3417 mar.Tags = tags 3418 } 3419 } 3420 } 3421 3422 return nil 3423} 3424 3425// MetricAlertResourceCollection represents a collection of alert rule resources. 3426type MetricAlertResourceCollection struct { 3427 autorest.Response `json:"-"` 3428 // Value - the values for the alert rule resources. 3429 Value *[]MetricAlertResource `json:"value,omitempty"` 3430} 3431 3432// MetricAlertResourcePatch the metric alert resource for patch operations. 3433type MetricAlertResourcePatch struct { 3434 // Tags - Resource tags 3435 Tags map[string]*string `json:"tags"` 3436 // MetricAlertProperties - The alert rule properties of the resource. 3437 *MetricAlertProperties `json:"properties,omitempty"` 3438} 3439 3440// MarshalJSON is the custom marshaler for MetricAlertResourcePatch. 3441func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { 3442 objectMap := make(map[string]interface{}) 3443 if marp.Tags != nil { 3444 objectMap["tags"] = marp.Tags 3445 } 3446 if marp.MetricAlertProperties != nil { 3447 objectMap["properties"] = marp.MetricAlertProperties 3448 } 3449 return json.Marshal(objectMap) 3450} 3451 3452// UnmarshalJSON is the custom unmarshaler for MetricAlertResourcePatch struct. 3453func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error { 3454 var m map[string]*json.RawMessage 3455 err := json.Unmarshal(body, &m) 3456 if err != nil { 3457 return err 3458 } 3459 for k, v := range m { 3460 switch k { 3461 case "tags": 3462 if v != nil { 3463 var tags map[string]*string 3464 err = json.Unmarshal(*v, &tags) 3465 if err != nil { 3466 return err 3467 } 3468 marp.Tags = tags 3469 } 3470 case "properties": 3471 if v != nil { 3472 var metricAlertProperties MetricAlertProperties 3473 err = json.Unmarshal(*v, &metricAlertProperties) 3474 if err != nil { 3475 return err 3476 } 3477 marp.MetricAlertProperties = &metricAlertProperties 3478 } 3479 } 3480 } 3481 3482 return nil 3483} 3484 3485// MetricAlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single resource that 3486// has multiple metric criteria. 3487type MetricAlertSingleResourceMultipleMetricCriteria struct { 3488 // AllOf - The list of metric criteria for this 'all of' operation. 3489 AllOf *[]MetricCriteria `json:"allOf,omitempty"` 3490 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 3491 AdditionalProperties map[string]interface{} `json:""` 3492 // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria' 3493 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` 3494} 3495 3496// MarshalJSON is the custom marshaler for MetricAlertSingleResourceMultipleMetricCriteria. 3497func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { 3498 masrmmc.OdataType = OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria 3499 objectMap := make(map[string]interface{}) 3500 if masrmmc.AllOf != nil { 3501 objectMap["allOf"] = masrmmc.AllOf 3502 } 3503 if masrmmc.OdataType != "" { 3504 objectMap["odata.type"] = masrmmc.OdataType 3505 } 3506 for k, v := range masrmmc.AdditionalProperties { 3507 objectMap[k] = v 3508 } 3509 return json.Marshal(objectMap) 3510} 3511 3512// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. 3513func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { 3514 return &masrmmc, true 3515} 3516 3517// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. 3518func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { 3519 return nil, false 3520} 3521 3522// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. 3523func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { 3524 return &masrmmc, true 3525} 3526 3527// UnmarshalJSON is the custom unmarshaler for MetricAlertSingleResourceMultipleMetricCriteria struct. 3528func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error { 3529 var m map[string]*json.RawMessage 3530 err := json.Unmarshal(body, &m) 3531 if err != nil { 3532 return err 3533 } 3534 for k, v := range m { 3535 switch k { 3536 case "allOf": 3537 if v != nil { 3538 var allOf []MetricCriteria 3539 err = json.Unmarshal(*v, &allOf) 3540 if err != nil { 3541 return err 3542 } 3543 masrmmc.AllOf = &allOf 3544 } 3545 default: 3546 if v != nil { 3547 var additionalProperties interface{} 3548 err = json.Unmarshal(*v, &additionalProperties) 3549 if err != nil { 3550 return err 3551 } 3552 if masrmmc.AdditionalProperties == nil { 3553 masrmmc.AdditionalProperties = make(map[string]interface{}) 3554 } 3555 masrmmc.AdditionalProperties[k] = additionalProperties 3556 } 3557 case "odata.type": 3558 if v != nil { 3559 var odataType OdataTypeBasicMetricAlertCriteria 3560 err = json.Unmarshal(*v, &odataType) 3561 if err != nil { 3562 return err 3563 } 3564 masrmmc.OdataType = odataType 3565 } 3566 } 3567 } 3568 3569 return nil 3570} 3571 3572// MetricAlertStatus an alert status. 3573type MetricAlertStatus struct { 3574 // Name - The status name. 3575 Name *string `json:"name,omitempty"` 3576 // ID - The alert rule arm id. 3577 ID *string `json:"id,omitempty"` 3578 // Type - The extended resource type name. 3579 Type *string `json:"type,omitempty"` 3580 // Properties - The alert status properties of the metric alert status. 3581 Properties *MetricAlertStatusProperties `json:"properties,omitempty"` 3582} 3583 3584// MetricAlertStatusCollection represents a collection of alert rule resources. 3585type MetricAlertStatusCollection struct { 3586 autorest.Response `json:"-"` 3587 // Value - the values for the alert rule resources. 3588 Value *[]MetricAlertStatus `json:"value,omitempty"` 3589} 3590 3591// MetricAlertStatusProperties an alert status properties. 3592type MetricAlertStatusProperties struct { 3593 // Dimensions - An object describing the type of the dimensions. 3594 Dimensions map[string]*string `json:"dimensions"` 3595 // Status - status value 3596 Status *string `json:"status,omitempty"` 3597 // Timestamp - UTC time when the status was checked. 3598 Timestamp *date.Time `json:"timestamp,omitempty"` 3599} 3600 3601// MarshalJSON is the custom marshaler for MetricAlertStatusProperties. 3602func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { 3603 objectMap := make(map[string]interface{}) 3604 if masp.Dimensions != nil { 3605 objectMap["dimensions"] = masp.Dimensions 3606 } 3607 if masp.Status != nil { 3608 objectMap["status"] = masp.Status 3609 } 3610 if masp.Timestamp != nil { 3611 objectMap["timestamp"] = masp.Timestamp 3612 } 3613 return json.Marshal(objectMap) 3614} 3615 3616// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and the 3617// retention period for that time grain. 3618type MetricAvailability struct { 3619 // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. 3620 TimeGrain *string `json:"timeGrain,omitempty"` 3621 // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. 3622 Retention *string `json:"retention,omitempty"` 3623} 3624 3625// MetricCriteria criterion to filter metrics. 3626type MetricCriteria struct { 3627 // Name - Name of the criteria. 3628 Name *string `json:"name,omitempty"` 3629 // MetricName - Name of the metric. 3630 MetricName *string `json:"metricName,omitempty"` 3631 // MetricNamespace - Namespace of the metric. 3632 MetricNamespace *string `json:"metricNamespace,omitempty"` 3633 // Operator - the criteria operator. 3634 Operator interface{} `json:"operator,omitempty"` 3635 // TimeAggregation - the criteria time aggregation types. 3636 TimeAggregation interface{} `json:"timeAggregation,omitempty"` 3637 // Threshold - the criteria threshold value that activates the alert. 3638 Threshold *float64 `json:"threshold,omitempty"` 3639 // Dimensions - List of dimension conditions. 3640 Dimensions *[]MetricDimension `json:"dimensions,omitempty"` 3641} 3642 3643// MetricDefinition metric definition class specifies the metadata for a metric. 3644type MetricDefinition struct { 3645 // IsDimensionRequired - Flag to indicate whether the dimension is required. 3646 IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` 3647 // ResourceID - the resource identifier of the resource that emitted the metric. 3648 ResourceID *string `json:"resourceId,omitempty"` 3649 // Namespace - the namespace the metric blongs to. 3650 Namespace *string `json:"namespace,omitempty"` 3651 // Name - the name and the display name of the metric, i.e. it is a localizable string. 3652 Name *LocalizableString `json:"name,omitempty"` 3653 // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified' 3654 Unit Unit `json:"unit,omitempty"` 3655 // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' 3656 PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` 3657 // SupportedAggregationTypes - the collection of what aggregation types are supported. 3658 SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` 3659 // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. 3660 MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` 3661 // ID - the resource identifier of the metric definition. 3662 ID *string `json:"id,omitempty"` 3663 // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. 3664 Dimensions *[]LocalizableString `json:"dimensions,omitempty"` 3665} 3666 3667// MetricDefinitionCollection represents collection of metric definitions. 3668type MetricDefinitionCollection struct { 3669 autorest.Response `json:"-"` 3670 // Value - the values for the metric definitions. 3671 Value *[]MetricDefinition `json:"value,omitempty"` 3672} 3673 3674// MetricDimension specifies a metric dimension. 3675type MetricDimension struct { 3676 // Name - Name of the dimension. 3677 Name *string `json:"name,omitempty"` 3678 // Operator - the dimension operator. 3679 Operator *string `json:"operator,omitempty"` 3680 // Values - list of dimension values. 3681 Values *[]string `json:"values,omitempty"` 3682} 3683 3684// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. 3685type MetricSettings struct { 3686 // TimeGrain - the timegrain of the metric in ISO8601 format. 3687 TimeGrain *string `json:"timeGrain,omitempty"` 3688 // Category - Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. 3689 Category *string `json:"category,omitempty"` 3690 // Enabled - a value indicating whether this category is enabled. 3691 Enabled *bool `json:"enabled,omitempty"` 3692 // RetentionPolicy - the retention policy for this category. 3693 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 3694} 3695 3696// MetricTrigger the trigger that results in a scaling action. 3697type MetricTrigger struct { 3698 // MetricName - the name of the metric that defines what the rule monitors. 3699 MetricName *string `json:"metricName,omitempty"` 3700 // MetricResourceURI - the resource identifier of the resource the rule monitors. 3701 MetricResourceURI *string `json:"metricResourceUri,omitempty"` 3702 // TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. 3703 TimeGrain *string `json:"timeGrain,omitempty"` 3704 // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' 3705 Statistic MetricStatisticType `json:"statistic,omitempty"` 3706 // TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. 3707 TimeWindow *string `json:"timeWindow,omitempty"` 3708 // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast' 3709 TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` 3710 // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' 3711 Operator ComparisonOperationType `json:"operator,omitempty"` 3712 // Threshold - the threshold of the metric that triggers the scale action. 3713 Threshold *float64 `json:"threshold,omitempty"` 3714} 3715 3716// MetricValue represents a metric value. 3717type MetricValue struct { 3718 // TimeStamp - the timestamp for the metric value in ISO 8601 format. 3719 TimeStamp *date.Time `json:"timeStamp,omitempty"` 3720 // Average - the average value in the time range. 3721 Average *float64 `json:"average,omitempty"` 3722 // Minimum - the least value in the time range. 3723 Minimum *float64 `json:"minimum,omitempty"` 3724 // Maximum - the greatest value in the time range. 3725 Maximum *float64 `json:"maximum,omitempty"` 3726 // Total - the sum of all of the values in the time range. 3727 Total *float64 `json:"total,omitempty"` 3728 // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. 3729 Count *int64 `json:"count,omitempty"` 3730} 3731 3732// Operation microsoft Insights API operation definition. 3733type Operation struct { 3734 // Name - Operation name: {provider}/{resource}/{operation} 3735 Name *string `json:"name,omitempty"` 3736 // Display - Display metadata associated with the operation. 3737 Display *OperationDisplay `json:"display,omitempty"` 3738} 3739 3740// OperationDisplay display metadata associated with the operation. 3741type OperationDisplay struct { 3742 // Provider - Service provider: Microsoft.Insights 3743 Provider *string `json:"provider,omitempty"` 3744 // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. 3745 Resource *string `json:"resource,omitempty"` 3746 // Operation - Operation type: Read, write, delete, etc. 3747 Operation *string `json:"operation,omitempty"` 3748} 3749 3750// OperationListResult result of the request to list Microsoft.Insights operations. It contains a list of 3751// operations and a URL link to get the next set of results. 3752type OperationListResult struct { 3753 autorest.Response `json:"-"` 3754 // Value - List of operations supported by the Microsoft.Insights provider. 3755 Value *[]Operation `json:"value,omitempty"` 3756 // NextLink - URL to get the next set of operation list results if there are any. 3757 NextLink *string `json:"nextLink,omitempty"` 3758} 3759 3760// ProxyOnlyResource a proxy only azure resource object 3761type ProxyOnlyResource struct { 3762 // ID - Azure resource Id 3763 ID *string `json:"id,omitempty"` 3764 // Name - Azure resource name 3765 Name *string `json:"name,omitempty"` 3766 // Type - Azure resource type 3767 Type *string `json:"type,omitempty"` 3768} 3769 3770// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate element 3771// is used. 3772type Recurrence struct { 3773 // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' 3774 Frequency RecurrenceFrequency `json:"frequency,omitempty"` 3775 // Schedule - the scheduling constraints for when the profile begins. 3776 Schedule *RecurrentSchedule `json:"schedule,omitempty"` 3777} 3778 3779// RecurrentSchedule the scheduling constraints for when the profile begins. 3780type RecurrentSchedule struct { 3781 // TimeZone - the timezone for the hours of the profile. Some examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time 3782 TimeZone *string `json:"timeZone,omitempty"` 3783 // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. 3784 Days *[]string `json:"days,omitempty"` 3785 // Hours - A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). 3786 Hours *[]int32 `json:"hours,omitempty"` 3787 // Minutes - A collection of minutes at which the profile takes effect at. 3788 Minutes *[]int32 `json:"minutes,omitempty"` 3789} 3790 3791// Resource an azure resource object 3792type Resource struct { 3793 // ID - Azure resource Id 3794 ID *string `json:"id,omitempty"` 3795 // Name - Azure resource name 3796 Name *string `json:"name,omitempty"` 3797 // Type - Azure resource type 3798 Type *string `json:"type,omitempty"` 3799 // Location - Resource location 3800 Location *string `json:"location,omitempty"` 3801 // Tags - Resource tags 3802 Tags map[string]*string `json:"tags"` 3803} 3804 3805// MarshalJSON is the custom marshaler for Resource. 3806func (r Resource) MarshalJSON() ([]byte, error) { 3807 objectMap := make(map[string]interface{}) 3808 if r.ID != nil { 3809 objectMap["id"] = r.ID 3810 } 3811 if r.Name != nil { 3812 objectMap["name"] = r.Name 3813 } 3814 if r.Type != nil { 3815 objectMap["type"] = r.Type 3816 } 3817 if r.Location != nil { 3818 objectMap["location"] = r.Location 3819 } 3820 if r.Tags != nil { 3821 objectMap["tags"] = r.Tags 3822 } 3823 return json.Marshal(objectMap) 3824} 3825 3826// Response the response to a metrics query. 3827type Response struct { 3828 autorest.Response `json:"-"` 3829 // Cost - The integer value representing the cost of the query, for data case. 3830 Cost *float64 `json:"cost,omitempty"` 3831 // Timespan - The timespan for which the data was retrieved. Its value consists of two datatimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. 3832 Timespan *string `json:"timespan,omitempty"` 3833 // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. 3834 Interval *string `json:"interval,omitempty"` 3835 // Namespace - The namespace of the metrics been queried 3836 Namespace *string `json:"namespace,omitempty"` 3837 // Resourceregion - The region of the resource been queried for metrics. 3838 Resourceregion *string `json:"resourceregion,omitempty"` 3839 // Value - the value of the collection. 3840 Value *[]Metric `json:"value,omitempty"` 3841} 3842 3843// RetentionPolicy specifies the retention policy for the log. 3844type RetentionPolicy struct { 3845 // Enabled - a value indicating whether the retention policy is enabled. 3846 Enabled *bool `json:"enabled,omitempty"` 3847 // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. 3848 Days *int32 `json:"days,omitempty"` 3849} 3850 3851// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is 3852// resolved. 3853type BasicRuleAction interface { 3854 AsRuleEmailAction() (*RuleEmailAction, bool) 3855 AsRuleWebhookAction() (*RuleWebhookAction, bool) 3856 AsRuleAction() (*RuleAction, bool) 3857} 3858 3859// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is 3860// resolved. 3861type RuleAction struct { 3862 // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' 3863 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` 3864} 3865 3866func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { 3867 var m map[string]interface{} 3868 err := json.Unmarshal(body, &m) 3869 if err != nil { 3870 return nil, err 3871 } 3872 3873 switch m["odata.type"] { 3874 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): 3875 var rea RuleEmailAction 3876 err := json.Unmarshal(body, &rea) 3877 return rea, err 3878 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): 3879 var rwa RuleWebhookAction 3880 err := json.Unmarshal(body, &rwa) 3881 return rwa, err 3882 default: 3883 var ra RuleAction 3884 err := json.Unmarshal(body, &ra) 3885 return ra, err 3886 } 3887} 3888func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { 3889 var rawMessages []*json.RawMessage 3890 err := json.Unmarshal(body, &rawMessages) 3891 if err != nil { 3892 return nil, err 3893 } 3894 3895 raArray := make([]BasicRuleAction, len(rawMessages)) 3896 3897 for index, rawMessage := range rawMessages { 3898 ra, err := unmarshalBasicRuleAction(*rawMessage) 3899 if err != nil { 3900 return nil, err 3901 } 3902 raArray[index] = ra 3903 } 3904 return raArray, nil 3905} 3906 3907// MarshalJSON is the custom marshaler for RuleAction. 3908func (ra RuleAction) MarshalJSON() ([]byte, error) { 3909 ra.OdataType = OdataTypeRuleAction 3910 objectMap := make(map[string]interface{}) 3911 if ra.OdataType != "" { 3912 objectMap["odata.type"] = ra.OdataType 3913 } 3914 return json.Marshal(objectMap) 3915} 3916 3917// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. 3918func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { 3919 return nil, false 3920} 3921 3922// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. 3923func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { 3924 return nil, false 3925} 3926 3927// AsRuleAction is the BasicRuleAction implementation for RuleAction. 3928func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { 3929 return &ra, true 3930} 3931 3932// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. 3933func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { 3934 return &ra, true 3935} 3936 3937// BasicRuleCondition the condition that results in the alert rule being activated. 3938type BasicRuleCondition interface { 3939 AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) 3940 AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) 3941 AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) 3942 AsRuleCondition() (*RuleCondition, bool) 3943} 3944 3945// RuleCondition the condition that results in the alert rule being activated. 3946type RuleCondition struct { 3947 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 3948 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 3949 // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 3950 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 3951} 3952 3953func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { 3954 var m map[string]interface{} 3955 err := json.Unmarshal(body, &m) 3956 if err != nil { 3957 return nil, err 3958 } 3959 3960 switch m["odata.type"] { 3961 case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): 3962 var trc ThresholdRuleCondition 3963 err := json.Unmarshal(body, &trc) 3964 return trc, err 3965 case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): 3966 var ltrc LocationThresholdRuleCondition 3967 err := json.Unmarshal(body, <rc) 3968 return ltrc, err 3969 case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): 3970 var merc ManagementEventRuleCondition 3971 err := json.Unmarshal(body, &merc) 3972 return merc, err 3973 default: 3974 var rc RuleCondition 3975 err := json.Unmarshal(body, &rc) 3976 return rc, err 3977 } 3978} 3979func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { 3980 var rawMessages []*json.RawMessage 3981 err := json.Unmarshal(body, &rawMessages) 3982 if err != nil { 3983 return nil, err 3984 } 3985 3986 rcArray := make([]BasicRuleCondition, len(rawMessages)) 3987 3988 for index, rawMessage := range rawMessages { 3989 rc, err := unmarshalBasicRuleCondition(*rawMessage) 3990 if err != nil { 3991 return nil, err 3992 } 3993 rcArray[index] = rc 3994 } 3995 return rcArray, nil 3996} 3997 3998// MarshalJSON is the custom marshaler for RuleCondition. 3999func (rc RuleCondition) MarshalJSON() ([]byte, error) { 4000 rc.OdataType = OdataTypeRuleCondition 4001 objectMap := make(map[string]interface{}) 4002 objectMap["dataSource"] = rc.DataSource 4003 if rc.OdataType != "" { 4004 objectMap["odata.type"] = rc.OdataType 4005 } 4006 return json.Marshal(objectMap) 4007} 4008 4009// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. 4010func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 4011 return nil, false 4012} 4013 4014// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. 4015func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 4016 return nil, false 4017} 4018 4019// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. 4020func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 4021 return nil, false 4022} 4023 4024// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. 4025func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { 4026 return &rc, true 4027} 4028 4029// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. 4030func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 4031 return &rc, true 4032} 4033 4034// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. 4035func (rc *RuleCondition) UnmarshalJSON(body []byte) error { 4036 var m map[string]*json.RawMessage 4037 err := json.Unmarshal(body, &m) 4038 if err != nil { 4039 return err 4040 } 4041 for k, v := range m { 4042 switch k { 4043 case "dataSource": 4044 if v != nil { 4045 dataSource, err := unmarshalBasicRuleDataSource(*v) 4046 if err != nil { 4047 return err 4048 } 4049 rc.DataSource = dataSource 4050 } 4051 case "odata.type": 4052 if v != nil { 4053 var odataType OdataTypeBasicRuleCondition 4054 err = json.Unmarshal(*v, &odataType) 4055 if err != nil { 4056 return err 4057 } 4058 rc.OdataType = odataType 4059 } 4060 } 4061 } 4062 4063 return nil 4064} 4065 4066// BasicRuleDataSource the resource from which the rule collects its data. 4067type BasicRuleDataSource interface { 4068 AsRuleMetricDataSource() (*RuleMetricDataSource, bool) 4069 AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) 4070 AsRuleDataSource() (*RuleDataSource, bool) 4071} 4072 4073// RuleDataSource the resource from which the rule collects its data. 4074type RuleDataSource struct { 4075 // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 4076 ResourceURI *string `json:"resourceUri,omitempty"` 4077 // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' 4078 OdataType OdataType `json:"odata.type,omitempty"` 4079} 4080 4081func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { 4082 var m map[string]interface{} 4083 err := json.Unmarshal(body, &m) 4084 if err != nil { 4085 return nil, err 4086 } 4087 4088 switch m["odata.type"] { 4089 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): 4090 var rmds RuleMetricDataSource 4091 err := json.Unmarshal(body, &rmds) 4092 return rmds, err 4093 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): 4094 var rmeds RuleManagementEventDataSource 4095 err := json.Unmarshal(body, &rmeds) 4096 return rmeds, err 4097 default: 4098 var rds RuleDataSource 4099 err := json.Unmarshal(body, &rds) 4100 return rds, err 4101 } 4102} 4103func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { 4104 var rawMessages []*json.RawMessage 4105 err := json.Unmarshal(body, &rawMessages) 4106 if err != nil { 4107 return nil, err 4108 } 4109 4110 rdsArray := make([]BasicRuleDataSource, len(rawMessages)) 4111 4112 for index, rawMessage := range rawMessages { 4113 rds, err := unmarshalBasicRuleDataSource(*rawMessage) 4114 if err != nil { 4115 return nil, err 4116 } 4117 rdsArray[index] = rds 4118 } 4119 return rdsArray, nil 4120} 4121 4122// MarshalJSON is the custom marshaler for RuleDataSource. 4123func (rds RuleDataSource) MarshalJSON() ([]byte, error) { 4124 rds.OdataType = OdataTypeRuleDataSource 4125 objectMap := make(map[string]interface{}) 4126 if rds.ResourceURI != nil { 4127 objectMap["resourceUri"] = rds.ResourceURI 4128 } 4129 if rds.OdataType != "" { 4130 objectMap["odata.type"] = rds.OdataType 4131 } 4132 return json.Marshal(objectMap) 4133} 4134 4135// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. 4136func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { 4137 return nil, false 4138} 4139 4140// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. 4141func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { 4142 return nil, false 4143} 4144 4145// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. 4146func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { 4147 return &rds, true 4148} 4149 4150// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. 4151func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { 4152 return &rds, true 4153} 4154 4155// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The discriminator is 4156// always RuleEmailAction in this case. 4157type RuleEmailAction struct { 4158 // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. 4159 SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` 4160 // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. 4161 CustomEmails *[]string `json:"customEmails,omitempty"` 4162 // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' 4163 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` 4164} 4165 4166// MarshalJSON is the custom marshaler for RuleEmailAction. 4167func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { 4168 rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction 4169 objectMap := make(map[string]interface{}) 4170 if rea.SendToServiceOwners != nil { 4171 objectMap["sendToServiceOwners"] = rea.SendToServiceOwners 4172 } 4173 if rea.CustomEmails != nil { 4174 objectMap["customEmails"] = rea.CustomEmails 4175 } 4176 if rea.OdataType != "" { 4177 objectMap["odata.type"] = rea.OdataType 4178 } 4179 return json.Marshal(objectMap) 4180} 4181 4182// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. 4183func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { 4184 return &rea, true 4185} 4186 4187// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. 4188func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { 4189 return nil, false 4190} 4191 4192// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. 4193func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { 4194 return nil, false 4195} 4196 4197// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. 4198func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { 4199 return &rea, true 4200} 4201 4202// RuleManagementEventClaimsDataSource the claims for a rule management event data source. 4203type RuleManagementEventClaimsDataSource struct { 4204 // EmailAddress - the email address. 4205 EmailAddress *string `json:"emailAddress,omitempty"` 4206} 4207 4208// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always 4209// RuleManagementEventDataSource in this case. 4210type RuleManagementEventDataSource struct { 4211 // EventName - the event name. 4212 EventName *string `json:"eventName,omitempty"` 4213 // EventSource - the event source. 4214 EventSource *string `json:"eventSource,omitempty"` 4215 // Level - the level. 4216 Level *string `json:"level,omitempty"` 4217 // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. 4218 OperationName *string `json:"operationName,omitempty"` 4219 // ResourceGroupName - the resource group name. 4220 ResourceGroupName *string `json:"resourceGroupName,omitempty"` 4221 // ResourceProviderName - the resource provider name. 4222 ResourceProviderName *string `json:"resourceProviderName,omitempty"` 4223 // Status - The status of the operation that should be checked for. If no status is provided, any status will match. 4224 Status *string `json:"status,omitempty"` 4225 // SubStatus - the substatus. 4226 SubStatus *string `json:"subStatus,omitempty"` 4227 // Claims - the claims. 4228 Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` 4229 // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 4230 ResourceURI *string `json:"resourceUri,omitempty"` 4231 // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' 4232 OdataType OdataType `json:"odata.type,omitempty"` 4233} 4234 4235// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. 4236func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { 4237 rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource 4238 objectMap := make(map[string]interface{}) 4239 if rmeds.EventName != nil { 4240 objectMap["eventName"] = rmeds.EventName 4241 } 4242 if rmeds.EventSource != nil { 4243 objectMap["eventSource"] = rmeds.EventSource 4244 } 4245 if rmeds.Level != nil { 4246 objectMap["level"] = rmeds.Level 4247 } 4248 if rmeds.OperationName != nil { 4249 objectMap["operationName"] = rmeds.OperationName 4250 } 4251 if rmeds.ResourceGroupName != nil { 4252 objectMap["resourceGroupName"] = rmeds.ResourceGroupName 4253 } 4254 if rmeds.ResourceProviderName != nil { 4255 objectMap["resourceProviderName"] = rmeds.ResourceProviderName 4256 } 4257 if rmeds.Status != nil { 4258 objectMap["status"] = rmeds.Status 4259 } 4260 if rmeds.SubStatus != nil { 4261 objectMap["subStatus"] = rmeds.SubStatus 4262 } 4263 if rmeds.Claims != nil { 4264 objectMap["claims"] = rmeds.Claims 4265 } 4266 if rmeds.ResourceURI != nil { 4267 objectMap["resourceUri"] = rmeds.ResourceURI 4268 } 4269 if rmeds.OdataType != "" { 4270 objectMap["odata.type"] = rmeds.OdataType 4271 } 4272 return json.Marshal(objectMap) 4273} 4274 4275// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 4276func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { 4277 return nil, false 4278} 4279 4280// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 4281func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { 4282 return &rmeds, true 4283} 4284 4285// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 4286func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { 4287 return nil, false 4288} 4289 4290// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 4291func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { 4292 return &rmeds, true 4293} 4294 4295// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource in this 4296// case. 4297type RuleMetricDataSource struct { 4298 // MetricName - the name of the metric that defines what the rule monitors. 4299 MetricName *string `json:"metricName,omitempty"` 4300 // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 4301 ResourceURI *string `json:"resourceUri,omitempty"` 4302 // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' 4303 OdataType OdataType `json:"odata.type,omitempty"` 4304} 4305 4306// MarshalJSON is the custom marshaler for RuleMetricDataSource. 4307func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { 4308 rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource 4309 objectMap := make(map[string]interface{}) 4310 if rmds.MetricName != nil { 4311 objectMap["metricName"] = rmds.MetricName 4312 } 4313 if rmds.ResourceURI != nil { 4314 objectMap["resourceUri"] = rmds.ResourceURI 4315 } 4316 if rmds.OdataType != "" { 4317 objectMap["odata.type"] = rmds.OdataType 4318 } 4319 return json.Marshal(objectMap) 4320} 4321 4322// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 4323func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { 4324 return &rmds, true 4325} 4326 4327// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 4328func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { 4329 return nil, false 4330} 4331 4332// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 4333func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { 4334 return nil, false 4335} 4336 4337// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 4338func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { 4339 return &rmds, true 4340} 4341 4342// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The 4343// discriminator is always RuleWebhookAction in this case. 4344type RuleWebhookAction struct { 4345 // ServiceURI - the service uri to Post the notification when the alert activates or resolves. 4346 ServiceURI *string `json:"serviceUri,omitempty"` 4347 // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. 4348 Properties map[string]*string `json:"properties"` 4349 // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' 4350 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` 4351} 4352 4353// MarshalJSON is the custom marshaler for RuleWebhookAction. 4354func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { 4355 rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction 4356 objectMap := make(map[string]interface{}) 4357 if rwa.ServiceURI != nil { 4358 objectMap["serviceUri"] = rwa.ServiceURI 4359 } 4360 if rwa.Properties != nil { 4361 objectMap["properties"] = rwa.Properties 4362 } 4363 if rwa.OdataType != "" { 4364 objectMap["odata.type"] = rwa.OdataType 4365 } 4366 return json.Marshal(objectMap) 4367} 4368 4369// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. 4370func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { 4371 return nil, false 4372} 4373 4374// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. 4375func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { 4376 return &rwa, true 4377} 4378 4379// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. 4380func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { 4381 return nil, false 4382} 4383 4384// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. 4385func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { 4386 return &rwa, true 4387} 4388 4389// ScaleAction the parameters for the scaling action. 4390type ScaleAction struct { 4391 // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' 4392 Direction ScaleDirection `json:"direction,omitempty"` 4393 // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' 4394 Type ScaleType `json:"type,omitempty"` 4395 // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. 4396 Value *string `json:"value,omitempty"` 4397 // Cooldown - the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. 4398 Cooldown *string `json:"cooldown,omitempty"` 4399} 4400 4401// ScaleCapacity the number of instances that can be used during this profile. 4402type ScaleCapacity struct { 4403 // Minimum - the minimum number of instances for the resource. 4404 Minimum *string `json:"minimum,omitempty"` 4405 // Maximum - the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. 4406 Maximum *string `json:"maximum,omitempty"` 4407 // Default - the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. 4408 Default *string `json:"default,omitempty"` 4409} 4410 4411// ScaleRule a rule that provide the triggers and parameters for the scaling action. 4412type ScaleRule struct { 4413 // MetricTrigger - the trigger that results in a scaling action. 4414 MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` 4415 // ScaleAction - the parameters for the scaling action. 4416 ScaleAction *ScaleAction `json:"scaleAction,omitempty"` 4417} 4418 4419// Schedule defines how often to run the search and the time interval. 4420type Schedule struct { 4421 // FrequencyInMinutes - frequency (in minutes) at which rule condition should be evaluated. 4422 FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"` 4423 // TimeWindowInMinutes - Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). 4424 TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"` 4425} 4426 4427// SenderAuthorization the authorization used by the user who has performed the operation that led to this event. 4428// This captures the RBAC properties of the event. These usually include the 'action', 'role' and the 'scope' 4429type SenderAuthorization struct { 4430 // Action - the permissible actions. For instance: microsoft.support/supporttickets/write 4431 Action *string `json:"action,omitempty"` 4432 // Role - the role of the user. For instance: Subscription Admin 4433 Role *string `json:"role,omitempty"` 4434 // Scope - the scope. 4435 Scope *string `json:"scope,omitempty"` 4436} 4437 4438// SmsReceiver an SMS receiver. 4439type SmsReceiver struct { 4440 // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. 4441 Name *string `json:"name,omitempty"` 4442 // CountryCode - The country code of the SMS receiver. 4443 CountryCode *string `json:"countryCode,omitempty"` 4444 // PhoneNumber - The phone number of the SMS receiver. 4445 PhoneNumber *string `json:"phoneNumber,omitempty"` 4446 // Status - The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' 4447 Status ReceiverStatus `json:"status,omitempty"` 4448} 4449 4450// Source specifies the log search query. 4451type Source struct { 4452 // Query - Log search query. 4453 Query *string `json:"query,omitempty"` 4454 // AuthorizedResources - List of Resource referred into query 4455 AuthorizedResources *[]string `json:"authorizedResources,omitempty"` 4456 // DataSourceID - The resource uri over which log search query is to be run. 4457 DataSourceID *string `json:"dataSourceId,omitempty"` 4458 // QueryType - Set value to 'ResultCount'. Possible values include: 'ResultCount' 4459 QueryType QueryType `json:"queryType,omitempty"` 4460} 4461 4462// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. 4463type ThresholdRuleCondition struct { 4464 // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' 4465 Operator ConditionOperator `json:"operator,omitempty"` 4466 // Threshold - the threshold value that activates the alert. 4467 Threshold *float64 `json:"threshold,omitempty"` 4468 // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. 4469 WindowSize *string `json:"windowSize,omitempty"` 4470 // TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' 4471 TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` 4472 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 4473 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 4474 // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 4475 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 4476} 4477 4478// MarshalJSON is the custom marshaler for ThresholdRuleCondition. 4479func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { 4480 trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition 4481 objectMap := make(map[string]interface{}) 4482 if trc.Operator != "" { 4483 objectMap["operator"] = trc.Operator 4484 } 4485 if trc.Threshold != nil { 4486 objectMap["threshold"] = trc.Threshold 4487 } 4488 if trc.WindowSize != nil { 4489 objectMap["windowSize"] = trc.WindowSize 4490 } 4491 if trc.TimeAggregation != "" { 4492 objectMap["timeAggregation"] = trc.TimeAggregation 4493 } 4494 objectMap["dataSource"] = trc.DataSource 4495 if trc.OdataType != "" { 4496 objectMap["odata.type"] = trc.OdataType 4497 } 4498 return json.Marshal(objectMap) 4499} 4500 4501// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 4502func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 4503 return &trc, true 4504} 4505 4506// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 4507func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 4508 return nil, false 4509} 4510 4511// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 4512func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 4513 return nil, false 4514} 4515 4516// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 4517func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { 4518 return nil, false 4519} 4520 4521// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 4522func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 4523 return &trc, true 4524} 4525 4526// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. 4527func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error { 4528 var m map[string]*json.RawMessage 4529 err := json.Unmarshal(body, &m) 4530 if err != nil { 4531 return err 4532 } 4533 for k, v := range m { 4534 switch k { 4535 case "operator": 4536 if v != nil { 4537 var operator ConditionOperator 4538 err = json.Unmarshal(*v, &operator) 4539 if err != nil { 4540 return err 4541 } 4542 trc.Operator = operator 4543 } 4544 case "threshold": 4545 if v != nil { 4546 var threshold float64 4547 err = json.Unmarshal(*v, &threshold) 4548 if err != nil { 4549 return err 4550 } 4551 trc.Threshold = &threshold 4552 } 4553 case "windowSize": 4554 if v != nil { 4555 var windowSize string 4556 err = json.Unmarshal(*v, &windowSize) 4557 if err != nil { 4558 return err 4559 } 4560 trc.WindowSize = &windowSize 4561 } 4562 case "timeAggregation": 4563 if v != nil { 4564 var timeAggregation TimeAggregationOperator 4565 err = json.Unmarshal(*v, &timeAggregation) 4566 if err != nil { 4567 return err 4568 } 4569 trc.TimeAggregation = timeAggregation 4570 } 4571 case "dataSource": 4572 if v != nil { 4573 dataSource, err := unmarshalBasicRuleDataSource(*v) 4574 if err != nil { 4575 return err 4576 } 4577 trc.DataSource = dataSource 4578 } 4579 case "odata.type": 4580 if v != nil { 4581 var odataType OdataTypeBasicRuleCondition 4582 err = json.Unmarshal(*v, &odataType) 4583 if err != nil { 4584 return err 4585 } 4586 trc.OdataType = odataType 4587 } 4588 } 4589 } 4590 4591 return nil 4592} 4593 4594// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. 4595type TimeSeriesElement struct { 4596 // Metadatavalues - the metadata values returned if $filter was specified in the call. 4597 Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` 4598 // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. 4599 Data *[]MetricValue `json:"data,omitempty"` 4600} 4601 4602// TimeSeriesInformation the time series info needed for calculating the baseline. 4603type TimeSeriesInformation struct { 4604 // Sensitivities - the list of sensitivities for calculating the baseline. 4605 Sensitivities *[]string `json:"sensitivities,omitempty"` 4606 // Values - The metric values to calculate the baseline. 4607 Values *[]float64 `json:"values,omitempty"` 4608 // Timestamps - the array of timestamps of the baselines. 4609 Timestamps *[]date.Time `json:"timestamps,omitempty"` 4610} 4611 4612// TimeWindow a specific date-time for the profile. 4613type TimeWindow struct { 4614 // TimeZone - the timezone of the start and end times for the profile. Some examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time 4615 TimeZone *string `json:"timeZone,omitempty"` 4616 // Start - the start time for the profile in ISO 8601 format. 4617 Start *date.Time `json:"start,omitempty"` 4618 // End - the end time for the profile in ISO 8601 format. 4619 End *date.Time `json:"end,omitempty"` 4620} 4621 4622// TriggerCondition the condition that results in the Log Search rule. 4623type TriggerCondition struct { 4624 // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' 4625 ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` 4626 // Threshold - Result or count threshold based on which rule should be triggered. 4627 Threshold *float64 `json:"threshold,omitempty"` 4628 // MetricTrigger - Trigger condition for metric query rule 4629 MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"` 4630} 4631 4632// VoiceReceiver a voice receiver. 4633type VoiceReceiver struct { 4634 // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. 4635 Name *string `json:"name,omitempty"` 4636 // CountryCode - The country code of the voice receiver. 4637 CountryCode *string `json:"countryCode,omitempty"` 4638 // PhoneNumber - The phone number of the voice receiver. 4639 PhoneNumber *string `json:"phoneNumber,omitempty"` 4640} 4641 4642// WebhookNotification webhook notification of an autoscale event. 4643type WebhookNotification struct { 4644 // ServiceURI - the service address to receive the notification. 4645 ServiceURI *string `json:"serviceUri,omitempty"` 4646 // Properties - a property bag of settings. This value can be empty. 4647 Properties map[string]*string `json:"properties"` 4648} 4649 4650// MarshalJSON is the custom marshaler for WebhookNotification. 4651func (wn WebhookNotification) MarshalJSON() ([]byte, error) { 4652 objectMap := make(map[string]interface{}) 4653 if wn.ServiceURI != nil { 4654 objectMap["serviceUri"] = wn.ServiceURI 4655 } 4656 if wn.Properties != nil { 4657 objectMap["properties"] = wn.Properties 4658 } 4659 return json.Marshal(objectMap) 4660} 4661 4662// WebhookReceiver a webhook receiver. 4663type WebhookReceiver struct { 4664 // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. 4665 Name *string `json:"name,omitempty"` 4666 // ServiceURI - The URI where webhooks should be sent. 4667 ServiceURI *string `json:"serviceUri,omitempty"` 4668} 4669