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