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