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