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