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