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/azure" 14 "github.com/Azure/go-autorest/autorest/date" 15 "github.com/Azure/go-autorest/autorest/to" 16 "github.com/Azure/go-autorest/tracing" 17 "net/http" 18) 19 20// The package's fully qualified name. 21const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2019-11-01-preview/insights" 22 23// BasicAction action descriptor. 24type BasicAction interface { 25 AsAlertingAction() (*AlertingAction, bool) 26 AsLogToMetricAction() (*LogToMetricAction, bool) 27 AsAction() (*Action, bool) 28} 29 30// Action action descriptor. 31type Action struct { 32 // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' 33 OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` 34} 35 36func unmarshalBasicAction(body []byte) (BasicAction, error) { 37 var m map[string]interface{} 38 err := json.Unmarshal(body, &m) 39 if err != nil { 40 return nil, err 41 } 42 43 switch m["odata.type"] { 44 case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction): 45 var aa AlertingAction 46 err := json.Unmarshal(body, &aa) 47 return aa, err 48 case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction): 49 var ltma LogToMetricAction 50 err := json.Unmarshal(body, <ma) 51 return ltma, err 52 default: 53 var a Action 54 err := json.Unmarshal(body, &a) 55 return a, err 56 } 57} 58func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) { 59 var rawMessages []*json.RawMessage 60 err := json.Unmarshal(body, &rawMessages) 61 if err != nil { 62 return nil, err 63 } 64 65 aArray := make([]BasicAction, len(rawMessages)) 66 67 for index, rawMessage := range rawMessages { 68 a, err := unmarshalBasicAction(*rawMessage) 69 if err != nil { 70 return nil, err 71 } 72 aArray[index] = a 73 } 74 return aArray, nil 75} 76 77// MarshalJSON is the custom marshaler for Action. 78func (a Action) MarshalJSON() ([]byte, error) { 79 a.OdataType = OdataTypeAction 80 objectMap := make(map[string]interface{}) 81 if a.OdataType != "" { 82 objectMap["odata.type"] = a.OdataType 83 } 84 return json.Marshal(objectMap) 85} 86 87// AsAlertingAction is the BasicAction implementation for Action. 88func (a Action) AsAlertingAction() (*AlertingAction, bool) { 89 return nil, false 90} 91 92// AsLogToMetricAction is the BasicAction implementation for Action. 93func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) { 94 return nil, false 95} 96 97// AsAction is the BasicAction implementation for Action. 98func (a Action) AsAction() (*Action, bool) { 99 return &a, true 100} 101 102// AsBasicAction is the BasicAction implementation for Action. 103func (a Action) AsBasicAction() (BasicAction, bool) { 104 return &a, true 105} 106 107// ActionGroup an Azure action group. 108type ActionGroup struct { 109 // GroupShortName - The short name of the action group. This will be used in SMS messages. 110 GroupShortName *string `json:"groupShortName,omitempty"` 111 // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. 112 Enabled *bool `json:"enabled,omitempty"` 113 // EmailReceivers - The list of email receivers that are part of this action group. 114 EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` 115 // SmsReceivers - The list of SMS receivers that are part of this action group. 116 SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` 117 // WebhookReceivers - The list of webhook receivers that are part of this action group. 118 WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` 119 // ItsmReceivers - The list of ITSM receivers that are part of this action group. 120 ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` 121 // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. 122 AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` 123 // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. 124 AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` 125 // VoiceReceivers - The list of voice receivers that are part of this action group. 126 VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` 127 // LogicAppReceivers - The list of logic app receivers that are part of this action group. 128 LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` 129 // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. 130 AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` 131 // 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. 132 ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` 133} 134 135// ActionGroupList a list of action groups. 136type ActionGroupList struct { 137 autorest.Response `json:"-"` 138 // Value - The list of action groups. 139 Value *[]ActionGroupResource `json:"value,omitempty"` 140 // NextLink - Provides the link to retrieve the next set of elements. 141 NextLink *string `json:"nextLink,omitempty"` 142} 143 144// ActionGroupPatch an Azure action group for patch operations. 145type ActionGroupPatch struct { 146 // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. 147 Enabled *bool `json:"enabled,omitempty"` 148} 149 150// ActionGroupPatchBody an action group object for the body of patch operations. 151type ActionGroupPatchBody struct { 152 // Tags - Resource tags 153 Tags map[string]*string `json:"tags"` 154 // ActionGroupPatch - The action group settings for an update operation. 155 *ActionGroupPatch `json:"properties,omitempty"` 156} 157 158// MarshalJSON is the custom marshaler for ActionGroupPatchBody. 159func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { 160 objectMap := make(map[string]interface{}) 161 if agpb.Tags != nil { 162 objectMap["tags"] = agpb.Tags 163 } 164 if agpb.ActionGroupPatch != nil { 165 objectMap["properties"] = agpb.ActionGroupPatch 166 } 167 return json.Marshal(objectMap) 168} 169 170// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. 171func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error { 172 var m map[string]*json.RawMessage 173 err := json.Unmarshal(body, &m) 174 if err != nil { 175 return err 176 } 177 for k, v := range m { 178 switch k { 179 case "tags": 180 if v != nil { 181 var tags map[string]*string 182 err = json.Unmarshal(*v, &tags) 183 if err != nil { 184 return err 185 } 186 agpb.Tags = tags 187 } 188 case "properties": 189 if v != nil { 190 var actionGroupPatch ActionGroupPatch 191 err = json.Unmarshal(*v, &actionGroupPatch) 192 if err != nil { 193 return err 194 } 195 agpb.ActionGroupPatch = &actionGroupPatch 196 } 197 } 198 } 199 200 return nil 201} 202 203// ActionGroupResource an action group resource. 204type ActionGroupResource struct { 205 autorest.Response `json:"-"` 206 // ActionGroup - The action groups properties of the resource. 207 *ActionGroup `json:"properties,omitempty"` 208 // ID - READ-ONLY; Azure resource Id 209 ID *string `json:"id,omitempty"` 210 // Name - READ-ONLY; Azure resource name 211 Name *string `json:"name,omitempty"` 212 // Type - READ-ONLY; Azure resource type 213 Type *string `json:"type,omitempty"` 214 // Location - Resource location 215 Location *string `json:"location,omitempty"` 216 // Tags - Resource tags 217 Tags map[string]*string `json:"tags"` 218} 219 220// MarshalJSON is the custom marshaler for ActionGroupResource. 221func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { 222 objectMap := make(map[string]interface{}) 223 if agr.ActionGroup != nil { 224 objectMap["properties"] = agr.ActionGroup 225 } 226 if agr.Location != nil { 227 objectMap["location"] = agr.Location 228 } 229 if agr.Tags != nil { 230 objectMap["tags"] = agr.Tags 231 } 232 return json.Marshal(objectMap) 233} 234 235// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. 236func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { 237 var m map[string]*json.RawMessage 238 err := json.Unmarshal(body, &m) 239 if err != nil { 240 return err 241 } 242 for k, v := range m { 243 switch k { 244 case "properties": 245 if v != nil { 246 var actionGroup ActionGroup 247 err = json.Unmarshal(*v, &actionGroup) 248 if err != nil { 249 return err 250 } 251 agr.ActionGroup = &actionGroup 252 } 253 case "id": 254 if v != nil { 255 var ID string 256 err = json.Unmarshal(*v, &ID) 257 if err != nil { 258 return err 259 } 260 agr.ID = &ID 261 } 262 case "name": 263 if v != nil { 264 var name string 265 err = json.Unmarshal(*v, &name) 266 if err != nil { 267 return err 268 } 269 agr.Name = &name 270 } 271 case "type": 272 if v != nil { 273 var typeVar string 274 err = json.Unmarshal(*v, &typeVar) 275 if err != nil { 276 return err 277 } 278 agr.Type = &typeVar 279 } 280 case "location": 281 if v != nil { 282 var location string 283 err = json.Unmarshal(*v, &location) 284 if err != nil { 285 return err 286 } 287 agr.Location = &location 288 } 289 case "tags": 290 if v != nil { 291 var tags map[string]*string 292 err = json.Unmarshal(*v, &tags) 293 if err != nil { 294 return err 295 } 296 agr.Tags = tags 297 } 298 } 299 } 300 301 return nil 302} 303 304// ActivityLogAlert an Azure activity log alert. 305type ActivityLogAlert struct { 306 // 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. 307 Scopes *[]string `json:"scopes,omitempty"` 308 // 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. 309 Enabled *bool `json:"enabled,omitempty"` 310 // Condition - The condition that will cause this alert to activate. 311 Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` 312 // Actions - The actions that will activate when the condition is met. 313 Actions *ActivityLogAlertActionList `json:"actions,omitempty"` 314 // Description - A description of this activity log alert. 315 Description *string `json:"description,omitempty"` 316} 317 318// ActivityLogAlertActionGroup a pointer to an Azure Action Group. 319type ActivityLogAlertActionGroup struct { 320 // ActionGroupID - The resourceId of the action group. This cannot be null or empty. 321 ActionGroupID *string `json:"actionGroupId,omitempty"` 322 // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. 323 WebhookProperties map[string]*string `json:"webhookProperties"` 324} 325 326// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. 327func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { 328 objectMap := make(map[string]interface{}) 329 if alaag.ActionGroupID != nil { 330 objectMap["actionGroupId"] = alaag.ActionGroupID 331 } 332 if alaag.WebhookProperties != nil { 333 objectMap["webhookProperties"] = alaag.WebhookProperties 334 } 335 return json.Marshal(objectMap) 336} 337 338// ActivityLogAlertActionList a list of activity log alert actions. 339type ActivityLogAlertActionList struct { 340 // ActionGroups - The list of activity log alerts. 341 ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` 342} 343 344// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member 345// conditions are met. 346type ActivityLogAlertAllOfCondition struct { 347 // AllOf - The list of activity log alert conditions. 348 AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` 349} 350 351// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log 352// field and value. 353type ActivityLogAlertLeafCondition struct { 354 // 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.'. 355 Field *string `json:"field,omitempty"` 356 // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. 357 Equals *string `json:"equals,omitempty"` 358} 359 360// ActivityLogAlertList a list of activity log alerts. 361type ActivityLogAlertList struct { 362 autorest.Response `json:"-"` 363 // Value - The list of activity log alerts. 364 Value *[]ActivityLogAlertResource `json:"value,omitempty"` 365 // NextLink - Provides the link to retrieve the next set of elements. 366 NextLink *string `json:"nextLink,omitempty"` 367} 368 369// ActivityLogAlertPatch an Azure activity log alert for patch operations. 370type ActivityLogAlertPatch struct { 371 // 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. 372 Enabled *bool `json:"enabled,omitempty"` 373} 374 375// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. 376type ActivityLogAlertPatchBody struct { 377 // Tags - Resource tags 378 Tags map[string]*string `json:"tags"` 379 // ActivityLogAlertPatch - The activity log alert settings for an update operation. 380 *ActivityLogAlertPatch `json:"properties,omitempty"` 381} 382 383// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. 384func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { 385 objectMap := make(map[string]interface{}) 386 if alapb.Tags != nil { 387 objectMap["tags"] = alapb.Tags 388 } 389 if alapb.ActivityLogAlertPatch != nil { 390 objectMap["properties"] = alapb.ActivityLogAlertPatch 391 } 392 return json.Marshal(objectMap) 393} 394 395// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. 396func (alapb *ActivityLogAlertPatchBody) UnmarshalJSON(body []byte) error { 397 var m map[string]*json.RawMessage 398 err := json.Unmarshal(body, &m) 399 if err != nil { 400 return err 401 } 402 for k, v := range m { 403 switch k { 404 case "tags": 405 if v != nil { 406 var tags map[string]*string 407 err = json.Unmarshal(*v, &tags) 408 if err != nil { 409 return err 410 } 411 alapb.Tags = tags 412 } 413 case "properties": 414 if v != nil { 415 var activityLogAlertPatch ActivityLogAlertPatch 416 err = json.Unmarshal(*v, &activityLogAlertPatch) 417 if err != nil { 418 return err 419 } 420 alapb.ActivityLogAlertPatch = &activityLogAlertPatch 421 } 422 } 423 } 424 425 return nil 426} 427 428// ActivityLogAlertResource an activity log alert resource. 429type ActivityLogAlertResource struct { 430 autorest.Response `json:"-"` 431 // ActivityLogAlert - The activity log alert properties of the resource. 432 *ActivityLogAlert `json:"properties,omitempty"` 433 // ID - READ-ONLY; Azure resource Id 434 ID *string `json:"id,omitempty"` 435 // Name - READ-ONLY; Azure resource name 436 Name *string `json:"name,omitempty"` 437 // Type - READ-ONLY; Azure resource type 438 Type *string `json:"type,omitempty"` 439 // Location - Resource location 440 Location *string `json:"location,omitempty"` 441 // Tags - Resource tags 442 Tags map[string]*string `json:"tags"` 443} 444 445// MarshalJSON is the custom marshaler for ActivityLogAlertResource. 446func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { 447 objectMap := make(map[string]interface{}) 448 if alar.ActivityLogAlert != nil { 449 objectMap["properties"] = alar.ActivityLogAlert 450 } 451 if alar.Location != nil { 452 objectMap["location"] = alar.Location 453 } 454 if alar.Tags != nil { 455 objectMap["tags"] = alar.Tags 456 } 457 return json.Marshal(objectMap) 458} 459 460// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. 461func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { 462 var m map[string]*json.RawMessage 463 err := json.Unmarshal(body, &m) 464 if err != nil { 465 return err 466 } 467 for k, v := range m { 468 switch k { 469 case "properties": 470 if v != nil { 471 var activityLogAlert ActivityLogAlert 472 err = json.Unmarshal(*v, &activityLogAlert) 473 if err != nil { 474 return err 475 } 476 alar.ActivityLogAlert = &activityLogAlert 477 } 478 case "id": 479 if v != nil { 480 var ID string 481 err = json.Unmarshal(*v, &ID) 482 if err != nil { 483 return err 484 } 485 alar.ID = &ID 486 } 487 case "name": 488 if v != nil { 489 var name string 490 err = json.Unmarshal(*v, &name) 491 if err != nil { 492 return err 493 } 494 alar.Name = &name 495 } 496 case "type": 497 if v != nil { 498 var typeVar string 499 err = json.Unmarshal(*v, &typeVar) 500 if err != nil { 501 return err 502 } 503 alar.Type = &typeVar 504 } 505 case "location": 506 if v != nil { 507 var location string 508 err = json.Unmarshal(*v, &location) 509 if err != nil { 510 return err 511 } 512 alar.Location = &location 513 } 514 case "tags": 515 if v != nil { 516 var tags map[string]*string 517 err = json.Unmarshal(*v, &tags) 518 if err != nil { 519 return err 520 } 521 alar.Tags = tags 522 } 523 } 524 } 525 526 return nil 527} 528 529// AlertingAction specify action need to be taken when rule type is Alert 530type AlertingAction struct { 531 // Severity - Severity of the alert. Possible values include: 'Zero', 'One', 'Two', 'Three', 'Four' 532 Severity AlertSeverity `json:"severity,omitempty"` 533 // AznsAction - Azure action group reference. 534 AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"` 535 // ThrottlingInMin - time (in minutes) for which Alerts should be throttled or suppressed. 536 ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` 537 // Trigger - The trigger condition that results in the alert rule being. 538 Trigger *TriggerCondition `json:"trigger,omitempty"` 539 // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' 540 OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` 541} 542 543// MarshalJSON is the custom marshaler for AlertingAction. 544func (aa AlertingAction) MarshalJSON() ([]byte, error) { 545 aa.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction 546 objectMap := make(map[string]interface{}) 547 if aa.Severity != "" { 548 objectMap["severity"] = aa.Severity 549 } 550 if aa.AznsAction != nil { 551 objectMap["aznsAction"] = aa.AznsAction 552 } 553 if aa.ThrottlingInMin != nil { 554 objectMap["throttlingInMin"] = aa.ThrottlingInMin 555 } 556 if aa.Trigger != nil { 557 objectMap["trigger"] = aa.Trigger 558 } 559 if aa.OdataType != "" { 560 objectMap["odata.type"] = aa.OdataType 561 } 562 return json.Marshal(objectMap) 563} 564 565// AsAlertingAction is the BasicAction implementation for AlertingAction. 566func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { 567 return &aa, true 568} 569 570// AsLogToMetricAction is the BasicAction implementation for AlertingAction. 571func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) { 572 return nil, false 573} 574 575// AsAction is the BasicAction implementation for AlertingAction. 576func (aa AlertingAction) AsAction() (*Action, bool) { 577 return nil, false 578} 579 580// AsBasicAction is the BasicAction implementation for AlertingAction. 581func (aa AlertingAction) AsBasicAction() (BasicAction, bool) { 582 return &aa, true 583} 584 585// AlertRule an alert rule. 586type AlertRule struct { 587 // Name - the name of the alert rule. 588 Name *string `json:"name,omitempty"` 589 // Description - the description of the alert rule that will be included in the alert email. 590 Description *string `json:"description,omitempty"` 591 // IsEnabled - the flag that indicates whether the alert rule is enabled. 592 IsEnabled *bool `json:"isEnabled,omitempty"` 593 // Condition - the condition that results in the alert rule being activated. 594 Condition BasicRuleCondition `json:"condition,omitempty"` 595 // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. 596 Actions *[]BasicRuleAction `json:"actions,omitempty"` 597 // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. 598 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 599} 600 601// MarshalJSON is the custom marshaler for AlertRule. 602func (ar AlertRule) MarshalJSON() ([]byte, error) { 603 objectMap := make(map[string]interface{}) 604 if ar.Name != nil { 605 objectMap["name"] = ar.Name 606 } 607 if ar.Description != nil { 608 objectMap["description"] = ar.Description 609 } 610 if ar.IsEnabled != nil { 611 objectMap["isEnabled"] = ar.IsEnabled 612 } 613 objectMap["condition"] = ar.Condition 614 if ar.Actions != nil { 615 objectMap["actions"] = ar.Actions 616 } 617 return json.Marshal(objectMap) 618} 619 620// UnmarshalJSON is the custom unmarshaler for AlertRule struct. 621func (ar *AlertRule) UnmarshalJSON(body []byte) error { 622 var m map[string]*json.RawMessage 623 err := json.Unmarshal(body, &m) 624 if err != nil { 625 return err 626 } 627 for k, v := range m { 628 switch k { 629 case "name": 630 if v != nil { 631 var name string 632 err = json.Unmarshal(*v, &name) 633 if err != nil { 634 return err 635 } 636 ar.Name = &name 637 } 638 case "description": 639 if v != nil { 640 var description string 641 err = json.Unmarshal(*v, &description) 642 if err != nil { 643 return err 644 } 645 ar.Description = &description 646 } 647 case "isEnabled": 648 if v != nil { 649 var isEnabled bool 650 err = json.Unmarshal(*v, &isEnabled) 651 if err != nil { 652 return err 653 } 654 ar.IsEnabled = &isEnabled 655 } 656 case "condition": 657 if v != nil { 658 condition, err := unmarshalBasicRuleCondition(*v) 659 if err != nil { 660 return err 661 } 662 ar.Condition = condition 663 } 664 case "actions": 665 if v != nil { 666 actions, err := unmarshalBasicRuleActionArray(*v) 667 if err != nil { 668 return err 669 } 670 ar.Actions = &actions 671 } 672 case "lastUpdatedTime": 673 if v != nil { 674 var lastUpdatedTime date.Time 675 err = json.Unmarshal(*v, &lastUpdatedTime) 676 if err != nil { 677 return err 678 } 679 ar.LastUpdatedTime = &lastUpdatedTime 680 } 681 } 682 } 683 684 return nil 685} 686 687// AlertRuleResource the alert rule resource. 688type AlertRuleResource struct { 689 autorest.Response `json:"-"` 690 // AlertRule - The alert rule properties of the resource. 691 *AlertRule `json:"properties,omitempty"` 692 // ID - READ-ONLY; Azure resource Id 693 ID *string `json:"id,omitempty"` 694 // Name - READ-ONLY; Azure resource name 695 Name *string `json:"name,omitempty"` 696 // Type - READ-ONLY; Azure resource type 697 Type *string `json:"type,omitempty"` 698 // Location - Resource location 699 Location *string `json:"location,omitempty"` 700 // Tags - Resource tags 701 Tags map[string]*string `json:"tags"` 702} 703 704// MarshalJSON is the custom marshaler for AlertRuleResource. 705func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { 706 objectMap := make(map[string]interface{}) 707 if arr.AlertRule != nil { 708 objectMap["properties"] = arr.AlertRule 709 } 710 if arr.Location != nil { 711 objectMap["location"] = arr.Location 712 } 713 if arr.Tags != nil { 714 objectMap["tags"] = arr.Tags 715 } 716 return json.Marshal(objectMap) 717} 718 719// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. 720func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { 721 var m map[string]*json.RawMessage 722 err := json.Unmarshal(body, &m) 723 if err != nil { 724 return err 725 } 726 for k, v := range m { 727 switch k { 728 case "properties": 729 if v != nil { 730 var alertRule AlertRule 731 err = json.Unmarshal(*v, &alertRule) 732 if err != nil { 733 return err 734 } 735 arr.AlertRule = &alertRule 736 } 737 case "id": 738 if v != nil { 739 var ID string 740 err = json.Unmarshal(*v, &ID) 741 if err != nil { 742 return err 743 } 744 arr.ID = &ID 745 } 746 case "name": 747 if v != nil { 748 var name string 749 err = json.Unmarshal(*v, &name) 750 if err != nil { 751 return err 752 } 753 arr.Name = &name 754 } 755 case "type": 756 if v != nil { 757 var typeVar string 758 err = json.Unmarshal(*v, &typeVar) 759 if err != nil { 760 return err 761 } 762 arr.Type = &typeVar 763 } 764 case "location": 765 if v != nil { 766 var location string 767 err = json.Unmarshal(*v, &location) 768 if err != nil { 769 return err 770 } 771 arr.Location = &location 772 } 773 case "tags": 774 if v != nil { 775 var tags map[string]*string 776 err = json.Unmarshal(*v, &tags) 777 if err != nil { 778 return err 779 } 780 arr.Tags = tags 781 } 782 } 783 } 784 785 return nil 786} 787 788// AlertRuleResourceCollection represents a collection of alert rule resources. 789type AlertRuleResourceCollection struct { 790 autorest.Response `json:"-"` 791 // Value - the values for the alert rule resources. 792 Value *[]AlertRuleResource `json:"value,omitempty"` 793} 794 795// AlertRuleResourcePatch the alert rule object for patch operations. 796type AlertRuleResourcePatch struct { 797 // Tags - Resource tags 798 Tags map[string]*string `json:"tags"` 799 // AlertRule - The properties of an alert rule. 800 *AlertRule `json:"properties,omitempty"` 801} 802 803// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. 804func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { 805 objectMap := make(map[string]interface{}) 806 if arrp.Tags != nil { 807 objectMap["tags"] = arrp.Tags 808 } 809 if arrp.AlertRule != nil { 810 objectMap["properties"] = arrp.AlertRule 811 } 812 return json.Marshal(objectMap) 813} 814 815// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. 816func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error { 817 var m map[string]*json.RawMessage 818 err := json.Unmarshal(body, &m) 819 if err != nil { 820 return err 821 } 822 for k, v := range m { 823 switch k { 824 case "tags": 825 if v != nil { 826 var tags map[string]*string 827 err = json.Unmarshal(*v, &tags) 828 if err != nil { 829 return err 830 } 831 arrp.Tags = tags 832 } 833 case "properties": 834 if v != nil { 835 var alertRule AlertRule 836 err = json.Unmarshal(*v, &alertRule) 837 if err != nil { 838 return err 839 } 840 arrp.AlertRule = &alertRule 841 } 842 } 843 } 844 845 return nil 846} 847 848// ArmRoleReceiver an arm role receiver. 849type ArmRoleReceiver struct { 850 // Name - The name of the arm role receiver. Names must be unique across all receivers within an action group. 851 Name *string `json:"name,omitempty"` 852 // RoleID - The arm role id. 853 RoleID *string `json:"roleId,omitempty"` 854 // UseCommonAlertSchema - Indicates whether to use common alert schema. 855 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` 856} 857 858// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. 859type AutomationRunbookReceiver struct { 860 // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. 861 AutomationAccountID *string `json:"automationAccountId,omitempty"` 862 // RunbookName - The name for this runbook. 863 RunbookName *string `json:"runbookName,omitempty"` 864 // WebhookResourceID - The resource id for webhook linked to this runbook. 865 WebhookResourceID *string `json:"webhookResourceId,omitempty"` 866 // IsGlobalRunbook - Indicates whether this instance is global runbook. 867 IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` 868 // Name - Indicates name of the webhook. 869 Name *string `json:"name,omitempty"` 870 // ServiceURI - The URI where webhooks should be sent. 871 ServiceURI *string `json:"serviceUri,omitempty"` 872 // UseCommonAlertSchema - Indicates whether to use common alert schema. 873 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` 874} 875 876// AutoscaleNotification autoscale notification. 877type AutoscaleNotification struct { 878 // Operation - the operation associated with the notification and its value must be "scale" 879 Operation *string `json:"operation,omitempty"` 880 // Email - the email notification. 881 Email *EmailNotification `json:"email,omitempty"` 882 // Webhooks - the collection of webhook notifications. 883 Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` 884} 885 886// AutoscaleProfile autoscale profile. 887type AutoscaleProfile struct { 888 // Name - the name of the profile. 889 Name *string `json:"name,omitempty"` 890 // Capacity - the number of instances that can be used during this profile. 891 Capacity *ScaleCapacity `json:"capacity,omitempty"` 892 // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. 893 Rules *[]ScaleRule `json:"rules,omitempty"` 894 // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. 895 FixedDate *TimeWindow `json:"fixedDate,omitempty"` 896 // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. 897 Recurrence *Recurrence `json:"recurrence,omitempty"` 898} 899 900// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a 901// resource. 902type AutoscaleSetting struct { 903 // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. 904 Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` 905 // Notifications - the collection of notifications. 906 Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` 907 // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. 908 Enabled *bool `json:"enabled,omitempty"` 909 // Name - the name of the autoscale setting. 910 Name *string `json:"name,omitempty"` 911 // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. 912 TargetResourceURI *string `json:"targetResourceUri,omitempty"` 913} 914 915// AutoscaleSettingResource the autoscale setting resource. 916type AutoscaleSettingResource struct { 917 autorest.Response `json:"-"` 918 // AutoscaleSetting - The autoscale setting of the resource. 919 *AutoscaleSetting `json:"properties,omitempty"` 920 // ID - READ-ONLY; Azure resource Id 921 ID *string `json:"id,omitempty"` 922 // Name - READ-ONLY; Azure resource name 923 Name *string `json:"name,omitempty"` 924 // Type - READ-ONLY; Azure resource type 925 Type *string `json:"type,omitempty"` 926 // Location - Resource location 927 Location *string `json:"location,omitempty"` 928 // Tags - Resource tags 929 Tags map[string]*string `json:"tags"` 930} 931 932// MarshalJSON is the custom marshaler for AutoscaleSettingResource. 933func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { 934 objectMap := make(map[string]interface{}) 935 if asr.AutoscaleSetting != nil { 936 objectMap["properties"] = asr.AutoscaleSetting 937 } 938 if asr.Location != nil { 939 objectMap["location"] = asr.Location 940 } 941 if asr.Tags != nil { 942 objectMap["tags"] = asr.Tags 943 } 944 return json.Marshal(objectMap) 945} 946 947// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. 948func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { 949 var m map[string]*json.RawMessage 950 err := json.Unmarshal(body, &m) 951 if err != nil { 952 return err 953 } 954 for k, v := range m { 955 switch k { 956 case "properties": 957 if v != nil { 958 var autoscaleSetting AutoscaleSetting 959 err = json.Unmarshal(*v, &autoscaleSetting) 960 if err != nil { 961 return err 962 } 963 asr.AutoscaleSetting = &autoscaleSetting 964 } 965 case "id": 966 if v != nil { 967 var ID string 968 err = json.Unmarshal(*v, &ID) 969 if err != nil { 970 return err 971 } 972 asr.ID = &ID 973 } 974 case "name": 975 if v != nil { 976 var name string 977 err = json.Unmarshal(*v, &name) 978 if err != nil { 979 return err 980 } 981 asr.Name = &name 982 } 983 case "type": 984 if v != nil { 985 var typeVar string 986 err = json.Unmarshal(*v, &typeVar) 987 if err != nil { 988 return err 989 } 990 asr.Type = &typeVar 991 } 992 case "location": 993 if v != nil { 994 var location string 995 err = json.Unmarshal(*v, &location) 996 if err != nil { 997 return err 998 } 999 asr.Location = &location 1000 } 1001 case "tags": 1002 if v != nil { 1003 var tags map[string]*string 1004 err = json.Unmarshal(*v, &tags) 1005 if err != nil { 1006 return err 1007 } 1008 asr.Tags = tags 1009 } 1010 } 1011 } 1012 1013 return nil 1014} 1015 1016// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. 1017type AutoscaleSettingResourceCollection struct { 1018 autorest.Response `json:"-"` 1019 // Value - the values for the autoscale setting resources. 1020 Value *[]AutoscaleSettingResource `json:"value,omitempty"` 1021 // NextLink - URL to get the next set of results. 1022 NextLink *string `json:"nextLink,omitempty"` 1023} 1024 1025// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of 1026// AutoscaleSettingResource values. 1027type AutoscaleSettingResourceCollectionIterator struct { 1028 i int 1029 page AutoscaleSettingResourceCollectionPage 1030} 1031 1032// NextWithContext advances to the next value. If there was an error making 1033// the request the iterator does not advance and the error is returned. 1034func (iter *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { 1035 if tracing.IsEnabled() { 1036 ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.NextWithContext") 1037 defer func() { 1038 sc := -1 1039 if iter.Response().Response.Response != nil { 1040 sc = iter.Response().Response.Response.StatusCode 1041 } 1042 tracing.EndSpan(ctx, sc, err) 1043 }() 1044 } 1045 iter.i++ 1046 if iter.i < len(iter.page.Values()) { 1047 return nil 1048 } 1049 err = iter.page.NextWithContext(ctx) 1050 if err != nil { 1051 iter.i-- 1052 return err 1053 } 1054 iter.i = 0 1055 return nil 1056} 1057 1058// Next advances to the next value. If there was an error making 1059// the request the iterator does not advance and the error is returned. 1060// Deprecated: Use NextWithContext() instead. 1061func (iter *AutoscaleSettingResourceCollectionIterator) Next() error { 1062 return iter.NextWithContext(context.Background()) 1063} 1064 1065// NotDone returns true if the enumeration should be started or is not yet complete. 1066func (iter AutoscaleSettingResourceCollectionIterator) NotDone() bool { 1067 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1068} 1069 1070// Response returns the raw server response from the last page request. 1071func (iter AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { 1072 return iter.page.Response() 1073} 1074 1075// Value returns the current value or a zero-initialized value if the 1076// iterator has advanced beyond the end of the collection. 1077func (iter AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { 1078 if !iter.page.NotDone() { 1079 return AutoscaleSettingResource{} 1080 } 1081 return iter.page.Values()[iter.i] 1082} 1083 1084// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. 1085func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { 1086 return AutoscaleSettingResourceCollectionIterator{page: page} 1087} 1088 1089// IsEmpty returns true if the ListResult contains no values. 1090func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { 1091 return asrc.Value == nil || len(*asrc.Value) == 0 1092} 1093 1094// hasNextLink returns true if the NextLink is not empty. 1095func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { 1096 return asrc.NextLink != nil && len(*asrc.NextLink) != 0 1097} 1098 1099// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. 1100// It returns nil if no more results exist. 1101func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { 1102 if !asrc.hasNextLink() { 1103 return nil, nil 1104 } 1105 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1106 autorest.AsJSON(), 1107 autorest.AsGet(), 1108 autorest.WithBaseURL(to.String(asrc.NextLink))) 1109} 1110 1111// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. 1112type AutoscaleSettingResourceCollectionPage struct { 1113 fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) 1114 asrc AutoscaleSettingResourceCollection 1115} 1116 1117// NextWithContext advances to the next page of values. If there was an error making 1118// the request the page does not advance and the error is returned. 1119func (page *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { 1120 if tracing.IsEnabled() { 1121 ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.NextWithContext") 1122 defer func() { 1123 sc := -1 1124 if page.Response().Response.Response != nil { 1125 sc = page.Response().Response.Response.StatusCode 1126 } 1127 tracing.EndSpan(ctx, sc, err) 1128 }() 1129 } 1130 for { 1131 next, err := page.fn(ctx, page.asrc) 1132 if err != nil { 1133 return err 1134 } 1135 page.asrc = next 1136 if !next.hasNextLink() || !next.IsEmpty() { 1137 break 1138 } 1139 } 1140 return nil 1141} 1142 1143// Next advances to the next page of values. If there was an error making 1144// the request the page does not advance and the error is returned. 1145// Deprecated: Use NextWithContext() instead. 1146func (page *AutoscaleSettingResourceCollectionPage) Next() error { 1147 return page.NextWithContext(context.Background()) 1148} 1149 1150// NotDone returns true if the page enumeration should be started or is not yet complete. 1151func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { 1152 return !page.asrc.IsEmpty() 1153} 1154 1155// Response returns the raw server response from the last page request. 1156func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { 1157 return page.asrc 1158} 1159 1160// Values returns the slice of values for the current page or nil if there are no values. 1161func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { 1162 if page.asrc.IsEmpty() { 1163 return nil 1164 } 1165 return *page.asrc.Value 1166} 1167 1168// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. 1169func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { 1170 return AutoscaleSettingResourceCollectionPage{ 1171 fn: getNextPage, 1172 asrc: cur, 1173 } 1174} 1175 1176// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. 1177type AutoscaleSettingResourcePatch struct { 1178 // Tags - Resource tags 1179 Tags map[string]*string `json:"tags"` 1180 // AutoscaleSetting - The autoscale setting properties of the update operation. 1181 *AutoscaleSetting `json:"properties,omitempty"` 1182} 1183 1184// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. 1185func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { 1186 objectMap := make(map[string]interface{}) 1187 if asrp.Tags != nil { 1188 objectMap["tags"] = asrp.Tags 1189 } 1190 if asrp.AutoscaleSetting != nil { 1191 objectMap["properties"] = asrp.AutoscaleSetting 1192 } 1193 return json.Marshal(objectMap) 1194} 1195 1196// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. 1197func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error { 1198 var m map[string]*json.RawMessage 1199 err := json.Unmarshal(body, &m) 1200 if err != nil { 1201 return err 1202 } 1203 for k, v := range m { 1204 switch k { 1205 case "tags": 1206 if v != nil { 1207 var tags map[string]*string 1208 err = json.Unmarshal(*v, &tags) 1209 if err != nil { 1210 return err 1211 } 1212 asrp.Tags = tags 1213 } 1214 case "properties": 1215 if v != nil { 1216 var autoscaleSetting AutoscaleSetting 1217 err = json.Unmarshal(*v, &autoscaleSetting) 1218 if err != nil { 1219 return err 1220 } 1221 asrp.AutoscaleSetting = &autoscaleSetting 1222 } 1223 } 1224 } 1225 1226 return nil 1227} 1228 1229// AzNsActionGroup azure action group 1230type AzNsActionGroup struct { 1231 // ActionGroup - Azure Action Group reference. 1232 ActionGroup *[]string `json:"actionGroup,omitempty"` 1233 // EmailSubject - Custom subject override for all email ids in Azure action group 1234 EmailSubject *string `json:"emailSubject,omitempty"` 1235 // CustomWebhookPayload - Custom payload to be sent for all webhook URI in Azure action group 1236 CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"` 1237} 1238 1239// AzureAppPushReceiver the Azure mobile App push notification receiver. 1240type AzureAppPushReceiver struct { 1241 // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. 1242 Name *string `json:"name,omitempty"` 1243 // EmailAddress - The email address registered for the Azure mobile app. 1244 EmailAddress *string `json:"emailAddress,omitempty"` 1245} 1246 1247// AzureFunctionReceiver an azure function receiver. 1248type AzureFunctionReceiver struct { 1249 // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. 1250 Name *string `json:"name,omitempty"` 1251 // FunctionAppResourceID - The azure resource id of the function app. 1252 FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` 1253 // FunctionName - The function name in the function app. 1254 FunctionName *string `json:"functionName,omitempty"` 1255 // HTTPTriggerURL - The http trigger url where http request sent to. 1256 HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` 1257 // UseCommonAlertSchema - Indicates whether to use common alert schema. 1258 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` 1259} 1260 1261// AzureMonitorPrivateLinkScope an Azure Monitor PrivateLinkScope definition. 1262type AzureMonitorPrivateLinkScope struct { 1263 autorest.Response `json:"-"` 1264 // AzureMonitorPrivateLinkScopeProperties - Properties that define a Azure Monitor PrivateLinkScope resource. 1265 *AzureMonitorPrivateLinkScopeProperties `json:"properties,omitempty"` 1266 // ID - READ-ONLY; Azure resource Id 1267 ID *string `json:"id,omitempty"` 1268 // Name - READ-ONLY; Azure resource name 1269 Name *string `json:"name,omitempty"` 1270 // Type - READ-ONLY; Azure resource type 1271 Type *string `json:"type,omitempty"` 1272 // Location - Resource location 1273 Location *string `json:"location,omitempty"` 1274 // Tags - Resource tags 1275 Tags map[string]*string `json:"tags"` 1276} 1277 1278// MarshalJSON is the custom marshaler for AzureMonitorPrivateLinkScope. 1279func (ampls AzureMonitorPrivateLinkScope) MarshalJSON() ([]byte, error) { 1280 objectMap := make(map[string]interface{}) 1281 if ampls.AzureMonitorPrivateLinkScopeProperties != nil { 1282 objectMap["properties"] = ampls.AzureMonitorPrivateLinkScopeProperties 1283 } 1284 if ampls.Location != nil { 1285 objectMap["location"] = ampls.Location 1286 } 1287 if ampls.Tags != nil { 1288 objectMap["tags"] = ampls.Tags 1289 } 1290 return json.Marshal(objectMap) 1291} 1292 1293// UnmarshalJSON is the custom unmarshaler for AzureMonitorPrivateLinkScope struct. 1294func (ampls *AzureMonitorPrivateLinkScope) UnmarshalJSON(body []byte) error { 1295 var m map[string]*json.RawMessage 1296 err := json.Unmarshal(body, &m) 1297 if err != nil { 1298 return err 1299 } 1300 for k, v := range m { 1301 switch k { 1302 case "properties": 1303 if v != nil { 1304 var azureMonitorPrivateLinkScopeProperties AzureMonitorPrivateLinkScopeProperties 1305 err = json.Unmarshal(*v, &azureMonitorPrivateLinkScopeProperties) 1306 if err != nil { 1307 return err 1308 } 1309 ampls.AzureMonitorPrivateLinkScopeProperties = &azureMonitorPrivateLinkScopeProperties 1310 } 1311 case "id": 1312 if v != nil { 1313 var ID string 1314 err = json.Unmarshal(*v, &ID) 1315 if err != nil { 1316 return err 1317 } 1318 ampls.ID = &ID 1319 } 1320 case "name": 1321 if v != nil { 1322 var name string 1323 err = json.Unmarshal(*v, &name) 1324 if err != nil { 1325 return err 1326 } 1327 ampls.Name = &name 1328 } 1329 case "type": 1330 if v != nil { 1331 var typeVar string 1332 err = json.Unmarshal(*v, &typeVar) 1333 if err != nil { 1334 return err 1335 } 1336 ampls.Type = &typeVar 1337 } 1338 case "location": 1339 if v != nil { 1340 var location string 1341 err = json.Unmarshal(*v, &location) 1342 if err != nil { 1343 return err 1344 } 1345 ampls.Location = &location 1346 } 1347 case "tags": 1348 if v != nil { 1349 var tags map[string]*string 1350 err = json.Unmarshal(*v, &tags) 1351 if err != nil { 1352 return err 1353 } 1354 ampls.Tags = tags 1355 } 1356 } 1357 } 1358 1359 return nil 1360} 1361 1362// AzureMonitorPrivateLinkScopeListResult describes the list of Azure Monitor PrivateLinkScope resources. 1363type AzureMonitorPrivateLinkScopeListResult struct { 1364 autorest.Response `json:"-"` 1365 // Value - List of Azure Monitor PrivateLinkScope definitions. 1366 Value *[]AzureMonitorPrivateLinkScope `json:"value,omitempty"` 1367 // NextLink - The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many PrivateLinkScopes where returned in the result set. 1368 NextLink *string `json:"nextLink,omitempty"` 1369} 1370 1371// AzureMonitorPrivateLinkScopeListResultIterator provides access to a complete listing of 1372// AzureMonitorPrivateLinkScope values. 1373type AzureMonitorPrivateLinkScopeListResultIterator struct { 1374 i int 1375 page AzureMonitorPrivateLinkScopeListResultPage 1376} 1377 1378// NextWithContext advances to the next value. If there was an error making 1379// the request the iterator does not advance and the error is returned. 1380func (iter *AzureMonitorPrivateLinkScopeListResultIterator) NextWithContext(ctx context.Context) (err error) { 1381 if tracing.IsEnabled() { 1382 ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultIterator.NextWithContext") 1383 defer func() { 1384 sc := -1 1385 if iter.Response().Response.Response != nil { 1386 sc = iter.Response().Response.Response.StatusCode 1387 } 1388 tracing.EndSpan(ctx, sc, err) 1389 }() 1390 } 1391 iter.i++ 1392 if iter.i < len(iter.page.Values()) { 1393 return nil 1394 } 1395 err = iter.page.NextWithContext(ctx) 1396 if err != nil { 1397 iter.i-- 1398 return err 1399 } 1400 iter.i = 0 1401 return nil 1402} 1403 1404// Next advances to the next value. If there was an error making 1405// the request the iterator does not advance and the error is returned. 1406// Deprecated: Use NextWithContext() instead. 1407func (iter *AzureMonitorPrivateLinkScopeListResultIterator) Next() error { 1408 return iter.NextWithContext(context.Background()) 1409} 1410 1411// NotDone returns true if the enumeration should be started or is not yet complete. 1412func (iter AzureMonitorPrivateLinkScopeListResultIterator) NotDone() bool { 1413 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1414} 1415 1416// Response returns the raw server response from the last page request. 1417func (iter AzureMonitorPrivateLinkScopeListResultIterator) Response() AzureMonitorPrivateLinkScopeListResult { 1418 return iter.page.Response() 1419} 1420 1421// Value returns the current value or a zero-initialized value if the 1422// iterator has advanced beyond the end of the collection. 1423func (iter AzureMonitorPrivateLinkScopeListResultIterator) Value() AzureMonitorPrivateLinkScope { 1424 if !iter.page.NotDone() { 1425 return AzureMonitorPrivateLinkScope{} 1426 } 1427 return iter.page.Values()[iter.i] 1428} 1429 1430// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultIterator type. 1431func NewAzureMonitorPrivateLinkScopeListResultIterator(page AzureMonitorPrivateLinkScopeListResultPage) AzureMonitorPrivateLinkScopeListResultIterator { 1432 return AzureMonitorPrivateLinkScopeListResultIterator{page: page} 1433} 1434 1435// IsEmpty returns true if the ListResult contains no values. 1436func (amplslr AzureMonitorPrivateLinkScopeListResult) IsEmpty() bool { 1437 return amplslr.Value == nil || len(*amplslr.Value) == 0 1438} 1439 1440// hasNextLink returns true if the NextLink is not empty. 1441func (amplslr AzureMonitorPrivateLinkScopeListResult) hasNextLink() bool { 1442 return amplslr.NextLink != nil && len(*amplslr.NextLink) != 0 1443} 1444 1445// azureMonitorPrivateLinkScopeListResultPreparer prepares a request to retrieve the next set of results. 1446// It returns nil if no more results exist. 1447func (amplslr AzureMonitorPrivateLinkScopeListResult) azureMonitorPrivateLinkScopeListResultPreparer(ctx context.Context) (*http.Request, error) { 1448 if !amplslr.hasNextLink() { 1449 return nil, nil 1450 } 1451 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1452 autorest.AsJSON(), 1453 autorest.AsGet(), 1454 autorest.WithBaseURL(to.String(amplslr.NextLink))) 1455} 1456 1457// AzureMonitorPrivateLinkScopeListResultPage contains a page of AzureMonitorPrivateLinkScope values. 1458type AzureMonitorPrivateLinkScopeListResultPage struct { 1459 fn func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error) 1460 amplslr AzureMonitorPrivateLinkScopeListResult 1461} 1462 1463// NextWithContext advances to the next page of values. If there was an error making 1464// the request the page does not advance and the error is returned. 1465func (page *AzureMonitorPrivateLinkScopeListResultPage) NextWithContext(ctx context.Context) (err error) { 1466 if tracing.IsEnabled() { 1467 ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultPage.NextWithContext") 1468 defer func() { 1469 sc := -1 1470 if page.Response().Response.Response != nil { 1471 sc = page.Response().Response.Response.StatusCode 1472 } 1473 tracing.EndSpan(ctx, sc, err) 1474 }() 1475 } 1476 for { 1477 next, err := page.fn(ctx, page.amplslr) 1478 if err != nil { 1479 return err 1480 } 1481 page.amplslr = next 1482 if !next.hasNextLink() || !next.IsEmpty() { 1483 break 1484 } 1485 } 1486 return nil 1487} 1488 1489// Next advances to the next page of values. If there was an error making 1490// the request the page does not advance and the error is returned. 1491// Deprecated: Use NextWithContext() instead. 1492func (page *AzureMonitorPrivateLinkScopeListResultPage) Next() error { 1493 return page.NextWithContext(context.Background()) 1494} 1495 1496// NotDone returns true if the page enumeration should be started or is not yet complete. 1497func (page AzureMonitorPrivateLinkScopeListResultPage) NotDone() bool { 1498 return !page.amplslr.IsEmpty() 1499} 1500 1501// Response returns the raw server response from the last page request. 1502func (page AzureMonitorPrivateLinkScopeListResultPage) Response() AzureMonitorPrivateLinkScopeListResult { 1503 return page.amplslr 1504} 1505 1506// Values returns the slice of values for the current page or nil if there are no values. 1507func (page AzureMonitorPrivateLinkScopeListResultPage) Values() []AzureMonitorPrivateLinkScope { 1508 if page.amplslr.IsEmpty() { 1509 return nil 1510 } 1511 return *page.amplslr.Value 1512} 1513 1514// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultPage type. 1515func NewAzureMonitorPrivateLinkScopeListResultPage(cur AzureMonitorPrivateLinkScopeListResult, getNextPage func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error)) AzureMonitorPrivateLinkScopeListResultPage { 1516 return AzureMonitorPrivateLinkScopeListResultPage{ 1517 fn: getNextPage, 1518 amplslr: cur, 1519 } 1520} 1521 1522// AzureMonitorPrivateLinkScopeProperties properties that define a Azure Monitor PrivateLinkScope resource. 1523type AzureMonitorPrivateLinkScopeProperties struct { 1524 // ProvisioningState - READ-ONLY; Current state of this PrivateLinkScope: whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed. 1525 ProvisioningState *string `json:"provisioningState,omitempty"` 1526 // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections. 1527 PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` 1528} 1529 1530// MarshalJSON is the custom marshaler for AzureMonitorPrivateLinkScopeProperties. 1531func (amplsp AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { 1532 objectMap := make(map[string]interface{}) 1533 return json.Marshal(objectMap) 1534} 1535 1536// Baseline the baseline values for a single sensitivity value. 1537type Baseline struct { 1538 // Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh' 1539 Sensitivity Sensitivity `json:"sensitivity,omitempty"` 1540 // LowThresholds - The low thresholds of the baseline. 1541 LowThresholds *[]float64 `json:"lowThresholds,omitempty"` 1542 // HighThresholds - The high thresholds of the baseline. 1543 HighThresholds *[]float64 `json:"highThresholds,omitempty"` 1544 // Timestamps - the array of timestamps of the baselines. 1545 Timestamps *[]date.Time `json:"timestamps,omitempty"` 1546} 1547 1548// BaselineMetadata represents a baseline metadata value. 1549type BaselineMetadata struct { 1550 // Name - Name of the baseline metadata. 1551 Name *string `json:"name,omitempty"` 1552 // Value - Value of the baseline metadata. 1553 Value *string `json:"value,omitempty"` 1554} 1555 1556// BaselineMetadataValue represents a baseline metadata value. 1557type BaselineMetadataValue struct { 1558 // Name - the name of the metadata. 1559 Name *LocalizableString `json:"name,omitempty"` 1560 // Value - the value of the metadata. 1561 Value *string `json:"value,omitempty"` 1562} 1563 1564// BaselineProperties the baseline properties class. 1565type BaselineProperties struct { 1566 // 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. 1567 Timespan *string `json:"timespan,omitempty"` 1568 // 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. 1569 Interval *string `json:"interval,omitempty"` 1570 // Aggregation - The aggregation type of the metric. 1571 Aggregation *string `json:"aggregation,omitempty"` 1572 // Timestamps - the array of timestamps of the baselines. 1573 Timestamps *[]date.Time `json:"timestamps,omitempty"` 1574 // Baseline - the baseline values for each sensitivity. 1575 Baseline *[]Baseline `json:"baseline,omitempty"` 1576 // Metadata - the baseline metadata values. 1577 Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` 1578} 1579 1580// BaselineResponse the response to a baseline query. 1581type BaselineResponse struct { 1582 autorest.Response `json:"-"` 1583 // ID - READ-ONLY; the metric baseline Id. 1584 ID *string `json:"id,omitempty"` 1585 // Type - READ-ONLY; the resource type of the baseline resource. 1586 Type *string `json:"type,omitempty"` 1587 // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. 1588 Name *LocalizableString `json:"name,omitempty"` 1589 // BaselineProperties - the properties of the baseline. 1590 *BaselineProperties `json:"properties,omitempty"` 1591} 1592 1593// MarshalJSON is the custom marshaler for BaselineResponse. 1594func (br BaselineResponse) MarshalJSON() ([]byte, error) { 1595 objectMap := make(map[string]interface{}) 1596 if br.BaselineProperties != nil { 1597 objectMap["properties"] = br.BaselineProperties 1598 } 1599 return json.Marshal(objectMap) 1600} 1601 1602// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. 1603func (br *BaselineResponse) UnmarshalJSON(body []byte) error { 1604 var m map[string]*json.RawMessage 1605 err := json.Unmarshal(body, &m) 1606 if err != nil { 1607 return err 1608 } 1609 for k, v := range m { 1610 switch k { 1611 case "id": 1612 if v != nil { 1613 var ID string 1614 err = json.Unmarshal(*v, &ID) 1615 if err != nil { 1616 return err 1617 } 1618 br.ID = &ID 1619 } 1620 case "type": 1621 if v != nil { 1622 var typeVar string 1623 err = json.Unmarshal(*v, &typeVar) 1624 if err != nil { 1625 return err 1626 } 1627 br.Type = &typeVar 1628 } 1629 case "name": 1630 if v != nil { 1631 var name LocalizableString 1632 err = json.Unmarshal(*v, &name) 1633 if err != nil { 1634 return err 1635 } 1636 br.Name = &name 1637 } 1638 case "properties": 1639 if v != nil { 1640 var baselineProperties BaselineProperties 1641 err = json.Unmarshal(*v, &baselineProperties) 1642 if err != nil { 1643 return err 1644 } 1645 br.BaselineProperties = &baselineProperties 1646 } 1647 } 1648 } 1649 1650 return nil 1651} 1652 1653// CalculateBaselineResponse the response to a calculate baseline call. 1654type CalculateBaselineResponse struct { 1655 autorest.Response `json:"-"` 1656 // Type - the resource type of the baseline resource. 1657 Type *string `json:"type,omitempty"` 1658 // Timestamps - the array of timestamps of the baselines. 1659 Timestamps *[]date.Time `json:"timestamps,omitempty"` 1660 // Baseline - the baseline values for each sensitivity. 1661 Baseline *[]Baseline `json:"baseline,omitempty"` 1662} 1663 1664// Criteria specifies the criteria for converting log to metric. 1665type Criteria struct { 1666 // MetricName - Name of the metric 1667 MetricName *string `json:"metricName,omitempty"` 1668 // Dimensions - List of Dimensions for creating metric 1669 Dimensions *[]Dimension `json:"dimensions,omitempty"` 1670} 1671 1672// DataContainer information about a container with data for a given resource. 1673type DataContainer struct { 1674 // Workspace - Log Analytics workspace information. 1675 Workspace *WorkspaceInfo `json:"workspace,omitempty"` 1676} 1677 1678// DiagnosticSettings the diagnostic settings. 1679type DiagnosticSettings struct { 1680 // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. 1681 StorageAccountID *string `json:"storageAccountId,omitempty"` 1682 // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. 1683 ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` 1684 // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. 1685 EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` 1686 // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. 1687 EventHubName *string `json:"eventHubName,omitempty"` 1688 // Metrics - The list of metric settings. 1689 Metrics *[]MetricSettings `json:"metrics,omitempty"` 1690 // Logs - The list of logs settings. 1691 Logs *[]LogSettings `json:"logs,omitempty"` 1692 // 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 1693 WorkspaceID *string `json:"workspaceId,omitempty"` 1694 // 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.) 1695 LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` 1696} 1697 1698// DiagnosticSettingsCategory the diagnostic settings Category. 1699type DiagnosticSettingsCategory struct { 1700 // CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs' 1701 CategoryType CategoryType `json:"categoryType,omitempty"` 1702} 1703 1704// DiagnosticSettingsCategoryResource the diagnostic settings category resource. 1705type DiagnosticSettingsCategoryResource struct { 1706 autorest.Response `json:"-"` 1707 // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. 1708 *DiagnosticSettingsCategory `json:"properties,omitempty"` 1709 // ID - READ-ONLY; Azure resource Id 1710 ID *string `json:"id,omitempty"` 1711 // Name - READ-ONLY; Azure resource name 1712 Name *string `json:"name,omitempty"` 1713 // Type - READ-ONLY; Azure resource type 1714 Type *string `json:"type,omitempty"` 1715} 1716 1717// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. 1718func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { 1719 objectMap := make(map[string]interface{}) 1720 if dscr.DiagnosticSettingsCategory != nil { 1721 objectMap["properties"] = dscr.DiagnosticSettingsCategory 1722 } 1723 return json.Marshal(objectMap) 1724} 1725 1726// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. 1727func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error { 1728 var m map[string]*json.RawMessage 1729 err := json.Unmarshal(body, &m) 1730 if err != nil { 1731 return err 1732 } 1733 for k, v := range m { 1734 switch k { 1735 case "properties": 1736 if v != nil { 1737 var diagnosticSettingsCategory DiagnosticSettingsCategory 1738 err = json.Unmarshal(*v, &diagnosticSettingsCategory) 1739 if err != nil { 1740 return err 1741 } 1742 dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory 1743 } 1744 case "id": 1745 if v != nil { 1746 var ID string 1747 err = json.Unmarshal(*v, &ID) 1748 if err != nil { 1749 return err 1750 } 1751 dscr.ID = &ID 1752 } 1753 case "name": 1754 if v != nil { 1755 var name string 1756 err = json.Unmarshal(*v, &name) 1757 if err != nil { 1758 return err 1759 } 1760 dscr.Name = &name 1761 } 1762 case "type": 1763 if v != nil { 1764 var typeVar string 1765 err = json.Unmarshal(*v, &typeVar) 1766 if err != nil { 1767 return err 1768 } 1769 dscr.Type = &typeVar 1770 } 1771 } 1772 } 1773 1774 return nil 1775} 1776 1777// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category 1778// resources. 1779type DiagnosticSettingsCategoryResourceCollection struct { 1780 autorest.Response `json:"-"` 1781 // Value - The collection of diagnostic settings category resources. 1782 Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` 1783} 1784 1785// DiagnosticSettingsResource the diagnostic setting resource. 1786type DiagnosticSettingsResource struct { 1787 autorest.Response `json:"-"` 1788 // DiagnosticSettings - Properties of a Diagnostic Settings Resource. 1789 *DiagnosticSettings `json:"properties,omitempty"` 1790 // ID - READ-ONLY; Azure resource Id 1791 ID *string `json:"id,omitempty"` 1792 // Name - READ-ONLY; Azure resource name 1793 Name *string `json:"name,omitempty"` 1794 // Type - READ-ONLY; Azure resource type 1795 Type *string `json:"type,omitempty"` 1796} 1797 1798// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. 1799func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { 1800 objectMap := make(map[string]interface{}) 1801 if dsr.DiagnosticSettings != nil { 1802 objectMap["properties"] = dsr.DiagnosticSettings 1803 } 1804 return json.Marshal(objectMap) 1805} 1806 1807// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. 1808func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error { 1809 var m map[string]*json.RawMessage 1810 err := json.Unmarshal(body, &m) 1811 if err != nil { 1812 return err 1813 } 1814 for k, v := range m { 1815 switch k { 1816 case "properties": 1817 if v != nil { 1818 var diagnosticSettings DiagnosticSettings 1819 err = json.Unmarshal(*v, &diagnosticSettings) 1820 if err != nil { 1821 return err 1822 } 1823 dsr.DiagnosticSettings = &diagnosticSettings 1824 } 1825 case "id": 1826 if v != nil { 1827 var ID string 1828 err = json.Unmarshal(*v, &ID) 1829 if err != nil { 1830 return err 1831 } 1832 dsr.ID = &ID 1833 } 1834 case "name": 1835 if v != nil { 1836 var name string 1837 err = json.Unmarshal(*v, &name) 1838 if err != nil { 1839 return err 1840 } 1841 dsr.Name = &name 1842 } 1843 case "type": 1844 if v != nil { 1845 var typeVar string 1846 err = json.Unmarshal(*v, &typeVar) 1847 if err != nil { 1848 return err 1849 } 1850 dsr.Type = &typeVar 1851 } 1852 } 1853 } 1854 1855 return nil 1856} 1857 1858// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. 1859type DiagnosticSettingsResourceCollection struct { 1860 autorest.Response `json:"-"` 1861 // Value - The collection of diagnostic settings resources;. 1862 Value *[]DiagnosticSettingsResource `json:"value,omitempty"` 1863} 1864 1865// Dimension specifies the criteria for converting log to metric. 1866type Dimension struct { 1867 // Name - Name of the dimension 1868 Name *string `json:"name,omitempty"` 1869 // Operator - Operator for dimension values 1870 Operator *string `json:"operator,omitempty"` 1871 // Values - List of dimension values 1872 Values *[]string `json:"values,omitempty"` 1873} 1874 1875// DynamicMetricCriteria criterion for dynamic threshold. 1876type DynamicMetricCriteria struct { 1877 // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' 1878 Operator DynamicThresholdOperator `json:"operator,omitempty"` 1879 // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'DynamicThresholdSensitivityLow', 'DynamicThresholdSensitivityMedium', 'DynamicThresholdSensitivityHigh' 1880 AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` 1881 // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. 1882 FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` 1883 // 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) 1884 IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"` 1885 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 1886 AdditionalProperties map[string]interface{} `json:""` 1887 // Name - Name of the criteria. 1888 Name *string `json:"name,omitempty"` 1889 // MetricName - Name of the metric. 1890 MetricName *string `json:"metricName,omitempty"` 1891 // MetricNamespace - Namespace of the metric. 1892 MetricNamespace *string `json:"metricNamespace,omitempty"` 1893 // TimeAggregation - the criteria time aggregation types. 1894 TimeAggregation interface{} `json:"timeAggregation,omitempty"` 1895 // Dimensions - List of dimension conditions. 1896 Dimensions *[]MetricDimension `json:"dimensions,omitempty"` 1897 // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. 1898 SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` 1899 // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' 1900 CriterionType CriterionType `json:"criterionType,omitempty"` 1901} 1902 1903// MarshalJSON is the custom marshaler for DynamicMetricCriteria. 1904func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { 1905 dmc.CriterionType = CriterionTypeDynamicThresholdCriterion 1906 objectMap := make(map[string]interface{}) 1907 if dmc.Operator != "" { 1908 objectMap["operator"] = dmc.Operator 1909 } 1910 if dmc.AlertSensitivity != "" { 1911 objectMap["alertSensitivity"] = dmc.AlertSensitivity 1912 } 1913 if dmc.FailingPeriods != nil { 1914 objectMap["failingPeriods"] = dmc.FailingPeriods 1915 } 1916 if dmc.IgnoreDataBefore != nil { 1917 objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore 1918 } 1919 if dmc.Name != nil { 1920 objectMap["name"] = dmc.Name 1921 } 1922 if dmc.MetricName != nil { 1923 objectMap["metricName"] = dmc.MetricName 1924 } 1925 if dmc.MetricNamespace != nil { 1926 objectMap["metricNamespace"] = dmc.MetricNamespace 1927 } 1928 if dmc.TimeAggregation != nil { 1929 objectMap["timeAggregation"] = dmc.TimeAggregation 1930 } 1931 if dmc.Dimensions != nil { 1932 objectMap["dimensions"] = dmc.Dimensions 1933 } 1934 if dmc.SkipMetricValidation != nil { 1935 objectMap["skipMetricValidation"] = dmc.SkipMetricValidation 1936 } 1937 if dmc.CriterionType != "" { 1938 objectMap["criterionType"] = dmc.CriterionType 1939 } 1940 for k, v := range dmc.AdditionalProperties { 1941 objectMap[k] = v 1942 } 1943 return json.Marshal(objectMap) 1944} 1945 1946// AsMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. 1947func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { 1948 return nil, false 1949} 1950 1951// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. 1952func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { 1953 return &dmc, true 1954} 1955 1956// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. 1957func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { 1958 return nil, false 1959} 1960 1961// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. 1962func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { 1963 return &dmc, true 1964} 1965 1966// UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct. 1967func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error { 1968 var m map[string]*json.RawMessage 1969 err := json.Unmarshal(body, &m) 1970 if err != nil { 1971 return err 1972 } 1973 for k, v := range m { 1974 switch k { 1975 case "operator": 1976 if v != nil { 1977 var operator DynamicThresholdOperator 1978 err = json.Unmarshal(*v, &operator) 1979 if err != nil { 1980 return err 1981 } 1982 dmc.Operator = operator 1983 } 1984 case "alertSensitivity": 1985 if v != nil { 1986 var alertSensitivity DynamicThresholdSensitivity 1987 err = json.Unmarshal(*v, &alertSensitivity) 1988 if err != nil { 1989 return err 1990 } 1991 dmc.AlertSensitivity = alertSensitivity 1992 } 1993 case "failingPeriods": 1994 if v != nil { 1995 var failingPeriods DynamicThresholdFailingPeriods 1996 err = json.Unmarshal(*v, &failingPeriods) 1997 if err != nil { 1998 return err 1999 } 2000 dmc.FailingPeriods = &failingPeriods 2001 } 2002 case "ignoreDataBefore": 2003 if v != nil { 2004 var ignoreDataBefore date.Time 2005 err = json.Unmarshal(*v, &ignoreDataBefore) 2006 if err != nil { 2007 return err 2008 } 2009 dmc.IgnoreDataBefore = &ignoreDataBefore 2010 } 2011 default: 2012 if v != nil { 2013 var additionalProperties interface{} 2014 err = json.Unmarshal(*v, &additionalProperties) 2015 if err != nil { 2016 return err 2017 } 2018 if dmc.AdditionalProperties == nil { 2019 dmc.AdditionalProperties = make(map[string]interface{}) 2020 } 2021 dmc.AdditionalProperties[k] = additionalProperties 2022 } 2023 case "name": 2024 if v != nil { 2025 var name string 2026 err = json.Unmarshal(*v, &name) 2027 if err != nil { 2028 return err 2029 } 2030 dmc.Name = &name 2031 } 2032 case "metricName": 2033 if v != nil { 2034 var metricName string 2035 err = json.Unmarshal(*v, &metricName) 2036 if err != nil { 2037 return err 2038 } 2039 dmc.MetricName = &metricName 2040 } 2041 case "metricNamespace": 2042 if v != nil { 2043 var metricNamespace string 2044 err = json.Unmarshal(*v, &metricNamespace) 2045 if err != nil { 2046 return err 2047 } 2048 dmc.MetricNamespace = &metricNamespace 2049 } 2050 case "timeAggregation": 2051 if v != nil { 2052 var timeAggregation interface{} 2053 err = json.Unmarshal(*v, &timeAggregation) 2054 if err != nil { 2055 return err 2056 } 2057 dmc.TimeAggregation = timeAggregation 2058 } 2059 case "dimensions": 2060 if v != nil { 2061 var dimensions []MetricDimension 2062 err = json.Unmarshal(*v, &dimensions) 2063 if err != nil { 2064 return err 2065 } 2066 dmc.Dimensions = &dimensions 2067 } 2068 case "skipMetricValidation": 2069 if v != nil { 2070 var skipMetricValidation bool 2071 err = json.Unmarshal(*v, &skipMetricValidation) 2072 if err != nil { 2073 return err 2074 } 2075 dmc.SkipMetricValidation = &skipMetricValidation 2076 } 2077 case "criterionType": 2078 if v != nil { 2079 var criterionType CriterionType 2080 err = json.Unmarshal(*v, &criterionType) 2081 if err != nil { 2082 return err 2083 } 2084 dmc.CriterionType = criterionType 2085 } 2086 } 2087 } 2088 2089 return nil 2090} 2091 2092// DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback 2093// time window required to raise an alert. 2094type DynamicThresholdFailingPeriods struct { 2095 // 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. 2096 NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"` 2097 // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. 2098 MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"` 2099} 2100 2101// EmailNotification email notification of an autoscale event. 2102type EmailNotification struct { 2103 // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. 2104 SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` 2105 // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. 2106 SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` 2107 // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. 2108 CustomEmails *[]string `json:"customEmails,omitempty"` 2109} 2110 2111// EmailReceiver an email receiver. 2112type EmailReceiver struct { 2113 // Name - The name of the email receiver. Names must be unique across all receivers within an action group. 2114 Name *string `json:"name,omitempty"` 2115 // EmailAddress - The email address of this receiver. 2116 EmailAddress *string `json:"emailAddress,omitempty"` 2117 // UseCommonAlertSchema - Indicates whether to use common alert schema. 2118 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` 2119 // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' 2120 Status ReceiverStatus `json:"status,omitempty"` 2121} 2122 2123// MarshalJSON is the custom marshaler for EmailReceiver. 2124func (er EmailReceiver) MarshalJSON() ([]byte, error) { 2125 objectMap := make(map[string]interface{}) 2126 if er.Name != nil { 2127 objectMap["name"] = er.Name 2128 } 2129 if er.EmailAddress != nil { 2130 objectMap["emailAddress"] = er.EmailAddress 2131 } 2132 if er.UseCommonAlertSchema != nil { 2133 objectMap["useCommonAlertSchema"] = er.UseCommonAlertSchema 2134 } 2135 return json.Marshal(objectMap) 2136} 2137 2138// EnableRequest describes a receiver that should be resubscribed. 2139type EnableRequest struct { 2140 // ReceiverName - The name of the receiver to resubscribe. 2141 ReceiverName *string `json:"receiverName,omitempty"` 2142} 2143 2144// Error error details. 2145type Error struct { 2146 // Code - Error code identifying the specific error. 2147 Code *string `json:"code,omitempty"` 2148 // Message - Error message in the caller's locale. 2149 Message *string `json:"message,omitempty"` 2150} 2151 2152// ErrorAdditionalInfo the resource management error additional info. 2153type ErrorAdditionalInfo struct { 2154 // Type - READ-ONLY; The additional info type. 2155 Type *string `json:"type,omitempty"` 2156 // Info - READ-ONLY; The additional info. 2157 Info interface{} `json:"info,omitempty"` 2158} 2159 2160// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. 2161func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { 2162 objectMap := make(map[string]interface{}) 2163 return json.Marshal(objectMap) 2164} 2165 2166// ErrorResponse describes the format of Error response. 2167type ErrorResponse struct { 2168 // Code - Error code 2169 Code *string `json:"code,omitempty"` 2170 // Message - Error message indicating why the operation failed. 2171 Message *string `json:"message,omitempty"` 2172} 2173 2174// ErrorResponseCommon the resource management error response. 2175type ErrorResponseCommon struct { 2176 // Details - READ-ONLY; The error details. 2177 Details *[]ErrorResponseCommon `json:"details,omitempty"` 2178 // AdditionalInfo - READ-ONLY; The error additional info. 2179 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` 2180 // Code - Error code 2181 Code *string `json:"code,omitempty"` 2182 // Message - Error message indicating why the operation failed. 2183 Message *string `json:"message,omitempty"` 2184} 2185 2186// MarshalJSON is the custom marshaler for ErrorResponseCommon. 2187func (erc ErrorResponseCommon) MarshalJSON() ([]byte, error) { 2188 objectMap := make(map[string]interface{}) 2189 if erc.Code != nil { 2190 objectMap["code"] = erc.Code 2191 } 2192 if erc.Message != nil { 2193 objectMap["message"] = erc.Message 2194 } 2195 return json.Marshal(objectMap) 2196} 2197 2198// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, 2199// Security, ServiceHealth, Alert, Recommendation, Policy. 2200type EventCategoryCollection struct { 2201 autorest.Response `json:"-"` 2202 // Value - the list that includes the Azure event categories. 2203 Value *[]LocalizableString `json:"value,omitempty"` 2204} 2205 2206// EventData the Azure event log entries are of type EventData 2207type EventData struct { 2208 // Authorization - READ-ONLY; The sender authorization information. 2209 Authorization *SenderAuthorization `json:"authorization,omitempty"` 2210 // Claims - READ-ONLY; key value pairs to identify ARM permissions. 2211 Claims map[string]*string `json:"claims"` 2212 // Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. 2213 Caller *string `json:"caller,omitempty"` 2214 // Description - READ-ONLY; the description of the event. 2215 Description *string `json:"description,omitempty"` 2216 // ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. 2217 ID *string `json:"id,omitempty"` 2218 // EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event. 2219 EventDataID *string `json:"eventDataId,omitempty"` 2220 // 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. 2221 CorrelationID *string `json:"correlationId,omitempty"` 2222 // 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. 2223 EventName *LocalizableString `json:"eventName,omitempty"` 2224 // Category - READ-ONLY; the event category. 2225 Category *LocalizableString `json:"category,omitempty"` 2226 // 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). 2227 HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` 2228 // Level - READ-ONLY; the event level. Possible values include: 'EventLevelCritical', 'EventLevelError', 'EventLevelWarning', 'EventLevelInformational', 'EventLevelVerbose' 2229 Level EventLevel `json:"level,omitempty"` 2230 // ResourceGroupName - READ-ONLY; the resource group name of the impacted resource. 2231 ResourceGroupName *string `json:"resourceGroupName,omitempty"` 2232 // ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource. 2233 ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` 2234 // ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. 2235 ResourceID *string `json:"resourceId,omitempty"` 2236 // ResourceType - READ-ONLY; the resource type 2237 ResourceType *LocalizableString `json:"resourceType,omitempty"` 2238 // OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. 2239 OperationID *string `json:"operationId,omitempty"` 2240 // OperationName - READ-ONLY; the operation name. 2241 OperationName *LocalizableString `json:"operationName,omitempty"` 2242 // Properties - READ-ONLY; the set of <Key, Value> pairs (usually a Dictionary<String, String>) that includes details about the event. 2243 Properties map[string]*string `json:"properties"` 2244 // Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. 2245 Status *LocalizableString `json:"status,omitempty"` 2246 // 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) 2247 SubStatus *LocalizableString `json:"subStatus,omitempty"` 2248 // 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. 2249 EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` 2250 // 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. 2251 SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` 2252 // SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID. 2253 SubscriptionID *string `json:"subscriptionId,omitempty"` 2254 // TenantID - READ-ONLY; the Azure tenant Id 2255 TenantID *string `json:"tenantId,omitempty"` 2256} 2257 2258// MarshalJSON is the custom marshaler for EventData. 2259func (ed EventData) MarshalJSON() ([]byte, error) { 2260 objectMap := make(map[string]interface{}) 2261 return json.Marshal(objectMap) 2262} 2263 2264// EventDataCollection represents collection of events. 2265type EventDataCollection struct { 2266 autorest.Response `json:"-"` 2267 // Value - this list that includes the Azure audit logs. 2268 Value *[]EventData `json:"value,omitempty"` 2269 // NextLink - Provides the link to retrieve the next set of events. 2270 NextLink *string `json:"nextLink,omitempty"` 2271} 2272 2273// EventDataCollectionIterator provides access to a complete listing of EventData values. 2274type EventDataCollectionIterator struct { 2275 i int 2276 page EventDataCollectionPage 2277} 2278 2279// NextWithContext advances to the next value. If there was an error making 2280// the request the iterator does not advance and the error is returned. 2281func (iter *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) { 2282 if tracing.IsEnabled() { 2283 ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.NextWithContext") 2284 defer func() { 2285 sc := -1 2286 if iter.Response().Response.Response != nil { 2287 sc = iter.Response().Response.Response.StatusCode 2288 } 2289 tracing.EndSpan(ctx, sc, err) 2290 }() 2291 } 2292 iter.i++ 2293 if iter.i < len(iter.page.Values()) { 2294 return nil 2295 } 2296 err = iter.page.NextWithContext(ctx) 2297 if err != nil { 2298 iter.i-- 2299 return err 2300 } 2301 iter.i = 0 2302 return nil 2303} 2304 2305// Next advances to the next value. If there was an error making 2306// the request the iterator does not advance and the error is returned. 2307// Deprecated: Use NextWithContext() instead. 2308func (iter *EventDataCollectionIterator) Next() error { 2309 return iter.NextWithContext(context.Background()) 2310} 2311 2312// NotDone returns true if the enumeration should be started or is not yet complete. 2313func (iter EventDataCollectionIterator) NotDone() bool { 2314 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2315} 2316 2317// Response returns the raw server response from the last page request. 2318func (iter EventDataCollectionIterator) Response() EventDataCollection { 2319 return iter.page.Response() 2320} 2321 2322// Value returns the current value or a zero-initialized value if the 2323// iterator has advanced beyond the end of the collection. 2324func (iter EventDataCollectionIterator) Value() EventData { 2325 if !iter.page.NotDone() { 2326 return EventData{} 2327 } 2328 return iter.page.Values()[iter.i] 2329} 2330 2331// Creates a new instance of the EventDataCollectionIterator type. 2332func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator { 2333 return EventDataCollectionIterator{page: page} 2334} 2335 2336// IsEmpty returns true if the ListResult contains no values. 2337func (edc EventDataCollection) IsEmpty() bool { 2338 return edc.Value == nil || len(*edc.Value) == 0 2339} 2340 2341// hasNextLink returns true if the NextLink is not empty. 2342func (edc EventDataCollection) hasNextLink() bool { 2343 return edc.NextLink != nil && len(*edc.NextLink) != 0 2344} 2345 2346// eventDataCollectionPreparer prepares a request to retrieve the next set of results. 2347// It returns nil if no more results exist. 2348func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) { 2349 if !edc.hasNextLink() { 2350 return nil, nil 2351 } 2352 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2353 autorest.AsJSON(), 2354 autorest.AsGet(), 2355 autorest.WithBaseURL(to.String(edc.NextLink))) 2356} 2357 2358// EventDataCollectionPage contains a page of EventData values. 2359type EventDataCollectionPage struct { 2360 fn func(context.Context, EventDataCollection) (EventDataCollection, error) 2361 edc EventDataCollection 2362} 2363 2364// NextWithContext advances to the next page of values. If there was an error making 2365// the request the page does not advance and the error is returned. 2366func (page *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) { 2367 if tracing.IsEnabled() { 2368 ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.NextWithContext") 2369 defer func() { 2370 sc := -1 2371 if page.Response().Response.Response != nil { 2372 sc = page.Response().Response.Response.StatusCode 2373 } 2374 tracing.EndSpan(ctx, sc, err) 2375 }() 2376 } 2377 for { 2378 next, err := page.fn(ctx, page.edc) 2379 if err != nil { 2380 return err 2381 } 2382 page.edc = next 2383 if !next.hasNextLink() || !next.IsEmpty() { 2384 break 2385 } 2386 } 2387 return nil 2388} 2389 2390// Next advances to the next page of values. If there was an error making 2391// the request the page does not advance and the error is returned. 2392// Deprecated: Use NextWithContext() instead. 2393func (page *EventDataCollectionPage) Next() error { 2394 return page.NextWithContext(context.Background()) 2395} 2396 2397// NotDone returns true if the page enumeration should be started or is not yet complete. 2398func (page EventDataCollectionPage) NotDone() bool { 2399 return !page.edc.IsEmpty() 2400} 2401 2402// Response returns the raw server response from the last page request. 2403func (page EventDataCollectionPage) Response() EventDataCollection { 2404 return page.edc 2405} 2406 2407// Values returns the slice of values for the current page or nil if there are no values. 2408func (page EventDataCollectionPage) Values() []EventData { 2409 if page.edc.IsEmpty() { 2410 return nil 2411 } 2412 return *page.edc.Value 2413} 2414 2415// Creates a new instance of the EventDataCollectionPage type. 2416func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage { 2417 return EventDataCollectionPage{ 2418 fn: getNextPage, 2419 edc: cur, 2420 } 2421} 2422 2423// HTTPRequestInfo the Http request info. 2424type HTTPRequestInfo struct { 2425 // ClientRequestID - the client request id. 2426 ClientRequestID *string `json:"clientRequestId,omitempty"` 2427 // ClientIPAddress - the client Ip Address 2428 ClientIPAddress *string `json:"clientIpAddress,omitempty"` 2429 // Method - the Http request method. 2430 Method *string `json:"method,omitempty"` 2431 // URI - the Uri. 2432 URI *string `json:"uri,omitempty"` 2433} 2434 2435// Incident an alert incident indicates the activation status of an alert rule. 2436type Incident struct { 2437 autorest.Response `json:"-"` 2438 // Name - READ-ONLY; Incident name. 2439 Name *string `json:"name,omitempty"` 2440 // RuleName - READ-ONLY; Rule name that is associated with the incident. 2441 RuleName *string `json:"ruleName,omitempty"` 2442 // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. 2443 IsActive *bool `json:"isActive,omitempty"` 2444 // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. 2445 ActivatedTime *date.Time `json:"activatedTime,omitempty"` 2446 // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. 2447 ResolvedTime *date.Time `json:"resolvedTime,omitempty"` 2448} 2449 2450// MarshalJSON is the custom marshaler for Incident. 2451func (i Incident) MarshalJSON() ([]byte, error) { 2452 objectMap := make(map[string]interface{}) 2453 return json.Marshal(objectMap) 2454} 2455 2456// IncidentListResult the List incidents operation response. 2457type IncidentListResult struct { 2458 autorest.Response `json:"-"` 2459 // Value - the incident collection. 2460 Value *[]Incident `json:"value,omitempty"` 2461} 2462 2463// ItsmReceiver an Itsm receiver. 2464type ItsmReceiver struct { 2465 // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. 2466 Name *string `json:"name,omitempty"` 2467 // WorkspaceID - OMS LA instance identifier. 2468 WorkspaceID *string `json:"workspaceId,omitempty"` 2469 // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. 2470 ConnectionID *string `json:"connectionId,omitempty"` 2471 // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. 2472 TicketConfiguration *string `json:"ticketConfiguration,omitempty"` 2473 // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' 2474 Region *string `json:"region,omitempty"` 2475} 2476 2477// LocalizableString the localizable string class. 2478type LocalizableString struct { 2479 // Value - the invariant value. 2480 Value *string `json:"value,omitempty"` 2481 // LocalizedValue - the locale specific value. 2482 LocalizedValue *string `json:"localizedValue,omitempty"` 2483} 2484 2485// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. 2486type LocationThresholdRuleCondition struct { 2487 // 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. 2488 WindowSize *string `json:"windowSize,omitempty"` 2489 // FailedLocationCount - the number of locations that must fail to activate the alert. 2490 FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` 2491 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 2492 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 2493 // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 2494 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 2495} 2496 2497// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. 2498func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { 2499 ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition 2500 objectMap := make(map[string]interface{}) 2501 if ltrc.WindowSize != nil { 2502 objectMap["windowSize"] = ltrc.WindowSize 2503 } 2504 if ltrc.FailedLocationCount != nil { 2505 objectMap["failedLocationCount"] = ltrc.FailedLocationCount 2506 } 2507 objectMap["dataSource"] = ltrc.DataSource 2508 if ltrc.OdataType != "" { 2509 objectMap["odata.type"] = ltrc.OdataType 2510 } 2511 return json.Marshal(objectMap) 2512} 2513 2514// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 2515func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 2516 return nil, false 2517} 2518 2519// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 2520func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 2521 return <rc, true 2522} 2523 2524// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 2525func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 2526 return nil, false 2527} 2528 2529// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 2530func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { 2531 return nil, false 2532} 2533 2534// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 2535func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 2536 return <rc, true 2537} 2538 2539// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. 2540func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error { 2541 var m map[string]*json.RawMessage 2542 err := json.Unmarshal(body, &m) 2543 if err != nil { 2544 return err 2545 } 2546 for k, v := range m { 2547 switch k { 2548 case "windowSize": 2549 if v != nil { 2550 var windowSize string 2551 err = json.Unmarshal(*v, &windowSize) 2552 if err != nil { 2553 return err 2554 } 2555 ltrc.WindowSize = &windowSize 2556 } 2557 case "failedLocationCount": 2558 if v != nil { 2559 var failedLocationCount int32 2560 err = json.Unmarshal(*v, &failedLocationCount) 2561 if err != nil { 2562 return err 2563 } 2564 ltrc.FailedLocationCount = &failedLocationCount 2565 } 2566 case "dataSource": 2567 if v != nil { 2568 dataSource, err := unmarshalBasicRuleDataSource(*v) 2569 if err != nil { 2570 return err 2571 } 2572 ltrc.DataSource = dataSource 2573 } 2574 case "odata.type": 2575 if v != nil { 2576 var odataType OdataTypeBasicRuleCondition 2577 err = json.Unmarshal(*v, &odataType) 2578 if err != nil { 2579 return err 2580 } 2581 ltrc.OdataType = odataType 2582 } 2583 } 2584 } 2585 2586 return nil 2587} 2588 2589// LogicAppReceiver a logic app receiver. 2590type LogicAppReceiver struct { 2591 // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. 2592 Name *string `json:"name,omitempty"` 2593 // ResourceID - The azure resource id of the logic app receiver. 2594 ResourceID *string `json:"resourceId,omitempty"` 2595 // CallbackURL - The callback url where http request sent to. 2596 CallbackURL *string `json:"callbackUrl,omitempty"` 2597 // UseCommonAlertSchema - Indicates whether to use common alert schema. 2598 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` 2599} 2600 2601// LogMetricTrigger a log metrics trigger descriptor. 2602type LogMetricTrigger struct { 2603 // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' 2604 ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` 2605 // Threshold - The threshold of the metric trigger. 2606 Threshold *float64 `json:"threshold,omitempty"` 2607 // MetricTriggerType - Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'MetricTriggerTypeConsecutive', 'MetricTriggerTypeTotal' 2608 MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"` 2609 // MetricColumn - Evaluation of metric on a particular column 2610 MetricColumn *string `json:"metricColumn,omitempty"` 2611} 2612 2613// LogProfileCollection represents a collection of log profiles. 2614type LogProfileCollection struct { 2615 autorest.Response `json:"-"` 2616 // Value - the values of the log profiles. 2617 Value *[]LogProfileResource `json:"value,omitempty"` 2618} 2619 2620// LogProfileProperties the log profile properties. 2621type LogProfileProperties struct { 2622 // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. 2623 StorageAccountID *string `json:"storageAccountId,omitempty"` 2624 // 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}'. 2625 ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` 2626 // 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. 2627 Locations *[]string `json:"locations,omitempty"` 2628 // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' 2629 Categories *[]string `json:"categories,omitempty"` 2630 // RetentionPolicy - the retention policy for the events in the log. 2631 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 2632} 2633 2634// LogProfileResource the log profile resource. 2635type LogProfileResource struct { 2636 autorest.Response `json:"-"` 2637 // LogProfileProperties - The log profile properties of the resource. 2638 *LogProfileProperties `json:"properties,omitempty"` 2639 // ID - READ-ONLY; Azure resource Id 2640 ID *string `json:"id,omitempty"` 2641 // Name - READ-ONLY; Azure resource name 2642 Name *string `json:"name,omitempty"` 2643 // Type - READ-ONLY; Azure resource type 2644 Type *string `json:"type,omitempty"` 2645 // Location - Resource location 2646 Location *string `json:"location,omitempty"` 2647 // Tags - Resource tags 2648 Tags map[string]*string `json:"tags"` 2649} 2650 2651// MarshalJSON is the custom marshaler for LogProfileResource. 2652func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { 2653 objectMap := make(map[string]interface{}) 2654 if lpr.LogProfileProperties != nil { 2655 objectMap["properties"] = lpr.LogProfileProperties 2656 } 2657 if lpr.Location != nil { 2658 objectMap["location"] = lpr.Location 2659 } 2660 if lpr.Tags != nil { 2661 objectMap["tags"] = lpr.Tags 2662 } 2663 return json.Marshal(objectMap) 2664} 2665 2666// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. 2667func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { 2668 var m map[string]*json.RawMessage 2669 err := json.Unmarshal(body, &m) 2670 if err != nil { 2671 return err 2672 } 2673 for k, v := range m { 2674 switch k { 2675 case "properties": 2676 if v != nil { 2677 var logProfileProperties LogProfileProperties 2678 err = json.Unmarshal(*v, &logProfileProperties) 2679 if err != nil { 2680 return err 2681 } 2682 lpr.LogProfileProperties = &logProfileProperties 2683 } 2684 case "id": 2685 if v != nil { 2686 var ID string 2687 err = json.Unmarshal(*v, &ID) 2688 if err != nil { 2689 return err 2690 } 2691 lpr.ID = &ID 2692 } 2693 case "name": 2694 if v != nil { 2695 var name string 2696 err = json.Unmarshal(*v, &name) 2697 if err != nil { 2698 return err 2699 } 2700 lpr.Name = &name 2701 } 2702 case "type": 2703 if v != nil { 2704 var typeVar string 2705 err = json.Unmarshal(*v, &typeVar) 2706 if err != nil { 2707 return err 2708 } 2709 lpr.Type = &typeVar 2710 } 2711 case "location": 2712 if v != nil { 2713 var location string 2714 err = json.Unmarshal(*v, &location) 2715 if err != nil { 2716 return err 2717 } 2718 lpr.Location = &location 2719 } 2720 case "tags": 2721 if v != nil { 2722 var tags map[string]*string 2723 err = json.Unmarshal(*v, &tags) 2724 if err != nil { 2725 return err 2726 } 2727 lpr.Tags = tags 2728 } 2729 } 2730 } 2731 2732 return nil 2733} 2734 2735// LogProfileResourcePatch the log profile resource for patch operations. 2736type LogProfileResourcePatch struct { 2737 // Tags - Resource tags 2738 Tags map[string]*string `json:"tags"` 2739 // LogProfileProperties - The log profile properties for an update operation. 2740 *LogProfileProperties `json:"properties,omitempty"` 2741} 2742 2743// MarshalJSON is the custom marshaler for LogProfileResourcePatch. 2744func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { 2745 objectMap := make(map[string]interface{}) 2746 if lprp.Tags != nil { 2747 objectMap["tags"] = lprp.Tags 2748 } 2749 if lprp.LogProfileProperties != nil { 2750 objectMap["properties"] = lprp.LogProfileProperties 2751 } 2752 return json.Marshal(objectMap) 2753} 2754 2755// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. 2756func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { 2757 var m map[string]*json.RawMessage 2758 err := json.Unmarshal(body, &m) 2759 if err != nil { 2760 return err 2761 } 2762 for k, v := range m { 2763 switch k { 2764 case "tags": 2765 if v != nil { 2766 var tags map[string]*string 2767 err = json.Unmarshal(*v, &tags) 2768 if err != nil { 2769 return err 2770 } 2771 lprp.Tags = tags 2772 } 2773 case "properties": 2774 if v != nil { 2775 var logProfileProperties LogProfileProperties 2776 err = json.Unmarshal(*v, &logProfileProperties) 2777 if err != nil { 2778 return err 2779 } 2780 lprp.LogProfileProperties = &logProfileProperties 2781 } 2782 } 2783 } 2784 2785 return nil 2786} 2787 2788// LogSearchRule log Search Rule Definition 2789type LogSearchRule struct { 2790 // Description - The description of the Log Search rule. 2791 Description *string `json:"description,omitempty"` 2792 // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' 2793 Enabled Enabled `json:"enabled,omitempty"` 2794 // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. 2795 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 2796 // ProvisioningState - READ-ONLY; Provisioning state of the scheduled query rule. Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' 2797 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2798 // Source - Data Source against which rule will Query Data 2799 Source *Source `json:"source,omitempty"` 2800 // Schedule - Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction 2801 Schedule *Schedule `json:"schedule,omitempty"` 2802 // Action - Action needs to be taken on rule execution. 2803 Action BasicAction `json:"action,omitempty"` 2804} 2805 2806// MarshalJSON is the custom marshaler for LogSearchRule. 2807func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { 2808 objectMap := make(map[string]interface{}) 2809 if lsr.Description != nil { 2810 objectMap["description"] = lsr.Description 2811 } 2812 if lsr.Enabled != "" { 2813 objectMap["enabled"] = lsr.Enabled 2814 } 2815 if lsr.Source != nil { 2816 objectMap["source"] = lsr.Source 2817 } 2818 if lsr.Schedule != nil { 2819 objectMap["schedule"] = lsr.Schedule 2820 } 2821 objectMap["action"] = lsr.Action 2822 return json.Marshal(objectMap) 2823} 2824 2825// UnmarshalJSON is the custom unmarshaler for LogSearchRule struct. 2826func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { 2827 var m map[string]*json.RawMessage 2828 err := json.Unmarshal(body, &m) 2829 if err != nil { 2830 return err 2831 } 2832 for k, v := range m { 2833 switch k { 2834 case "description": 2835 if v != nil { 2836 var description string 2837 err = json.Unmarshal(*v, &description) 2838 if err != nil { 2839 return err 2840 } 2841 lsr.Description = &description 2842 } 2843 case "enabled": 2844 if v != nil { 2845 var enabled Enabled 2846 err = json.Unmarshal(*v, &enabled) 2847 if err != nil { 2848 return err 2849 } 2850 lsr.Enabled = enabled 2851 } 2852 case "lastUpdatedTime": 2853 if v != nil { 2854 var lastUpdatedTime date.Time 2855 err = json.Unmarshal(*v, &lastUpdatedTime) 2856 if err != nil { 2857 return err 2858 } 2859 lsr.LastUpdatedTime = &lastUpdatedTime 2860 } 2861 case "provisioningState": 2862 if v != nil { 2863 var provisioningState ProvisioningState 2864 err = json.Unmarshal(*v, &provisioningState) 2865 if err != nil { 2866 return err 2867 } 2868 lsr.ProvisioningState = provisioningState 2869 } 2870 case "source": 2871 if v != nil { 2872 var source Source 2873 err = json.Unmarshal(*v, &source) 2874 if err != nil { 2875 return err 2876 } 2877 lsr.Source = &source 2878 } 2879 case "schedule": 2880 if v != nil { 2881 var schedule Schedule 2882 err = json.Unmarshal(*v, &schedule) 2883 if err != nil { 2884 return err 2885 } 2886 lsr.Schedule = &schedule 2887 } 2888 case "action": 2889 if v != nil { 2890 action, err := unmarshalBasicAction(*v) 2891 if err != nil { 2892 return err 2893 } 2894 lsr.Action = action 2895 } 2896 } 2897 } 2898 2899 return nil 2900} 2901 2902// LogSearchRulePatch log Search Rule Definition for Patching 2903type LogSearchRulePatch struct { 2904 // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' 2905 Enabled Enabled `json:"enabled,omitempty"` 2906} 2907 2908// LogSearchRuleResource the Log Search Rule resource. 2909type LogSearchRuleResource struct { 2910 autorest.Response `json:"-"` 2911 // LogSearchRule - The rule properties of the resource. 2912 *LogSearchRule `json:"properties,omitempty"` 2913 // ID - READ-ONLY; Azure resource Id 2914 ID *string `json:"id,omitempty"` 2915 // Name - READ-ONLY; Azure resource name 2916 Name *string `json:"name,omitempty"` 2917 // Type - READ-ONLY; Azure resource type 2918 Type *string `json:"type,omitempty"` 2919 // Location - Resource location 2920 Location *string `json:"location,omitempty"` 2921 // Tags - Resource tags 2922 Tags map[string]*string `json:"tags"` 2923} 2924 2925// MarshalJSON is the custom marshaler for LogSearchRuleResource. 2926func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) { 2927 objectMap := make(map[string]interface{}) 2928 if lsrr.LogSearchRule != nil { 2929 objectMap["properties"] = lsrr.LogSearchRule 2930 } 2931 if lsrr.Location != nil { 2932 objectMap["location"] = lsrr.Location 2933 } 2934 if lsrr.Tags != nil { 2935 objectMap["tags"] = lsrr.Tags 2936 } 2937 return json.Marshal(objectMap) 2938} 2939 2940// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResource struct. 2941func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error { 2942 var m map[string]*json.RawMessage 2943 err := json.Unmarshal(body, &m) 2944 if err != nil { 2945 return err 2946 } 2947 for k, v := range m { 2948 switch k { 2949 case "properties": 2950 if v != nil { 2951 var logSearchRule LogSearchRule 2952 err = json.Unmarshal(*v, &logSearchRule) 2953 if err != nil { 2954 return err 2955 } 2956 lsrr.LogSearchRule = &logSearchRule 2957 } 2958 case "id": 2959 if v != nil { 2960 var ID string 2961 err = json.Unmarshal(*v, &ID) 2962 if err != nil { 2963 return err 2964 } 2965 lsrr.ID = &ID 2966 } 2967 case "name": 2968 if v != nil { 2969 var name string 2970 err = json.Unmarshal(*v, &name) 2971 if err != nil { 2972 return err 2973 } 2974 lsrr.Name = &name 2975 } 2976 case "type": 2977 if v != nil { 2978 var typeVar string 2979 err = json.Unmarshal(*v, &typeVar) 2980 if err != nil { 2981 return err 2982 } 2983 lsrr.Type = &typeVar 2984 } 2985 case "location": 2986 if v != nil { 2987 var location string 2988 err = json.Unmarshal(*v, &location) 2989 if err != nil { 2990 return err 2991 } 2992 lsrr.Location = &location 2993 } 2994 case "tags": 2995 if v != nil { 2996 var tags map[string]*string 2997 err = json.Unmarshal(*v, &tags) 2998 if err != nil { 2999 return err 3000 } 3001 lsrr.Tags = tags 3002 } 3003 } 3004 } 3005 3006 return nil 3007} 3008 3009// LogSearchRuleResourceCollection represents a collection of Log Search rule resources. 3010type LogSearchRuleResourceCollection struct { 3011 autorest.Response `json:"-"` 3012 // Value - The values for the Log Search Rule resources. 3013 Value *[]LogSearchRuleResource `json:"value,omitempty"` 3014} 3015 3016// LogSearchRuleResourcePatch the log search rule resource for patch operations. 3017type LogSearchRuleResourcePatch struct { 3018 // Tags - Resource tags 3019 Tags map[string]*string `json:"tags"` 3020 // LogSearchRulePatch - The log search rule properties of the resource. 3021 *LogSearchRulePatch `json:"properties,omitempty"` 3022} 3023 3024// MarshalJSON is the custom marshaler for LogSearchRuleResourcePatch. 3025func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) { 3026 objectMap := make(map[string]interface{}) 3027 if lsrrp.Tags != nil { 3028 objectMap["tags"] = lsrrp.Tags 3029 } 3030 if lsrrp.LogSearchRulePatch != nil { 3031 objectMap["properties"] = lsrrp.LogSearchRulePatch 3032 } 3033 return json.Marshal(objectMap) 3034} 3035 3036// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResourcePatch struct. 3037func (lsrrp *LogSearchRuleResourcePatch) UnmarshalJSON(body []byte) error { 3038 var m map[string]*json.RawMessage 3039 err := json.Unmarshal(body, &m) 3040 if err != nil { 3041 return err 3042 } 3043 for k, v := range m { 3044 switch k { 3045 case "tags": 3046 if v != nil { 3047 var tags map[string]*string 3048 err = json.Unmarshal(*v, &tags) 3049 if err != nil { 3050 return err 3051 } 3052 lsrrp.Tags = tags 3053 } 3054 case "properties": 3055 if v != nil { 3056 var logSearchRulePatch LogSearchRulePatch 3057 err = json.Unmarshal(*v, &logSearchRulePatch) 3058 if err != nil { 3059 return err 3060 } 3061 lsrrp.LogSearchRulePatch = &logSearchRulePatch 3062 } 3063 } 3064 } 3065 3066 return nil 3067} 3068 3069// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. 3070type LogSettings struct { 3071 // 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. 3072 Category *string `json:"category,omitempty"` 3073 // Enabled - a value indicating whether this log is enabled. 3074 Enabled *bool `json:"enabled,omitempty"` 3075 // RetentionPolicy - the retention policy for this log. 3076 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 3077} 3078 3079// LogToMetricAction specify action need to be taken when rule type is converting log to metric 3080type LogToMetricAction struct { 3081 // Criteria - Criteria of Metric 3082 Criteria *[]Criteria `json:"criteria,omitempty"` 3083 // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' 3084 OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` 3085} 3086 3087// MarshalJSON is the custom marshaler for LogToMetricAction. 3088func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) { 3089 ltma.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction 3090 objectMap := make(map[string]interface{}) 3091 if ltma.Criteria != nil { 3092 objectMap["criteria"] = ltma.Criteria 3093 } 3094 if ltma.OdataType != "" { 3095 objectMap["odata.type"] = ltma.OdataType 3096 } 3097 return json.Marshal(objectMap) 3098} 3099 3100// AsAlertingAction is the BasicAction implementation for LogToMetricAction. 3101func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) { 3102 return nil, false 3103} 3104 3105// AsLogToMetricAction is the BasicAction implementation for LogToMetricAction. 3106func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) { 3107 return <ma, true 3108} 3109 3110// AsAction is the BasicAction implementation for LogToMetricAction. 3111func (ltma LogToMetricAction) AsAction() (*Action, bool) { 3112 return nil, false 3113} 3114 3115// AsBasicAction is the BasicAction implementation for LogToMetricAction. 3116func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) { 3117 return <ma, true 3118} 3119 3120// ManagementEventAggregationCondition how the data that is collected should be combined over time. 3121type ManagementEventAggregationCondition struct { 3122 // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' 3123 Operator ConditionOperator `json:"operator,omitempty"` 3124 // Threshold - The threshold value that activates the alert. 3125 Threshold *float64 `json:"threshold,omitempty"` 3126 // 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. 3127 WindowSize *string `json:"windowSize,omitempty"` 3128} 3129 3130// ManagementEventRuleCondition a management event rule condition. 3131type ManagementEventRuleCondition struct { 3132 // 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. 3133 Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` 3134 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 3135 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 3136 // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 3137 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 3138} 3139 3140// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. 3141func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { 3142 merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition 3143 objectMap := make(map[string]interface{}) 3144 if merc.Aggregation != nil { 3145 objectMap["aggregation"] = merc.Aggregation 3146 } 3147 objectMap["dataSource"] = merc.DataSource 3148 if merc.OdataType != "" { 3149 objectMap["odata.type"] = merc.OdataType 3150 } 3151 return json.Marshal(objectMap) 3152} 3153 3154// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 3155func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 3156 return nil, false 3157} 3158 3159// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 3160func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 3161 return nil, false 3162} 3163 3164// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 3165func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 3166 return &merc, true 3167} 3168 3169// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 3170func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { 3171 return nil, false 3172} 3173 3174// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 3175func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 3176 return &merc, true 3177} 3178 3179// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. 3180func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error { 3181 var m map[string]*json.RawMessage 3182 err := json.Unmarshal(body, &m) 3183 if err != nil { 3184 return err 3185 } 3186 for k, v := range m { 3187 switch k { 3188 case "aggregation": 3189 if v != nil { 3190 var aggregation ManagementEventAggregationCondition 3191 err = json.Unmarshal(*v, &aggregation) 3192 if err != nil { 3193 return err 3194 } 3195 merc.Aggregation = &aggregation 3196 } 3197 case "dataSource": 3198 if v != nil { 3199 dataSource, err := unmarshalBasicRuleDataSource(*v) 3200 if err != nil { 3201 return err 3202 } 3203 merc.DataSource = dataSource 3204 } 3205 case "odata.type": 3206 if v != nil { 3207 var odataType OdataTypeBasicRuleCondition 3208 err = json.Unmarshal(*v, &odataType) 3209 if err != nil { 3210 return err 3211 } 3212 merc.OdataType = odataType 3213 } 3214 } 3215 } 3216 3217 return nil 3218} 3219 3220// MetadataValue represents a metric metadata value. 3221type MetadataValue struct { 3222 // Name - the name of the metadata. 3223 Name *LocalizableString `json:"name,omitempty"` 3224 // Value - the value of the metadata. 3225 Value *string `json:"value,omitempty"` 3226} 3227 3228// Metric the result data of a query. 3229type Metric struct { 3230 // ID - the metric Id. 3231 ID *string `json:"id,omitempty"` 3232 // Type - the resource type of the metric resource. 3233 Type *string `json:"type,omitempty"` 3234 // Name - the name and the display name of the metric, i.e. it is localizable string. 3235 Name *LocalizableString `json:"name,omitempty"` 3236 // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' 3237 Unit Unit `json:"unit,omitempty"` 3238 // Timeseries - the time series returned when a data query is performed. 3239 Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` 3240} 3241 3242// MetricAlertAction an alert action. 3243type MetricAlertAction struct { 3244 // ActionGroupID - the id of the action group to use. 3245 ActionGroupID *string `json:"actionGroupId,omitempty"` 3246 // WebHookProperties - The properties of a webhook object. 3247 WebHookProperties map[string]*string `json:"webHookProperties"` 3248} 3249 3250// MarshalJSON is the custom marshaler for MetricAlertAction. 3251func (maa MetricAlertAction) MarshalJSON() ([]byte, error) { 3252 objectMap := make(map[string]interface{}) 3253 if maa.ActionGroupID != nil { 3254 objectMap["actionGroupId"] = maa.ActionGroupID 3255 } 3256 if maa.WebHookProperties != nil { 3257 objectMap["webHookProperties"] = maa.WebHookProperties 3258 } 3259 return json.Marshal(objectMap) 3260} 3261 3262// BasicMetricAlertCriteria the rule criteria that defines the conditions of the alert rule. 3263type BasicMetricAlertCriteria interface { 3264 AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) 3265 AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) 3266 AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) 3267 AsMetricAlertCriteria() (*MetricAlertCriteria, bool) 3268} 3269 3270// MetricAlertCriteria the rule criteria that defines the conditions of the alert rule. 3271type MetricAlertCriteria struct { 3272 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 3273 AdditionalProperties map[string]interface{} `json:""` 3274 // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' 3275 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` 3276} 3277 3278func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) { 3279 var m map[string]interface{} 3280 err := json.Unmarshal(body, &m) 3281 if err != nil { 3282 return nil, err 3283 } 3284 3285 switch m["odata.type"] { 3286 case string(OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): 3287 var masrmmc MetricAlertSingleResourceMultipleMetricCriteria 3288 err := json.Unmarshal(body, &masrmmc) 3289 return masrmmc, err 3290 case string(OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): 3291 var wlac WebtestLocationAvailabilityCriteria 3292 err := json.Unmarshal(body, &wlac) 3293 return wlac, err 3294 case string(OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): 3295 var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria 3296 err := json.Unmarshal(body, &mamrmmc) 3297 return mamrmmc, err 3298 default: 3299 var mac MetricAlertCriteria 3300 err := json.Unmarshal(body, &mac) 3301 return mac, err 3302 } 3303} 3304func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) { 3305 var rawMessages []*json.RawMessage 3306 err := json.Unmarshal(body, &rawMessages) 3307 if err != nil { 3308 return nil, err 3309 } 3310 3311 macArray := make([]BasicMetricAlertCriteria, len(rawMessages)) 3312 3313 for index, rawMessage := range rawMessages { 3314 mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage) 3315 if err != nil { 3316 return nil, err 3317 } 3318 macArray[index] = mac 3319 } 3320 return macArray, nil 3321} 3322 3323// MarshalJSON is the custom marshaler for MetricAlertCriteria. 3324func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) { 3325 mac.OdataType = OdataTypeMetricAlertCriteria 3326 objectMap := make(map[string]interface{}) 3327 if mac.OdataType != "" { 3328 objectMap["odata.type"] = mac.OdataType 3329 } 3330 for k, v := range mac.AdditionalProperties { 3331 objectMap[k] = v 3332 } 3333 return json.Marshal(objectMap) 3334} 3335 3336// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. 3337func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { 3338 return nil, false 3339} 3340 3341// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. 3342func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { 3343 return nil, false 3344} 3345 3346// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. 3347func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { 3348 return nil, false 3349} 3350 3351// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. 3352func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { 3353 return &mac, true 3354} 3355 3356// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. 3357func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { 3358 return &mac, true 3359} 3360 3361// UnmarshalJSON is the custom unmarshaler for MetricAlertCriteria struct. 3362func (mac *MetricAlertCriteria) UnmarshalJSON(body []byte) error { 3363 var m map[string]*json.RawMessage 3364 err := json.Unmarshal(body, &m) 3365 if err != nil { 3366 return err 3367 } 3368 for k, v := range m { 3369 switch k { 3370 default: 3371 if v != nil { 3372 var additionalProperties interface{} 3373 err = json.Unmarshal(*v, &additionalProperties) 3374 if err != nil { 3375 return err 3376 } 3377 if mac.AdditionalProperties == nil { 3378 mac.AdditionalProperties = make(map[string]interface{}) 3379 } 3380 mac.AdditionalProperties[k] = additionalProperties 3381 } 3382 case "odata.type": 3383 if v != nil { 3384 var odataType OdataTypeBasicMetricAlertCriteria 3385 err = json.Unmarshal(*v, &odataType) 3386 if err != nil { 3387 return err 3388 } 3389 mac.OdataType = odataType 3390 } 3391 } 3392 } 3393 3394 return nil 3395} 3396 3397// MetricAlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple 3398// resource that has multiple metric criteria. 3399type MetricAlertMultipleResourceMultipleMetricCriteria struct { 3400 // AllOf - the list of multiple metric criteria for this 'all of' operation. 3401 AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"` 3402 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 3403 AdditionalProperties map[string]interface{} `json:""` 3404 // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' 3405 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` 3406} 3407 3408// MarshalJSON is the custom marshaler for MetricAlertMultipleResourceMultipleMetricCriteria. 3409func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { 3410 mamrmmc.OdataType = OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria 3411 objectMap := make(map[string]interface{}) 3412 if mamrmmc.AllOf != nil { 3413 objectMap["allOf"] = mamrmmc.AllOf 3414 } 3415 if mamrmmc.OdataType != "" { 3416 objectMap["odata.type"] = mamrmmc.OdataType 3417 } 3418 for k, v := range mamrmmc.AdditionalProperties { 3419 objectMap[k] = v 3420 } 3421 return json.Marshal(objectMap) 3422} 3423 3424// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. 3425func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { 3426 return nil, false 3427} 3428 3429// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. 3430func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { 3431 return nil, false 3432} 3433 3434// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. 3435func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { 3436 return &mamrmmc, true 3437} 3438 3439// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. 3440func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { 3441 return nil, false 3442} 3443 3444// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. 3445func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { 3446 return &mamrmmc, true 3447} 3448 3449// UnmarshalJSON is the custom unmarshaler for MetricAlertMultipleResourceMultipleMetricCriteria struct. 3450func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error { 3451 var m map[string]*json.RawMessage 3452 err := json.Unmarshal(body, &m) 3453 if err != nil { 3454 return err 3455 } 3456 for k, v := range m { 3457 switch k { 3458 case "allOf": 3459 if v != nil { 3460 allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v) 3461 if err != nil { 3462 return err 3463 } 3464 mamrmmc.AllOf = &allOf 3465 } 3466 default: 3467 if v != nil { 3468 var additionalProperties interface{} 3469 err = json.Unmarshal(*v, &additionalProperties) 3470 if err != nil { 3471 return err 3472 } 3473 if mamrmmc.AdditionalProperties == nil { 3474 mamrmmc.AdditionalProperties = make(map[string]interface{}) 3475 } 3476 mamrmmc.AdditionalProperties[k] = additionalProperties 3477 } 3478 case "odata.type": 3479 if v != nil { 3480 var odataType OdataTypeBasicMetricAlertCriteria 3481 err = json.Unmarshal(*v, &odataType) 3482 if err != nil { 3483 return err 3484 } 3485 mamrmmc.OdataType = odataType 3486 } 3487 } 3488 } 3489 3490 return nil 3491} 3492 3493// MetricAlertProperties an alert rule. 3494type MetricAlertProperties struct { 3495 // Description - the description of the metric alert that will be included in the alert email. 3496 Description *string `json:"description,omitempty"` 3497 // Severity - Alert severity {0, 1, 2, 3, 4} 3498 Severity *int32 `json:"severity,omitempty"` 3499 // Enabled - the flag that indicates whether the metric alert is enabled. 3500 Enabled *bool `json:"enabled,omitempty"` 3501 // Scopes - the list of resource id's that this metric alert is scoped to. 3502 Scopes *[]string `json:"scopes,omitempty"` 3503 // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. 3504 EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` 3505 // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. 3506 WindowSize *string `json:"windowSize,omitempty"` 3507 // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. 3508 TargetResourceType *string `json:"targetResourceType,omitempty"` 3509 // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. 3510 TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` 3511 // Criteria - defines the specific alert criteria information. 3512 Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` 3513 // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. 3514 AutoMitigate *bool `json:"autoMitigate,omitempty"` 3515 // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. 3516 Actions *[]MetricAlertAction `json:"actions,omitempty"` 3517 // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. 3518 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 3519} 3520 3521// MarshalJSON is the custom marshaler for MetricAlertProperties. 3522func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) { 3523 objectMap := make(map[string]interface{}) 3524 if mapVar.Description != nil { 3525 objectMap["description"] = mapVar.Description 3526 } 3527 if mapVar.Severity != nil { 3528 objectMap["severity"] = mapVar.Severity 3529 } 3530 if mapVar.Enabled != nil { 3531 objectMap["enabled"] = mapVar.Enabled 3532 } 3533 if mapVar.Scopes != nil { 3534 objectMap["scopes"] = mapVar.Scopes 3535 } 3536 if mapVar.EvaluationFrequency != nil { 3537 objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency 3538 } 3539 if mapVar.WindowSize != nil { 3540 objectMap["windowSize"] = mapVar.WindowSize 3541 } 3542 if mapVar.TargetResourceType != nil { 3543 objectMap["targetResourceType"] = mapVar.TargetResourceType 3544 } 3545 if mapVar.TargetResourceRegion != nil { 3546 objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion 3547 } 3548 objectMap["criteria"] = mapVar.Criteria 3549 if mapVar.AutoMitigate != nil { 3550 objectMap["autoMitigate"] = mapVar.AutoMitigate 3551 } 3552 if mapVar.Actions != nil { 3553 objectMap["actions"] = mapVar.Actions 3554 } 3555 return json.Marshal(objectMap) 3556} 3557 3558// UnmarshalJSON is the custom unmarshaler for MetricAlertProperties struct. 3559func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error { 3560 var m map[string]*json.RawMessage 3561 err := json.Unmarshal(body, &m) 3562 if err != nil { 3563 return err 3564 } 3565 for k, v := range m { 3566 switch k { 3567 case "description": 3568 if v != nil { 3569 var description string 3570 err = json.Unmarshal(*v, &description) 3571 if err != nil { 3572 return err 3573 } 3574 mapVar.Description = &description 3575 } 3576 case "severity": 3577 if v != nil { 3578 var severity int32 3579 err = json.Unmarshal(*v, &severity) 3580 if err != nil { 3581 return err 3582 } 3583 mapVar.Severity = &severity 3584 } 3585 case "enabled": 3586 if v != nil { 3587 var enabled bool 3588 err = json.Unmarshal(*v, &enabled) 3589 if err != nil { 3590 return err 3591 } 3592 mapVar.Enabled = &enabled 3593 } 3594 case "scopes": 3595 if v != nil { 3596 var scopes []string 3597 err = json.Unmarshal(*v, &scopes) 3598 if err != nil { 3599 return err 3600 } 3601 mapVar.Scopes = &scopes 3602 } 3603 case "evaluationFrequency": 3604 if v != nil { 3605 var evaluationFrequency string 3606 err = json.Unmarshal(*v, &evaluationFrequency) 3607 if err != nil { 3608 return err 3609 } 3610 mapVar.EvaluationFrequency = &evaluationFrequency 3611 } 3612 case "windowSize": 3613 if v != nil { 3614 var windowSize string 3615 err = json.Unmarshal(*v, &windowSize) 3616 if err != nil { 3617 return err 3618 } 3619 mapVar.WindowSize = &windowSize 3620 } 3621 case "targetResourceType": 3622 if v != nil { 3623 var targetResourceType string 3624 err = json.Unmarshal(*v, &targetResourceType) 3625 if err != nil { 3626 return err 3627 } 3628 mapVar.TargetResourceType = &targetResourceType 3629 } 3630 case "targetResourceRegion": 3631 if v != nil { 3632 var targetResourceRegion string 3633 err = json.Unmarshal(*v, &targetResourceRegion) 3634 if err != nil { 3635 return err 3636 } 3637 mapVar.TargetResourceRegion = &targetResourceRegion 3638 } 3639 case "criteria": 3640 if v != nil { 3641 criteria, err := unmarshalBasicMetricAlertCriteria(*v) 3642 if err != nil { 3643 return err 3644 } 3645 mapVar.Criteria = criteria 3646 } 3647 case "autoMitigate": 3648 if v != nil { 3649 var autoMitigate bool 3650 err = json.Unmarshal(*v, &autoMitigate) 3651 if err != nil { 3652 return err 3653 } 3654 mapVar.AutoMitigate = &autoMitigate 3655 } 3656 case "actions": 3657 if v != nil { 3658 var actions []MetricAlertAction 3659 err = json.Unmarshal(*v, &actions) 3660 if err != nil { 3661 return err 3662 } 3663 mapVar.Actions = &actions 3664 } 3665 case "lastUpdatedTime": 3666 if v != nil { 3667 var lastUpdatedTime date.Time 3668 err = json.Unmarshal(*v, &lastUpdatedTime) 3669 if err != nil { 3670 return err 3671 } 3672 mapVar.LastUpdatedTime = &lastUpdatedTime 3673 } 3674 } 3675 } 3676 3677 return nil 3678} 3679 3680// MetricAlertPropertiesPatch an alert rule properties for patch. 3681type MetricAlertPropertiesPatch struct { 3682 // Description - the description of the metric alert that will be included in the alert email. 3683 Description *string `json:"description,omitempty"` 3684 // Severity - Alert severity {0, 1, 2, 3, 4} 3685 Severity *int32 `json:"severity,omitempty"` 3686 // Enabled - the flag that indicates whether the metric alert is enabled. 3687 Enabled *bool `json:"enabled,omitempty"` 3688 // Scopes - the list of resource id's that this metric alert is scoped to. 3689 Scopes *[]string `json:"scopes,omitempty"` 3690 // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. 3691 EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` 3692 // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. 3693 WindowSize *string `json:"windowSize,omitempty"` 3694 // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. 3695 TargetResourceType *string `json:"targetResourceType,omitempty"` 3696 // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. 3697 TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` 3698 // Criteria - defines the specific alert criteria information. 3699 Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` 3700 // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. 3701 AutoMitigate *bool `json:"autoMitigate,omitempty"` 3702 // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. 3703 Actions *[]MetricAlertAction `json:"actions,omitempty"` 3704 // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. 3705 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 3706} 3707 3708// MarshalJSON is the custom marshaler for MetricAlertPropertiesPatch. 3709func (mapp MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { 3710 objectMap := make(map[string]interface{}) 3711 if mapp.Description != nil { 3712 objectMap["description"] = mapp.Description 3713 } 3714 if mapp.Severity != nil { 3715 objectMap["severity"] = mapp.Severity 3716 } 3717 if mapp.Enabled != nil { 3718 objectMap["enabled"] = mapp.Enabled 3719 } 3720 if mapp.Scopes != nil { 3721 objectMap["scopes"] = mapp.Scopes 3722 } 3723 if mapp.EvaluationFrequency != nil { 3724 objectMap["evaluationFrequency"] = mapp.EvaluationFrequency 3725 } 3726 if mapp.WindowSize != nil { 3727 objectMap["windowSize"] = mapp.WindowSize 3728 } 3729 if mapp.TargetResourceType != nil { 3730 objectMap["targetResourceType"] = mapp.TargetResourceType 3731 } 3732 if mapp.TargetResourceRegion != nil { 3733 objectMap["targetResourceRegion"] = mapp.TargetResourceRegion 3734 } 3735 objectMap["criteria"] = mapp.Criteria 3736 if mapp.AutoMitigate != nil { 3737 objectMap["autoMitigate"] = mapp.AutoMitigate 3738 } 3739 if mapp.Actions != nil { 3740 objectMap["actions"] = mapp.Actions 3741 } 3742 return json.Marshal(objectMap) 3743} 3744 3745// UnmarshalJSON is the custom unmarshaler for MetricAlertPropertiesPatch struct. 3746func (mapp *MetricAlertPropertiesPatch) UnmarshalJSON(body []byte) error { 3747 var m map[string]*json.RawMessage 3748 err := json.Unmarshal(body, &m) 3749 if err != nil { 3750 return err 3751 } 3752 for k, v := range m { 3753 switch k { 3754 case "description": 3755 if v != nil { 3756 var description string 3757 err = json.Unmarshal(*v, &description) 3758 if err != nil { 3759 return err 3760 } 3761 mapp.Description = &description 3762 } 3763 case "severity": 3764 if v != nil { 3765 var severity int32 3766 err = json.Unmarshal(*v, &severity) 3767 if err != nil { 3768 return err 3769 } 3770 mapp.Severity = &severity 3771 } 3772 case "enabled": 3773 if v != nil { 3774 var enabled bool 3775 err = json.Unmarshal(*v, &enabled) 3776 if err != nil { 3777 return err 3778 } 3779 mapp.Enabled = &enabled 3780 } 3781 case "scopes": 3782 if v != nil { 3783 var scopes []string 3784 err = json.Unmarshal(*v, &scopes) 3785 if err != nil { 3786 return err 3787 } 3788 mapp.Scopes = &scopes 3789 } 3790 case "evaluationFrequency": 3791 if v != nil { 3792 var evaluationFrequency string 3793 err = json.Unmarshal(*v, &evaluationFrequency) 3794 if err != nil { 3795 return err 3796 } 3797 mapp.EvaluationFrequency = &evaluationFrequency 3798 } 3799 case "windowSize": 3800 if v != nil { 3801 var windowSize string 3802 err = json.Unmarshal(*v, &windowSize) 3803 if err != nil { 3804 return err 3805 } 3806 mapp.WindowSize = &windowSize 3807 } 3808 case "targetResourceType": 3809 if v != nil { 3810 var targetResourceType string 3811 err = json.Unmarshal(*v, &targetResourceType) 3812 if err != nil { 3813 return err 3814 } 3815 mapp.TargetResourceType = &targetResourceType 3816 } 3817 case "targetResourceRegion": 3818 if v != nil { 3819 var targetResourceRegion string 3820 err = json.Unmarshal(*v, &targetResourceRegion) 3821 if err != nil { 3822 return err 3823 } 3824 mapp.TargetResourceRegion = &targetResourceRegion 3825 } 3826 case "criteria": 3827 if v != nil { 3828 criteria, err := unmarshalBasicMetricAlertCriteria(*v) 3829 if err != nil { 3830 return err 3831 } 3832 mapp.Criteria = criteria 3833 } 3834 case "autoMitigate": 3835 if v != nil { 3836 var autoMitigate bool 3837 err = json.Unmarshal(*v, &autoMitigate) 3838 if err != nil { 3839 return err 3840 } 3841 mapp.AutoMitigate = &autoMitigate 3842 } 3843 case "actions": 3844 if v != nil { 3845 var actions []MetricAlertAction 3846 err = json.Unmarshal(*v, &actions) 3847 if err != nil { 3848 return err 3849 } 3850 mapp.Actions = &actions 3851 } 3852 case "lastUpdatedTime": 3853 if v != nil { 3854 var lastUpdatedTime date.Time 3855 err = json.Unmarshal(*v, &lastUpdatedTime) 3856 if err != nil { 3857 return err 3858 } 3859 mapp.LastUpdatedTime = &lastUpdatedTime 3860 } 3861 } 3862 } 3863 3864 return nil 3865} 3866 3867// MetricAlertResource the metric alert resource. 3868type MetricAlertResource struct { 3869 autorest.Response `json:"-"` 3870 // MetricAlertProperties - The alert rule properties of the resource. 3871 *MetricAlertProperties `json:"properties,omitempty"` 3872 // ID - READ-ONLY; Azure resource Id 3873 ID *string `json:"id,omitempty"` 3874 // Name - READ-ONLY; Azure resource name 3875 Name *string `json:"name,omitempty"` 3876 // Type - READ-ONLY; Azure resource type 3877 Type *string `json:"type,omitempty"` 3878 // Location - Resource location 3879 Location *string `json:"location,omitempty"` 3880 // Tags - Resource tags 3881 Tags map[string]*string `json:"tags"` 3882} 3883 3884// MarshalJSON is the custom marshaler for MetricAlertResource. 3885func (mar MetricAlertResource) MarshalJSON() ([]byte, error) { 3886 objectMap := make(map[string]interface{}) 3887 if mar.MetricAlertProperties != nil { 3888 objectMap["properties"] = mar.MetricAlertProperties 3889 } 3890 if mar.Location != nil { 3891 objectMap["location"] = mar.Location 3892 } 3893 if mar.Tags != nil { 3894 objectMap["tags"] = mar.Tags 3895 } 3896 return json.Marshal(objectMap) 3897} 3898 3899// UnmarshalJSON is the custom unmarshaler for MetricAlertResource struct. 3900func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error { 3901 var m map[string]*json.RawMessage 3902 err := json.Unmarshal(body, &m) 3903 if err != nil { 3904 return err 3905 } 3906 for k, v := range m { 3907 switch k { 3908 case "properties": 3909 if v != nil { 3910 var metricAlertProperties MetricAlertProperties 3911 err = json.Unmarshal(*v, &metricAlertProperties) 3912 if err != nil { 3913 return err 3914 } 3915 mar.MetricAlertProperties = &metricAlertProperties 3916 } 3917 case "id": 3918 if v != nil { 3919 var ID string 3920 err = json.Unmarshal(*v, &ID) 3921 if err != nil { 3922 return err 3923 } 3924 mar.ID = &ID 3925 } 3926 case "name": 3927 if v != nil { 3928 var name string 3929 err = json.Unmarshal(*v, &name) 3930 if err != nil { 3931 return err 3932 } 3933 mar.Name = &name 3934 } 3935 case "type": 3936 if v != nil { 3937 var typeVar string 3938 err = json.Unmarshal(*v, &typeVar) 3939 if err != nil { 3940 return err 3941 } 3942 mar.Type = &typeVar 3943 } 3944 case "location": 3945 if v != nil { 3946 var location string 3947 err = json.Unmarshal(*v, &location) 3948 if err != nil { 3949 return err 3950 } 3951 mar.Location = &location 3952 } 3953 case "tags": 3954 if v != nil { 3955 var tags map[string]*string 3956 err = json.Unmarshal(*v, &tags) 3957 if err != nil { 3958 return err 3959 } 3960 mar.Tags = tags 3961 } 3962 } 3963 } 3964 3965 return nil 3966} 3967 3968// MetricAlertResourceCollection represents a collection of alert rule resources. 3969type MetricAlertResourceCollection struct { 3970 autorest.Response `json:"-"` 3971 // Value - the values for the alert rule resources. 3972 Value *[]MetricAlertResource `json:"value,omitempty"` 3973} 3974 3975// MetricAlertResourcePatch the metric alert resource for patch operations. 3976type MetricAlertResourcePatch struct { 3977 // Tags - Resource tags 3978 Tags map[string]*string `json:"tags"` 3979 // MetricAlertPropertiesPatch - The alert rule properties of the resource. 3980 *MetricAlertPropertiesPatch `json:"properties,omitempty"` 3981} 3982 3983// MarshalJSON is the custom marshaler for MetricAlertResourcePatch. 3984func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { 3985 objectMap := make(map[string]interface{}) 3986 if marp.Tags != nil { 3987 objectMap["tags"] = marp.Tags 3988 } 3989 if marp.MetricAlertPropertiesPatch != nil { 3990 objectMap["properties"] = marp.MetricAlertPropertiesPatch 3991 } 3992 return json.Marshal(objectMap) 3993} 3994 3995// UnmarshalJSON is the custom unmarshaler for MetricAlertResourcePatch struct. 3996func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error { 3997 var m map[string]*json.RawMessage 3998 err := json.Unmarshal(body, &m) 3999 if err != nil { 4000 return err 4001 } 4002 for k, v := range m { 4003 switch k { 4004 case "tags": 4005 if v != nil { 4006 var tags map[string]*string 4007 err = json.Unmarshal(*v, &tags) 4008 if err != nil { 4009 return err 4010 } 4011 marp.Tags = tags 4012 } 4013 case "properties": 4014 if v != nil { 4015 var metricAlertPropertiesPatch MetricAlertPropertiesPatch 4016 err = json.Unmarshal(*v, &metricAlertPropertiesPatch) 4017 if err != nil { 4018 return err 4019 } 4020 marp.MetricAlertPropertiesPatch = &metricAlertPropertiesPatch 4021 } 4022 } 4023 } 4024 4025 return nil 4026} 4027 4028// MetricAlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single 4029// resource that has multiple metric criteria. 4030type MetricAlertSingleResourceMultipleMetricCriteria struct { 4031 // AllOf - The list of metric criteria for this 'all of' operation. 4032 AllOf *[]MetricCriteria `json:"allOf,omitempty"` 4033 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 4034 AdditionalProperties map[string]interface{} `json:""` 4035 // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' 4036 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` 4037} 4038 4039// MarshalJSON is the custom marshaler for MetricAlertSingleResourceMultipleMetricCriteria. 4040func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { 4041 masrmmc.OdataType = OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria 4042 objectMap := make(map[string]interface{}) 4043 if masrmmc.AllOf != nil { 4044 objectMap["allOf"] = masrmmc.AllOf 4045 } 4046 if masrmmc.OdataType != "" { 4047 objectMap["odata.type"] = masrmmc.OdataType 4048 } 4049 for k, v := range masrmmc.AdditionalProperties { 4050 objectMap[k] = v 4051 } 4052 return json.Marshal(objectMap) 4053} 4054 4055// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. 4056func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { 4057 return &masrmmc, true 4058} 4059 4060// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. 4061func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { 4062 return nil, false 4063} 4064 4065// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. 4066func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { 4067 return nil, false 4068} 4069 4070// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. 4071func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { 4072 return nil, false 4073} 4074 4075// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. 4076func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { 4077 return &masrmmc, true 4078} 4079 4080// UnmarshalJSON is the custom unmarshaler for MetricAlertSingleResourceMultipleMetricCriteria struct. 4081func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) 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 case "allOf": 4090 if v != nil { 4091 var allOf []MetricCriteria 4092 err = json.Unmarshal(*v, &allOf) 4093 if err != nil { 4094 return err 4095 } 4096 masrmmc.AllOf = &allOf 4097 } 4098 default: 4099 if v != nil { 4100 var additionalProperties interface{} 4101 err = json.Unmarshal(*v, &additionalProperties) 4102 if err != nil { 4103 return err 4104 } 4105 if masrmmc.AdditionalProperties == nil { 4106 masrmmc.AdditionalProperties = make(map[string]interface{}) 4107 } 4108 masrmmc.AdditionalProperties[k] = additionalProperties 4109 } 4110 case "odata.type": 4111 if v != nil { 4112 var odataType OdataTypeBasicMetricAlertCriteria 4113 err = json.Unmarshal(*v, &odataType) 4114 if err != nil { 4115 return err 4116 } 4117 masrmmc.OdataType = odataType 4118 } 4119 } 4120 } 4121 4122 return nil 4123} 4124 4125// MetricAlertStatus an alert status. 4126type MetricAlertStatus struct { 4127 // Name - The status name. 4128 Name *string `json:"name,omitempty"` 4129 // ID - The alert rule arm id. 4130 ID *string `json:"id,omitempty"` 4131 // Type - The extended resource type name. 4132 Type *string `json:"type,omitempty"` 4133 // Properties - The alert status properties of the metric alert status. 4134 Properties *MetricAlertStatusProperties `json:"properties,omitempty"` 4135} 4136 4137// MetricAlertStatusCollection represents a collection of alert rule resources. 4138type MetricAlertStatusCollection struct { 4139 autorest.Response `json:"-"` 4140 // Value - the values for the alert rule resources. 4141 Value *[]MetricAlertStatus `json:"value,omitempty"` 4142} 4143 4144// MetricAlertStatusProperties an alert status properties. 4145type MetricAlertStatusProperties struct { 4146 // Dimensions - An object describing the type of the dimensions. 4147 Dimensions map[string]*string `json:"dimensions"` 4148 // Status - status value 4149 Status *string `json:"status,omitempty"` 4150 // Timestamp - UTC time when the status was checked. 4151 Timestamp *date.Time `json:"timestamp,omitempty"` 4152} 4153 4154// MarshalJSON is the custom marshaler for MetricAlertStatusProperties. 4155func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { 4156 objectMap := make(map[string]interface{}) 4157 if masp.Dimensions != nil { 4158 objectMap["dimensions"] = masp.Dimensions 4159 } 4160 if masp.Status != nil { 4161 objectMap["status"] = masp.Status 4162 } 4163 if masp.Timestamp != nil { 4164 objectMap["timestamp"] = masp.Timestamp 4165 } 4166 return json.Marshal(objectMap) 4167} 4168 4169// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and 4170// the retention period for that time grain. 4171type MetricAvailability struct { 4172 // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. 4173 TimeGrain *string `json:"timeGrain,omitempty"` 4174 // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. 4175 Retention *string `json:"retention,omitempty"` 4176} 4177 4178// MetricBaselinesProperties the response to a metric baselines query. 4179type MetricBaselinesProperties struct { 4180 // 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. 4181 Timespan *string `json:"timespan,omitempty"` 4182 // 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. 4183 Interval *string `json:"interval,omitempty"` 4184 // Namespace - The namespace of the metrics been queried. 4185 Namespace *string `json:"namespace,omitempty"` 4186 // Baselines - The baseline for each time series that was queried. 4187 Baselines *[]TimeSeriesBaseline `json:"baselines,omitempty"` 4188} 4189 4190// MetricBaselinesResponse a list of metric baselines. 4191type MetricBaselinesResponse struct { 4192 autorest.Response `json:"-"` 4193 // Value - The list of metric baselines. 4194 Value *[]SingleMetricBaseline `json:"value,omitempty"` 4195} 4196 4197// MetricCriteria criterion to filter metrics. 4198type MetricCriteria struct { 4199 // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' 4200 Operator Operator `json:"operator,omitempty"` 4201 // Threshold - the criteria threshold value that activates the alert. 4202 Threshold *float64 `json:"threshold,omitempty"` 4203 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 4204 AdditionalProperties map[string]interface{} `json:""` 4205 // Name - Name of the criteria. 4206 Name *string `json:"name,omitempty"` 4207 // MetricName - Name of the metric. 4208 MetricName *string `json:"metricName,omitempty"` 4209 // MetricNamespace - Namespace of the metric. 4210 MetricNamespace *string `json:"metricNamespace,omitempty"` 4211 // TimeAggregation - the criteria time aggregation types. 4212 TimeAggregation interface{} `json:"timeAggregation,omitempty"` 4213 // Dimensions - List of dimension conditions. 4214 Dimensions *[]MetricDimension `json:"dimensions,omitempty"` 4215 // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. 4216 SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` 4217 // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' 4218 CriterionType CriterionType `json:"criterionType,omitempty"` 4219} 4220 4221// MarshalJSON is the custom marshaler for MetricCriteria. 4222func (mc MetricCriteria) MarshalJSON() ([]byte, error) { 4223 mc.CriterionType = CriterionTypeStaticThresholdCriterion 4224 objectMap := make(map[string]interface{}) 4225 if mc.Operator != "" { 4226 objectMap["operator"] = mc.Operator 4227 } 4228 if mc.Threshold != nil { 4229 objectMap["threshold"] = mc.Threshold 4230 } 4231 if mc.Name != nil { 4232 objectMap["name"] = mc.Name 4233 } 4234 if mc.MetricName != nil { 4235 objectMap["metricName"] = mc.MetricName 4236 } 4237 if mc.MetricNamespace != nil { 4238 objectMap["metricNamespace"] = mc.MetricNamespace 4239 } 4240 if mc.TimeAggregation != nil { 4241 objectMap["timeAggregation"] = mc.TimeAggregation 4242 } 4243 if mc.Dimensions != nil { 4244 objectMap["dimensions"] = mc.Dimensions 4245 } 4246 if mc.SkipMetricValidation != nil { 4247 objectMap["skipMetricValidation"] = mc.SkipMetricValidation 4248 } 4249 if mc.CriterionType != "" { 4250 objectMap["criterionType"] = mc.CriterionType 4251 } 4252 for k, v := range mc.AdditionalProperties { 4253 objectMap[k] = v 4254 } 4255 return json.Marshal(objectMap) 4256} 4257 4258// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. 4259func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { 4260 return &mc, true 4261} 4262 4263// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. 4264func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { 4265 return nil, false 4266} 4267 4268// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. 4269func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { 4270 return nil, false 4271} 4272 4273// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. 4274func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { 4275 return &mc, true 4276} 4277 4278// UnmarshalJSON is the custom unmarshaler for MetricCriteria struct. 4279func (mc *MetricCriteria) UnmarshalJSON(body []byte) error { 4280 var m map[string]*json.RawMessage 4281 err := json.Unmarshal(body, &m) 4282 if err != nil { 4283 return err 4284 } 4285 for k, v := range m { 4286 switch k { 4287 case "operator": 4288 if v != nil { 4289 var operator Operator 4290 err = json.Unmarshal(*v, &operator) 4291 if err != nil { 4292 return err 4293 } 4294 mc.Operator = operator 4295 } 4296 case "threshold": 4297 if v != nil { 4298 var threshold float64 4299 err = json.Unmarshal(*v, &threshold) 4300 if err != nil { 4301 return err 4302 } 4303 mc.Threshold = &threshold 4304 } 4305 default: 4306 if v != nil { 4307 var additionalProperties interface{} 4308 err = json.Unmarshal(*v, &additionalProperties) 4309 if err != nil { 4310 return err 4311 } 4312 if mc.AdditionalProperties == nil { 4313 mc.AdditionalProperties = make(map[string]interface{}) 4314 } 4315 mc.AdditionalProperties[k] = additionalProperties 4316 } 4317 case "name": 4318 if v != nil { 4319 var name string 4320 err = json.Unmarshal(*v, &name) 4321 if err != nil { 4322 return err 4323 } 4324 mc.Name = &name 4325 } 4326 case "metricName": 4327 if v != nil { 4328 var metricName string 4329 err = json.Unmarshal(*v, &metricName) 4330 if err != nil { 4331 return err 4332 } 4333 mc.MetricName = &metricName 4334 } 4335 case "metricNamespace": 4336 if v != nil { 4337 var metricNamespace string 4338 err = json.Unmarshal(*v, &metricNamespace) 4339 if err != nil { 4340 return err 4341 } 4342 mc.MetricNamespace = &metricNamespace 4343 } 4344 case "timeAggregation": 4345 if v != nil { 4346 var timeAggregation interface{} 4347 err = json.Unmarshal(*v, &timeAggregation) 4348 if err != nil { 4349 return err 4350 } 4351 mc.TimeAggregation = timeAggregation 4352 } 4353 case "dimensions": 4354 if v != nil { 4355 var dimensions []MetricDimension 4356 err = json.Unmarshal(*v, &dimensions) 4357 if err != nil { 4358 return err 4359 } 4360 mc.Dimensions = &dimensions 4361 } 4362 case "skipMetricValidation": 4363 if v != nil { 4364 var skipMetricValidation bool 4365 err = json.Unmarshal(*v, &skipMetricValidation) 4366 if err != nil { 4367 return err 4368 } 4369 mc.SkipMetricValidation = &skipMetricValidation 4370 } 4371 case "criterionType": 4372 if v != nil { 4373 var criterionType CriterionType 4374 err = json.Unmarshal(*v, &criterionType) 4375 if err != nil { 4376 return err 4377 } 4378 mc.CriterionType = criterionType 4379 } 4380 } 4381 } 4382 4383 return nil 4384} 4385 4386// MetricDefinition metric definition class specifies the metadata for a metric. 4387type MetricDefinition struct { 4388 // IsDimensionRequired - Flag to indicate whether the dimension is required. 4389 IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` 4390 // ResourceID - the resource identifier of the resource that emitted the metric. 4391 ResourceID *string `json:"resourceId,omitempty"` 4392 // Namespace - the namespace the metric belongs to. 4393 Namespace *string `json:"namespace,omitempty"` 4394 // Name - the name and the display name of the metric, i.e. it is a localizable string. 4395 Name *LocalizableString `json:"name,omitempty"` 4396 // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' 4397 Unit Unit `json:"unit,omitempty"` 4398 // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' 4399 PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` 4400 // SupportedAggregationTypes - the collection of what aggregation types are supported. 4401 SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` 4402 // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. 4403 MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` 4404 // ID - the resource identifier of the metric definition. 4405 ID *string `json:"id,omitempty"` 4406 // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. 4407 Dimensions *[]LocalizableString `json:"dimensions,omitempty"` 4408} 4409 4410// MetricDefinitionCollection represents collection of metric definitions. 4411type MetricDefinitionCollection struct { 4412 autorest.Response `json:"-"` 4413 // Value - the values for the metric definitions. 4414 Value *[]MetricDefinition `json:"value,omitempty"` 4415} 4416 4417// MetricDimension specifies a metric dimension. 4418type MetricDimension struct { 4419 // Name - Name of the dimension. 4420 Name *string `json:"name,omitempty"` 4421 // Operator - the dimension operator. Only 'Include' and 'Exclude' are supported 4422 Operator *string `json:"operator,omitempty"` 4423 // Values - list of dimension values. 4424 Values *[]string `json:"values,omitempty"` 4425} 4426 4427// MetricNamespace metric namespace class specifies the metadata for a metric namespace. 4428type MetricNamespace struct { 4429 // ID - The ID of the metricNamespace. 4430 ID *string `json:"id,omitempty"` 4431 // Type - The type of the namespace. 4432 Type *string `json:"type,omitempty"` 4433 // Name - The name of the namespace. 4434 Name *string `json:"name,omitempty"` 4435 // Properties - Properties which include the fully qualified namespace name. 4436 Properties *MetricNamespaceName `json:"properties,omitempty"` 4437} 4438 4439// MetricNamespaceCollection represents collection of metric namespaces. 4440type MetricNamespaceCollection struct { 4441 autorest.Response `json:"-"` 4442 // Value - The values for the metric namespaces. 4443 Value *[]MetricNamespace `json:"value,omitempty"` 4444} 4445 4446// MetricNamespaceName the fully qualified metric namespace name. 4447type MetricNamespaceName struct { 4448 // MetricNamespaceName - The metric namespace name. 4449 MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` 4450} 4451 4452// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. 4453type MetricSettings struct { 4454 // TimeGrain - the timegrain of the metric in ISO8601 format. 4455 TimeGrain *string `json:"timeGrain,omitempty"` 4456 // 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. 4457 Category *string `json:"category,omitempty"` 4458 // Enabled - a value indicating whether this category is enabled. 4459 Enabled *bool `json:"enabled,omitempty"` 4460 // RetentionPolicy - the retention policy for this category. 4461 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 4462} 4463 4464// MetricSingleDimension the metric dimension name and value. 4465type MetricSingleDimension struct { 4466 // Name - Name of the dimension. 4467 Name *string `json:"name,omitempty"` 4468 // Value - Value of the dimension. 4469 Value *string `json:"value,omitempty"` 4470} 4471 4472// MetricTrigger the trigger that results in a scaling action. 4473type MetricTrigger struct { 4474 // MetricName - the name of the metric that defines what the rule monitors. 4475 MetricName *string `json:"metricName,omitempty"` 4476 // MetricNamespace - the namespace of the metric that defines what the rule monitors. 4477 MetricNamespace *string `json:"metricNamespace,omitempty"` 4478 // MetricResourceURI - the resource identifier of the resource the rule monitors. 4479 MetricResourceURI *string `json:"metricResourceUri,omitempty"` 4480 // 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. 4481 TimeGrain *string `json:"timeGrain,omitempty"` 4482 // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' 4483 Statistic MetricStatisticType `json:"statistic,omitempty"` 4484 // 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. 4485 TimeWindow *string `json:"timeWindow,omitempty"` 4486 // 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' 4487 TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` 4488 // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' 4489 Operator ComparisonOperationType `json:"operator,omitempty"` 4490 // Threshold - the threshold of the metric that triggers the scale action. 4491 Threshold *float64 `json:"threshold,omitempty"` 4492 // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. 4493 Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` 4494} 4495 4496// MetricValue represents a metric value. 4497type MetricValue struct { 4498 // TimeStamp - the timestamp for the metric value in ISO 8601 format. 4499 TimeStamp *date.Time `json:"timeStamp,omitempty"` 4500 // Average - the average value in the time range. 4501 Average *float64 `json:"average,omitempty"` 4502 // Minimum - the least value in the time range. 4503 Minimum *float64 `json:"minimum,omitempty"` 4504 // Maximum - the greatest value in the time range. 4505 Maximum *float64 `json:"maximum,omitempty"` 4506 // Total - the sum of all of the values in the time range. 4507 Total *float64 `json:"total,omitempty"` 4508 // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. 4509 Count *float64 `json:"count,omitempty"` 4510} 4511 4512// BasicMultiMetricCriteria the types of conditions for a multi resource alert. 4513type BasicMultiMetricCriteria interface { 4514 AsMetricCriteria() (*MetricCriteria, bool) 4515 AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) 4516 AsMultiMetricCriteria() (*MultiMetricCriteria, bool) 4517} 4518 4519// MultiMetricCriteria the types of conditions for a multi resource alert. 4520type MultiMetricCriteria struct { 4521 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 4522 AdditionalProperties map[string]interface{} `json:""` 4523 // Name - Name of the criteria. 4524 Name *string `json:"name,omitempty"` 4525 // MetricName - Name of the metric. 4526 MetricName *string `json:"metricName,omitempty"` 4527 // MetricNamespace - Namespace of the metric. 4528 MetricNamespace *string `json:"metricNamespace,omitempty"` 4529 // TimeAggregation - the criteria time aggregation types. 4530 TimeAggregation interface{} `json:"timeAggregation,omitempty"` 4531 // Dimensions - List of dimension conditions. 4532 Dimensions *[]MetricDimension `json:"dimensions,omitempty"` 4533 // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. 4534 SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` 4535 // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' 4536 CriterionType CriterionType `json:"criterionType,omitempty"` 4537} 4538 4539func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) { 4540 var m map[string]interface{} 4541 err := json.Unmarshal(body, &m) 4542 if err != nil { 4543 return nil, err 4544 } 4545 4546 switch m["criterionType"] { 4547 case string(CriterionTypeStaticThresholdCriterion): 4548 var mc MetricCriteria 4549 err := json.Unmarshal(body, &mc) 4550 return mc, err 4551 case string(CriterionTypeDynamicThresholdCriterion): 4552 var dmc DynamicMetricCriteria 4553 err := json.Unmarshal(body, &dmc) 4554 return dmc, err 4555 default: 4556 var mmc MultiMetricCriteria 4557 err := json.Unmarshal(body, &mmc) 4558 return mmc, err 4559 } 4560} 4561func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) { 4562 var rawMessages []*json.RawMessage 4563 err := json.Unmarshal(body, &rawMessages) 4564 if err != nil { 4565 return nil, err 4566 } 4567 4568 mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages)) 4569 4570 for index, rawMessage := range rawMessages { 4571 mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage) 4572 if err != nil { 4573 return nil, err 4574 } 4575 mmcArray[index] = mmc 4576 } 4577 return mmcArray, nil 4578} 4579 4580// MarshalJSON is the custom marshaler for MultiMetricCriteria. 4581func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { 4582 mmc.CriterionType = CriterionTypeMultiMetricCriteria 4583 objectMap := make(map[string]interface{}) 4584 if mmc.Name != nil { 4585 objectMap["name"] = mmc.Name 4586 } 4587 if mmc.MetricName != nil { 4588 objectMap["metricName"] = mmc.MetricName 4589 } 4590 if mmc.MetricNamespace != nil { 4591 objectMap["metricNamespace"] = mmc.MetricNamespace 4592 } 4593 if mmc.TimeAggregation != nil { 4594 objectMap["timeAggregation"] = mmc.TimeAggregation 4595 } 4596 if mmc.Dimensions != nil { 4597 objectMap["dimensions"] = mmc.Dimensions 4598 } 4599 if mmc.SkipMetricValidation != nil { 4600 objectMap["skipMetricValidation"] = mmc.SkipMetricValidation 4601 } 4602 if mmc.CriterionType != "" { 4603 objectMap["criterionType"] = mmc.CriterionType 4604 } 4605 for k, v := range mmc.AdditionalProperties { 4606 objectMap[k] = v 4607 } 4608 return json.Marshal(objectMap) 4609} 4610 4611// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. 4612func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { 4613 return nil, false 4614} 4615 4616// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. 4617func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { 4618 return nil, false 4619} 4620 4621// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. 4622func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { 4623 return &mmc, true 4624} 4625 4626// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. 4627func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { 4628 return &mmc, true 4629} 4630 4631// UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct. 4632func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error { 4633 var m map[string]*json.RawMessage 4634 err := json.Unmarshal(body, &m) 4635 if err != nil { 4636 return err 4637 } 4638 for k, v := range m { 4639 switch k { 4640 default: 4641 if v != nil { 4642 var additionalProperties interface{} 4643 err = json.Unmarshal(*v, &additionalProperties) 4644 if err != nil { 4645 return err 4646 } 4647 if mmc.AdditionalProperties == nil { 4648 mmc.AdditionalProperties = make(map[string]interface{}) 4649 } 4650 mmc.AdditionalProperties[k] = additionalProperties 4651 } 4652 case "name": 4653 if v != nil { 4654 var name string 4655 err = json.Unmarshal(*v, &name) 4656 if err != nil { 4657 return err 4658 } 4659 mmc.Name = &name 4660 } 4661 case "metricName": 4662 if v != nil { 4663 var metricName string 4664 err = json.Unmarshal(*v, &metricName) 4665 if err != nil { 4666 return err 4667 } 4668 mmc.MetricName = &metricName 4669 } 4670 case "metricNamespace": 4671 if v != nil { 4672 var metricNamespace string 4673 err = json.Unmarshal(*v, &metricNamespace) 4674 if err != nil { 4675 return err 4676 } 4677 mmc.MetricNamespace = &metricNamespace 4678 } 4679 case "timeAggregation": 4680 if v != nil { 4681 var timeAggregation interface{} 4682 err = json.Unmarshal(*v, &timeAggregation) 4683 if err != nil { 4684 return err 4685 } 4686 mmc.TimeAggregation = timeAggregation 4687 } 4688 case "dimensions": 4689 if v != nil { 4690 var dimensions []MetricDimension 4691 err = json.Unmarshal(*v, &dimensions) 4692 if err != nil { 4693 return err 4694 } 4695 mmc.Dimensions = &dimensions 4696 } 4697 case "skipMetricValidation": 4698 if v != nil { 4699 var skipMetricValidation bool 4700 err = json.Unmarshal(*v, &skipMetricValidation) 4701 if err != nil { 4702 return err 4703 } 4704 mmc.SkipMetricValidation = &skipMetricValidation 4705 } 4706 case "criterionType": 4707 if v != nil { 4708 var criterionType CriterionType 4709 err = json.Unmarshal(*v, &criterionType) 4710 if err != nil { 4711 return err 4712 } 4713 mmc.CriterionType = criterionType 4714 } 4715 } 4716 } 4717 4718 return nil 4719} 4720 4721// Operation microsoft Insights API operation definition. 4722type Operation struct { 4723 // Name - Operation name: {provider}/{resource}/{operation} 4724 Name *string `json:"name,omitempty"` 4725 // Display - Display metadata associated with the operation. 4726 Display *OperationDisplay `json:"display,omitempty"` 4727} 4728 4729// OperationDisplay display metadata associated with the operation. 4730type OperationDisplay struct { 4731 // Provider - Service provider: Microsoft.Insights 4732 Provider *string `json:"provider,omitempty"` 4733 // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. 4734 Resource *string `json:"resource,omitempty"` 4735 // Operation - Operation type: Read, write, delete, etc. 4736 Operation *string `json:"operation,omitempty"` 4737} 4738 4739// OperationListResult result of the request to list Microsoft.Insights operations. It contains a list of 4740// operations and a URL link to get the next set of results. 4741type OperationListResult struct { 4742 autorest.Response `json:"-"` 4743 // Value - List of operations supported by the Microsoft.Insights provider. 4744 Value *[]Operation `json:"value,omitempty"` 4745 // NextLink - URL to get the next set of operation list results if there are any. 4746 NextLink *string `json:"nextLink,omitempty"` 4747} 4748 4749// OperationStatus the status of operation. 4750type OperationStatus struct { 4751 autorest.Response `json:"-"` 4752 // ID - The operation Id. 4753 ID *string `json:"id,omitempty"` 4754 // Name - The operation name. 4755 Name *string `json:"name,omitempty"` 4756 // StartTime - Start time of the job in standard ISO8601 format. 4757 StartTime *date.Time `json:"startTime,omitempty"` 4758 // EndTime - End time of the job in standard ISO8601 format. 4759 EndTime *date.Time `json:"endTime,omitempty"` 4760 // Status - The status of the operation. 4761 Status *string `json:"status,omitempty"` 4762 // Error - The error detail of the operation if any. 4763 Error *ErrorResponseCommon `json:"error,omitempty"` 4764} 4765 4766// PrivateEndpointConnection a private endpoint connection 4767type PrivateEndpointConnection struct { 4768 autorest.Response `json:"-"` 4769 // PrivateEndpointConnectionProperties - Resource properties. 4770 *PrivateEndpointConnectionProperties `json:"properties,omitempty"` 4771 // ID - READ-ONLY; Azure resource Id 4772 ID *string `json:"id,omitempty"` 4773 // Name - READ-ONLY; Azure resource name 4774 Name *string `json:"name,omitempty"` 4775 // Type - READ-ONLY; Azure resource type 4776 Type *string `json:"type,omitempty"` 4777} 4778 4779// MarshalJSON is the custom marshaler for PrivateEndpointConnection. 4780func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { 4781 objectMap := make(map[string]interface{}) 4782 if pec.PrivateEndpointConnectionProperties != nil { 4783 objectMap["properties"] = pec.PrivateEndpointConnectionProperties 4784 } 4785 return json.Marshal(objectMap) 4786} 4787 4788// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. 4789func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { 4790 var m map[string]*json.RawMessage 4791 err := json.Unmarshal(body, &m) 4792 if err != nil { 4793 return err 4794 } 4795 for k, v := range m { 4796 switch k { 4797 case "properties": 4798 if v != nil { 4799 var privateEndpointConnectionProperties PrivateEndpointConnectionProperties 4800 err = json.Unmarshal(*v, &privateEndpointConnectionProperties) 4801 if err != nil { 4802 return err 4803 } 4804 pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties 4805 } 4806 case "id": 4807 if v != nil { 4808 var ID string 4809 err = json.Unmarshal(*v, &ID) 4810 if err != nil { 4811 return err 4812 } 4813 pec.ID = &ID 4814 } 4815 case "name": 4816 if v != nil { 4817 var name string 4818 err = json.Unmarshal(*v, &name) 4819 if err != nil { 4820 return err 4821 } 4822 pec.Name = &name 4823 } 4824 case "type": 4825 if v != nil { 4826 var typeVar string 4827 err = json.Unmarshal(*v, &typeVar) 4828 if err != nil { 4829 return err 4830 } 4831 pec.Type = &typeVar 4832 } 4833 } 4834 } 4835 4836 return nil 4837} 4838 4839// PrivateEndpointConnectionListResult a list of private endpoint connections. 4840type PrivateEndpointConnectionListResult struct { 4841 autorest.Response `json:"-"` 4842 // Value - READ-ONLY; Array of results. 4843 Value *[]PrivateEndpointConnection `json:"value,omitempty"` 4844 // NextLink - READ-ONLY; Link to retrieve next page of results. 4845 NextLink *string `json:"nextLink,omitempty"` 4846} 4847 4848// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. 4849func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { 4850 objectMap := make(map[string]interface{}) 4851 return json.Marshal(objectMap) 4852} 4853 4854// PrivateEndpointConnectionListResultIterator provides access to a complete listing of 4855// PrivateEndpointConnection values. 4856type PrivateEndpointConnectionListResultIterator struct { 4857 i int 4858 page PrivateEndpointConnectionListResultPage 4859} 4860 4861// NextWithContext advances to the next value. If there was an error making 4862// the request the iterator does not advance and the error is returned. 4863func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { 4864 if tracing.IsEnabled() { 4865 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") 4866 defer func() { 4867 sc := -1 4868 if iter.Response().Response.Response != nil { 4869 sc = iter.Response().Response.Response.StatusCode 4870 } 4871 tracing.EndSpan(ctx, sc, err) 4872 }() 4873 } 4874 iter.i++ 4875 if iter.i < len(iter.page.Values()) { 4876 return nil 4877 } 4878 err = iter.page.NextWithContext(ctx) 4879 if err != nil { 4880 iter.i-- 4881 return err 4882 } 4883 iter.i = 0 4884 return nil 4885} 4886 4887// Next advances to the next value. If there was an error making 4888// the request the iterator does not advance and the error is returned. 4889// Deprecated: Use NextWithContext() instead. 4890func (iter *PrivateEndpointConnectionListResultIterator) Next() error { 4891 return iter.NextWithContext(context.Background()) 4892} 4893 4894// NotDone returns true if the enumeration should be started or is not yet complete. 4895func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { 4896 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4897} 4898 4899// Response returns the raw server response from the last page request. 4900func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { 4901 return iter.page.Response() 4902} 4903 4904// Value returns the current value or a zero-initialized value if the 4905// iterator has advanced beyond the end of the collection. 4906func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { 4907 if !iter.page.NotDone() { 4908 return PrivateEndpointConnection{} 4909 } 4910 return iter.page.Values()[iter.i] 4911} 4912 4913// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. 4914func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { 4915 return PrivateEndpointConnectionListResultIterator{page: page} 4916} 4917 4918// IsEmpty returns true if the ListResult contains no values. 4919func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { 4920 return peclr.Value == nil || len(*peclr.Value) == 0 4921} 4922 4923// hasNextLink returns true if the NextLink is not empty. 4924func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { 4925 return peclr.NextLink != nil && len(*peclr.NextLink) != 0 4926} 4927 4928// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. 4929// It returns nil if no more results exist. 4930func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { 4931 if !peclr.hasNextLink() { 4932 return nil, nil 4933 } 4934 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4935 autorest.AsJSON(), 4936 autorest.AsGet(), 4937 autorest.WithBaseURL(to.String(peclr.NextLink))) 4938} 4939 4940// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. 4941type PrivateEndpointConnectionListResultPage struct { 4942 fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) 4943 peclr PrivateEndpointConnectionListResult 4944} 4945 4946// NextWithContext advances to the next page of values. If there was an error making 4947// the request the page does not advance and the error is returned. 4948func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { 4949 if tracing.IsEnabled() { 4950 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") 4951 defer func() { 4952 sc := -1 4953 if page.Response().Response.Response != nil { 4954 sc = page.Response().Response.Response.StatusCode 4955 } 4956 tracing.EndSpan(ctx, sc, err) 4957 }() 4958 } 4959 for { 4960 next, err := page.fn(ctx, page.peclr) 4961 if err != nil { 4962 return err 4963 } 4964 page.peclr = next 4965 if !next.hasNextLink() || !next.IsEmpty() { 4966 break 4967 } 4968 } 4969 return nil 4970} 4971 4972// Next advances to the next page of values. If there was an error making 4973// the request the page does not advance and the error is returned. 4974// Deprecated: Use NextWithContext() instead. 4975func (page *PrivateEndpointConnectionListResultPage) Next() error { 4976 return page.NextWithContext(context.Background()) 4977} 4978 4979// NotDone returns true if the page enumeration should be started or is not yet complete. 4980func (page PrivateEndpointConnectionListResultPage) NotDone() bool { 4981 return !page.peclr.IsEmpty() 4982} 4983 4984// Response returns the raw server response from the last page request. 4985func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { 4986 return page.peclr 4987} 4988 4989// Values returns the slice of values for the current page or nil if there are no values. 4990func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { 4991 if page.peclr.IsEmpty() { 4992 return nil 4993 } 4994 return *page.peclr.Value 4995} 4996 4997// Creates a new instance of the PrivateEndpointConnectionListResultPage type. 4998func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { 4999 return PrivateEndpointConnectionListResultPage{ 5000 fn: getNextPage, 5001 peclr: cur, 5002 } 5003} 5004 5005// PrivateEndpointConnectionProperties properties of a private endpoint connection. 5006type PrivateEndpointConnectionProperties struct { 5007 // PrivateEndpoint - Private endpoint which the connection belongs to. 5008 PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` 5009 // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. 5010 PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` 5011 // ProvisioningState - READ-ONLY; State of the private endpoint connection. 5012 ProvisioningState *string `json:"provisioningState,omitempty"` 5013} 5014 5015// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. 5016func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { 5017 objectMap := make(map[string]interface{}) 5018 if pecp.PrivateEndpoint != nil { 5019 objectMap["privateEndpoint"] = pecp.PrivateEndpoint 5020 } 5021 if pecp.PrivateLinkServiceConnectionState != nil { 5022 objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState 5023 } 5024 return json.Marshal(objectMap) 5025} 5026 5027// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results 5028// of a long-running operation. 5029type PrivateEndpointConnectionsCreateOrUpdateFuture struct { 5030 azure.FutureAPI 5031 // Result returns the result of the asynchronous operation. 5032 // If the operation has not completed it will return an error. 5033 Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) 5034} 5035 5036// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5037func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 5038 var azFuture azure.Future 5039 if err := json.Unmarshal(body, &azFuture); err != nil { 5040 return err 5041 } 5042 future.FutureAPI = &azFuture 5043 future.Result = future.result 5044 return nil 5045} 5046 5047// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. 5048func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { 5049 var done bool 5050 done, err = future.DoneWithContext(context.Background(), client) 5051 if err != nil { 5052 err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 5053 return 5054 } 5055 if !done { 5056 pec.Response.Response = future.Response() 5057 err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsCreateOrUpdateFuture") 5058 return 5059 } 5060 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5061 if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { 5062 pec, err = client.CreateOrUpdateResponder(pec.Response.Response) 5063 if err != nil { 5064 err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") 5065 } 5066 } 5067 return 5068} 5069 5070// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a 5071// long-running operation. 5072type PrivateEndpointConnectionsDeleteFuture struct { 5073 azure.FutureAPI 5074 // Result returns the result of the asynchronous operation. 5075 // If the operation has not completed it will return an error. 5076 Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) 5077} 5078 5079// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5080func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { 5081 var azFuture azure.Future 5082 if err := json.Unmarshal(body, &azFuture); err != nil { 5083 return err 5084 } 5085 future.FutureAPI = &azFuture 5086 future.Result = future.result 5087 return nil 5088} 5089 5090// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. 5091func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { 5092 var done bool 5093 done, err = future.DoneWithContext(context.Background(), client) 5094 if err != nil { 5095 err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") 5096 return 5097 } 5098 if !done { 5099 ar.Response = future.Response() 5100 err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsDeleteFuture") 5101 return 5102 } 5103 ar.Response = future.Response() 5104 return 5105} 5106 5107// PrivateEndpointProperty private endpoint which the connection belongs to. 5108type PrivateEndpointProperty struct { 5109 // ID - Resource id of the private endpoint. 5110 ID *string `json:"id,omitempty"` 5111} 5112 5113// PrivateLinkResource a private link resource 5114type PrivateLinkResource struct { 5115 autorest.Response `json:"-"` 5116 // PrivateLinkResourceProperties - Resource properties. 5117 *PrivateLinkResourceProperties `json:"properties,omitempty"` 5118 // ID - READ-ONLY; Azure resource Id 5119 ID *string `json:"id,omitempty"` 5120 // Name - READ-ONLY; Azure resource name 5121 Name *string `json:"name,omitempty"` 5122 // Type - READ-ONLY; Azure resource type 5123 Type *string `json:"type,omitempty"` 5124} 5125 5126// MarshalJSON is the custom marshaler for PrivateLinkResource. 5127func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { 5128 objectMap := make(map[string]interface{}) 5129 if plr.PrivateLinkResourceProperties != nil { 5130 objectMap["properties"] = plr.PrivateLinkResourceProperties 5131 } 5132 return json.Marshal(objectMap) 5133} 5134 5135// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. 5136func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { 5137 var m map[string]*json.RawMessage 5138 err := json.Unmarshal(body, &m) 5139 if err != nil { 5140 return err 5141 } 5142 for k, v := range m { 5143 switch k { 5144 case "properties": 5145 if v != nil { 5146 var privateLinkResourceProperties PrivateLinkResourceProperties 5147 err = json.Unmarshal(*v, &privateLinkResourceProperties) 5148 if err != nil { 5149 return err 5150 } 5151 plr.PrivateLinkResourceProperties = &privateLinkResourceProperties 5152 } 5153 case "id": 5154 if v != nil { 5155 var ID string 5156 err = json.Unmarshal(*v, &ID) 5157 if err != nil { 5158 return err 5159 } 5160 plr.ID = &ID 5161 } 5162 case "name": 5163 if v != nil { 5164 var name string 5165 err = json.Unmarshal(*v, &name) 5166 if err != nil { 5167 return err 5168 } 5169 plr.Name = &name 5170 } 5171 case "type": 5172 if v != nil { 5173 var typeVar string 5174 err = json.Unmarshal(*v, &typeVar) 5175 if err != nil { 5176 return err 5177 } 5178 plr.Type = &typeVar 5179 } 5180 } 5181 } 5182 5183 return nil 5184} 5185 5186// PrivateLinkResourceListResult a list of private link resources 5187type PrivateLinkResourceListResult struct { 5188 autorest.Response `json:"-"` 5189 // Value - READ-ONLY; Array of results. 5190 Value *[]PrivateLinkResource `json:"value,omitempty"` 5191 // NextLink - READ-ONLY; Link to retrieve next page of results. 5192 NextLink *string `json:"nextLink,omitempty"` 5193} 5194 5195// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. 5196func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { 5197 objectMap := make(map[string]interface{}) 5198 return json.Marshal(objectMap) 5199} 5200 5201// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource 5202// values. 5203type PrivateLinkResourceListResultIterator struct { 5204 i int 5205 page PrivateLinkResourceListResultPage 5206} 5207 5208// NextWithContext advances to the next value. If there was an error making 5209// the request the iterator does not advance and the error is returned. 5210func (iter *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { 5211 if tracing.IsEnabled() { 5212 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.NextWithContext") 5213 defer func() { 5214 sc := -1 5215 if iter.Response().Response.Response != nil { 5216 sc = iter.Response().Response.Response.StatusCode 5217 } 5218 tracing.EndSpan(ctx, sc, err) 5219 }() 5220 } 5221 iter.i++ 5222 if iter.i < len(iter.page.Values()) { 5223 return nil 5224 } 5225 err = iter.page.NextWithContext(ctx) 5226 if err != nil { 5227 iter.i-- 5228 return err 5229 } 5230 iter.i = 0 5231 return nil 5232} 5233 5234// Next advances to the next value. If there was an error making 5235// the request the iterator does not advance and the error is returned. 5236// Deprecated: Use NextWithContext() instead. 5237func (iter *PrivateLinkResourceListResultIterator) Next() error { 5238 return iter.NextWithContext(context.Background()) 5239} 5240 5241// NotDone returns true if the enumeration should be started or is not yet complete. 5242func (iter PrivateLinkResourceListResultIterator) NotDone() bool { 5243 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 5244} 5245 5246// Response returns the raw server response from the last page request. 5247func (iter PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { 5248 return iter.page.Response() 5249} 5250 5251// Value returns the current value or a zero-initialized value if the 5252// iterator has advanced beyond the end of the collection. 5253func (iter PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { 5254 if !iter.page.NotDone() { 5255 return PrivateLinkResource{} 5256 } 5257 return iter.page.Values()[iter.i] 5258} 5259 5260// Creates a new instance of the PrivateLinkResourceListResultIterator type. 5261func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { 5262 return PrivateLinkResourceListResultIterator{page: page} 5263} 5264 5265// IsEmpty returns true if the ListResult contains no values. 5266func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { 5267 return plrlr.Value == nil || len(*plrlr.Value) == 0 5268} 5269 5270// hasNextLink returns true if the NextLink is not empty. 5271func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { 5272 return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 5273} 5274 5275// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. 5276// It returns nil if no more results exist. 5277func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { 5278 if !plrlr.hasNextLink() { 5279 return nil, nil 5280 } 5281 return autorest.Prepare((&http.Request{}).WithContext(ctx), 5282 autorest.AsJSON(), 5283 autorest.AsGet(), 5284 autorest.WithBaseURL(to.String(plrlr.NextLink))) 5285} 5286 5287// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. 5288type PrivateLinkResourceListResultPage struct { 5289 fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) 5290 plrlr PrivateLinkResourceListResult 5291} 5292 5293// NextWithContext advances to the next page of values. If there was an error making 5294// the request the page does not advance and the error is returned. 5295func (page *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { 5296 if tracing.IsEnabled() { 5297 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.NextWithContext") 5298 defer func() { 5299 sc := -1 5300 if page.Response().Response.Response != nil { 5301 sc = page.Response().Response.Response.StatusCode 5302 } 5303 tracing.EndSpan(ctx, sc, err) 5304 }() 5305 } 5306 for { 5307 next, err := page.fn(ctx, page.plrlr) 5308 if err != nil { 5309 return err 5310 } 5311 page.plrlr = next 5312 if !next.hasNextLink() || !next.IsEmpty() { 5313 break 5314 } 5315 } 5316 return nil 5317} 5318 5319// Next advances to the next page of values. If there was an error making 5320// the request the page does not advance and the error is returned. 5321// Deprecated: Use NextWithContext() instead. 5322func (page *PrivateLinkResourceListResultPage) Next() error { 5323 return page.NextWithContext(context.Background()) 5324} 5325 5326// NotDone returns true if the page enumeration should be started or is not yet complete. 5327func (page PrivateLinkResourceListResultPage) NotDone() bool { 5328 return !page.plrlr.IsEmpty() 5329} 5330 5331// Response returns the raw server response from the last page request. 5332func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { 5333 return page.plrlr 5334} 5335 5336// Values returns the slice of values for the current page or nil if there are no values. 5337func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { 5338 if page.plrlr.IsEmpty() { 5339 return nil 5340 } 5341 return *page.plrlr.Value 5342} 5343 5344// Creates a new instance of the PrivateLinkResourceListResultPage type. 5345func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { 5346 return PrivateLinkResourceListResultPage{ 5347 fn: getNextPage, 5348 plrlr: cur, 5349 } 5350} 5351 5352// PrivateLinkResourceProperties properties of a private link resource. 5353type PrivateLinkResourceProperties struct { 5354 // GroupID - READ-ONLY; The private link resource group id. 5355 GroupID *string `json:"groupId,omitempty"` 5356 // RequiredMembers - READ-ONLY; The private link resource required member names. 5357 RequiredMembers *[]string `json:"requiredMembers,omitempty"` 5358} 5359 5360// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. 5361func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { 5362 objectMap := make(map[string]interface{}) 5363 return json.Marshal(objectMap) 5364} 5365 5366// PrivateLinkScopedResourcesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results 5367// of a long-running operation. 5368type PrivateLinkScopedResourcesCreateOrUpdateFuture struct { 5369 azure.FutureAPI 5370 // Result returns the result of the asynchronous operation. 5371 // If the operation has not completed it will return an error. 5372 Result func(PrivateLinkScopedResourcesClient) (ScopedResource, error) 5373} 5374 5375// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5376func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 5377 var azFuture azure.Future 5378 if err := json.Unmarshal(body, &azFuture); err != nil { 5379 return err 5380 } 5381 future.FutureAPI = &azFuture 5382 future.Result = future.result 5383 return nil 5384} 5385 5386// result is the default implementation for PrivateLinkScopedResourcesCreateOrUpdateFuture.Result. 5387func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) result(client PrivateLinkScopedResourcesClient) (sr ScopedResource, err error) { 5388 var done bool 5389 done, err = future.DoneWithContext(context.Background(), client) 5390 if err != nil { 5391 err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 5392 return 5393 } 5394 if !done { 5395 sr.Response.Response = future.Response() 5396 err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesCreateOrUpdateFuture") 5397 return 5398 } 5399 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5400 if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { 5401 sr, err = client.CreateOrUpdateResponder(sr.Response.Response) 5402 if err != nil { 5403 err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") 5404 } 5405 } 5406 return 5407} 5408 5409// PrivateLinkScopedResourcesDeleteFuture an abstraction for monitoring and retrieving the results of a 5410// long-running operation. 5411type PrivateLinkScopedResourcesDeleteFuture struct { 5412 azure.FutureAPI 5413 // Result returns the result of the asynchronous operation. 5414 // If the operation has not completed it will return an error. 5415 Result func(PrivateLinkScopedResourcesClient) (autorest.Response, error) 5416} 5417 5418// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5419func (future *PrivateLinkScopedResourcesDeleteFuture) UnmarshalJSON(body []byte) error { 5420 var azFuture azure.Future 5421 if err := json.Unmarshal(body, &azFuture); err != nil { 5422 return err 5423 } 5424 future.FutureAPI = &azFuture 5425 future.Result = future.result 5426 return nil 5427} 5428 5429// result is the default implementation for PrivateLinkScopedResourcesDeleteFuture.Result. 5430func (future *PrivateLinkScopedResourcesDeleteFuture) result(client PrivateLinkScopedResourcesClient) (ar autorest.Response, err error) { 5431 var done bool 5432 done, err = future.DoneWithContext(context.Background(), client) 5433 if err != nil { 5434 err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesDeleteFuture", "Result", future.Response(), "Polling failure") 5435 return 5436 } 5437 if !done { 5438 ar.Response = future.Response() 5439 err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesDeleteFuture") 5440 return 5441 } 5442 ar.Response = future.Response() 5443 return 5444} 5445 5446// PrivateLinkScopesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 5447// operation. 5448type PrivateLinkScopesDeleteFuture struct { 5449 azure.FutureAPI 5450 // Result returns the result of the asynchronous operation. 5451 // If the operation has not completed it will return an error. 5452 Result func(PrivateLinkScopesClient) (autorest.Response, error) 5453} 5454 5455// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5456func (future *PrivateLinkScopesDeleteFuture) UnmarshalJSON(body []byte) error { 5457 var azFuture azure.Future 5458 if err := json.Unmarshal(body, &azFuture); err != nil { 5459 return err 5460 } 5461 future.FutureAPI = &azFuture 5462 future.Result = future.result 5463 return nil 5464} 5465 5466// result is the default implementation for PrivateLinkScopesDeleteFuture.Result. 5467func (future *PrivateLinkScopesDeleteFuture) result(client PrivateLinkScopesClient) (ar autorest.Response, err error) { 5468 var done bool 5469 done, err = future.DoneWithContext(context.Background(), client) 5470 if err != nil { 5471 err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesDeleteFuture", "Result", future.Response(), "Polling failure") 5472 return 5473 } 5474 if !done { 5475 ar.Response = future.Response() 5476 err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopesDeleteFuture") 5477 return 5478 } 5479 ar.Response = future.Response() 5480 return 5481} 5482 5483// PrivateLinkScopesResource an azure resource object 5484type PrivateLinkScopesResource struct { 5485 // ID - READ-ONLY; Azure resource Id 5486 ID *string `json:"id,omitempty"` 5487 // Name - READ-ONLY; Azure resource name 5488 Name *string `json:"name,omitempty"` 5489 // Type - READ-ONLY; Azure resource type 5490 Type *string `json:"type,omitempty"` 5491 // Location - Resource location 5492 Location *string `json:"location,omitempty"` 5493 // Tags - Resource tags 5494 Tags map[string]*string `json:"tags"` 5495} 5496 5497// MarshalJSON is the custom marshaler for PrivateLinkScopesResource. 5498func (plsr PrivateLinkScopesResource) MarshalJSON() ([]byte, error) { 5499 objectMap := make(map[string]interface{}) 5500 if plsr.Location != nil { 5501 objectMap["location"] = plsr.Location 5502 } 5503 if plsr.Tags != nil { 5504 objectMap["tags"] = plsr.Tags 5505 } 5506 return json.Marshal(objectMap) 5507} 5508 5509// PrivateLinkServiceConnectionStateProperty state of the private endpoint connection. 5510type PrivateLinkServiceConnectionStateProperty struct { 5511 // Status - The private link service connection status. 5512 Status *string `json:"status,omitempty"` 5513 // Description - The private link service connection description. 5514 Description *string `json:"description,omitempty"` 5515 // ActionsRequired - READ-ONLY; The actions required for private link service connection. 5516 ActionsRequired *string `json:"actionsRequired,omitempty"` 5517} 5518 5519// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. 5520func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { 5521 objectMap := make(map[string]interface{}) 5522 if plscsp.Status != nil { 5523 objectMap["status"] = plscsp.Status 5524 } 5525 if plscsp.Description != nil { 5526 objectMap["description"] = plscsp.Description 5527 } 5528 return json.Marshal(objectMap) 5529} 5530 5531// ProxyOnlyResource a proxy only azure resource object 5532type ProxyOnlyResource struct { 5533 // ID - READ-ONLY; Azure resource Id 5534 ID *string `json:"id,omitempty"` 5535 // Name - READ-ONLY; Azure resource name 5536 Name *string `json:"name,omitempty"` 5537 // Type - READ-ONLY; Azure resource type 5538 Type *string `json:"type,omitempty"` 5539} 5540 5541// MarshalJSON is the custom marshaler for ProxyOnlyResource. 5542func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) { 5543 objectMap := make(map[string]interface{}) 5544 return json.Marshal(objectMap) 5545} 5546 5547// ProxyResource an azure resource object 5548type ProxyResource struct { 5549 // ID - READ-ONLY; Azure resource Id 5550 ID *string `json:"id,omitempty"` 5551 // Name - READ-ONLY; Azure resource name 5552 Name *string `json:"name,omitempty"` 5553 // Type - READ-ONLY; Azure resource type 5554 Type *string `json:"type,omitempty"` 5555} 5556 5557// MarshalJSON is the custom marshaler for ProxyResource. 5558func (pr ProxyResource) MarshalJSON() ([]byte, error) { 5559 objectMap := make(map[string]interface{}) 5560 return json.Marshal(objectMap) 5561} 5562 5563// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate 5564// element is used. 5565type Recurrence struct { 5566 // 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' 5567 Frequency RecurrenceFrequency `json:"frequency,omitempty"` 5568 // Schedule - the scheduling constraints for when the profile begins. 5569 Schedule *RecurrentSchedule `json:"schedule,omitempty"` 5570} 5571 5572// RecurrentSchedule the scheduling constraints for when the profile begins. 5573type RecurrentSchedule struct { 5574 // 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 5575 TimeZone *string `json:"timeZone,omitempty"` 5576 // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. 5577 Days *[]string `json:"days,omitempty"` 5578 // 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). 5579 Hours *[]int32 `json:"hours,omitempty"` 5580 // Minutes - A collection of minutes at which the profile takes effect at. 5581 Minutes *[]int32 `json:"minutes,omitempty"` 5582} 5583 5584// Resource an azure resource object 5585type Resource struct { 5586 // ID - READ-ONLY; Azure resource Id 5587 ID *string `json:"id,omitempty"` 5588 // Name - READ-ONLY; Azure resource name 5589 Name *string `json:"name,omitempty"` 5590 // Type - READ-ONLY; Azure resource type 5591 Type *string `json:"type,omitempty"` 5592 // Location - Resource location 5593 Location *string `json:"location,omitempty"` 5594 // Tags - Resource tags 5595 Tags map[string]*string `json:"tags"` 5596} 5597 5598// MarshalJSON is the custom marshaler for Resource. 5599func (r Resource) MarshalJSON() ([]byte, error) { 5600 objectMap := make(map[string]interface{}) 5601 if r.Location != nil { 5602 objectMap["location"] = r.Location 5603 } 5604 if r.Tags != nil { 5605 objectMap["tags"] = r.Tags 5606 } 5607 return json.Marshal(objectMap) 5608} 5609 5610// Response the response to a metrics query. 5611type Response struct { 5612 autorest.Response `json:"-"` 5613 // Cost - The integer value representing the cost of the query, for data case. 5614 Cost *float64 `json:"cost,omitempty"` 5615 // 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. 5616 Timespan *string `json:"timespan,omitempty"` 5617 // 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. 5618 Interval *string `json:"interval,omitempty"` 5619 // Namespace - The namespace of the metrics been queried 5620 Namespace *string `json:"namespace,omitempty"` 5621 // Resourceregion - The region of the resource been queried for metrics. 5622 Resourceregion *string `json:"resourceregion,omitempty"` 5623 // Value - the value of the collection. 5624 Value *[]Metric `json:"value,omitempty"` 5625} 5626 5627// ResponseWithError an error response from the API. 5628type ResponseWithError struct { 5629 // Error - Error information. 5630 Error *Error `json:"error,omitempty"` 5631} 5632 5633// RetentionPolicy specifies the retention policy for the log. 5634type RetentionPolicy struct { 5635 // Enabled - a value indicating whether the retention policy is enabled. 5636 Enabled *bool `json:"enabled,omitempty"` 5637 // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. 5638 Days *int32 `json:"days,omitempty"` 5639} 5640 5641// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is 5642// resolved. 5643type BasicRuleAction interface { 5644 AsRuleEmailAction() (*RuleEmailAction, bool) 5645 AsRuleWebhookAction() (*RuleWebhookAction, bool) 5646 AsRuleAction() (*RuleAction, bool) 5647} 5648 5649// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is 5650// resolved. 5651type RuleAction struct { 5652 // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' 5653 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` 5654} 5655 5656func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { 5657 var m map[string]interface{} 5658 err := json.Unmarshal(body, &m) 5659 if err != nil { 5660 return nil, err 5661 } 5662 5663 switch m["odata.type"] { 5664 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): 5665 var rea RuleEmailAction 5666 err := json.Unmarshal(body, &rea) 5667 return rea, err 5668 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): 5669 var rwa RuleWebhookAction 5670 err := json.Unmarshal(body, &rwa) 5671 return rwa, err 5672 default: 5673 var ra RuleAction 5674 err := json.Unmarshal(body, &ra) 5675 return ra, err 5676 } 5677} 5678func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { 5679 var rawMessages []*json.RawMessage 5680 err := json.Unmarshal(body, &rawMessages) 5681 if err != nil { 5682 return nil, err 5683 } 5684 5685 raArray := make([]BasicRuleAction, len(rawMessages)) 5686 5687 for index, rawMessage := range rawMessages { 5688 ra, err := unmarshalBasicRuleAction(*rawMessage) 5689 if err != nil { 5690 return nil, err 5691 } 5692 raArray[index] = ra 5693 } 5694 return raArray, nil 5695} 5696 5697// MarshalJSON is the custom marshaler for RuleAction. 5698func (ra RuleAction) MarshalJSON() ([]byte, error) { 5699 ra.OdataType = OdataTypeRuleAction 5700 objectMap := make(map[string]interface{}) 5701 if ra.OdataType != "" { 5702 objectMap["odata.type"] = ra.OdataType 5703 } 5704 return json.Marshal(objectMap) 5705} 5706 5707// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. 5708func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { 5709 return nil, false 5710} 5711 5712// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. 5713func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { 5714 return nil, false 5715} 5716 5717// AsRuleAction is the BasicRuleAction implementation for RuleAction. 5718func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { 5719 return &ra, true 5720} 5721 5722// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. 5723func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { 5724 return &ra, true 5725} 5726 5727// BasicRuleCondition the condition that results in the alert rule being activated. 5728type BasicRuleCondition interface { 5729 AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) 5730 AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) 5731 AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) 5732 AsRuleCondition() (*RuleCondition, bool) 5733} 5734 5735// RuleCondition the condition that results in the alert rule being activated. 5736type RuleCondition struct { 5737 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 5738 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 5739 // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 5740 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 5741} 5742 5743func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { 5744 var m map[string]interface{} 5745 err := json.Unmarshal(body, &m) 5746 if err != nil { 5747 return nil, err 5748 } 5749 5750 switch m["odata.type"] { 5751 case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): 5752 var trc ThresholdRuleCondition 5753 err := json.Unmarshal(body, &trc) 5754 return trc, err 5755 case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): 5756 var ltrc LocationThresholdRuleCondition 5757 err := json.Unmarshal(body, <rc) 5758 return ltrc, err 5759 case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): 5760 var merc ManagementEventRuleCondition 5761 err := json.Unmarshal(body, &merc) 5762 return merc, err 5763 default: 5764 var rc RuleCondition 5765 err := json.Unmarshal(body, &rc) 5766 return rc, err 5767 } 5768} 5769func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { 5770 var rawMessages []*json.RawMessage 5771 err := json.Unmarshal(body, &rawMessages) 5772 if err != nil { 5773 return nil, err 5774 } 5775 5776 rcArray := make([]BasicRuleCondition, len(rawMessages)) 5777 5778 for index, rawMessage := range rawMessages { 5779 rc, err := unmarshalBasicRuleCondition(*rawMessage) 5780 if err != nil { 5781 return nil, err 5782 } 5783 rcArray[index] = rc 5784 } 5785 return rcArray, nil 5786} 5787 5788// MarshalJSON is the custom marshaler for RuleCondition. 5789func (rc RuleCondition) MarshalJSON() ([]byte, error) { 5790 rc.OdataType = OdataTypeRuleCondition 5791 objectMap := make(map[string]interface{}) 5792 objectMap["dataSource"] = rc.DataSource 5793 if rc.OdataType != "" { 5794 objectMap["odata.type"] = rc.OdataType 5795 } 5796 return json.Marshal(objectMap) 5797} 5798 5799// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. 5800func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 5801 return nil, false 5802} 5803 5804// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. 5805func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 5806 return nil, false 5807} 5808 5809// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. 5810func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 5811 return nil, false 5812} 5813 5814// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. 5815func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { 5816 return &rc, true 5817} 5818 5819// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. 5820func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 5821 return &rc, true 5822} 5823 5824// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. 5825func (rc *RuleCondition) UnmarshalJSON(body []byte) error { 5826 var m map[string]*json.RawMessage 5827 err := json.Unmarshal(body, &m) 5828 if err != nil { 5829 return err 5830 } 5831 for k, v := range m { 5832 switch k { 5833 case "dataSource": 5834 if v != nil { 5835 dataSource, err := unmarshalBasicRuleDataSource(*v) 5836 if err != nil { 5837 return err 5838 } 5839 rc.DataSource = dataSource 5840 } 5841 case "odata.type": 5842 if v != nil { 5843 var odataType OdataTypeBasicRuleCondition 5844 err = json.Unmarshal(*v, &odataType) 5845 if err != nil { 5846 return err 5847 } 5848 rc.OdataType = odataType 5849 } 5850 } 5851 } 5852 5853 return nil 5854} 5855 5856// BasicRuleDataSource the resource from which the rule collects its data. 5857type BasicRuleDataSource interface { 5858 AsRuleMetricDataSource() (*RuleMetricDataSource, bool) 5859 AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) 5860 AsRuleDataSource() (*RuleDataSource, bool) 5861} 5862 5863// RuleDataSource the resource from which the rule collects its data. 5864type RuleDataSource struct { 5865 // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 5866 ResourceURI *string `json:"resourceUri,omitempty"` 5867 // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' 5868 OdataType OdataType `json:"odata.type,omitempty"` 5869} 5870 5871func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { 5872 var m map[string]interface{} 5873 err := json.Unmarshal(body, &m) 5874 if err != nil { 5875 return nil, err 5876 } 5877 5878 switch m["odata.type"] { 5879 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): 5880 var rmds RuleMetricDataSource 5881 err := json.Unmarshal(body, &rmds) 5882 return rmds, err 5883 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): 5884 var rmeds RuleManagementEventDataSource 5885 err := json.Unmarshal(body, &rmeds) 5886 return rmeds, err 5887 default: 5888 var rds RuleDataSource 5889 err := json.Unmarshal(body, &rds) 5890 return rds, err 5891 } 5892} 5893func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { 5894 var rawMessages []*json.RawMessage 5895 err := json.Unmarshal(body, &rawMessages) 5896 if err != nil { 5897 return nil, err 5898 } 5899 5900 rdsArray := make([]BasicRuleDataSource, len(rawMessages)) 5901 5902 for index, rawMessage := range rawMessages { 5903 rds, err := unmarshalBasicRuleDataSource(*rawMessage) 5904 if err != nil { 5905 return nil, err 5906 } 5907 rdsArray[index] = rds 5908 } 5909 return rdsArray, nil 5910} 5911 5912// MarshalJSON is the custom marshaler for RuleDataSource. 5913func (rds RuleDataSource) MarshalJSON() ([]byte, error) { 5914 rds.OdataType = OdataTypeRuleDataSource 5915 objectMap := make(map[string]interface{}) 5916 if rds.ResourceURI != nil { 5917 objectMap["resourceUri"] = rds.ResourceURI 5918 } 5919 if rds.OdataType != "" { 5920 objectMap["odata.type"] = rds.OdataType 5921 } 5922 return json.Marshal(objectMap) 5923} 5924 5925// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. 5926func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { 5927 return nil, false 5928} 5929 5930// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. 5931func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { 5932 return nil, false 5933} 5934 5935// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. 5936func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { 5937 return &rds, true 5938} 5939 5940// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. 5941func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { 5942 return &rds, true 5943} 5944 5945// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The 5946// discriminator is always RuleEmailAction in this case. 5947type RuleEmailAction struct { 5948 // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. 5949 SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` 5950 // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. 5951 CustomEmails *[]string `json:"customEmails,omitempty"` 5952 // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' 5953 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` 5954} 5955 5956// MarshalJSON is the custom marshaler for RuleEmailAction. 5957func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { 5958 rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction 5959 objectMap := make(map[string]interface{}) 5960 if rea.SendToServiceOwners != nil { 5961 objectMap["sendToServiceOwners"] = rea.SendToServiceOwners 5962 } 5963 if rea.CustomEmails != nil { 5964 objectMap["customEmails"] = rea.CustomEmails 5965 } 5966 if rea.OdataType != "" { 5967 objectMap["odata.type"] = rea.OdataType 5968 } 5969 return json.Marshal(objectMap) 5970} 5971 5972// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. 5973func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { 5974 return &rea, true 5975} 5976 5977// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. 5978func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { 5979 return nil, false 5980} 5981 5982// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. 5983func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { 5984 return nil, false 5985} 5986 5987// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. 5988func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { 5989 return &rea, true 5990} 5991 5992// RuleManagementEventClaimsDataSource the claims for a rule management event data source. 5993type RuleManagementEventClaimsDataSource struct { 5994 // EmailAddress - the email address. 5995 EmailAddress *string `json:"emailAddress,omitempty"` 5996} 5997 5998// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always 5999// RuleManagementEventDataSource in this case. 6000type RuleManagementEventDataSource struct { 6001 // EventName - the event name. 6002 EventName *string `json:"eventName,omitempty"` 6003 // EventSource - the event source. 6004 EventSource *string `json:"eventSource,omitempty"` 6005 // Level - the level. 6006 Level *string `json:"level,omitempty"` 6007 // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. 6008 OperationName *string `json:"operationName,omitempty"` 6009 // ResourceGroupName - the resource group name. 6010 ResourceGroupName *string `json:"resourceGroupName,omitempty"` 6011 // ResourceProviderName - the resource provider name. 6012 ResourceProviderName *string `json:"resourceProviderName,omitempty"` 6013 // Status - The status of the operation that should be checked for. If no status is provided, any status will match. 6014 Status *string `json:"status,omitempty"` 6015 // SubStatus - the substatus. 6016 SubStatus *string `json:"subStatus,omitempty"` 6017 // Claims - the claims. 6018 Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` 6019 // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 6020 ResourceURI *string `json:"resourceUri,omitempty"` 6021 // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' 6022 OdataType OdataType `json:"odata.type,omitempty"` 6023} 6024 6025// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. 6026func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { 6027 rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource 6028 objectMap := make(map[string]interface{}) 6029 if rmeds.EventName != nil { 6030 objectMap["eventName"] = rmeds.EventName 6031 } 6032 if rmeds.EventSource != nil { 6033 objectMap["eventSource"] = rmeds.EventSource 6034 } 6035 if rmeds.Level != nil { 6036 objectMap["level"] = rmeds.Level 6037 } 6038 if rmeds.OperationName != nil { 6039 objectMap["operationName"] = rmeds.OperationName 6040 } 6041 if rmeds.ResourceGroupName != nil { 6042 objectMap["resourceGroupName"] = rmeds.ResourceGroupName 6043 } 6044 if rmeds.ResourceProviderName != nil { 6045 objectMap["resourceProviderName"] = rmeds.ResourceProviderName 6046 } 6047 if rmeds.Status != nil { 6048 objectMap["status"] = rmeds.Status 6049 } 6050 if rmeds.SubStatus != nil { 6051 objectMap["subStatus"] = rmeds.SubStatus 6052 } 6053 if rmeds.Claims != nil { 6054 objectMap["claims"] = rmeds.Claims 6055 } 6056 if rmeds.ResourceURI != nil { 6057 objectMap["resourceUri"] = rmeds.ResourceURI 6058 } 6059 if rmeds.OdataType != "" { 6060 objectMap["odata.type"] = rmeds.OdataType 6061 } 6062 return json.Marshal(objectMap) 6063} 6064 6065// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 6066func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { 6067 return nil, false 6068} 6069 6070// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 6071func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { 6072 return &rmeds, true 6073} 6074 6075// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 6076func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { 6077 return nil, false 6078} 6079 6080// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 6081func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { 6082 return &rmeds, true 6083} 6084 6085// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource 6086// in this case. 6087type RuleMetricDataSource struct { 6088 // MetricName - the name of the metric that defines what the rule monitors. 6089 MetricName *string `json:"metricName,omitempty"` 6090 // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 6091 ResourceURI *string `json:"resourceUri,omitempty"` 6092 // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' 6093 OdataType OdataType `json:"odata.type,omitempty"` 6094} 6095 6096// MarshalJSON is the custom marshaler for RuleMetricDataSource. 6097func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { 6098 rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource 6099 objectMap := make(map[string]interface{}) 6100 if rmds.MetricName != nil { 6101 objectMap["metricName"] = rmds.MetricName 6102 } 6103 if rmds.ResourceURI != nil { 6104 objectMap["resourceUri"] = rmds.ResourceURI 6105 } 6106 if rmds.OdataType != "" { 6107 objectMap["odata.type"] = rmds.OdataType 6108 } 6109 return json.Marshal(objectMap) 6110} 6111 6112// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 6113func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { 6114 return &rmds, true 6115} 6116 6117// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 6118func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { 6119 return nil, false 6120} 6121 6122// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 6123func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { 6124 return nil, false 6125} 6126 6127// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 6128func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { 6129 return &rmds, true 6130} 6131 6132// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The 6133// discriminator is always RuleWebhookAction in this case. 6134type RuleWebhookAction struct { 6135 // ServiceURI - the service uri to Post the notification when the alert activates or resolves. 6136 ServiceURI *string `json:"serviceUri,omitempty"` 6137 // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. 6138 Properties map[string]*string `json:"properties"` 6139 // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' 6140 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` 6141} 6142 6143// MarshalJSON is the custom marshaler for RuleWebhookAction. 6144func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { 6145 rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction 6146 objectMap := make(map[string]interface{}) 6147 if rwa.ServiceURI != nil { 6148 objectMap["serviceUri"] = rwa.ServiceURI 6149 } 6150 if rwa.Properties != nil { 6151 objectMap["properties"] = rwa.Properties 6152 } 6153 if rwa.OdataType != "" { 6154 objectMap["odata.type"] = rwa.OdataType 6155 } 6156 return json.Marshal(objectMap) 6157} 6158 6159// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. 6160func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { 6161 return nil, false 6162} 6163 6164// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. 6165func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { 6166 return &rwa, true 6167} 6168 6169// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. 6170func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { 6171 return nil, false 6172} 6173 6174// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. 6175func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { 6176 return &rwa, true 6177} 6178 6179// ScaleAction the parameters for the scaling action. 6180type ScaleAction struct { 6181 // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' 6182 Direction ScaleDirection `json:"direction,omitempty"` 6183 // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' 6184 Type ScaleType `json:"type,omitempty"` 6185 // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. 6186 Value *string `json:"value,omitempty"` 6187 // 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. 6188 Cooldown *string `json:"cooldown,omitempty"` 6189} 6190 6191// ScaleCapacity the number of instances that can be used during this profile. 6192type ScaleCapacity struct { 6193 // Minimum - the minimum number of instances for the resource. 6194 Minimum *string `json:"minimum,omitempty"` 6195 // 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. 6196 Maximum *string `json:"maximum,omitempty"` 6197 // 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. 6198 Default *string `json:"default,omitempty"` 6199} 6200 6201// ScaleRule a rule that provide the triggers and parameters for the scaling action. 6202type ScaleRule struct { 6203 // MetricTrigger - the trigger that results in a scaling action. 6204 MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` 6205 // ScaleAction - the parameters for the scaling action. 6206 ScaleAction *ScaleAction `json:"scaleAction,omitempty"` 6207} 6208 6209// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. 6210type ScaleRuleMetricDimension struct { 6211 // DimensionName - Name of the dimension. 6212 DimensionName *string `json:"DimensionName,omitempty"` 6213 // 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' 6214 Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` 6215 // Values - list of dimension values. For example: ["App1","App2"]. 6216 Values *[]string `json:"Values,omitempty"` 6217} 6218 6219// Schedule defines how often to run the search and the time interval. 6220type Schedule struct { 6221 // FrequencyInMinutes - frequency (in minutes) at which rule condition should be evaluated. 6222 FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"` 6223 // TimeWindowInMinutes - Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). 6224 TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"` 6225} 6226 6227// ScopedResource a private link scoped resource 6228type ScopedResource struct { 6229 autorest.Response `json:"-"` 6230 // ScopedResourceProperties - Resource properties. 6231 *ScopedResourceProperties `json:"properties,omitempty"` 6232 // ID - READ-ONLY; Azure resource Id 6233 ID *string `json:"id,omitempty"` 6234 // Name - READ-ONLY; Azure resource name 6235 Name *string `json:"name,omitempty"` 6236 // Type - READ-ONLY; Azure resource type 6237 Type *string `json:"type,omitempty"` 6238} 6239 6240// MarshalJSON is the custom marshaler for ScopedResource. 6241func (sr ScopedResource) MarshalJSON() ([]byte, error) { 6242 objectMap := make(map[string]interface{}) 6243 if sr.ScopedResourceProperties != nil { 6244 objectMap["properties"] = sr.ScopedResourceProperties 6245 } 6246 return json.Marshal(objectMap) 6247} 6248 6249// UnmarshalJSON is the custom unmarshaler for ScopedResource struct. 6250func (sr *ScopedResource) UnmarshalJSON(body []byte) error { 6251 var m map[string]*json.RawMessage 6252 err := json.Unmarshal(body, &m) 6253 if err != nil { 6254 return err 6255 } 6256 for k, v := range m { 6257 switch k { 6258 case "properties": 6259 if v != nil { 6260 var scopedResourceProperties ScopedResourceProperties 6261 err = json.Unmarshal(*v, &scopedResourceProperties) 6262 if err != nil { 6263 return err 6264 } 6265 sr.ScopedResourceProperties = &scopedResourceProperties 6266 } 6267 case "id": 6268 if v != nil { 6269 var ID string 6270 err = json.Unmarshal(*v, &ID) 6271 if err != nil { 6272 return err 6273 } 6274 sr.ID = &ID 6275 } 6276 case "name": 6277 if v != nil { 6278 var name string 6279 err = json.Unmarshal(*v, &name) 6280 if err != nil { 6281 return err 6282 } 6283 sr.Name = &name 6284 } 6285 case "type": 6286 if v != nil { 6287 var typeVar string 6288 err = json.Unmarshal(*v, &typeVar) 6289 if err != nil { 6290 return err 6291 } 6292 sr.Type = &typeVar 6293 } 6294 } 6295 } 6296 6297 return nil 6298} 6299 6300// ScopedResourceListResult a list of scoped resources in a private link scope. 6301type ScopedResourceListResult struct { 6302 autorest.Response `json:"-"` 6303 // Value - READ-ONLY; Array of results. 6304 Value *[]ScopedResource `json:"value,omitempty"` 6305 // NextLink - READ-ONLY; Link to retrieve next page of results. 6306 NextLink *string `json:"nextLink,omitempty"` 6307} 6308 6309// MarshalJSON is the custom marshaler for ScopedResourceListResult. 6310func (srlr ScopedResourceListResult) MarshalJSON() ([]byte, error) { 6311 objectMap := make(map[string]interface{}) 6312 return json.Marshal(objectMap) 6313} 6314 6315// ScopedResourceListResultIterator provides access to a complete listing of ScopedResource values. 6316type ScopedResourceListResultIterator struct { 6317 i int 6318 page ScopedResourceListResultPage 6319} 6320 6321// NextWithContext advances to the next value. If there was an error making 6322// the request the iterator does not advance and the error is returned. 6323func (iter *ScopedResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { 6324 if tracing.IsEnabled() { 6325 ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultIterator.NextWithContext") 6326 defer func() { 6327 sc := -1 6328 if iter.Response().Response.Response != nil { 6329 sc = iter.Response().Response.Response.StatusCode 6330 } 6331 tracing.EndSpan(ctx, sc, err) 6332 }() 6333 } 6334 iter.i++ 6335 if iter.i < len(iter.page.Values()) { 6336 return nil 6337 } 6338 err = iter.page.NextWithContext(ctx) 6339 if err != nil { 6340 iter.i-- 6341 return err 6342 } 6343 iter.i = 0 6344 return nil 6345} 6346 6347// Next advances to the next value. If there was an error making 6348// the request the iterator does not advance and the error is returned. 6349// Deprecated: Use NextWithContext() instead. 6350func (iter *ScopedResourceListResultIterator) Next() error { 6351 return iter.NextWithContext(context.Background()) 6352} 6353 6354// NotDone returns true if the enumeration should be started or is not yet complete. 6355func (iter ScopedResourceListResultIterator) NotDone() bool { 6356 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6357} 6358 6359// Response returns the raw server response from the last page request. 6360func (iter ScopedResourceListResultIterator) Response() ScopedResourceListResult { 6361 return iter.page.Response() 6362} 6363 6364// Value returns the current value or a zero-initialized value if the 6365// iterator has advanced beyond the end of the collection. 6366func (iter ScopedResourceListResultIterator) Value() ScopedResource { 6367 if !iter.page.NotDone() { 6368 return ScopedResource{} 6369 } 6370 return iter.page.Values()[iter.i] 6371} 6372 6373// Creates a new instance of the ScopedResourceListResultIterator type. 6374func NewScopedResourceListResultIterator(page ScopedResourceListResultPage) ScopedResourceListResultIterator { 6375 return ScopedResourceListResultIterator{page: page} 6376} 6377 6378// IsEmpty returns true if the ListResult contains no values. 6379func (srlr ScopedResourceListResult) IsEmpty() bool { 6380 return srlr.Value == nil || len(*srlr.Value) == 0 6381} 6382 6383// hasNextLink returns true if the NextLink is not empty. 6384func (srlr ScopedResourceListResult) hasNextLink() bool { 6385 return srlr.NextLink != nil && len(*srlr.NextLink) != 0 6386} 6387 6388// scopedResourceListResultPreparer prepares a request to retrieve the next set of results. 6389// It returns nil if no more results exist. 6390func (srlr ScopedResourceListResult) scopedResourceListResultPreparer(ctx context.Context) (*http.Request, error) { 6391 if !srlr.hasNextLink() { 6392 return nil, nil 6393 } 6394 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6395 autorest.AsJSON(), 6396 autorest.AsGet(), 6397 autorest.WithBaseURL(to.String(srlr.NextLink))) 6398} 6399 6400// ScopedResourceListResultPage contains a page of ScopedResource values. 6401type ScopedResourceListResultPage struct { 6402 fn func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error) 6403 srlr ScopedResourceListResult 6404} 6405 6406// NextWithContext advances to the next page of values. If there was an error making 6407// the request the page does not advance and the error is returned. 6408func (page *ScopedResourceListResultPage) NextWithContext(ctx context.Context) (err error) { 6409 if tracing.IsEnabled() { 6410 ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultPage.NextWithContext") 6411 defer func() { 6412 sc := -1 6413 if page.Response().Response.Response != nil { 6414 sc = page.Response().Response.Response.StatusCode 6415 } 6416 tracing.EndSpan(ctx, sc, err) 6417 }() 6418 } 6419 for { 6420 next, err := page.fn(ctx, page.srlr) 6421 if err != nil { 6422 return err 6423 } 6424 page.srlr = next 6425 if !next.hasNextLink() || !next.IsEmpty() { 6426 break 6427 } 6428 } 6429 return nil 6430} 6431 6432// Next advances to the next page of values. If there was an error making 6433// the request the page does not advance and the error is returned. 6434// Deprecated: Use NextWithContext() instead. 6435func (page *ScopedResourceListResultPage) Next() error { 6436 return page.NextWithContext(context.Background()) 6437} 6438 6439// NotDone returns true if the page enumeration should be started or is not yet complete. 6440func (page ScopedResourceListResultPage) NotDone() bool { 6441 return !page.srlr.IsEmpty() 6442} 6443 6444// Response returns the raw server response from the last page request. 6445func (page ScopedResourceListResultPage) Response() ScopedResourceListResult { 6446 return page.srlr 6447} 6448 6449// Values returns the slice of values for the current page or nil if there are no values. 6450func (page ScopedResourceListResultPage) Values() []ScopedResource { 6451 if page.srlr.IsEmpty() { 6452 return nil 6453 } 6454 return *page.srlr.Value 6455} 6456 6457// Creates a new instance of the ScopedResourceListResultPage type. 6458func NewScopedResourceListResultPage(cur ScopedResourceListResult, getNextPage func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error)) ScopedResourceListResultPage { 6459 return ScopedResourceListResultPage{ 6460 fn: getNextPage, 6461 srlr: cur, 6462 } 6463} 6464 6465// ScopedResourceProperties properties of a private link scoped resource. 6466type ScopedResourceProperties struct { 6467 // LinkedResourceID - The resource id of the scoped Azure monitor resource. 6468 LinkedResourceID *string `json:"linkedResourceId,omitempty"` 6469 // ProvisioningState - READ-ONLY; State of the private endpoint connection. 6470 ProvisioningState *string `json:"provisioningState,omitempty"` 6471} 6472 6473// MarshalJSON is the custom marshaler for ScopedResourceProperties. 6474func (srp ScopedResourceProperties) MarshalJSON() ([]byte, error) { 6475 objectMap := make(map[string]interface{}) 6476 if srp.LinkedResourceID != nil { 6477 objectMap["linkedResourceId"] = srp.LinkedResourceID 6478 } 6479 return json.Marshal(objectMap) 6480} 6481 6482// SenderAuthorization the authorization used by the user who has performed the operation that led to this 6483// event. This captures the RBAC properties of the event. These usually include the 'action', 'role' and 6484// the 'scope' 6485type SenderAuthorization struct { 6486 // Action - the permissible actions. For instance: microsoft.support/supporttickets/write 6487 Action *string `json:"action,omitempty"` 6488 // Role - the role of the user. For instance: Subscription Admin 6489 Role *string `json:"role,omitempty"` 6490 // Scope - the scope. 6491 Scope *string `json:"scope,omitempty"` 6492} 6493 6494// SingleBaseline the baseline values for a single sensitivity value. 6495type SingleBaseline struct { 6496 // Sensitivity - the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' 6497 Sensitivity BaselineSensitivity `json:"sensitivity,omitempty"` 6498 // LowThresholds - The low thresholds of the baseline. 6499 LowThresholds *[]float64 `json:"lowThresholds,omitempty"` 6500 // HighThresholds - The high thresholds of the baseline. 6501 HighThresholds *[]float64 `json:"highThresholds,omitempty"` 6502} 6503 6504// SingleMetricBaseline the baseline results of a single metric. 6505type SingleMetricBaseline struct { 6506 // ID - The metric baseline Id. 6507 ID *string `json:"id,omitempty"` 6508 // Type - The resource type of the metric baseline resource. 6509 Type *string `json:"type,omitempty"` 6510 // Name - The name of the metric for which the baselines were retrieved. 6511 Name *string `json:"name,omitempty"` 6512 // MetricBaselinesProperties - The metric baseline properties of the metric. 6513 *MetricBaselinesProperties `json:"properties,omitempty"` 6514} 6515 6516// MarshalJSON is the custom marshaler for SingleMetricBaseline. 6517func (smb SingleMetricBaseline) MarshalJSON() ([]byte, error) { 6518 objectMap := make(map[string]interface{}) 6519 if smb.ID != nil { 6520 objectMap["id"] = smb.ID 6521 } 6522 if smb.Type != nil { 6523 objectMap["type"] = smb.Type 6524 } 6525 if smb.Name != nil { 6526 objectMap["name"] = smb.Name 6527 } 6528 if smb.MetricBaselinesProperties != nil { 6529 objectMap["properties"] = smb.MetricBaselinesProperties 6530 } 6531 return json.Marshal(objectMap) 6532} 6533 6534// UnmarshalJSON is the custom unmarshaler for SingleMetricBaseline struct. 6535func (smb *SingleMetricBaseline) UnmarshalJSON(body []byte) error { 6536 var m map[string]*json.RawMessage 6537 err := json.Unmarshal(body, &m) 6538 if err != nil { 6539 return err 6540 } 6541 for k, v := range m { 6542 switch k { 6543 case "id": 6544 if v != nil { 6545 var ID string 6546 err = json.Unmarshal(*v, &ID) 6547 if err != nil { 6548 return err 6549 } 6550 smb.ID = &ID 6551 } 6552 case "type": 6553 if v != nil { 6554 var typeVar string 6555 err = json.Unmarshal(*v, &typeVar) 6556 if err != nil { 6557 return err 6558 } 6559 smb.Type = &typeVar 6560 } 6561 case "name": 6562 if v != nil { 6563 var name string 6564 err = json.Unmarshal(*v, &name) 6565 if err != nil { 6566 return err 6567 } 6568 smb.Name = &name 6569 } 6570 case "properties": 6571 if v != nil { 6572 var metricBaselinesProperties MetricBaselinesProperties 6573 err = json.Unmarshal(*v, &metricBaselinesProperties) 6574 if err != nil { 6575 return err 6576 } 6577 smb.MetricBaselinesProperties = &metricBaselinesProperties 6578 } 6579 } 6580 } 6581 6582 return nil 6583} 6584 6585// SmsReceiver an SMS receiver. 6586type SmsReceiver struct { 6587 // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. 6588 Name *string `json:"name,omitempty"` 6589 // CountryCode - The country code of the SMS receiver. 6590 CountryCode *string `json:"countryCode,omitempty"` 6591 // PhoneNumber - The phone number of the SMS receiver. 6592 PhoneNumber *string `json:"phoneNumber,omitempty"` 6593 // Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' 6594 Status ReceiverStatus `json:"status,omitempty"` 6595} 6596 6597// MarshalJSON is the custom marshaler for SmsReceiver. 6598func (sr SmsReceiver) MarshalJSON() ([]byte, error) { 6599 objectMap := make(map[string]interface{}) 6600 if sr.Name != nil { 6601 objectMap["name"] = sr.Name 6602 } 6603 if sr.CountryCode != nil { 6604 objectMap["countryCode"] = sr.CountryCode 6605 } 6606 if sr.PhoneNumber != nil { 6607 objectMap["phoneNumber"] = sr.PhoneNumber 6608 } 6609 return json.Marshal(objectMap) 6610} 6611 6612// Source specifies the log search query. 6613type Source struct { 6614 // Query - Log search query. Required for action type - AlertingAction 6615 Query *string `json:"query,omitempty"` 6616 // AuthorizedResources - List of Resource referred into query 6617 AuthorizedResources *[]string `json:"authorizedResources,omitempty"` 6618 // DataSourceID - The resource uri over which log search query is to be run. 6619 DataSourceID *string `json:"dataSourceId,omitempty"` 6620 // QueryType - Set value to 'ResultCount'. Possible values include: 'ResultCount' 6621 QueryType QueryType `json:"queryType,omitempty"` 6622} 6623 6624// SubscriptionDiagnosticSettings the subscription diagnostic settings. 6625type SubscriptionDiagnosticSettings struct { 6626 // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. 6627 StorageAccountID *string `json:"storageAccountId,omitempty"` 6628 // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. 6629 ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` 6630 // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. 6631 EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` 6632 // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. 6633 EventHubName *string `json:"eventHubName,omitempty"` 6634 // Logs - The list of logs settings. 6635 Logs *[]SubscriptionLogSettings `json:"logs,omitempty"` 6636 // 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 6637 WorkspaceID *string `json:"workspaceId,omitempty"` 6638} 6639 6640// SubscriptionDiagnosticSettingsResource the subscription diagnostic setting resource. 6641type SubscriptionDiagnosticSettingsResource struct { 6642 autorest.Response `json:"-"` 6643 // SubscriptionDiagnosticSettings - Properties of a Subscription Diagnostic Settings Resource. 6644 *SubscriptionDiagnosticSettings `json:"properties,omitempty"` 6645 // ID - READ-ONLY; Azure resource Id 6646 ID *string `json:"id,omitempty"` 6647 // Name - READ-ONLY; Azure resource name 6648 Name *string `json:"name,omitempty"` 6649 // Type - READ-ONLY; Azure resource type 6650 Type *string `json:"type,omitempty"` 6651 // Location - Location of the resource 6652 Location *string `json:"location,omitempty"` 6653} 6654 6655// MarshalJSON is the custom marshaler for SubscriptionDiagnosticSettingsResource. 6656func (sdsr SubscriptionDiagnosticSettingsResource) MarshalJSON() ([]byte, error) { 6657 objectMap := make(map[string]interface{}) 6658 if sdsr.SubscriptionDiagnosticSettings != nil { 6659 objectMap["properties"] = sdsr.SubscriptionDiagnosticSettings 6660 } 6661 if sdsr.Location != nil { 6662 objectMap["location"] = sdsr.Location 6663 } 6664 return json.Marshal(objectMap) 6665} 6666 6667// UnmarshalJSON is the custom unmarshaler for SubscriptionDiagnosticSettingsResource struct. 6668func (sdsr *SubscriptionDiagnosticSettingsResource) UnmarshalJSON(body []byte) error { 6669 var m map[string]*json.RawMessage 6670 err := json.Unmarshal(body, &m) 6671 if err != nil { 6672 return err 6673 } 6674 for k, v := range m { 6675 switch k { 6676 case "properties": 6677 if v != nil { 6678 var subscriptionDiagnosticSettings SubscriptionDiagnosticSettings 6679 err = json.Unmarshal(*v, &subscriptionDiagnosticSettings) 6680 if err != nil { 6681 return err 6682 } 6683 sdsr.SubscriptionDiagnosticSettings = &subscriptionDiagnosticSettings 6684 } 6685 case "id": 6686 if v != nil { 6687 var ID string 6688 err = json.Unmarshal(*v, &ID) 6689 if err != nil { 6690 return err 6691 } 6692 sdsr.ID = &ID 6693 } 6694 case "name": 6695 if v != nil { 6696 var name string 6697 err = json.Unmarshal(*v, &name) 6698 if err != nil { 6699 return err 6700 } 6701 sdsr.Name = &name 6702 } 6703 case "type": 6704 if v != nil { 6705 var typeVar string 6706 err = json.Unmarshal(*v, &typeVar) 6707 if err != nil { 6708 return err 6709 } 6710 sdsr.Type = &typeVar 6711 } 6712 case "location": 6713 if v != nil { 6714 var location string 6715 err = json.Unmarshal(*v, &location) 6716 if err != nil { 6717 return err 6718 } 6719 sdsr.Location = &location 6720 } 6721 } 6722 } 6723 6724 return nil 6725} 6726 6727// SubscriptionDiagnosticSettingsResourceCollection represents a collection of subscription diagnostic 6728// settings resources. 6729type SubscriptionDiagnosticSettingsResourceCollection struct { 6730 autorest.Response `json:"-"` 6731 // Value - The collection of subscription diagnostic settings resources. 6732 Value *[]SubscriptionDiagnosticSettingsResource `json:"value,omitempty"` 6733} 6734 6735// SubscriptionLogSettings part of Subscription diagnostic setting. Specifies the settings for a particular 6736// log. 6737type SubscriptionLogSettings struct { 6738 // Category - Name of a Subscription Diagnostic Log category for a resource type this setting is applied to. 6739 Category *string `json:"category,omitempty"` 6740 // Enabled - a value indicating whether this log is enabled. 6741 Enabled *bool `json:"enabled,omitempty"` 6742} 6743 6744// SubscriptionProxyOnlyResource a proxy only azure resource object 6745type SubscriptionProxyOnlyResource struct { 6746 // ID - READ-ONLY; Azure resource Id 6747 ID *string `json:"id,omitempty"` 6748 // Name - READ-ONLY; Azure resource name 6749 Name *string `json:"name,omitempty"` 6750 // Type - READ-ONLY; Azure resource type 6751 Type *string `json:"type,omitempty"` 6752 // Location - Location of the resource 6753 Location *string `json:"location,omitempty"` 6754} 6755 6756// MarshalJSON is the custom marshaler for SubscriptionProxyOnlyResource. 6757func (spor SubscriptionProxyOnlyResource) MarshalJSON() ([]byte, error) { 6758 objectMap := make(map[string]interface{}) 6759 if spor.Location != nil { 6760 objectMap["location"] = spor.Location 6761 } 6762 return json.Marshal(objectMap) 6763} 6764 6765// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on a 6766// PrivateLinkScope instance. 6767type TagsResource struct { 6768 // Tags - Resource tags 6769 Tags map[string]*string `json:"tags"` 6770} 6771 6772// MarshalJSON is the custom marshaler for TagsResource. 6773func (tr TagsResource) MarshalJSON() ([]byte, error) { 6774 objectMap := make(map[string]interface{}) 6775 if tr.Tags != nil { 6776 objectMap["tags"] = tr.Tags 6777 } 6778 return json.Marshal(objectMap) 6779} 6780 6781// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. 6782type ThresholdRuleCondition struct { 6783 // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' 6784 Operator ConditionOperator `json:"operator,omitempty"` 6785 // Threshold - the threshold value that activates the alert. 6786 Threshold *float64 `json:"threshold,omitempty"` 6787 // 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. 6788 WindowSize *string `json:"windowSize,omitempty"` 6789 // 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' 6790 TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` 6791 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 6792 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 6793 // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 6794 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 6795} 6796 6797// MarshalJSON is the custom marshaler for ThresholdRuleCondition. 6798func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { 6799 trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition 6800 objectMap := make(map[string]interface{}) 6801 if trc.Operator != "" { 6802 objectMap["operator"] = trc.Operator 6803 } 6804 if trc.Threshold != nil { 6805 objectMap["threshold"] = trc.Threshold 6806 } 6807 if trc.WindowSize != nil { 6808 objectMap["windowSize"] = trc.WindowSize 6809 } 6810 if trc.TimeAggregation != "" { 6811 objectMap["timeAggregation"] = trc.TimeAggregation 6812 } 6813 objectMap["dataSource"] = trc.DataSource 6814 if trc.OdataType != "" { 6815 objectMap["odata.type"] = trc.OdataType 6816 } 6817 return json.Marshal(objectMap) 6818} 6819 6820// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 6821func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 6822 return &trc, true 6823} 6824 6825// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 6826func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 6827 return nil, false 6828} 6829 6830// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 6831func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 6832 return nil, false 6833} 6834 6835// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 6836func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { 6837 return nil, false 6838} 6839 6840// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 6841func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 6842 return &trc, true 6843} 6844 6845// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. 6846func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error { 6847 var m map[string]*json.RawMessage 6848 err := json.Unmarshal(body, &m) 6849 if err != nil { 6850 return err 6851 } 6852 for k, v := range m { 6853 switch k { 6854 case "operator": 6855 if v != nil { 6856 var operator ConditionOperator 6857 err = json.Unmarshal(*v, &operator) 6858 if err != nil { 6859 return err 6860 } 6861 trc.Operator = operator 6862 } 6863 case "threshold": 6864 if v != nil { 6865 var threshold float64 6866 err = json.Unmarshal(*v, &threshold) 6867 if err != nil { 6868 return err 6869 } 6870 trc.Threshold = &threshold 6871 } 6872 case "windowSize": 6873 if v != nil { 6874 var windowSize string 6875 err = json.Unmarshal(*v, &windowSize) 6876 if err != nil { 6877 return err 6878 } 6879 trc.WindowSize = &windowSize 6880 } 6881 case "timeAggregation": 6882 if v != nil { 6883 var timeAggregation TimeAggregationOperator 6884 err = json.Unmarshal(*v, &timeAggregation) 6885 if err != nil { 6886 return err 6887 } 6888 trc.TimeAggregation = timeAggregation 6889 } 6890 case "dataSource": 6891 if v != nil { 6892 dataSource, err := unmarshalBasicRuleDataSource(*v) 6893 if err != nil { 6894 return err 6895 } 6896 trc.DataSource = dataSource 6897 } 6898 case "odata.type": 6899 if v != nil { 6900 var odataType OdataTypeBasicRuleCondition 6901 err = json.Unmarshal(*v, &odataType) 6902 if err != nil { 6903 return err 6904 } 6905 trc.OdataType = odataType 6906 } 6907 } 6908 } 6909 6910 return nil 6911} 6912 6913// TimeSeriesBaseline the baseline values for a single time series. 6914type TimeSeriesBaseline struct { 6915 // Aggregation - The aggregation type of the metric. 6916 Aggregation *string `json:"aggregation,omitempty"` 6917 // Dimensions - The dimensions of this time series. 6918 Dimensions *[]MetricSingleDimension `json:"dimensions,omitempty"` 6919 // Timestamps - The list of timestamps of the baselines. 6920 Timestamps *[]date.Time `json:"timestamps,omitempty"` 6921 // Data - The baseline values for each sensitivity. 6922 Data *[]SingleBaseline `json:"data,omitempty"` 6923 // Metadata - The baseline metadata values. 6924 Metadata *[]BaselineMetadata `json:"metadata,omitempty"` 6925} 6926 6927// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. 6928type TimeSeriesElement struct { 6929 // Metadatavalues - the metadata values returned if $filter was specified in the call. 6930 Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` 6931 // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. 6932 Data *[]MetricValue `json:"data,omitempty"` 6933} 6934 6935// TimeSeriesInformation the time series info needed for calculating the baseline. 6936type TimeSeriesInformation struct { 6937 // Sensitivities - the list of sensitivities for calculating the baseline. 6938 Sensitivities *[]string `json:"sensitivities,omitempty"` 6939 // Values - The metric values to calculate the baseline. 6940 Values *[]float64 `json:"values,omitempty"` 6941 // Timestamps - the array of timestamps of the baselines. 6942 Timestamps *[]date.Time `json:"timestamps,omitempty"` 6943} 6944 6945// TimeWindow a specific date-time for the profile. 6946type TimeWindow struct { 6947 // 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 6948 TimeZone *string `json:"timeZone,omitempty"` 6949 // Start - the start time for the profile in ISO 8601 format. 6950 Start *date.Time `json:"start,omitempty"` 6951 // End - the end time for the profile in ISO 8601 format. 6952 End *date.Time `json:"end,omitempty"` 6953} 6954 6955// TriggerCondition the condition that results in the Log Search rule. 6956type TriggerCondition struct { 6957 // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' 6958 ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` 6959 // Threshold - Result or count threshold based on which rule should be triggered. 6960 Threshold *float64 `json:"threshold,omitempty"` 6961 // MetricTrigger - Trigger condition for metric query rule 6962 MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"` 6963} 6964 6965// VMInsightsOnboardingStatus VM Insights onboarding status for a resource. 6966type VMInsightsOnboardingStatus struct { 6967 autorest.Response `json:"-"` 6968 // VMInsightsOnboardingStatusProperties - Resource properties. 6969 *VMInsightsOnboardingStatusProperties `json:"properties,omitempty"` 6970 // ID - READ-ONLY; Azure resource Id 6971 ID *string `json:"id,omitempty"` 6972 // Name - READ-ONLY; Azure resource name 6973 Name *string `json:"name,omitempty"` 6974 // Type - READ-ONLY; Azure resource type 6975 Type *string `json:"type,omitempty"` 6976} 6977 6978// MarshalJSON is the custom marshaler for VMInsightsOnboardingStatus. 6979func (vios VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { 6980 objectMap := make(map[string]interface{}) 6981 if vios.VMInsightsOnboardingStatusProperties != nil { 6982 objectMap["properties"] = vios.VMInsightsOnboardingStatusProperties 6983 } 6984 return json.Marshal(objectMap) 6985} 6986 6987// UnmarshalJSON is the custom unmarshaler for VMInsightsOnboardingStatus struct. 6988func (vios *VMInsightsOnboardingStatus) UnmarshalJSON(body []byte) error { 6989 var m map[string]*json.RawMessage 6990 err := json.Unmarshal(body, &m) 6991 if err != nil { 6992 return err 6993 } 6994 for k, v := range m { 6995 switch k { 6996 case "properties": 6997 if v != nil { 6998 var VMInsightsOnboardingStatusProperties VMInsightsOnboardingStatusProperties 6999 err = json.Unmarshal(*v, &VMInsightsOnboardingStatusProperties) 7000 if err != nil { 7001 return err 7002 } 7003 vios.VMInsightsOnboardingStatusProperties = &VMInsightsOnboardingStatusProperties 7004 } 7005 case "id": 7006 if v != nil { 7007 var ID string 7008 err = json.Unmarshal(*v, &ID) 7009 if err != nil { 7010 return err 7011 } 7012 vios.ID = &ID 7013 } 7014 case "name": 7015 if v != nil { 7016 var name string 7017 err = json.Unmarshal(*v, &name) 7018 if err != nil { 7019 return err 7020 } 7021 vios.Name = &name 7022 } 7023 case "type": 7024 if v != nil { 7025 var typeVar string 7026 err = json.Unmarshal(*v, &typeVar) 7027 if err != nil { 7028 return err 7029 } 7030 vios.Type = &typeVar 7031 } 7032 } 7033 } 7034 7035 return nil 7036} 7037 7038// VMInsightsOnboardingStatusProperties resource properties. 7039type VMInsightsOnboardingStatusProperties struct { 7040 // ResourceID - Azure Resource Manager identifier of the resource whose onboarding status is being represented. 7041 ResourceID *string `json:"resourceId,omitempty"` 7042 // 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' 7043 OnboardingStatus OnboardingStatus `json:"onboardingStatus,omitempty"` 7044 // 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' 7045 DataStatus DataStatus `json:"dataStatus,omitempty"` 7046 // Data - Containers that currently store VM Insights data for the specified resource. 7047 Data *[]DataContainer `json:"data,omitempty"` 7048} 7049 7050// VoiceReceiver a voice receiver. 7051type VoiceReceiver struct { 7052 // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. 7053 Name *string `json:"name,omitempty"` 7054 // CountryCode - The country code of the voice receiver. 7055 CountryCode *string `json:"countryCode,omitempty"` 7056 // PhoneNumber - The phone number of the voice receiver. 7057 PhoneNumber *string `json:"phoneNumber,omitempty"` 7058} 7059 7060// WebhookNotification webhook notification of an autoscale event. 7061type WebhookNotification struct { 7062 // ServiceURI - the service address to receive the notification. 7063 ServiceURI *string `json:"serviceUri,omitempty"` 7064 // Properties - a property bag of settings. This value can be empty. 7065 Properties map[string]*string `json:"properties"` 7066} 7067 7068// MarshalJSON is the custom marshaler for WebhookNotification. 7069func (wn WebhookNotification) MarshalJSON() ([]byte, error) { 7070 objectMap := make(map[string]interface{}) 7071 if wn.ServiceURI != nil { 7072 objectMap["serviceUri"] = wn.ServiceURI 7073 } 7074 if wn.Properties != nil { 7075 objectMap["properties"] = wn.Properties 7076 } 7077 return json.Marshal(objectMap) 7078} 7079 7080// WebhookReceiver a webhook receiver. 7081type WebhookReceiver struct { 7082 // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. 7083 Name *string `json:"name,omitempty"` 7084 // ServiceURI - The URI where webhooks should be sent. 7085 ServiceURI *string `json:"serviceUri,omitempty"` 7086 // UseCommonAlertSchema - Indicates whether to use common alert schema. 7087 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` 7088 // UseAadAuth - Indicates whether or not use AAD authentication. 7089 UseAadAuth *bool `json:"useAadAuth,omitempty"` 7090 // ObjectID - Indicates the webhook app object Id for aad auth. 7091 ObjectID *string `json:"objectId,omitempty"` 7092 // IdentifierURI - Indicates the identifier uri for aad auth. 7093 IdentifierURI *string `json:"identifierUri,omitempty"` 7094 // TenantID - Indicates the tenant id for aad auth. 7095 TenantID *string `json:"tenantId,omitempty"` 7096} 7097 7098// WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource. 7099type WebtestLocationAvailabilityCriteria struct { 7100 // WebTestID - The Application Insights web test Id. 7101 WebTestID *string `json:"webTestId,omitempty"` 7102 // ComponentID - The Application Insights resource Id. 7103 ComponentID *string `json:"componentId,omitempty"` 7104 // FailedLocationCount - The number of failed locations. 7105 FailedLocationCount *float64 `json:"failedLocationCount,omitempty"` 7106 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 7107 AdditionalProperties map[string]interface{} `json:""` 7108 // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' 7109 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` 7110} 7111 7112// MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria. 7113func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { 7114 wlac.OdataType = OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria 7115 objectMap := make(map[string]interface{}) 7116 if wlac.WebTestID != nil { 7117 objectMap["webTestId"] = wlac.WebTestID 7118 } 7119 if wlac.ComponentID != nil { 7120 objectMap["componentId"] = wlac.ComponentID 7121 } 7122 if wlac.FailedLocationCount != nil { 7123 objectMap["failedLocationCount"] = wlac.FailedLocationCount 7124 } 7125 if wlac.OdataType != "" { 7126 objectMap["odata.type"] = wlac.OdataType 7127 } 7128 for k, v := range wlac.AdditionalProperties { 7129 objectMap[k] = v 7130 } 7131 return json.Marshal(objectMap) 7132} 7133 7134// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. 7135func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { 7136 return nil, false 7137} 7138 7139// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. 7140func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { 7141 return &wlac, true 7142} 7143 7144// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. 7145func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { 7146 return nil, false 7147} 7148 7149// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. 7150func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { 7151 return nil, false 7152} 7153 7154// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. 7155func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { 7156 return &wlac, true 7157} 7158 7159// UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct. 7160func (wlac *WebtestLocationAvailabilityCriteria) UnmarshalJSON(body []byte) error { 7161 var m map[string]*json.RawMessage 7162 err := json.Unmarshal(body, &m) 7163 if err != nil { 7164 return err 7165 } 7166 for k, v := range m { 7167 switch k { 7168 case "webTestId": 7169 if v != nil { 7170 var webTestID string 7171 err = json.Unmarshal(*v, &webTestID) 7172 if err != nil { 7173 return err 7174 } 7175 wlac.WebTestID = &webTestID 7176 } 7177 case "componentId": 7178 if v != nil { 7179 var componentID string 7180 err = json.Unmarshal(*v, &componentID) 7181 if err != nil { 7182 return err 7183 } 7184 wlac.ComponentID = &componentID 7185 } 7186 case "failedLocationCount": 7187 if v != nil { 7188 var failedLocationCount float64 7189 err = json.Unmarshal(*v, &failedLocationCount) 7190 if err != nil { 7191 return err 7192 } 7193 wlac.FailedLocationCount = &failedLocationCount 7194 } 7195 default: 7196 if v != nil { 7197 var additionalProperties interface{} 7198 err = json.Unmarshal(*v, &additionalProperties) 7199 if err != nil { 7200 return err 7201 } 7202 if wlac.AdditionalProperties == nil { 7203 wlac.AdditionalProperties = make(map[string]interface{}) 7204 } 7205 wlac.AdditionalProperties[k] = additionalProperties 7206 } 7207 case "odata.type": 7208 if v != nil { 7209 var odataType OdataTypeBasicMetricAlertCriteria 7210 err = json.Unmarshal(*v, &odataType) 7211 if err != nil { 7212 return err 7213 } 7214 wlac.OdataType = odataType 7215 } 7216 } 7217 } 7218 7219 return nil 7220} 7221 7222// WorkspaceInfo information about a Log Analytics Workspace. 7223type WorkspaceInfo struct { 7224 // ID - Azure Resource Manager identifier of the Log Analytics Workspace. 7225 ID *string `json:"id,omitempty"` 7226 // Location - Location of the Log Analytics workspace. 7227 Location *string `json:"location,omitempty"` 7228 // WorkspaceInfoProperties - Resource properties. 7229 *WorkspaceInfoProperties `json:"properties,omitempty"` 7230} 7231 7232// MarshalJSON is the custom marshaler for WorkspaceInfo. 7233func (wi WorkspaceInfo) MarshalJSON() ([]byte, error) { 7234 objectMap := make(map[string]interface{}) 7235 if wi.ID != nil { 7236 objectMap["id"] = wi.ID 7237 } 7238 if wi.Location != nil { 7239 objectMap["location"] = wi.Location 7240 } 7241 if wi.WorkspaceInfoProperties != nil { 7242 objectMap["properties"] = wi.WorkspaceInfoProperties 7243 } 7244 return json.Marshal(objectMap) 7245} 7246 7247// UnmarshalJSON is the custom unmarshaler for WorkspaceInfo struct. 7248func (wi *WorkspaceInfo) UnmarshalJSON(body []byte) error { 7249 var m map[string]*json.RawMessage 7250 err := json.Unmarshal(body, &m) 7251 if err != nil { 7252 return err 7253 } 7254 for k, v := range m { 7255 switch k { 7256 case "id": 7257 if v != nil { 7258 var ID string 7259 err = json.Unmarshal(*v, &ID) 7260 if err != nil { 7261 return err 7262 } 7263 wi.ID = &ID 7264 } 7265 case "location": 7266 if v != nil { 7267 var location string 7268 err = json.Unmarshal(*v, &location) 7269 if err != nil { 7270 return err 7271 } 7272 wi.Location = &location 7273 } 7274 case "properties": 7275 if v != nil { 7276 var workspaceInfoProperties WorkspaceInfoProperties 7277 err = json.Unmarshal(*v, &workspaceInfoProperties) 7278 if err != nil { 7279 return err 7280 } 7281 wi.WorkspaceInfoProperties = &workspaceInfoProperties 7282 } 7283 } 7284 } 7285 7286 return nil 7287} 7288 7289// WorkspaceInfoProperties resource properties. 7290type WorkspaceInfoProperties struct { 7291 // CustomerID - Log Analytics workspace identifier. 7292 CustomerID *string `json:"customerId,omitempty"` 7293} 7294