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