1package insights 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "encoding/json" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/date" 24 "github.com/Azure/go-autorest/autorest/to" 25 "net/http" 26) 27 28// AggregationType enumerates the values for aggregation type. 29type AggregationType string 30 31const ( 32 // Average ... 33 Average AggregationType = "Average" 34 // Count ... 35 Count AggregationType = "Count" 36 // Maximum ... 37 Maximum AggregationType = "Maximum" 38 // Minimum ... 39 Minimum AggregationType = "Minimum" 40 // None ... 41 None AggregationType = "None" 42 // Total ... 43 Total AggregationType = "Total" 44) 45 46// CategoryType enumerates the values for category type. 47type CategoryType string 48 49const ( 50 // Logs ... 51 Logs CategoryType = "Logs" 52 // Metrics ... 53 Metrics CategoryType = "Metrics" 54) 55 56// ComparisonOperationType enumerates the values for comparison operation type. 57type ComparisonOperationType string 58 59const ( 60 // Equals ... 61 Equals ComparisonOperationType = "Equals" 62 // GreaterThan ... 63 GreaterThan ComparisonOperationType = "GreaterThan" 64 // GreaterThanOrEqual ... 65 GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" 66 // LessThan ... 67 LessThan ComparisonOperationType = "LessThan" 68 // LessThanOrEqual ... 69 LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" 70 // NotEquals ... 71 NotEquals ComparisonOperationType = "NotEquals" 72) 73 74// ConditionOperator enumerates the values for condition operator. 75type ConditionOperator string 76 77const ( 78 // ConditionOperatorGreaterThan ... 79 ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" 80 // ConditionOperatorGreaterThanOrEqual ... 81 ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" 82 // ConditionOperatorLessThan ... 83 ConditionOperatorLessThan ConditionOperator = "LessThan" 84 // ConditionOperatorLessThanOrEqual ... 85 ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" 86) 87 88// EventLevel enumerates the values for event level. 89type EventLevel string 90 91const ( 92 // Critical ... 93 Critical EventLevel = "Critical" 94 // Error ... 95 Error EventLevel = "Error" 96 // Informational ... 97 Informational EventLevel = "Informational" 98 // Verbose ... 99 Verbose EventLevel = "Verbose" 100 // Warning ... 101 Warning EventLevel = "Warning" 102) 103 104// MetricStatisticType enumerates the values for metric statistic type. 105type MetricStatisticType string 106 107const ( 108 // MetricStatisticTypeAverage ... 109 MetricStatisticTypeAverage MetricStatisticType = "Average" 110 // MetricStatisticTypeMax ... 111 MetricStatisticTypeMax MetricStatisticType = "Max" 112 // MetricStatisticTypeMin ... 113 MetricStatisticTypeMin MetricStatisticType = "Min" 114 // MetricStatisticTypeSum ... 115 MetricStatisticTypeSum MetricStatisticType = "Sum" 116) 117 118// OdataType enumerates the values for odata type. 119type OdataType string 120 121const ( 122 // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... 123 OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" 124 // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... 125 OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" 126 // OdataTypeRuleDataSource ... 127 OdataTypeRuleDataSource OdataType = "RuleDataSource" 128) 129 130// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. 131type OdataTypeBasicRuleAction string 132 133const ( 134 // OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... 135 OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" 136 // OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... 137 OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" 138 // OdataTypeRuleAction ... 139 OdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" 140) 141 142// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. 143type OdataTypeBasicRuleCondition string 144 145const ( 146 // OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... 147 OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" 148 // OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... 149 OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" 150 // OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... 151 OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" 152 // OdataTypeRuleCondition ... 153 OdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" 154) 155 156// ReceiverStatus enumerates the values for receiver status. 157type ReceiverStatus string 158 159const ( 160 // Disabled ... 161 Disabled ReceiverStatus = "Disabled" 162 // Enabled ... 163 Enabled ReceiverStatus = "Enabled" 164 // NotSpecified ... 165 NotSpecified ReceiverStatus = "NotSpecified" 166) 167 168// RecurrenceFrequency enumerates the values for recurrence frequency. 169type RecurrenceFrequency string 170 171const ( 172 // RecurrenceFrequencyDay ... 173 RecurrenceFrequencyDay RecurrenceFrequency = "Day" 174 // RecurrenceFrequencyHour ... 175 RecurrenceFrequencyHour RecurrenceFrequency = "Hour" 176 // RecurrenceFrequencyMinute ... 177 RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" 178 // RecurrenceFrequencyMonth ... 179 RecurrenceFrequencyMonth RecurrenceFrequency = "Month" 180 // RecurrenceFrequencyNone ... 181 RecurrenceFrequencyNone RecurrenceFrequency = "None" 182 // RecurrenceFrequencySecond ... 183 RecurrenceFrequencySecond RecurrenceFrequency = "Second" 184 // RecurrenceFrequencyWeek ... 185 RecurrenceFrequencyWeek RecurrenceFrequency = "Week" 186 // RecurrenceFrequencyYear ... 187 RecurrenceFrequencyYear RecurrenceFrequency = "Year" 188) 189 190// ResultType enumerates the values for result type. 191type ResultType string 192 193const ( 194 // Data ... 195 Data ResultType = "Data" 196 // Metadata ... 197 Metadata ResultType = "Metadata" 198) 199 200// ScaleDirection enumerates the values for scale direction. 201type ScaleDirection string 202 203const ( 204 // ScaleDirectionDecrease ... 205 ScaleDirectionDecrease ScaleDirection = "Decrease" 206 // ScaleDirectionIncrease ... 207 ScaleDirectionIncrease ScaleDirection = "Increase" 208 // ScaleDirectionNone ... 209 ScaleDirectionNone ScaleDirection = "None" 210) 211 212// ScaleType enumerates the values for scale type. 213type ScaleType string 214 215const ( 216 // ChangeCount ... 217 ChangeCount ScaleType = "ChangeCount" 218 // ExactCount ... 219 ExactCount ScaleType = "ExactCount" 220 // PercentChangeCount ... 221 PercentChangeCount ScaleType = "PercentChangeCount" 222) 223 224// Sensitivity enumerates the values for sensitivity. 225type Sensitivity string 226 227const ( 228 // High ... 229 High Sensitivity = "High" 230 // Low ... 231 Low Sensitivity = "Low" 232 // Medium ... 233 Medium Sensitivity = "Medium" 234) 235 236// TimeAggregationOperator enumerates the values for time aggregation operator. 237type TimeAggregationOperator string 238 239const ( 240 // TimeAggregationOperatorAverage ... 241 TimeAggregationOperatorAverage TimeAggregationOperator = "Average" 242 // TimeAggregationOperatorLast ... 243 TimeAggregationOperatorLast TimeAggregationOperator = "Last" 244 // TimeAggregationOperatorMaximum ... 245 TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" 246 // TimeAggregationOperatorMinimum ... 247 TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" 248 // TimeAggregationOperatorTotal ... 249 TimeAggregationOperatorTotal TimeAggregationOperator = "Total" 250) 251 252// TimeAggregationType enumerates the values for time aggregation type. 253type TimeAggregationType string 254 255const ( 256 // TimeAggregationTypeAverage ... 257 TimeAggregationTypeAverage TimeAggregationType = "Average" 258 // TimeAggregationTypeCount ... 259 TimeAggregationTypeCount TimeAggregationType = "Count" 260 // TimeAggregationTypeMaximum ... 261 TimeAggregationTypeMaximum TimeAggregationType = "Maximum" 262 // TimeAggregationTypeMinimum ... 263 TimeAggregationTypeMinimum TimeAggregationType = "Minimum" 264 // TimeAggregationTypeTotal ... 265 TimeAggregationTypeTotal TimeAggregationType = "Total" 266) 267 268// Unit enumerates the values for unit. 269type Unit string 270 271const ( 272 // UnitBytes ... 273 UnitBytes Unit = "Bytes" 274 // UnitByteSeconds ... 275 UnitByteSeconds Unit = "ByteSeconds" 276 // UnitBytesPerSecond ... 277 UnitBytesPerSecond Unit = "BytesPerSecond" 278 // UnitCount ... 279 UnitCount Unit = "Count" 280 // UnitCountPerSecond ... 281 UnitCountPerSecond Unit = "CountPerSecond" 282 // UnitMilliSeconds ... 283 UnitMilliSeconds Unit = "MilliSeconds" 284 // UnitPercent ... 285 UnitPercent Unit = "Percent" 286 // UnitSeconds ... 287 UnitSeconds Unit = "Seconds" 288 // UnitUnspecified ... 289 UnitUnspecified Unit = "Unspecified" 290) 291 292// ActionGroup an Azure action group. 293type ActionGroup struct { 294 // GroupShortName - The short name of the action group. This will be used in SMS messages. 295 GroupShortName *string `json:"groupShortName,omitempty"` 296 // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. 297 Enabled *bool `json:"enabled,omitempty"` 298 // EmailReceivers - The list of email receivers that are part of this action group. 299 EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` 300 // SmsReceivers - The list of SMS receivers that are part of this action group. 301 SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` 302 // WebhookReceivers - The list of webhook receivers that are part of this action group. 303 WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` 304 // ItsmReceivers - The list of ITSM receivers that are part of this action group. 305 ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` 306 // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. 307 AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` 308 // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. 309 AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` 310 // VoiceReceivers - The list of voice receivers that are part of this action group. 311 VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` 312} 313 314// ActionGroupList a list of action groups. 315type ActionGroupList struct { 316 autorest.Response `json:"-"` 317 // Value - The list of action groups. 318 Value *[]ActionGroupResource `json:"value,omitempty"` 319 // NextLink - Provides the link to retrieve the next set of elements. 320 NextLink *string `json:"nextLink,omitempty"` 321} 322 323// ActionGroupPatch an Azure action group for patch operations. 324type ActionGroupPatch struct { 325 // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. 326 Enabled *bool `json:"enabled,omitempty"` 327} 328 329// ActionGroupPatchBody an action group object for the body of patch operations. 330type ActionGroupPatchBody struct { 331 // Tags - Resource tags 332 Tags map[string]*string `json:"tags"` 333 // ActionGroupPatch - The action group settings for an update operation. 334 *ActionGroupPatch `json:"properties,omitempty"` 335} 336 337// MarshalJSON is the custom marshaler for ActionGroupPatchBody. 338func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { 339 objectMap := make(map[string]interface{}) 340 if agpb.Tags != nil { 341 objectMap["tags"] = agpb.Tags 342 } 343 if agpb.ActionGroupPatch != nil { 344 objectMap["properties"] = agpb.ActionGroupPatch 345 } 346 return json.Marshal(objectMap) 347} 348 349// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. 350func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error { 351 var m map[string]*json.RawMessage 352 err := json.Unmarshal(body, &m) 353 if err != nil { 354 return err 355 } 356 for k, v := range m { 357 switch k { 358 case "tags": 359 if v != nil { 360 var tags map[string]*string 361 err = json.Unmarshal(*v, &tags) 362 if err != nil { 363 return err 364 } 365 agpb.Tags = tags 366 } 367 case "properties": 368 if v != nil { 369 var actionGroupPatch ActionGroupPatch 370 err = json.Unmarshal(*v, &actionGroupPatch) 371 if err != nil { 372 return err 373 } 374 agpb.ActionGroupPatch = &actionGroupPatch 375 } 376 } 377 } 378 379 return nil 380} 381 382// ActionGroupResource an action group resource. 383type ActionGroupResource struct { 384 autorest.Response `json:"-"` 385 // ActionGroup - The action groups properties of the resource. 386 *ActionGroup `json:"properties,omitempty"` 387 // ID - Azure resource Id 388 ID *string `json:"id,omitempty"` 389 // Name - Azure resource name 390 Name *string `json:"name,omitempty"` 391 // Type - Azure resource type 392 Type *string `json:"type,omitempty"` 393 // Location - Resource location 394 Location *string `json:"location,omitempty"` 395 // Tags - Resource tags 396 Tags map[string]*string `json:"tags"` 397} 398 399// MarshalJSON is the custom marshaler for ActionGroupResource. 400func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { 401 objectMap := make(map[string]interface{}) 402 if agr.ActionGroup != nil { 403 objectMap["properties"] = agr.ActionGroup 404 } 405 if agr.ID != nil { 406 objectMap["id"] = agr.ID 407 } 408 if agr.Name != nil { 409 objectMap["name"] = agr.Name 410 } 411 if agr.Type != nil { 412 objectMap["type"] = agr.Type 413 } 414 if agr.Location != nil { 415 objectMap["location"] = agr.Location 416 } 417 if agr.Tags != nil { 418 objectMap["tags"] = agr.Tags 419 } 420 return json.Marshal(objectMap) 421} 422 423// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. 424func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { 425 var m map[string]*json.RawMessage 426 err := json.Unmarshal(body, &m) 427 if err != nil { 428 return err 429 } 430 for k, v := range m { 431 switch k { 432 case "properties": 433 if v != nil { 434 var actionGroup ActionGroup 435 err = json.Unmarshal(*v, &actionGroup) 436 if err != nil { 437 return err 438 } 439 agr.ActionGroup = &actionGroup 440 } 441 case "id": 442 if v != nil { 443 var ID string 444 err = json.Unmarshal(*v, &ID) 445 if err != nil { 446 return err 447 } 448 agr.ID = &ID 449 } 450 case "name": 451 if v != nil { 452 var name string 453 err = json.Unmarshal(*v, &name) 454 if err != nil { 455 return err 456 } 457 agr.Name = &name 458 } 459 case "type": 460 if v != nil { 461 var typeVar string 462 err = json.Unmarshal(*v, &typeVar) 463 if err != nil { 464 return err 465 } 466 agr.Type = &typeVar 467 } 468 case "location": 469 if v != nil { 470 var location string 471 err = json.Unmarshal(*v, &location) 472 if err != nil { 473 return err 474 } 475 agr.Location = &location 476 } 477 case "tags": 478 if v != nil { 479 var tags map[string]*string 480 err = json.Unmarshal(*v, &tags) 481 if err != nil { 482 return err 483 } 484 agr.Tags = tags 485 } 486 } 487 } 488 489 return nil 490} 491 492// ActivityLogAlert an Azure activity log alert. 493type ActivityLogAlert struct { 494 // 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. 495 Scopes *[]string `json:"scopes,omitempty"` 496 // 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. 497 Enabled *bool `json:"enabled,omitempty"` 498 // Condition - The condition that will cause this alert to activate. 499 Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` 500 // Actions - The actions that will activate when the condition is met. 501 Actions *ActivityLogAlertActionList `json:"actions,omitempty"` 502 // Description - A description of this activity log alert. 503 Description *string `json:"description,omitempty"` 504} 505 506// ActivityLogAlertActionGroup a pointer to an Azure Action Group. 507type ActivityLogAlertActionGroup struct { 508 // ActionGroupID - The resourceId of the action group. This cannot be null or empty. 509 ActionGroupID *string `json:"actionGroupId,omitempty"` 510 // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. 511 WebhookProperties map[string]*string `json:"webhookProperties"` 512} 513 514// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. 515func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { 516 objectMap := make(map[string]interface{}) 517 if alaag.ActionGroupID != nil { 518 objectMap["actionGroupId"] = alaag.ActionGroupID 519 } 520 if alaag.WebhookProperties != nil { 521 objectMap["webhookProperties"] = alaag.WebhookProperties 522 } 523 return json.Marshal(objectMap) 524} 525 526// ActivityLogAlertActionList a list of activity log alert actions. 527type ActivityLogAlertActionList struct { 528 // ActionGroups - The list of activity log alerts. 529 ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` 530} 531 532// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member conditions are 533// met. 534type ActivityLogAlertAllOfCondition struct { 535 // AllOf - The list of activity log alert conditions. 536 AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` 537} 538 539// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log field and 540// value. 541type ActivityLogAlertLeafCondition struct { 542 // 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.'. 543 Field *string `json:"field,omitempty"` 544 // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. 545 Equals *string `json:"equals,omitempty"` 546} 547 548// ActivityLogAlertList a list of activity log alerts. 549type ActivityLogAlertList struct { 550 autorest.Response `json:"-"` 551 // Value - The list of activity log alerts. 552 Value *[]ActivityLogAlertResource `json:"value,omitempty"` 553 // NextLink - Provides the link to retrieve the next set of elements. 554 NextLink *string `json:"nextLink,omitempty"` 555} 556 557// ActivityLogAlertPatch an Azure activity log alert for patch operations. 558type ActivityLogAlertPatch struct { 559 // 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. 560 Enabled *bool `json:"enabled,omitempty"` 561} 562 563// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. 564type ActivityLogAlertPatchBody struct { 565 // Tags - Resource tags 566 Tags map[string]*string `json:"tags"` 567 // ActivityLogAlertPatch - The activity log alert settings for an update operation. 568 *ActivityLogAlertPatch `json:"properties,omitempty"` 569} 570 571// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. 572func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { 573 objectMap := make(map[string]interface{}) 574 if alapb.Tags != nil { 575 objectMap["tags"] = alapb.Tags 576 } 577 if alapb.ActivityLogAlertPatch != nil { 578 objectMap["properties"] = alapb.ActivityLogAlertPatch 579 } 580 return json.Marshal(objectMap) 581} 582 583// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. 584func (alapb *ActivityLogAlertPatchBody) UnmarshalJSON(body []byte) error { 585 var m map[string]*json.RawMessage 586 err := json.Unmarshal(body, &m) 587 if err != nil { 588 return err 589 } 590 for k, v := range m { 591 switch k { 592 case "tags": 593 if v != nil { 594 var tags map[string]*string 595 err = json.Unmarshal(*v, &tags) 596 if err != nil { 597 return err 598 } 599 alapb.Tags = tags 600 } 601 case "properties": 602 if v != nil { 603 var activityLogAlertPatch ActivityLogAlertPatch 604 err = json.Unmarshal(*v, &activityLogAlertPatch) 605 if err != nil { 606 return err 607 } 608 alapb.ActivityLogAlertPatch = &activityLogAlertPatch 609 } 610 } 611 } 612 613 return nil 614} 615 616// ActivityLogAlertResource an activity log alert resource. 617type ActivityLogAlertResource struct { 618 autorest.Response `json:"-"` 619 // ActivityLogAlert - The activity log alert properties of the resource. 620 *ActivityLogAlert `json:"properties,omitempty"` 621 // ID - Azure resource Id 622 ID *string `json:"id,omitempty"` 623 // Name - Azure resource name 624 Name *string `json:"name,omitempty"` 625 // Type - Azure resource type 626 Type *string `json:"type,omitempty"` 627 // Location - Resource location 628 Location *string `json:"location,omitempty"` 629 // Tags - Resource tags 630 Tags map[string]*string `json:"tags"` 631} 632 633// MarshalJSON is the custom marshaler for ActivityLogAlertResource. 634func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { 635 objectMap := make(map[string]interface{}) 636 if alar.ActivityLogAlert != nil { 637 objectMap["properties"] = alar.ActivityLogAlert 638 } 639 if alar.ID != nil { 640 objectMap["id"] = alar.ID 641 } 642 if alar.Name != nil { 643 objectMap["name"] = alar.Name 644 } 645 if alar.Type != nil { 646 objectMap["type"] = alar.Type 647 } 648 if alar.Location != nil { 649 objectMap["location"] = alar.Location 650 } 651 if alar.Tags != nil { 652 objectMap["tags"] = alar.Tags 653 } 654 return json.Marshal(objectMap) 655} 656 657// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. 658func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { 659 var m map[string]*json.RawMessage 660 err := json.Unmarshal(body, &m) 661 if err != nil { 662 return err 663 } 664 for k, v := range m { 665 switch k { 666 case "properties": 667 if v != nil { 668 var activityLogAlert ActivityLogAlert 669 err = json.Unmarshal(*v, &activityLogAlert) 670 if err != nil { 671 return err 672 } 673 alar.ActivityLogAlert = &activityLogAlert 674 } 675 case "id": 676 if v != nil { 677 var ID string 678 err = json.Unmarshal(*v, &ID) 679 if err != nil { 680 return err 681 } 682 alar.ID = &ID 683 } 684 case "name": 685 if v != nil { 686 var name string 687 err = json.Unmarshal(*v, &name) 688 if err != nil { 689 return err 690 } 691 alar.Name = &name 692 } 693 case "type": 694 if v != nil { 695 var typeVar string 696 err = json.Unmarshal(*v, &typeVar) 697 if err != nil { 698 return err 699 } 700 alar.Type = &typeVar 701 } 702 case "location": 703 if v != nil { 704 var location string 705 err = json.Unmarshal(*v, &location) 706 if err != nil { 707 return err 708 } 709 alar.Location = &location 710 } 711 case "tags": 712 if v != nil { 713 var tags map[string]*string 714 err = json.Unmarshal(*v, &tags) 715 if err != nil { 716 return err 717 } 718 alar.Tags = tags 719 } 720 } 721 } 722 723 return nil 724} 725 726// AlertRule an alert rule. 727type AlertRule struct { 728 // Name - the name of the alert rule. 729 Name *string `json:"name,omitempty"` 730 // Description - the description of the alert rule that will be included in the alert email. 731 Description *string `json:"description,omitempty"` 732 // IsEnabled - the flag that indicates whether the alert rule is enabled. 733 IsEnabled *bool `json:"isEnabled,omitempty"` 734 // Condition - the condition that results in the alert rule being activated. 735 Condition BasicRuleCondition `json:"condition,omitempty"` 736 // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. 737 Actions *[]BasicRuleAction `json:"actions,omitempty"` 738 // LastUpdatedTime - Last time the rule was updated in ISO8601 format. 739 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 740} 741 742// UnmarshalJSON is the custom unmarshaler for AlertRule struct. 743func (ar *AlertRule) UnmarshalJSON(body []byte) error { 744 var m map[string]*json.RawMessage 745 err := json.Unmarshal(body, &m) 746 if err != nil { 747 return err 748 } 749 for k, v := range m { 750 switch k { 751 case "name": 752 if v != nil { 753 var name string 754 err = json.Unmarshal(*v, &name) 755 if err != nil { 756 return err 757 } 758 ar.Name = &name 759 } 760 case "description": 761 if v != nil { 762 var description string 763 err = json.Unmarshal(*v, &description) 764 if err != nil { 765 return err 766 } 767 ar.Description = &description 768 } 769 case "isEnabled": 770 if v != nil { 771 var isEnabled bool 772 err = json.Unmarshal(*v, &isEnabled) 773 if err != nil { 774 return err 775 } 776 ar.IsEnabled = &isEnabled 777 } 778 case "condition": 779 if v != nil { 780 condition, err := unmarshalBasicRuleCondition(*v) 781 if err != nil { 782 return err 783 } 784 ar.Condition = condition 785 } 786 case "actions": 787 if v != nil { 788 actions, err := unmarshalBasicRuleActionArray(*v) 789 if err != nil { 790 return err 791 } 792 ar.Actions = &actions 793 } 794 case "lastUpdatedTime": 795 if v != nil { 796 var lastUpdatedTime date.Time 797 err = json.Unmarshal(*v, &lastUpdatedTime) 798 if err != nil { 799 return err 800 } 801 ar.LastUpdatedTime = &lastUpdatedTime 802 } 803 } 804 } 805 806 return nil 807} 808 809// AlertRuleResource the alert rule resource. 810type AlertRuleResource struct { 811 autorest.Response `json:"-"` 812 // AlertRule - The alert rule properties of the resource. 813 *AlertRule `json:"properties,omitempty"` 814 // ID - Azure resource Id 815 ID *string `json:"id,omitempty"` 816 // Name - Azure resource name 817 Name *string `json:"name,omitempty"` 818 // Type - Azure resource type 819 Type *string `json:"type,omitempty"` 820 // Location - Resource location 821 Location *string `json:"location,omitempty"` 822 // Tags - Resource tags 823 Tags map[string]*string `json:"tags"` 824} 825 826// MarshalJSON is the custom marshaler for AlertRuleResource. 827func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { 828 objectMap := make(map[string]interface{}) 829 if arr.AlertRule != nil { 830 objectMap["properties"] = arr.AlertRule 831 } 832 if arr.ID != nil { 833 objectMap["id"] = arr.ID 834 } 835 if arr.Name != nil { 836 objectMap["name"] = arr.Name 837 } 838 if arr.Type != nil { 839 objectMap["type"] = arr.Type 840 } 841 if arr.Location != nil { 842 objectMap["location"] = arr.Location 843 } 844 if arr.Tags != nil { 845 objectMap["tags"] = arr.Tags 846 } 847 return json.Marshal(objectMap) 848} 849 850// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. 851func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { 852 var m map[string]*json.RawMessage 853 err := json.Unmarshal(body, &m) 854 if err != nil { 855 return err 856 } 857 for k, v := range m { 858 switch k { 859 case "properties": 860 if v != nil { 861 var alertRule AlertRule 862 err = json.Unmarshal(*v, &alertRule) 863 if err != nil { 864 return err 865 } 866 arr.AlertRule = &alertRule 867 } 868 case "id": 869 if v != nil { 870 var ID string 871 err = json.Unmarshal(*v, &ID) 872 if err != nil { 873 return err 874 } 875 arr.ID = &ID 876 } 877 case "name": 878 if v != nil { 879 var name string 880 err = json.Unmarshal(*v, &name) 881 if err != nil { 882 return err 883 } 884 arr.Name = &name 885 } 886 case "type": 887 if v != nil { 888 var typeVar string 889 err = json.Unmarshal(*v, &typeVar) 890 if err != nil { 891 return err 892 } 893 arr.Type = &typeVar 894 } 895 case "location": 896 if v != nil { 897 var location string 898 err = json.Unmarshal(*v, &location) 899 if err != nil { 900 return err 901 } 902 arr.Location = &location 903 } 904 case "tags": 905 if v != nil { 906 var tags map[string]*string 907 err = json.Unmarshal(*v, &tags) 908 if err != nil { 909 return err 910 } 911 arr.Tags = tags 912 } 913 } 914 } 915 916 return nil 917} 918 919// AlertRuleResourceCollection represents a collection of alert rule resources. 920type AlertRuleResourceCollection struct { 921 autorest.Response `json:"-"` 922 // Value - the values for the alert rule resources. 923 Value *[]AlertRuleResource `json:"value,omitempty"` 924} 925 926// AlertRuleResourcePatch the alert rule object for patch operations. 927type AlertRuleResourcePatch struct { 928 // Tags - Resource tags 929 Tags map[string]*string `json:"tags"` 930 // AlertRule - The properties of an alert rule. 931 *AlertRule `json:"properties,omitempty"` 932} 933 934// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. 935func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { 936 objectMap := make(map[string]interface{}) 937 if arrp.Tags != nil { 938 objectMap["tags"] = arrp.Tags 939 } 940 if arrp.AlertRule != nil { 941 objectMap["properties"] = arrp.AlertRule 942 } 943 return json.Marshal(objectMap) 944} 945 946// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. 947func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error { 948 var m map[string]*json.RawMessage 949 err := json.Unmarshal(body, &m) 950 if err != nil { 951 return err 952 } 953 for k, v := range m { 954 switch k { 955 case "tags": 956 if v != nil { 957 var tags map[string]*string 958 err = json.Unmarshal(*v, &tags) 959 if err != nil { 960 return err 961 } 962 arrp.Tags = tags 963 } 964 case "properties": 965 if v != nil { 966 var alertRule AlertRule 967 err = json.Unmarshal(*v, &alertRule) 968 if err != nil { 969 return err 970 } 971 arrp.AlertRule = &alertRule 972 } 973 } 974 } 975 976 return nil 977} 978 979// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. 980type AutomationRunbookReceiver struct { 981 // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. 982 AutomationAccountID *string `json:"automationAccountId,omitempty"` 983 // RunbookName - The name for this runbook. 984 RunbookName *string `json:"runbookName,omitempty"` 985 // WebhookResourceID - The resource id for webhook linked to this runbook. 986 WebhookResourceID *string `json:"webhookResourceId,omitempty"` 987 // IsGlobalRunbook - Indicates whether this instance is global runbook. 988 IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` 989 // Name - Indicates name of the webhook. 990 Name *string `json:"name,omitempty"` 991 // ServiceURI - The URI where webhooks should be sent. 992 ServiceURI *string `json:"serviceUri,omitempty"` 993} 994 995// AutoscaleNotification autoscale notification. 996type AutoscaleNotification struct { 997 // Operation - the operation associated with the notification and its value must be "scale" 998 Operation *string `json:"operation,omitempty"` 999 // Email - the email notification. 1000 Email *EmailNotification `json:"email,omitempty"` 1001 // Webhooks - the collection of webhook notifications. 1002 Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` 1003} 1004 1005// AutoscaleProfile autoscale profile. 1006type AutoscaleProfile struct { 1007 // Name - the name of the profile. 1008 Name *string `json:"name,omitempty"` 1009 // Capacity - the number of instances that can be used during this profile. 1010 Capacity *ScaleCapacity `json:"capacity,omitempty"` 1011 // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. 1012 Rules *[]ScaleRule `json:"rules,omitempty"` 1013 // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. 1014 FixedDate *TimeWindow `json:"fixedDate,omitempty"` 1015 // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. 1016 Recurrence *Recurrence `json:"recurrence,omitempty"` 1017} 1018 1019// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a resource. 1020type AutoscaleSetting struct { 1021 // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. 1022 Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` 1023 // Notifications - the collection of notifications. 1024 Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` 1025 // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. 1026 Enabled *bool `json:"enabled,omitempty"` 1027 // Name - the name of the autoscale setting. 1028 Name *string `json:"name,omitempty"` 1029 // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. 1030 TargetResourceURI *string `json:"targetResourceUri,omitempty"` 1031} 1032 1033// AutoscaleSettingResource the autoscale setting resource. 1034type AutoscaleSettingResource struct { 1035 autorest.Response `json:"-"` 1036 // AutoscaleSetting - The autoscale setting of the resource. 1037 *AutoscaleSetting `json:"properties,omitempty"` 1038 // ID - Azure resource Id 1039 ID *string `json:"id,omitempty"` 1040 // Name - Azure resource name 1041 Name *string `json:"name,omitempty"` 1042 // Type - Azure resource type 1043 Type *string `json:"type,omitempty"` 1044 // Location - Resource location 1045 Location *string `json:"location,omitempty"` 1046 // Tags - Resource tags 1047 Tags map[string]*string `json:"tags"` 1048} 1049 1050// MarshalJSON is the custom marshaler for AutoscaleSettingResource. 1051func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { 1052 objectMap := make(map[string]interface{}) 1053 if asr.AutoscaleSetting != nil { 1054 objectMap["properties"] = asr.AutoscaleSetting 1055 } 1056 if asr.ID != nil { 1057 objectMap["id"] = asr.ID 1058 } 1059 if asr.Name != nil { 1060 objectMap["name"] = asr.Name 1061 } 1062 if asr.Type != nil { 1063 objectMap["type"] = asr.Type 1064 } 1065 if asr.Location != nil { 1066 objectMap["location"] = asr.Location 1067 } 1068 if asr.Tags != nil { 1069 objectMap["tags"] = asr.Tags 1070 } 1071 return json.Marshal(objectMap) 1072} 1073 1074// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. 1075func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { 1076 var m map[string]*json.RawMessage 1077 err := json.Unmarshal(body, &m) 1078 if err != nil { 1079 return err 1080 } 1081 for k, v := range m { 1082 switch k { 1083 case "properties": 1084 if v != nil { 1085 var autoscaleSetting AutoscaleSetting 1086 err = json.Unmarshal(*v, &autoscaleSetting) 1087 if err != nil { 1088 return err 1089 } 1090 asr.AutoscaleSetting = &autoscaleSetting 1091 } 1092 case "id": 1093 if v != nil { 1094 var ID string 1095 err = json.Unmarshal(*v, &ID) 1096 if err != nil { 1097 return err 1098 } 1099 asr.ID = &ID 1100 } 1101 case "name": 1102 if v != nil { 1103 var name string 1104 err = json.Unmarshal(*v, &name) 1105 if err != nil { 1106 return err 1107 } 1108 asr.Name = &name 1109 } 1110 case "type": 1111 if v != nil { 1112 var typeVar string 1113 err = json.Unmarshal(*v, &typeVar) 1114 if err != nil { 1115 return err 1116 } 1117 asr.Type = &typeVar 1118 } 1119 case "location": 1120 if v != nil { 1121 var location string 1122 err = json.Unmarshal(*v, &location) 1123 if err != nil { 1124 return err 1125 } 1126 asr.Location = &location 1127 } 1128 case "tags": 1129 if v != nil { 1130 var tags map[string]*string 1131 err = json.Unmarshal(*v, &tags) 1132 if err != nil { 1133 return err 1134 } 1135 asr.Tags = tags 1136 } 1137 } 1138 } 1139 1140 return nil 1141} 1142 1143// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. 1144type AutoscaleSettingResourceCollection struct { 1145 autorest.Response `json:"-"` 1146 // Value - the values for the autoscale setting resources. 1147 Value *[]AutoscaleSettingResource `json:"value,omitempty"` 1148 // NextLink - URL to get the next set of results. 1149 NextLink *string `json:"nextLink,omitempty"` 1150} 1151 1152// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of AutoscaleSettingResource 1153// values. 1154type AutoscaleSettingResourceCollectionIterator struct { 1155 i int 1156 page AutoscaleSettingResourceCollectionPage 1157} 1158 1159// Next advances to the next value. If there was an error making 1160// the request the iterator does not advance and the error is returned. 1161func (iter *AutoscaleSettingResourceCollectionIterator) Next() error { 1162 iter.i++ 1163 if iter.i < len(iter.page.Values()) { 1164 return nil 1165 } 1166 err := iter.page.Next() 1167 if err != nil { 1168 iter.i-- 1169 return err 1170 } 1171 iter.i = 0 1172 return nil 1173} 1174 1175// NotDone returns true if the enumeration should be started or is not yet complete. 1176func (iter AutoscaleSettingResourceCollectionIterator) NotDone() bool { 1177 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1178} 1179 1180// Response returns the raw server response from the last page request. 1181func (iter AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { 1182 return iter.page.Response() 1183} 1184 1185// Value returns the current value or a zero-initialized value if the 1186// iterator has advanced beyond the end of the collection. 1187func (iter AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { 1188 if !iter.page.NotDone() { 1189 return AutoscaleSettingResource{} 1190 } 1191 return iter.page.Values()[iter.i] 1192} 1193 1194// IsEmpty returns true if the ListResult contains no values. 1195func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { 1196 return asrc.Value == nil || len(*asrc.Value) == 0 1197} 1198 1199// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. 1200// It returns nil if no more results exist. 1201func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer() (*http.Request, error) { 1202 if asrc.NextLink == nil || len(to.String(asrc.NextLink)) < 1 { 1203 return nil, nil 1204 } 1205 return autorest.Prepare(&http.Request{}, 1206 autorest.AsJSON(), 1207 autorest.AsGet(), 1208 autorest.WithBaseURL(to.String(asrc.NextLink))) 1209} 1210 1211// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. 1212type AutoscaleSettingResourceCollectionPage struct { 1213 fn func(AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) 1214 asrc AutoscaleSettingResourceCollection 1215} 1216 1217// Next advances to the next page of values. If there was an error making 1218// the request the page does not advance and the error is returned. 1219func (page *AutoscaleSettingResourceCollectionPage) Next() error { 1220 next, err := page.fn(page.asrc) 1221 if err != nil { 1222 return err 1223 } 1224 page.asrc = next 1225 return nil 1226} 1227 1228// NotDone returns true if the page enumeration should be started or is not yet complete. 1229func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { 1230 return !page.asrc.IsEmpty() 1231} 1232 1233// Response returns the raw server response from the last page request. 1234func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { 1235 return page.asrc 1236} 1237 1238// Values returns the slice of values for the current page or nil if there are no values. 1239func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { 1240 if page.asrc.IsEmpty() { 1241 return nil 1242 } 1243 return *page.asrc.Value 1244} 1245 1246// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. 1247type AutoscaleSettingResourcePatch struct { 1248 // Tags - Resource tags 1249 Tags map[string]*string `json:"tags"` 1250 // AutoscaleSetting - The autoscale setting properties of the update operation. 1251 *AutoscaleSetting `json:"properties,omitempty"` 1252} 1253 1254// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. 1255func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { 1256 objectMap := make(map[string]interface{}) 1257 if asrp.Tags != nil { 1258 objectMap["tags"] = asrp.Tags 1259 } 1260 if asrp.AutoscaleSetting != nil { 1261 objectMap["properties"] = asrp.AutoscaleSetting 1262 } 1263 return json.Marshal(objectMap) 1264} 1265 1266// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. 1267func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error { 1268 var m map[string]*json.RawMessage 1269 err := json.Unmarshal(body, &m) 1270 if err != nil { 1271 return err 1272 } 1273 for k, v := range m { 1274 switch k { 1275 case "tags": 1276 if v != nil { 1277 var tags map[string]*string 1278 err = json.Unmarshal(*v, &tags) 1279 if err != nil { 1280 return err 1281 } 1282 asrp.Tags = tags 1283 } 1284 case "properties": 1285 if v != nil { 1286 var autoscaleSetting AutoscaleSetting 1287 err = json.Unmarshal(*v, &autoscaleSetting) 1288 if err != nil { 1289 return err 1290 } 1291 asrp.AutoscaleSetting = &autoscaleSetting 1292 } 1293 } 1294 } 1295 1296 return nil 1297} 1298 1299// AzureAppPushReceiver the Azure mobile App push notification receiver. 1300type AzureAppPushReceiver struct { 1301 // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. 1302 Name *string `json:"name,omitempty"` 1303 // EmailAddress - The email address registered for the Azure mobile app. 1304 EmailAddress *string `json:"emailAddress,omitempty"` 1305} 1306 1307// Baseline the baseline values for a single sensitivity value. 1308type Baseline struct { 1309 // Sensitivity - the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' 1310 Sensitivity Sensitivity `json:"sensitivity,omitempty"` 1311 // LowThresholds - The low thresholds of the baseline. 1312 LowThresholds *[]float64 `json:"lowThresholds,omitempty"` 1313 // HighThresholds - The high thresholds of the baseline. 1314 HighThresholds *[]float64 `json:"highThresholds,omitempty"` 1315} 1316 1317// BaselineMetadataValue represents a baseline metadata value. 1318type BaselineMetadataValue struct { 1319 // Name - the name of the metadata. 1320 Name *LocalizableString `json:"name,omitempty"` 1321 // Value - the value of the metadata. 1322 Value *string `json:"value,omitempty"` 1323} 1324 1325// BaselineProperties the baseline properties class. 1326type BaselineProperties struct { 1327 // Timespan - The timespan for which the data was retrieved. Its value consists of two datatimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. 1328 Timespan *string `json:"timespan,omitempty"` 1329 // 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. 1330 Interval *string `json:"interval,omitempty"` 1331 // Aggregation - The aggregation type of the metric. 1332 Aggregation *string `json:"aggregation,omitempty"` 1333 // Timestamps - the array of timestamps of the baselines. 1334 Timestamps *[]date.Time `json:"timestamps,omitempty"` 1335 // Baseline - the baseline values for each sensitivity. 1336 Baseline *[]Baseline `json:"baseline,omitempty"` 1337 // Metadata - the baseline metadata values. 1338 Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` 1339} 1340 1341// BaselineResponse the response to a baseline query. 1342type BaselineResponse struct { 1343 autorest.Response `json:"-"` 1344 // ID - the metric baseline Id. 1345 ID *string `json:"id,omitempty"` 1346 // Type - the resource type of the baseline resource. 1347 Type *string `json:"type,omitempty"` 1348 // Name - the name and the display name of the metric, i.e. it is localizable string. 1349 Name *LocalizableString `json:"name,omitempty"` 1350 // BaselineProperties - the properties of the baseline. 1351 *BaselineProperties `json:"properties,omitempty"` 1352} 1353 1354// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. 1355func (br *BaselineResponse) UnmarshalJSON(body []byte) error { 1356 var m map[string]*json.RawMessage 1357 err := json.Unmarshal(body, &m) 1358 if err != nil { 1359 return err 1360 } 1361 for k, v := range m { 1362 switch k { 1363 case "id": 1364 if v != nil { 1365 var ID string 1366 err = json.Unmarshal(*v, &ID) 1367 if err != nil { 1368 return err 1369 } 1370 br.ID = &ID 1371 } 1372 case "type": 1373 if v != nil { 1374 var typeVar string 1375 err = json.Unmarshal(*v, &typeVar) 1376 if err != nil { 1377 return err 1378 } 1379 br.Type = &typeVar 1380 } 1381 case "name": 1382 if v != nil { 1383 var name LocalizableString 1384 err = json.Unmarshal(*v, &name) 1385 if err != nil { 1386 return err 1387 } 1388 br.Name = &name 1389 } 1390 case "properties": 1391 if v != nil { 1392 var baselineProperties BaselineProperties 1393 err = json.Unmarshal(*v, &baselineProperties) 1394 if err != nil { 1395 return err 1396 } 1397 br.BaselineProperties = &baselineProperties 1398 } 1399 } 1400 } 1401 1402 return nil 1403} 1404 1405// CalculateBaselineResponse the response to a calcualte baseline call. 1406type CalculateBaselineResponse struct { 1407 autorest.Response `json:"-"` 1408 // Type - the resource type of the baseline resource. 1409 Type *string `json:"type,omitempty"` 1410 // Timestamps - the array of timestamps of the baselines. 1411 Timestamps *[]date.Time `json:"timestamps,omitempty"` 1412 // Baseline - the baseline values for each sensitivity. 1413 Baseline *[]Baseline `json:"baseline,omitempty"` 1414} 1415 1416// DiagnosticSettings the diagnostic settings. 1417type DiagnosticSettings struct { 1418 // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. 1419 StorageAccountID *string `json:"storageAccountId,omitempty"` 1420 // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. 1421 EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` 1422 // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. 1423 EventHubName *string `json:"eventHubName,omitempty"` 1424 // Metrics - the list of metric settings. 1425 Metrics *[]MetricSettings `json:"metrics,omitempty"` 1426 // Logs - the list of logs settings. 1427 Logs *[]LogSettings `json:"logs,omitempty"` 1428 // WorkspaceID - The workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 1429 WorkspaceID *string `json:"workspaceId,omitempty"` 1430} 1431 1432// DiagnosticSettingsCategory the diagnostic settings Category. 1433type DiagnosticSettingsCategory struct { 1434 // CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs' 1435 CategoryType CategoryType `json:"categoryType,omitempty"` 1436} 1437 1438// DiagnosticSettingsCategoryResource the diagnostic settings category resource. 1439type DiagnosticSettingsCategoryResource struct { 1440 autorest.Response `json:"-"` 1441 *DiagnosticSettingsCategory `json:"properties,omitempty"` 1442 // ID - Azure resource Id 1443 ID *string `json:"id,omitempty"` 1444 // Name - Azure resource name 1445 Name *string `json:"name,omitempty"` 1446 // Type - Azure resource type 1447 Type *string `json:"type,omitempty"` 1448} 1449 1450// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. 1451func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error { 1452 var m map[string]*json.RawMessage 1453 err := json.Unmarshal(body, &m) 1454 if err != nil { 1455 return err 1456 } 1457 for k, v := range m { 1458 switch k { 1459 case "properties": 1460 if v != nil { 1461 var diagnosticSettingsCategory DiagnosticSettingsCategory 1462 err = json.Unmarshal(*v, &diagnosticSettingsCategory) 1463 if err != nil { 1464 return err 1465 } 1466 dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory 1467 } 1468 case "id": 1469 if v != nil { 1470 var ID string 1471 err = json.Unmarshal(*v, &ID) 1472 if err != nil { 1473 return err 1474 } 1475 dscr.ID = &ID 1476 } 1477 case "name": 1478 if v != nil { 1479 var name string 1480 err = json.Unmarshal(*v, &name) 1481 if err != nil { 1482 return err 1483 } 1484 dscr.Name = &name 1485 } 1486 case "type": 1487 if v != nil { 1488 var typeVar string 1489 err = json.Unmarshal(*v, &typeVar) 1490 if err != nil { 1491 return err 1492 } 1493 dscr.Type = &typeVar 1494 } 1495 } 1496 } 1497 1498 return nil 1499} 1500 1501// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category resources. 1502type DiagnosticSettingsCategoryResourceCollection struct { 1503 autorest.Response `json:"-"` 1504 // Value - The collection of diagnostic settings category resources. 1505 Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` 1506} 1507 1508// DiagnosticSettingsResource the diagnostic setting resource. 1509type DiagnosticSettingsResource struct { 1510 autorest.Response `json:"-"` 1511 *DiagnosticSettings `json:"properties,omitempty"` 1512 // ID - Azure resource Id 1513 ID *string `json:"id,omitempty"` 1514 // Name - Azure resource name 1515 Name *string `json:"name,omitempty"` 1516 // Type - Azure resource type 1517 Type *string `json:"type,omitempty"` 1518} 1519 1520// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. 1521func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error { 1522 var m map[string]*json.RawMessage 1523 err := json.Unmarshal(body, &m) 1524 if err != nil { 1525 return err 1526 } 1527 for k, v := range m { 1528 switch k { 1529 case "properties": 1530 if v != nil { 1531 var diagnosticSettings DiagnosticSettings 1532 err = json.Unmarshal(*v, &diagnosticSettings) 1533 if err != nil { 1534 return err 1535 } 1536 dsr.DiagnosticSettings = &diagnosticSettings 1537 } 1538 case "id": 1539 if v != nil { 1540 var ID string 1541 err = json.Unmarshal(*v, &ID) 1542 if err != nil { 1543 return err 1544 } 1545 dsr.ID = &ID 1546 } 1547 case "name": 1548 if v != nil { 1549 var name string 1550 err = json.Unmarshal(*v, &name) 1551 if err != nil { 1552 return err 1553 } 1554 dsr.Name = &name 1555 } 1556 case "type": 1557 if v != nil { 1558 var typeVar string 1559 err = json.Unmarshal(*v, &typeVar) 1560 if err != nil { 1561 return err 1562 } 1563 dsr.Type = &typeVar 1564 } 1565 } 1566 } 1567 1568 return nil 1569} 1570 1571// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. 1572type DiagnosticSettingsResourceCollection struct { 1573 autorest.Response `json:"-"` 1574 // Value - The collection of diagnostic settings resources;. 1575 Value *[]DiagnosticSettingsResource `json:"value,omitempty"` 1576} 1577 1578// EmailNotification email notification of an autoscale event. 1579type EmailNotification struct { 1580 // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. 1581 SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` 1582 // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. 1583 SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` 1584 // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. 1585 CustomEmails *[]string `json:"customEmails,omitempty"` 1586} 1587 1588// EmailReceiver an email receiver. 1589type EmailReceiver struct { 1590 // Name - The name of the email receiver. Names must be unique across all receivers within an action group. 1591 Name *string `json:"name,omitempty"` 1592 // EmailAddress - The email address of this receiver. 1593 EmailAddress *string `json:"emailAddress,omitempty"` 1594 // Status - The receiver status of the e-mail. Possible values include: 'NotSpecified', 'Enabled', 'Disabled' 1595 Status ReceiverStatus `json:"status,omitempty"` 1596} 1597 1598// EnableRequest describes a receiver that should be resubscribed. 1599type EnableRequest struct { 1600 // ReceiverName - The name of the receiver to resubscribe. 1601 ReceiverName *string `json:"receiverName,omitempty"` 1602} 1603 1604// ErrorResponse describes the format of Error response. 1605type ErrorResponse struct { 1606 // Code - Error code 1607 Code *string `json:"code,omitempty"` 1608 // Message - Error message indicating why the operation failed. 1609 Message *string `json:"message,omitempty"` 1610} 1611 1612// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, 1613// Security, ServiceHealth, Alert, Recommendation, Policy. 1614type EventCategoryCollection struct { 1615 autorest.Response `json:"-"` 1616 // Value - the list that includes the Azure event categories. 1617 Value *[]LocalizableString `json:"value,omitempty"` 1618} 1619 1620// EventData the Azure event log entries are of type EventData 1621type EventData struct { 1622 Authorization *SenderAuthorization `json:"authorization,omitempty"` 1623 // Claims - key value pairs to identify ARM permissions. 1624 Claims map[string]*string `json:"claims"` 1625 // Caller - the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. 1626 Caller *string `json:"caller,omitempty"` 1627 // Description - the description of the event. 1628 Description *string `json:"description,omitempty"` 1629 // ID - the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. 1630 ID *string `json:"id,omitempty"` 1631 // EventDataID - the event data Id. This is a unique identifier for an event. 1632 EventDataID *string `json:"eventDataId,omitempty"` 1633 // CorrelationID - the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. 1634 CorrelationID *string `json:"correlationId,omitempty"` 1635 // EventName - the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. 1636 EventName *LocalizableString `json:"eventName,omitempty"` 1637 // Category - the event category. 1638 Category *LocalizableString `json:"category,omitempty"` 1639 // HTTPRequest - the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). 1640 HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` 1641 // Level - the event level. Possible values include: 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' 1642 Level EventLevel `json:"level,omitempty"` 1643 // ResourceGroupName - the resource group name of the impacted resource. 1644 ResourceGroupName *string `json:"resourceGroupName,omitempty"` 1645 // ResourceProviderName - the resource provider name of the impacted resource. 1646 ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` 1647 // ResourceID - the resource uri that uniquely identifies the resource that caused this event. 1648 ResourceID *string `json:"resourceId,omitempty"` 1649 // ResourceType - the resource type 1650 ResourceType *LocalizableString `json:"resourceType,omitempty"` 1651 // OperationID - It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. 1652 OperationID *string `json:"operationId,omitempty"` 1653 // OperationName - the operation name. 1654 OperationName *LocalizableString `json:"operationName,omitempty"` 1655 // Properties - the set of <Key, Value> pairs (usually a Dictionary<String, String>) that includes details about the event. 1656 Properties map[string]*string `json:"properties"` 1657 // Status - a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. 1658 Status *LocalizableString `json:"status,omitempty"` 1659 // SubStatus - the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) 1660 SubStatus *LocalizableString `json:"subStatus,omitempty"` 1661 // EventTimestamp - the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. 1662 EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` 1663 // SubmissionTimestamp - the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. 1664 SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` 1665 // SubscriptionID - the Azure subscription Id usually a GUID. 1666 SubscriptionID *string `json:"subscriptionId,omitempty"` 1667 // TenantID - the Azure tenant Id 1668 TenantID *string `json:"tenantId,omitempty"` 1669} 1670 1671// MarshalJSON is the custom marshaler for EventData. 1672func (ed EventData) MarshalJSON() ([]byte, error) { 1673 objectMap := make(map[string]interface{}) 1674 if ed.Authorization != nil { 1675 objectMap["authorization"] = ed.Authorization 1676 } 1677 if ed.Claims != nil { 1678 objectMap["claims"] = ed.Claims 1679 } 1680 if ed.Caller != nil { 1681 objectMap["caller"] = ed.Caller 1682 } 1683 if ed.Description != nil { 1684 objectMap["description"] = ed.Description 1685 } 1686 if ed.ID != nil { 1687 objectMap["id"] = ed.ID 1688 } 1689 if ed.EventDataID != nil { 1690 objectMap["eventDataId"] = ed.EventDataID 1691 } 1692 if ed.CorrelationID != nil { 1693 objectMap["correlationId"] = ed.CorrelationID 1694 } 1695 if ed.EventName != nil { 1696 objectMap["eventName"] = ed.EventName 1697 } 1698 if ed.Category != nil { 1699 objectMap["category"] = ed.Category 1700 } 1701 if ed.HTTPRequest != nil { 1702 objectMap["httpRequest"] = ed.HTTPRequest 1703 } 1704 objectMap["level"] = ed.Level 1705 if ed.ResourceGroupName != nil { 1706 objectMap["resourceGroupName"] = ed.ResourceGroupName 1707 } 1708 if ed.ResourceProviderName != nil { 1709 objectMap["resourceProviderName"] = ed.ResourceProviderName 1710 } 1711 if ed.ResourceID != nil { 1712 objectMap["resourceId"] = ed.ResourceID 1713 } 1714 if ed.ResourceType != nil { 1715 objectMap["resourceType"] = ed.ResourceType 1716 } 1717 if ed.OperationID != nil { 1718 objectMap["operationId"] = ed.OperationID 1719 } 1720 if ed.OperationName != nil { 1721 objectMap["operationName"] = ed.OperationName 1722 } 1723 if ed.Properties != nil { 1724 objectMap["properties"] = ed.Properties 1725 } 1726 if ed.Status != nil { 1727 objectMap["status"] = ed.Status 1728 } 1729 if ed.SubStatus != nil { 1730 objectMap["subStatus"] = ed.SubStatus 1731 } 1732 if ed.EventTimestamp != nil { 1733 objectMap["eventTimestamp"] = ed.EventTimestamp 1734 } 1735 if ed.SubmissionTimestamp != nil { 1736 objectMap["submissionTimestamp"] = ed.SubmissionTimestamp 1737 } 1738 if ed.SubscriptionID != nil { 1739 objectMap["subscriptionId"] = ed.SubscriptionID 1740 } 1741 if ed.TenantID != nil { 1742 objectMap["tenantId"] = ed.TenantID 1743 } 1744 return json.Marshal(objectMap) 1745} 1746 1747// EventDataCollection represents collection of events. 1748type EventDataCollection struct { 1749 autorest.Response `json:"-"` 1750 // Value - this list that includes the Azure audit logs. 1751 Value *[]EventData `json:"value,omitempty"` 1752 // NextLink - Provides the link to retrieve the next set of events. 1753 NextLink *string `json:"nextLink,omitempty"` 1754} 1755 1756// EventDataCollectionIterator provides access to a complete listing of EventData values. 1757type EventDataCollectionIterator struct { 1758 i int 1759 page EventDataCollectionPage 1760} 1761 1762// Next advances to the next value. If there was an error making 1763// the request the iterator does not advance and the error is returned. 1764func (iter *EventDataCollectionIterator) Next() error { 1765 iter.i++ 1766 if iter.i < len(iter.page.Values()) { 1767 return nil 1768 } 1769 err := iter.page.Next() 1770 if err != nil { 1771 iter.i-- 1772 return err 1773 } 1774 iter.i = 0 1775 return nil 1776} 1777 1778// NotDone returns true if the enumeration should be started or is not yet complete. 1779func (iter EventDataCollectionIterator) NotDone() bool { 1780 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1781} 1782 1783// Response returns the raw server response from the last page request. 1784func (iter EventDataCollectionIterator) Response() EventDataCollection { 1785 return iter.page.Response() 1786} 1787 1788// Value returns the current value or a zero-initialized value if the 1789// iterator has advanced beyond the end of the collection. 1790func (iter EventDataCollectionIterator) Value() EventData { 1791 if !iter.page.NotDone() { 1792 return EventData{} 1793 } 1794 return iter.page.Values()[iter.i] 1795} 1796 1797// IsEmpty returns true if the ListResult contains no values. 1798func (edc EventDataCollection) IsEmpty() bool { 1799 return edc.Value == nil || len(*edc.Value) == 0 1800} 1801 1802// eventDataCollectionPreparer prepares a request to retrieve the next set of results. 1803// It returns nil if no more results exist. 1804func (edc EventDataCollection) eventDataCollectionPreparer() (*http.Request, error) { 1805 if edc.NextLink == nil || len(to.String(edc.NextLink)) < 1 { 1806 return nil, nil 1807 } 1808 return autorest.Prepare(&http.Request{}, 1809 autorest.AsJSON(), 1810 autorest.AsGet(), 1811 autorest.WithBaseURL(to.String(edc.NextLink))) 1812} 1813 1814// EventDataCollectionPage contains a page of EventData values. 1815type EventDataCollectionPage struct { 1816 fn func(EventDataCollection) (EventDataCollection, error) 1817 edc EventDataCollection 1818} 1819 1820// Next advances to the next page of values. If there was an error making 1821// the request the page does not advance and the error is returned. 1822func (page *EventDataCollectionPage) Next() error { 1823 next, err := page.fn(page.edc) 1824 if err != nil { 1825 return err 1826 } 1827 page.edc = next 1828 return nil 1829} 1830 1831// NotDone returns true if the page enumeration should be started or is not yet complete. 1832func (page EventDataCollectionPage) NotDone() bool { 1833 return !page.edc.IsEmpty() 1834} 1835 1836// Response returns the raw server response from the last page request. 1837func (page EventDataCollectionPage) Response() EventDataCollection { 1838 return page.edc 1839} 1840 1841// Values returns the slice of values for the current page or nil if there are no values. 1842func (page EventDataCollectionPage) Values() []EventData { 1843 if page.edc.IsEmpty() { 1844 return nil 1845 } 1846 return *page.edc.Value 1847} 1848 1849// HTTPRequestInfo the Http request info. 1850type HTTPRequestInfo struct { 1851 // ClientRequestID - the client request id. 1852 ClientRequestID *string `json:"clientRequestId,omitempty"` 1853 // ClientIPAddress - the client Ip Address 1854 ClientIPAddress *string `json:"clientIpAddress,omitempty"` 1855 // Method - the Http request method. 1856 Method *string `json:"method,omitempty"` 1857 // URI - the Uri. 1858 URI *string `json:"uri,omitempty"` 1859} 1860 1861// Incident an alert incident indicates the activation status of an alert rule. 1862type Incident struct { 1863 autorest.Response `json:"-"` 1864 // Name - Incident name. 1865 Name *string `json:"name,omitempty"` 1866 // RuleName - Rule name that is associated with the incident. 1867 RuleName *string `json:"ruleName,omitempty"` 1868 // IsActive - A boolean to indicate whether the incident is active or resolved. 1869 IsActive *bool `json:"isActive,omitempty"` 1870 // ActivatedTime - The time at which the incident was activated in ISO8601 format. 1871 ActivatedTime *date.Time `json:"activatedTime,omitempty"` 1872 // ResolvedTime - The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. 1873 ResolvedTime *date.Time `json:"resolvedTime,omitempty"` 1874} 1875 1876// IncidentListResult the List incidents operation response. 1877type IncidentListResult struct { 1878 autorest.Response `json:"-"` 1879 // Value - the incident collection. 1880 Value *[]Incident `json:"value,omitempty"` 1881} 1882 1883// ItsmReceiver an Itsm receiver. 1884type ItsmReceiver struct { 1885 // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. 1886 Name *string `json:"name,omitempty"` 1887 // WorkspaceID - OMS LA instance identifier. 1888 WorkspaceID *string `json:"workspaceId,omitempty"` 1889 // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. 1890 ConnectionID *string `json:"connectionId,omitempty"` 1891 // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. 1892 TicketConfiguration *string `json:"ticketConfiguration,omitempty"` 1893 // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' 1894 Region *string `json:"region,omitempty"` 1895} 1896 1897// LocalizableString the localizable string class. 1898type LocalizableString struct { 1899 // Value - the invariant value. 1900 Value *string `json:"value,omitempty"` 1901 // LocalizedValue - the locale specific value. 1902 LocalizedValue *string `json:"localizedValue,omitempty"` 1903} 1904 1905// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. 1906type LocationThresholdRuleCondition struct { 1907 // 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. 1908 WindowSize *string `json:"windowSize,omitempty"` 1909 // FailedLocationCount - the number of locations that must fail to activate the alert. 1910 FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` 1911 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 1912 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 1913 // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 1914 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 1915} 1916 1917// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. 1918func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { 1919 ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition 1920 objectMap := make(map[string]interface{}) 1921 if ltrc.WindowSize != nil { 1922 objectMap["windowSize"] = ltrc.WindowSize 1923 } 1924 if ltrc.FailedLocationCount != nil { 1925 objectMap["failedLocationCount"] = ltrc.FailedLocationCount 1926 } 1927 objectMap["dataSource"] = ltrc.DataSource 1928 objectMap["odata.type"] = ltrc.OdataType 1929 return json.Marshal(objectMap) 1930} 1931 1932// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 1933func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 1934 return nil, false 1935} 1936 1937// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 1938func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 1939 return <rc, true 1940} 1941 1942// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 1943func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 1944 return nil, false 1945} 1946 1947// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 1948func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { 1949 return nil, false 1950} 1951 1952// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 1953func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 1954 return <rc, true 1955} 1956 1957// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. 1958func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error { 1959 var m map[string]*json.RawMessage 1960 err := json.Unmarshal(body, &m) 1961 if err != nil { 1962 return err 1963 } 1964 for k, v := range m { 1965 switch k { 1966 case "windowSize": 1967 if v != nil { 1968 var windowSize string 1969 err = json.Unmarshal(*v, &windowSize) 1970 if err != nil { 1971 return err 1972 } 1973 ltrc.WindowSize = &windowSize 1974 } 1975 case "failedLocationCount": 1976 if v != nil { 1977 var failedLocationCount int32 1978 err = json.Unmarshal(*v, &failedLocationCount) 1979 if err != nil { 1980 return err 1981 } 1982 ltrc.FailedLocationCount = &failedLocationCount 1983 } 1984 case "dataSource": 1985 if v != nil { 1986 dataSource, err := unmarshalBasicRuleDataSource(*v) 1987 if err != nil { 1988 return err 1989 } 1990 ltrc.DataSource = dataSource 1991 } 1992 case "odata.type": 1993 if v != nil { 1994 var odataType OdataTypeBasicRuleCondition 1995 err = json.Unmarshal(*v, &odataType) 1996 if err != nil { 1997 return err 1998 } 1999 ltrc.OdataType = odataType 2000 } 2001 } 2002 } 2003 2004 return nil 2005} 2006 2007// LogProfileCollection represents a collection of log profiles. 2008type LogProfileCollection struct { 2009 autorest.Response `json:"-"` 2010 // Value - the values of the log profiles. 2011 Value *[]LogProfileResource `json:"value,omitempty"` 2012} 2013 2014// LogProfileProperties the log profile properties. 2015type LogProfileProperties struct { 2016 // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. 2017 StorageAccountID *string `json:"storageAccountId,omitempty"` 2018 // 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}'. 2019 ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` 2020 // 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. 2021 Locations *[]string `json:"locations,omitempty"` 2022 // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' 2023 Categories *[]string `json:"categories,omitempty"` 2024 // RetentionPolicy - the retention policy for the events in the log. 2025 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 2026} 2027 2028// LogProfileResource the log profile resource. 2029type LogProfileResource struct { 2030 autorest.Response `json:"-"` 2031 // LogProfileProperties - The log profile properties of the resource. 2032 *LogProfileProperties `json:"properties,omitempty"` 2033 // ID - Azure resource Id 2034 ID *string `json:"id,omitempty"` 2035 // Name - Azure resource name 2036 Name *string `json:"name,omitempty"` 2037 // Type - Azure resource type 2038 Type *string `json:"type,omitempty"` 2039 // Location - Resource location 2040 Location *string `json:"location,omitempty"` 2041 // Tags - Resource tags 2042 Tags map[string]*string `json:"tags"` 2043} 2044 2045// MarshalJSON is the custom marshaler for LogProfileResource. 2046func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { 2047 objectMap := make(map[string]interface{}) 2048 if lpr.LogProfileProperties != nil { 2049 objectMap["properties"] = lpr.LogProfileProperties 2050 } 2051 if lpr.ID != nil { 2052 objectMap["id"] = lpr.ID 2053 } 2054 if lpr.Name != nil { 2055 objectMap["name"] = lpr.Name 2056 } 2057 if lpr.Type != nil { 2058 objectMap["type"] = lpr.Type 2059 } 2060 if lpr.Location != nil { 2061 objectMap["location"] = lpr.Location 2062 } 2063 if lpr.Tags != nil { 2064 objectMap["tags"] = lpr.Tags 2065 } 2066 return json.Marshal(objectMap) 2067} 2068 2069// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. 2070func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { 2071 var m map[string]*json.RawMessage 2072 err := json.Unmarshal(body, &m) 2073 if err != nil { 2074 return err 2075 } 2076 for k, v := range m { 2077 switch k { 2078 case "properties": 2079 if v != nil { 2080 var logProfileProperties LogProfileProperties 2081 err = json.Unmarshal(*v, &logProfileProperties) 2082 if err != nil { 2083 return err 2084 } 2085 lpr.LogProfileProperties = &logProfileProperties 2086 } 2087 case "id": 2088 if v != nil { 2089 var ID string 2090 err = json.Unmarshal(*v, &ID) 2091 if err != nil { 2092 return err 2093 } 2094 lpr.ID = &ID 2095 } 2096 case "name": 2097 if v != nil { 2098 var name string 2099 err = json.Unmarshal(*v, &name) 2100 if err != nil { 2101 return err 2102 } 2103 lpr.Name = &name 2104 } 2105 case "type": 2106 if v != nil { 2107 var typeVar string 2108 err = json.Unmarshal(*v, &typeVar) 2109 if err != nil { 2110 return err 2111 } 2112 lpr.Type = &typeVar 2113 } 2114 case "location": 2115 if v != nil { 2116 var location string 2117 err = json.Unmarshal(*v, &location) 2118 if err != nil { 2119 return err 2120 } 2121 lpr.Location = &location 2122 } 2123 case "tags": 2124 if v != nil { 2125 var tags map[string]*string 2126 err = json.Unmarshal(*v, &tags) 2127 if err != nil { 2128 return err 2129 } 2130 lpr.Tags = tags 2131 } 2132 } 2133 } 2134 2135 return nil 2136} 2137 2138// LogProfileResourcePatch the log profile resource for patch operations. 2139type LogProfileResourcePatch struct { 2140 // Tags - Resource tags 2141 Tags map[string]*string `json:"tags"` 2142 // LogProfileProperties - The log profile properties for an update operation. 2143 *LogProfileProperties `json:"properties,omitempty"` 2144} 2145 2146// MarshalJSON is the custom marshaler for LogProfileResourcePatch. 2147func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { 2148 objectMap := make(map[string]interface{}) 2149 if lprp.Tags != nil { 2150 objectMap["tags"] = lprp.Tags 2151 } 2152 if lprp.LogProfileProperties != nil { 2153 objectMap["properties"] = lprp.LogProfileProperties 2154 } 2155 return json.Marshal(objectMap) 2156} 2157 2158// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. 2159func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { 2160 var m map[string]*json.RawMessage 2161 err := json.Unmarshal(body, &m) 2162 if err != nil { 2163 return err 2164 } 2165 for k, v := range m { 2166 switch k { 2167 case "tags": 2168 if v != nil { 2169 var tags map[string]*string 2170 err = json.Unmarshal(*v, &tags) 2171 if err != nil { 2172 return err 2173 } 2174 lprp.Tags = tags 2175 } 2176 case "properties": 2177 if v != nil { 2178 var logProfileProperties LogProfileProperties 2179 err = json.Unmarshal(*v, &logProfileProperties) 2180 if err != nil { 2181 return err 2182 } 2183 lprp.LogProfileProperties = &logProfileProperties 2184 } 2185 } 2186 } 2187 2188 return nil 2189} 2190 2191// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. 2192type LogSettings struct { 2193 // 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. 2194 Category *string `json:"category,omitempty"` 2195 // Enabled - a value indicating whether this log is enabled. 2196 Enabled *bool `json:"enabled,omitempty"` 2197 // RetentionPolicy - the retention policy for this log. 2198 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 2199} 2200 2201// ManagementEventAggregationCondition how the data that is collected should be combined over time. 2202type ManagementEventAggregationCondition struct { 2203 // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' 2204 Operator ConditionOperator `json:"operator,omitempty"` 2205 // Threshold - The threshold value that activates the alert. 2206 Threshold *float64 `json:"threshold,omitempty"` 2207 // 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. 2208 WindowSize *string `json:"windowSize,omitempty"` 2209} 2210 2211// ManagementEventRuleCondition a management event rule condition. 2212type ManagementEventRuleCondition struct { 2213 // 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. 2214 Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` 2215 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 2216 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 2217 // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 2218 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 2219} 2220 2221// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. 2222func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { 2223 merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition 2224 objectMap := make(map[string]interface{}) 2225 if merc.Aggregation != nil { 2226 objectMap["aggregation"] = merc.Aggregation 2227 } 2228 objectMap["dataSource"] = merc.DataSource 2229 objectMap["odata.type"] = merc.OdataType 2230 return json.Marshal(objectMap) 2231} 2232 2233// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 2234func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 2235 return nil, false 2236} 2237 2238// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 2239func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 2240 return nil, false 2241} 2242 2243// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 2244func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 2245 return &merc, true 2246} 2247 2248// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 2249func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { 2250 return nil, false 2251} 2252 2253// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 2254func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 2255 return &merc, true 2256} 2257 2258// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. 2259func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error { 2260 var m map[string]*json.RawMessage 2261 err := json.Unmarshal(body, &m) 2262 if err != nil { 2263 return err 2264 } 2265 for k, v := range m { 2266 switch k { 2267 case "aggregation": 2268 if v != nil { 2269 var aggregation ManagementEventAggregationCondition 2270 err = json.Unmarshal(*v, &aggregation) 2271 if err != nil { 2272 return err 2273 } 2274 merc.Aggregation = &aggregation 2275 } 2276 case "dataSource": 2277 if v != nil { 2278 dataSource, err := unmarshalBasicRuleDataSource(*v) 2279 if err != nil { 2280 return err 2281 } 2282 merc.DataSource = dataSource 2283 } 2284 case "odata.type": 2285 if v != nil { 2286 var odataType OdataTypeBasicRuleCondition 2287 err = json.Unmarshal(*v, &odataType) 2288 if err != nil { 2289 return err 2290 } 2291 merc.OdataType = odataType 2292 } 2293 } 2294 } 2295 2296 return nil 2297} 2298 2299// MetadataValue represents a metric metadata value. 2300type MetadataValue struct { 2301 // Name - the name of the metadata. 2302 Name *LocalizableString `json:"name,omitempty"` 2303 // Value - the value of the metadata. 2304 Value *string `json:"value,omitempty"` 2305} 2306 2307// Metric the result data of a query. 2308type Metric struct { 2309 // ID - the metric Id. 2310 ID *string `json:"id,omitempty"` 2311 // Type - the resource type of the metric resource. 2312 Type *string `json:"type,omitempty"` 2313 // Name - the name and the display name of the metric, i.e. it is localizable string. 2314 Name *LocalizableString `json:"name,omitempty"` 2315 // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified' 2316 Unit Unit `json:"unit,omitempty"` 2317 // Timeseries - the time series returned when a data query is performed. 2318 Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` 2319} 2320 2321// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and the 2322// retention period for that time grain. 2323type MetricAvailability struct { 2324 // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. 2325 TimeGrain *string `json:"timeGrain,omitempty"` 2326 // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. 2327 Retention *string `json:"retention,omitempty"` 2328} 2329 2330// MetricDefinition metric definition class specifies the metadata for a metric. 2331type MetricDefinition struct { 2332 // IsDimensionRequired - Flag to indicate whether the dimension is required. 2333 IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` 2334 // ResourceID - the resource identifier of the resource that emitted the metric. 2335 ResourceID *string `json:"resourceId,omitempty"` 2336 // Name - the name and the display name of the metric, i.e. it is a localizable string. 2337 Name *LocalizableString `json:"name,omitempty"` 2338 // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified' 2339 Unit Unit `json:"unit,omitempty"` 2340 // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' 2341 PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` 2342 // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. 2343 MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` 2344 // ID - the resource identifier of the metric definition. 2345 ID *string `json:"id,omitempty"` 2346 // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. 2347 Dimensions *[]LocalizableString `json:"dimensions,omitempty"` 2348} 2349 2350// MetricDefinitionCollection represents collection of metric definitions. 2351type MetricDefinitionCollection struct { 2352 autorest.Response `json:"-"` 2353 // Value - the values for the metric definitions. 2354 Value *[]MetricDefinition `json:"value,omitempty"` 2355} 2356 2357// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. 2358type MetricSettings struct { 2359 // TimeGrain - the timegrain of the metric in ISO8601 format. 2360 TimeGrain *string `json:"timeGrain,omitempty"` 2361 // 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. 2362 Category *string `json:"category,omitempty"` 2363 // Enabled - a value indicating whether this category is enabled. 2364 Enabled *bool `json:"enabled,omitempty"` 2365 // RetentionPolicy - the retention policy for this category. 2366 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 2367} 2368 2369// MetricTrigger the trigger that results in a scaling action. 2370type MetricTrigger struct { 2371 // MetricName - the name of the metric that defines what the rule monitors. 2372 MetricName *string `json:"metricName,omitempty"` 2373 // MetricResourceURI - the resource identifier of the resource the rule monitors. 2374 MetricResourceURI *string `json:"metricResourceUri,omitempty"` 2375 // 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. 2376 TimeGrain *string `json:"timeGrain,omitempty"` 2377 // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' 2378 Statistic MetricStatisticType `json:"statistic,omitempty"` 2379 // 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. 2380 TimeWindow *string `json:"timeWindow,omitempty"` 2381 // 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' 2382 TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` 2383 // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' 2384 Operator ComparisonOperationType `json:"operator,omitempty"` 2385 // Threshold - the threshold of the metric that triggers the scale action. 2386 Threshold *float64 `json:"threshold,omitempty"` 2387} 2388 2389// MetricValue represents a metric value. 2390type MetricValue struct { 2391 // TimeStamp - the timestamp for the metric value in ISO 8601 format. 2392 TimeStamp *date.Time `json:"timeStamp,omitempty"` 2393 // Average - the average value in the time range. 2394 Average *float64 `json:"average,omitempty"` 2395 // Minimum - the least value in the time range. 2396 Minimum *float64 `json:"minimum,omitempty"` 2397 // Maximum - the greatest value in the time range. 2398 Maximum *float64 `json:"maximum,omitempty"` 2399 // Total - the sum of all of the values in the time range. 2400 Total *float64 `json:"total,omitempty"` 2401 // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. 2402 Count *int64 `json:"count,omitempty"` 2403} 2404 2405// Operation microsoft Insights API operation definition. 2406type Operation struct { 2407 // Name - Operation name: {provider}/{resource}/{operation} 2408 Name *string `json:"name,omitempty"` 2409 // Display - Display metadata associated with the operation. 2410 Display *OperationDisplay `json:"display,omitempty"` 2411} 2412 2413// OperationDisplay display metadata associated with the operation. 2414type OperationDisplay struct { 2415 // Provider - Service provider: Microsoft.Insights 2416 Provider *string `json:"provider,omitempty"` 2417 // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. 2418 Resource *string `json:"resource,omitempty"` 2419 // Operation - Operation type: Read, write, delete, etc. 2420 Operation *string `json:"operation,omitempty"` 2421} 2422 2423// OperationListResult result of the request to list Microsoft.Insights operations. It contains a list of 2424// operations and a URL link to get the next set of results. 2425type OperationListResult struct { 2426 autorest.Response `json:"-"` 2427 // Value - List of operations supported by the Microsoft.Insights provider. 2428 Value *[]Operation `json:"value,omitempty"` 2429 // NextLink - URL to get the next set of operation list results if there are any. 2430 NextLink *string `json:"nextLink,omitempty"` 2431} 2432 2433// ProxyOnlyResource a proxy only azure resource object 2434type ProxyOnlyResource struct { 2435 // ID - Azure resource Id 2436 ID *string `json:"id,omitempty"` 2437 // Name - Azure resource name 2438 Name *string `json:"name,omitempty"` 2439 // Type - Azure resource type 2440 Type *string `json:"type,omitempty"` 2441} 2442 2443// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate element 2444// is used. 2445type Recurrence struct { 2446 // 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. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' 2447 Frequency RecurrenceFrequency `json:"frequency,omitempty"` 2448 // Schedule - the scheduling constraints for when the profile begins. 2449 Schedule *RecurrentSchedule `json:"schedule,omitempty"` 2450} 2451 2452// RecurrentSchedule the scheduling constraints for when the profile begins. 2453type RecurrentSchedule struct { 2454 // TimeZone - the timezone for the hours of the profile. Some examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time 2455 TimeZone *string `json:"timeZone,omitempty"` 2456 // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. 2457 Days *[]string `json:"days,omitempty"` 2458 // 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). 2459 Hours *[]int32 `json:"hours,omitempty"` 2460 // Minutes - A collection of minutes at which the profile takes effect at. 2461 Minutes *[]int32 `json:"minutes,omitempty"` 2462} 2463 2464// Resource an azure resource object 2465type Resource struct { 2466 // ID - Azure resource Id 2467 ID *string `json:"id,omitempty"` 2468 // Name - Azure resource name 2469 Name *string `json:"name,omitempty"` 2470 // Type - Azure resource type 2471 Type *string `json:"type,omitempty"` 2472 // Location - Resource location 2473 Location *string `json:"location,omitempty"` 2474 // Tags - Resource tags 2475 Tags map[string]*string `json:"tags"` 2476} 2477 2478// MarshalJSON is the custom marshaler for Resource. 2479func (r Resource) MarshalJSON() ([]byte, error) { 2480 objectMap := make(map[string]interface{}) 2481 if r.ID != nil { 2482 objectMap["id"] = r.ID 2483 } 2484 if r.Name != nil { 2485 objectMap["name"] = r.Name 2486 } 2487 if r.Type != nil { 2488 objectMap["type"] = r.Type 2489 } 2490 if r.Location != nil { 2491 objectMap["location"] = r.Location 2492 } 2493 if r.Tags != nil { 2494 objectMap["tags"] = r.Tags 2495 } 2496 return json.Marshal(objectMap) 2497} 2498 2499// Response the response to a metrics query. 2500type Response struct { 2501 autorest.Response `json:"-"` 2502 // Cost - The integer value representing the cost of the query, for data case. 2503 Cost *float64 `json:"cost,omitempty"` 2504 // Timespan - The timespan for which the data was retrieved. Its value consists of two datatimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. 2505 Timespan *string `json:"timespan,omitempty"` 2506 // 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. 2507 Interval *string `json:"interval,omitempty"` 2508 // Value - the value of the collection. 2509 Value *[]Metric `json:"value,omitempty"` 2510} 2511 2512// RetentionPolicy specifies the retention policy for the log. 2513type RetentionPolicy struct { 2514 // Enabled - a value indicating whether the retention policy is enabled. 2515 Enabled *bool `json:"enabled,omitempty"` 2516 // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. 2517 Days *int32 `json:"days,omitempty"` 2518} 2519 2520// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is 2521// resolved. 2522type BasicRuleAction interface { 2523 AsRuleEmailAction() (*RuleEmailAction, bool) 2524 AsRuleWebhookAction() (*RuleWebhookAction, bool) 2525 AsRuleAction() (*RuleAction, bool) 2526} 2527 2528// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is 2529// resolved. 2530type RuleAction struct { 2531 // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' 2532 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` 2533} 2534 2535func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { 2536 var m map[string]interface{} 2537 err := json.Unmarshal(body, &m) 2538 if err != nil { 2539 return nil, err 2540 } 2541 2542 switch m["odata.type"] { 2543 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): 2544 var rea RuleEmailAction 2545 err := json.Unmarshal(body, &rea) 2546 return rea, err 2547 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): 2548 var rwa RuleWebhookAction 2549 err := json.Unmarshal(body, &rwa) 2550 return rwa, err 2551 default: 2552 var ra RuleAction 2553 err := json.Unmarshal(body, &ra) 2554 return ra, err 2555 } 2556} 2557func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { 2558 var rawMessages []*json.RawMessage 2559 err := json.Unmarshal(body, &rawMessages) 2560 if err != nil { 2561 return nil, err 2562 } 2563 2564 raArray := make([]BasicRuleAction, len(rawMessages)) 2565 2566 for index, rawMessage := range rawMessages { 2567 ra, err := unmarshalBasicRuleAction(*rawMessage) 2568 if err != nil { 2569 return nil, err 2570 } 2571 raArray[index] = ra 2572 } 2573 return raArray, nil 2574} 2575 2576// MarshalJSON is the custom marshaler for RuleAction. 2577func (ra RuleAction) MarshalJSON() ([]byte, error) { 2578 ra.OdataType = OdataTypeRuleAction 2579 objectMap := make(map[string]interface{}) 2580 objectMap["odata.type"] = ra.OdataType 2581 return json.Marshal(objectMap) 2582} 2583 2584// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. 2585func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { 2586 return nil, false 2587} 2588 2589// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. 2590func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { 2591 return nil, false 2592} 2593 2594// AsRuleAction is the BasicRuleAction implementation for RuleAction. 2595func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { 2596 return &ra, true 2597} 2598 2599// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. 2600func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { 2601 return &ra, true 2602} 2603 2604// BasicRuleCondition the condition that results in the alert rule being activated. 2605type BasicRuleCondition interface { 2606 AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) 2607 AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) 2608 AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) 2609 AsRuleCondition() (*RuleCondition, bool) 2610} 2611 2612// RuleCondition the condition that results in the alert rule being activated. 2613type RuleCondition struct { 2614 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 2615 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 2616 // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 2617 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 2618} 2619 2620func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { 2621 var m map[string]interface{} 2622 err := json.Unmarshal(body, &m) 2623 if err != nil { 2624 return nil, err 2625 } 2626 2627 switch m["odata.type"] { 2628 case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): 2629 var trc ThresholdRuleCondition 2630 err := json.Unmarshal(body, &trc) 2631 return trc, err 2632 case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): 2633 var ltrc LocationThresholdRuleCondition 2634 err := json.Unmarshal(body, <rc) 2635 return ltrc, err 2636 case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): 2637 var merc ManagementEventRuleCondition 2638 err := json.Unmarshal(body, &merc) 2639 return merc, err 2640 default: 2641 var rc RuleCondition 2642 err := json.Unmarshal(body, &rc) 2643 return rc, err 2644 } 2645} 2646func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { 2647 var rawMessages []*json.RawMessage 2648 err := json.Unmarshal(body, &rawMessages) 2649 if err != nil { 2650 return nil, err 2651 } 2652 2653 rcArray := make([]BasicRuleCondition, len(rawMessages)) 2654 2655 for index, rawMessage := range rawMessages { 2656 rc, err := unmarshalBasicRuleCondition(*rawMessage) 2657 if err != nil { 2658 return nil, err 2659 } 2660 rcArray[index] = rc 2661 } 2662 return rcArray, nil 2663} 2664 2665// MarshalJSON is the custom marshaler for RuleCondition. 2666func (rc RuleCondition) MarshalJSON() ([]byte, error) { 2667 rc.OdataType = OdataTypeRuleCondition 2668 objectMap := make(map[string]interface{}) 2669 objectMap["dataSource"] = rc.DataSource 2670 objectMap["odata.type"] = rc.OdataType 2671 return json.Marshal(objectMap) 2672} 2673 2674// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. 2675func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 2676 return nil, false 2677} 2678 2679// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. 2680func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 2681 return nil, false 2682} 2683 2684// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. 2685func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 2686 return nil, false 2687} 2688 2689// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. 2690func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { 2691 return &rc, true 2692} 2693 2694// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. 2695func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 2696 return &rc, true 2697} 2698 2699// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. 2700func (rc *RuleCondition) UnmarshalJSON(body []byte) error { 2701 var m map[string]*json.RawMessage 2702 err := json.Unmarshal(body, &m) 2703 if err != nil { 2704 return err 2705 } 2706 for k, v := range m { 2707 switch k { 2708 case "dataSource": 2709 if v != nil { 2710 dataSource, err := unmarshalBasicRuleDataSource(*v) 2711 if err != nil { 2712 return err 2713 } 2714 rc.DataSource = dataSource 2715 } 2716 case "odata.type": 2717 if v != nil { 2718 var odataType OdataTypeBasicRuleCondition 2719 err = json.Unmarshal(*v, &odataType) 2720 if err != nil { 2721 return err 2722 } 2723 rc.OdataType = odataType 2724 } 2725 } 2726 } 2727 2728 return nil 2729} 2730 2731// BasicRuleDataSource the resource from which the rule collects its data. 2732type BasicRuleDataSource interface { 2733 AsRuleMetricDataSource() (*RuleMetricDataSource, bool) 2734 AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) 2735 AsRuleDataSource() (*RuleDataSource, bool) 2736} 2737 2738// RuleDataSource the resource from which the rule collects its data. 2739type RuleDataSource struct { 2740 // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 2741 ResourceURI *string `json:"resourceUri,omitempty"` 2742 // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' 2743 OdataType OdataType `json:"odata.type,omitempty"` 2744} 2745 2746func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { 2747 var m map[string]interface{} 2748 err := json.Unmarshal(body, &m) 2749 if err != nil { 2750 return nil, err 2751 } 2752 2753 switch m["odata.type"] { 2754 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): 2755 var rmds RuleMetricDataSource 2756 err := json.Unmarshal(body, &rmds) 2757 return rmds, err 2758 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): 2759 var rmeds RuleManagementEventDataSource 2760 err := json.Unmarshal(body, &rmeds) 2761 return rmeds, err 2762 default: 2763 var rds RuleDataSource 2764 err := json.Unmarshal(body, &rds) 2765 return rds, err 2766 } 2767} 2768func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { 2769 var rawMessages []*json.RawMessage 2770 err := json.Unmarshal(body, &rawMessages) 2771 if err != nil { 2772 return nil, err 2773 } 2774 2775 rdsArray := make([]BasicRuleDataSource, len(rawMessages)) 2776 2777 for index, rawMessage := range rawMessages { 2778 rds, err := unmarshalBasicRuleDataSource(*rawMessage) 2779 if err != nil { 2780 return nil, err 2781 } 2782 rdsArray[index] = rds 2783 } 2784 return rdsArray, nil 2785} 2786 2787// MarshalJSON is the custom marshaler for RuleDataSource. 2788func (rds RuleDataSource) MarshalJSON() ([]byte, error) { 2789 rds.OdataType = OdataTypeRuleDataSource 2790 objectMap := make(map[string]interface{}) 2791 if rds.ResourceURI != nil { 2792 objectMap["resourceUri"] = rds.ResourceURI 2793 } 2794 objectMap["odata.type"] = rds.OdataType 2795 return json.Marshal(objectMap) 2796} 2797 2798// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. 2799func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { 2800 return nil, false 2801} 2802 2803// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. 2804func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { 2805 return nil, false 2806} 2807 2808// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. 2809func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { 2810 return &rds, true 2811} 2812 2813// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. 2814func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { 2815 return &rds, true 2816} 2817 2818// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The discriminator is 2819// always RuleEmailAction in this case. 2820type RuleEmailAction struct { 2821 // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. 2822 SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` 2823 // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. 2824 CustomEmails *[]string `json:"customEmails,omitempty"` 2825 // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' 2826 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` 2827} 2828 2829// MarshalJSON is the custom marshaler for RuleEmailAction. 2830func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { 2831 rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction 2832 objectMap := make(map[string]interface{}) 2833 if rea.SendToServiceOwners != nil { 2834 objectMap["sendToServiceOwners"] = rea.SendToServiceOwners 2835 } 2836 if rea.CustomEmails != nil { 2837 objectMap["customEmails"] = rea.CustomEmails 2838 } 2839 objectMap["odata.type"] = rea.OdataType 2840 return json.Marshal(objectMap) 2841} 2842 2843// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. 2844func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { 2845 return &rea, true 2846} 2847 2848// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. 2849func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { 2850 return nil, false 2851} 2852 2853// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. 2854func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { 2855 return nil, false 2856} 2857 2858// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. 2859func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { 2860 return &rea, true 2861} 2862 2863// RuleManagementEventClaimsDataSource the claims for a rule management event data source. 2864type RuleManagementEventClaimsDataSource struct { 2865 // EmailAddress - the email address. 2866 EmailAddress *string `json:"emailAddress,omitempty"` 2867} 2868 2869// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always 2870// RuleManagementEventDataSource in this case. 2871type RuleManagementEventDataSource struct { 2872 // EventName - the event name. 2873 EventName *string `json:"eventName,omitempty"` 2874 // EventSource - the event source. 2875 EventSource *string `json:"eventSource,omitempty"` 2876 // Level - the level. 2877 Level *string `json:"level,omitempty"` 2878 // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. 2879 OperationName *string `json:"operationName,omitempty"` 2880 // ResourceGroupName - the resource group name. 2881 ResourceGroupName *string `json:"resourceGroupName,omitempty"` 2882 // ResourceProviderName - the resource provider name. 2883 ResourceProviderName *string `json:"resourceProviderName,omitempty"` 2884 // Status - The status of the operation that should be checked for. If no status is provided, any status will match. 2885 Status *string `json:"status,omitempty"` 2886 // SubStatus - the substatus. 2887 SubStatus *string `json:"subStatus,omitempty"` 2888 // Claims - the claims. 2889 Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` 2890 // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 2891 ResourceURI *string `json:"resourceUri,omitempty"` 2892 // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' 2893 OdataType OdataType `json:"odata.type,omitempty"` 2894} 2895 2896// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. 2897func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { 2898 rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource 2899 objectMap := make(map[string]interface{}) 2900 if rmeds.EventName != nil { 2901 objectMap["eventName"] = rmeds.EventName 2902 } 2903 if rmeds.EventSource != nil { 2904 objectMap["eventSource"] = rmeds.EventSource 2905 } 2906 if rmeds.Level != nil { 2907 objectMap["level"] = rmeds.Level 2908 } 2909 if rmeds.OperationName != nil { 2910 objectMap["operationName"] = rmeds.OperationName 2911 } 2912 if rmeds.ResourceGroupName != nil { 2913 objectMap["resourceGroupName"] = rmeds.ResourceGroupName 2914 } 2915 if rmeds.ResourceProviderName != nil { 2916 objectMap["resourceProviderName"] = rmeds.ResourceProviderName 2917 } 2918 if rmeds.Status != nil { 2919 objectMap["status"] = rmeds.Status 2920 } 2921 if rmeds.SubStatus != nil { 2922 objectMap["subStatus"] = rmeds.SubStatus 2923 } 2924 if rmeds.Claims != nil { 2925 objectMap["claims"] = rmeds.Claims 2926 } 2927 if rmeds.ResourceURI != nil { 2928 objectMap["resourceUri"] = rmeds.ResourceURI 2929 } 2930 objectMap["odata.type"] = rmeds.OdataType 2931 return json.Marshal(objectMap) 2932} 2933 2934// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 2935func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { 2936 return nil, false 2937} 2938 2939// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 2940func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { 2941 return &rmeds, true 2942} 2943 2944// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 2945func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { 2946 return nil, false 2947} 2948 2949// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 2950func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { 2951 return &rmeds, true 2952} 2953 2954// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource in this 2955// case. 2956type RuleMetricDataSource struct { 2957 // MetricName - the name of the metric that defines what the rule monitors. 2958 MetricName *string `json:"metricName,omitempty"` 2959 // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 2960 ResourceURI *string `json:"resourceUri,omitempty"` 2961 // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' 2962 OdataType OdataType `json:"odata.type,omitempty"` 2963} 2964 2965// MarshalJSON is the custom marshaler for RuleMetricDataSource. 2966func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { 2967 rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource 2968 objectMap := make(map[string]interface{}) 2969 if rmds.MetricName != nil { 2970 objectMap["metricName"] = rmds.MetricName 2971 } 2972 if rmds.ResourceURI != nil { 2973 objectMap["resourceUri"] = rmds.ResourceURI 2974 } 2975 objectMap["odata.type"] = rmds.OdataType 2976 return json.Marshal(objectMap) 2977} 2978 2979// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 2980func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { 2981 return &rmds, true 2982} 2983 2984// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 2985func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { 2986 return nil, false 2987} 2988 2989// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 2990func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { 2991 return nil, false 2992} 2993 2994// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 2995func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { 2996 return &rmds, true 2997} 2998 2999// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The 3000// discriminator is always RuleWebhookAction in this case. 3001type RuleWebhookAction struct { 3002 // ServiceURI - the service uri to Post the notification when the alert activates or resolves. 3003 ServiceURI *string `json:"serviceUri,omitempty"` 3004 // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. 3005 Properties map[string]*string `json:"properties"` 3006 // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' 3007 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` 3008} 3009 3010// MarshalJSON is the custom marshaler for RuleWebhookAction. 3011func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { 3012 rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction 3013 objectMap := make(map[string]interface{}) 3014 if rwa.ServiceURI != nil { 3015 objectMap["serviceUri"] = rwa.ServiceURI 3016 } 3017 if rwa.Properties != nil { 3018 objectMap["properties"] = rwa.Properties 3019 } 3020 objectMap["odata.type"] = rwa.OdataType 3021 return json.Marshal(objectMap) 3022} 3023 3024// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. 3025func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { 3026 return nil, false 3027} 3028 3029// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. 3030func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { 3031 return &rwa, true 3032} 3033 3034// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. 3035func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { 3036 return nil, false 3037} 3038 3039// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. 3040func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { 3041 return &rwa, true 3042} 3043 3044// ScaleAction the parameters for the scaling action. 3045type ScaleAction struct { 3046 // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' 3047 Direction ScaleDirection `json:"direction,omitempty"` 3048 // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' 3049 Type ScaleType `json:"type,omitempty"` 3050 // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. 3051 Value *string `json:"value,omitempty"` 3052 // 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. 3053 Cooldown *string `json:"cooldown,omitempty"` 3054} 3055 3056// ScaleCapacity the number of instances that can be used during this profile. 3057type ScaleCapacity struct { 3058 // Minimum - the minimum number of instances for the resource. 3059 Minimum *string `json:"minimum,omitempty"` 3060 // 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. 3061 Maximum *string `json:"maximum,omitempty"` 3062 // 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. 3063 Default *string `json:"default,omitempty"` 3064} 3065 3066// ScaleRule a rule that provide the triggers and parameters for the scaling action. 3067type ScaleRule struct { 3068 // MetricTrigger - the trigger that results in a scaling action. 3069 MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` 3070 // ScaleAction - the parameters for the scaling action. 3071 ScaleAction *ScaleAction `json:"scaleAction,omitempty"` 3072} 3073 3074// SenderAuthorization the authorization used by the user who has performed the operation that led to this event. 3075// This captures the RBAC properties of the event. These usually include the 'action', 'role' and the 'scope' 3076type SenderAuthorization struct { 3077 // Action - the permissible actions. For instance: microsoft.support/supporttickets/write 3078 Action *string `json:"action,omitempty"` 3079 // Role - the role of the user. For instance: Subscription Admin 3080 Role *string `json:"role,omitempty"` 3081 // Scope - the scope. 3082 Scope *string `json:"scope,omitempty"` 3083} 3084 3085// SmsReceiver an SMS receiver. 3086type SmsReceiver struct { 3087 // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. 3088 Name *string `json:"name,omitempty"` 3089 // CountryCode - The country code of the SMS receiver. 3090 CountryCode *string `json:"countryCode,omitempty"` 3091 // PhoneNumber - The phone number of the SMS receiver. 3092 PhoneNumber *string `json:"phoneNumber,omitempty"` 3093 // Status - The status of the receiver. Possible values include: 'NotSpecified', 'Enabled', 'Disabled' 3094 Status ReceiverStatus `json:"status,omitempty"` 3095} 3096 3097// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. 3098type ThresholdRuleCondition struct { 3099 // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' 3100 Operator ConditionOperator `json:"operator,omitempty"` 3101 // Threshold - the threshold value that activates the alert. 3102 Threshold *float64 `json:"threshold,omitempty"` 3103 // 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. 3104 WindowSize *string `json:"windowSize,omitempty"` 3105 // 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' 3106 TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` 3107 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 3108 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 3109 // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 3110 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 3111} 3112 3113// MarshalJSON is the custom marshaler for ThresholdRuleCondition. 3114func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { 3115 trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition 3116 objectMap := make(map[string]interface{}) 3117 objectMap["operator"] = trc.Operator 3118 if trc.Threshold != nil { 3119 objectMap["threshold"] = trc.Threshold 3120 } 3121 if trc.WindowSize != nil { 3122 objectMap["windowSize"] = trc.WindowSize 3123 } 3124 objectMap["timeAggregation"] = trc.TimeAggregation 3125 objectMap["dataSource"] = trc.DataSource 3126 objectMap["odata.type"] = trc.OdataType 3127 return json.Marshal(objectMap) 3128} 3129 3130// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 3131func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 3132 return &trc, true 3133} 3134 3135// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 3136func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 3137 return nil, false 3138} 3139 3140// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 3141func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 3142 return nil, false 3143} 3144 3145// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 3146func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { 3147 return nil, false 3148} 3149 3150// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 3151func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 3152 return &trc, true 3153} 3154 3155// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. 3156func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error { 3157 var m map[string]*json.RawMessage 3158 err := json.Unmarshal(body, &m) 3159 if err != nil { 3160 return err 3161 } 3162 for k, v := range m { 3163 switch k { 3164 case "operator": 3165 if v != nil { 3166 var operator ConditionOperator 3167 err = json.Unmarshal(*v, &operator) 3168 if err != nil { 3169 return err 3170 } 3171 trc.Operator = operator 3172 } 3173 case "threshold": 3174 if v != nil { 3175 var threshold float64 3176 err = json.Unmarshal(*v, &threshold) 3177 if err != nil { 3178 return err 3179 } 3180 trc.Threshold = &threshold 3181 } 3182 case "windowSize": 3183 if v != nil { 3184 var windowSize string 3185 err = json.Unmarshal(*v, &windowSize) 3186 if err != nil { 3187 return err 3188 } 3189 trc.WindowSize = &windowSize 3190 } 3191 case "timeAggregation": 3192 if v != nil { 3193 var timeAggregation TimeAggregationOperator 3194 err = json.Unmarshal(*v, &timeAggregation) 3195 if err != nil { 3196 return err 3197 } 3198 trc.TimeAggregation = timeAggregation 3199 } 3200 case "dataSource": 3201 if v != nil { 3202 dataSource, err := unmarshalBasicRuleDataSource(*v) 3203 if err != nil { 3204 return err 3205 } 3206 trc.DataSource = dataSource 3207 } 3208 case "odata.type": 3209 if v != nil { 3210 var odataType OdataTypeBasicRuleCondition 3211 err = json.Unmarshal(*v, &odataType) 3212 if err != nil { 3213 return err 3214 } 3215 trc.OdataType = odataType 3216 } 3217 } 3218 } 3219 3220 return nil 3221} 3222 3223// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. 3224type TimeSeriesElement struct { 3225 // Metadatavalues - the metadata values returned if $filter was specified in the call. 3226 Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` 3227 // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. 3228 Data *[]MetricValue `json:"data,omitempty"` 3229} 3230 3231// TimeSeriesInformation the time series info needed for calculating the baseline. 3232type TimeSeriesInformation struct { 3233 // Sensitivities - the list of sensitivities for calculating the baseline. 3234 Sensitivities *[]string `json:"sensitivities,omitempty"` 3235 // Values - The metric values to calculate the baseline. 3236 Values *[]float64 `json:"values,omitempty"` 3237 // Timestamps - the array of timestamps of the baselines. 3238 Timestamps *[]date.Time `json:"timestamps,omitempty"` 3239} 3240 3241// TimeWindow a specific date-time for the profile. 3242type TimeWindow struct { 3243 // TimeZone - the timezone of the start and end times for the profile. Some examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time 3244 TimeZone *string `json:"timeZone,omitempty"` 3245 // Start - the start time for the profile in ISO 8601 format. 3246 Start *date.Time `json:"start,omitempty"` 3247 // End - the end time for the profile in ISO 8601 format. 3248 End *date.Time `json:"end,omitempty"` 3249} 3250 3251// VoiceReceiver an voice receiver. 3252type VoiceReceiver struct { 3253 // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. 3254 Name *string `json:"name,omitempty"` 3255 // CountryCode - The country code of the voice receiver. 3256 CountryCode *string `json:"countryCode,omitempty"` 3257 // PhoneNumber - The phone number of the voice receiver. 3258 PhoneNumber *string `json:"phoneNumber,omitempty"` 3259} 3260 3261// WebhookNotification webhook notification of an autoscale event. 3262type WebhookNotification struct { 3263 // ServiceURI - the service address to receive the notification. 3264 ServiceURI *string `json:"serviceUri,omitempty"` 3265 // Properties - a property bag of settings. This value can be empty. 3266 Properties map[string]*string `json:"properties"` 3267} 3268 3269// MarshalJSON is the custom marshaler for WebhookNotification. 3270func (wn WebhookNotification) MarshalJSON() ([]byte, error) { 3271 objectMap := make(map[string]interface{}) 3272 if wn.ServiceURI != nil { 3273 objectMap["serviceUri"] = wn.ServiceURI 3274 } 3275 if wn.Properties != nil { 3276 objectMap["properties"] = wn.Properties 3277 } 3278 return json.Marshal(objectMap) 3279} 3280 3281// WebhookReceiver a webhook receiver. 3282type WebhookReceiver struct { 3283 // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. 3284 Name *string `json:"name,omitempty"` 3285 // ServiceURI - The URI where webhooks should be sent. 3286 ServiceURI *string `json:"serviceUri,omitempty"` 3287} 3288