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/2021-04-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: 'OdataTypeBasicActionOdataTypeAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' 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(OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction): 45 var aa AlertingAction 46 err := json.Unmarshal(body, &aa) 47 return aa, err 48 case string(OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction): 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 = OdataTypeBasicActionOdataTypeAction 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 // Kind - READ-ONLY; Azure resource kind 215 Kind *string `json:"kind,omitempty"` 216 // Identity - READ-ONLY; Azure resource identity 217 Identity *string `json:"identity,omitempty"` 218 // Location - Resource location 219 Location *string `json:"location,omitempty"` 220 // Tags - Resource tags 221 Tags map[string]*string `json:"tags"` 222} 223 224// MarshalJSON is the custom marshaler for ActionGroupResource. 225func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { 226 objectMap := make(map[string]interface{}) 227 if agr.ActionGroup != nil { 228 objectMap["properties"] = agr.ActionGroup 229 } 230 if agr.Location != nil { 231 objectMap["location"] = agr.Location 232 } 233 if agr.Tags != nil { 234 objectMap["tags"] = agr.Tags 235 } 236 return json.Marshal(objectMap) 237} 238 239// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. 240func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { 241 var m map[string]*json.RawMessage 242 err := json.Unmarshal(body, &m) 243 if err != nil { 244 return err 245 } 246 for k, v := range m { 247 switch k { 248 case "properties": 249 if v != nil { 250 var actionGroup ActionGroup 251 err = json.Unmarshal(*v, &actionGroup) 252 if err != nil { 253 return err 254 } 255 agr.ActionGroup = &actionGroup 256 } 257 case "id": 258 if v != nil { 259 var ID string 260 err = json.Unmarshal(*v, &ID) 261 if err != nil { 262 return err 263 } 264 agr.ID = &ID 265 } 266 case "name": 267 if v != nil { 268 var name string 269 err = json.Unmarshal(*v, &name) 270 if err != nil { 271 return err 272 } 273 agr.Name = &name 274 } 275 case "type": 276 if v != nil { 277 var typeVar string 278 err = json.Unmarshal(*v, &typeVar) 279 if err != nil { 280 return err 281 } 282 agr.Type = &typeVar 283 } 284 case "kind": 285 if v != nil { 286 var kind string 287 err = json.Unmarshal(*v, &kind) 288 if err != nil { 289 return err 290 } 291 agr.Kind = &kind 292 } 293 case "identity": 294 if v != nil { 295 var identity string 296 err = json.Unmarshal(*v, &identity) 297 if err != nil { 298 return err 299 } 300 agr.Identity = &identity 301 } 302 case "location": 303 if v != nil { 304 var location string 305 err = json.Unmarshal(*v, &location) 306 if err != nil { 307 return err 308 } 309 agr.Location = &location 310 } 311 case "tags": 312 if v != nil { 313 var tags map[string]*string 314 err = json.Unmarshal(*v, &tags) 315 if err != nil { 316 return err 317 } 318 agr.Tags = tags 319 } 320 } 321 } 322 323 return nil 324} 325 326// ActivityLogAlert an Azure activity log alert. 327type ActivityLogAlert struct { 328 // 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. 329 Scopes *[]string `json:"scopes,omitempty"` 330 // 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. 331 Enabled *bool `json:"enabled,omitempty"` 332 // Condition - The condition that will cause this alert to activate. 333 Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` 334 // Actions - The actions that will activate when the condition is met. 335 Actions *ActivityLogAlertActionList `json:"actions,omitempty"` 336 // Description - A description of this activity log alert. 337 Description *string `json:"description,omitempty"` 338} 339 340// ActivityLogAlertActionGroup a pointer to an Azure Action Group. 341type ActivityLogAlertActionGroup struct { 342 // ActionGroupID - The resourceId of the action group. This cannot be null or empty. 343 ActionGroupID *string `json:"actionGroupId,omitempty"` 344 // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. 345 WebhookProperties map[string]*string `json:"webhookProperties"` 346} 347 348// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. 349func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { 350 objectMap := make(map[string]interface{}) 351 if alaag.ActionGroupID != nil { 352 objectMap["actionGroupId"] = alaag.ActionGroupID 353 } 354 if alaag.WebhookProperties != nil { 355 objectMap["webhookProperties"] = alaag.WebhookProperties 356 } 357 return json.Marshal(objectMap) 358} 359 360// ActivityLogAlertActionList a list of activity log alert actions. 361type ActivityLogAlertActionList struct { 362 // ActionGroups - The list of activity log alerts. 363 ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` 364} 365 366// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member 367// conditions are met. 368type ActivityLogAlertAllOfCondition struct { 369 // AllOf - The list of activity log alert conditions. 370 AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` 371} 372 373// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log 374// field and value. 375type ActivityLogAlertLeafCondition struct { 376 // 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.'. 377 Field *string `json:"field,omitempty"` 378 // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. 379 Equals *string `json:"equals,omitempty"` 380} 381 382// ActivityLogAlertList a list of activity log alerts. 383type ActivityLogAlertList struct { 384 autorest.Response `json:"-"` 385 // Value - The list of activity log alerts. 386 Value *[]ActivityLogAlertResource `json:"value,omitempty"` 387 // NextLink - Provides the link to retrieve the next set of elements. 388 NextLink *string `json:"nextLink,omitempty"` 389} 390 391// ActivityLogAlertPatch an Azure activity log alert for patch operations. 392type ActivityLogAlertPatch struct { 393 // 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. 394 Enabled *bool `json:"enabled,omitempty"` 395} 396 397// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. 398type ActivityLogAlertPatchBody struct { 399 // Tags - Resource tags 400 Tags map[string]*string `json:"tags"` 401 // ActivityLogAlertPatch - The activity log alert settings for an update operation. 402 *ActivityLogAlertPatch `json:"properties,omitempty"` 403} 404 405// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. 406func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { 407 objectMap := make(map[string]interface{}) 408 if alapb.Tags != nil { 409 objectMap["tags"] = alapb.Tags 410 } 411 if alapb.ActivityLogAlertPatch != nil { 412 objectMap["properties"] = alapb.ActivityLogAlertPatch 413 } 414 return json.Marshal(objectMap) 415} 416 417// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. 418func (alapb *ActivityLogAlertPatchBody) UnmarshalJSON(body []byte) error { 419 var m map[string]*json.RawMessage 420 err := json.Unmarshal(body, &m) 421 if err != nil { 422 return err 423 } 424 for k, v := range m { 425 switch k { 426 case "tags": 427 if v != nil { 428 var tags map[string]*string 429 err = json.Unmarshal(*v, &tags) 430 if err != nil { 431 return err 432 } 433 alapb.Tags = tags 434 } 435 case "properties": 436 if v != nil { 437 var activityLogAlertPatch ActivityLogAlertPatch 438 err = json.Unmarshal(*v, &activityLogAlertPatch) 439 if err != nil { 440 return err 441 } 442 alapb.ActivityLogAlertPatch = &activityLogAlertPatch 443 } 444 } 445 } 446 447 return nil 448} 449 450// ActivityLogAlertResource an activity log alert resource. 451type ActivityLogAlertResource struct { 452 autorest.Response `json:"-"` 453 // ActivityLogAlert - The activity log alert properties of the resource. 454 *ActivityLogAlert `json:"properties,omitempty"` 455 // ID - READ-ONLY; Azure resource Id 456 ID *string `json:"id,omitempty"` 457 // Name - READ-ONLY; Azure resource name 458 Name *string `json:"name,omitempty"` 459 // Type - READ-ONLY; Azure resource type 460 Type *string `json:"type,omitempty"` 461 // Location - Resource location 462 Location *string `json:"location,omitempty"` 463 // Tags - Resource tags 464 Tags map[string]*string `json:"tags"` 465 // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. 466 Kind *string `json:"kind,omitempty"` 467 // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. 468 Etag *string `json:"etag,omitempty"` 469} 470 471// MarshalJSON is the custom marshaler for ActivityLogAlertResource. 472func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { 473 objectMap := make(map[string]interface{}) 474 if alar.ActivityLogAlert != nil { 475 objectMap["properties"] = alar.ActivityLogAlert 476 } 477 if alar.Location != nil { 478 objectMap["location"] = alar.Location 479 } 480 if alar.Tags != nil { 481 objectMap["tags"] = alar.Tags 482 } 483 return json.Marshal(objectMap) 484} 485 486// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. 487func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { 488 var m map[string]*json.RawMessage 489 err := json.Unmarshal(body, &m) 490 if err != nil { 491 return err 492 } 493 for k, v := range m { 494 switch k { 495 case "properties": 496 if v != nil { 497 var activityLogAlert ActivityLogAlert 498 err = json.Unmarshal(*v, &activityLogAlert) 499 if err != nil { 500 return err 501 } 502 alar.ActivityLogAlert = &activityLogAlert 503 } 504 case "id": 505 if v != nil { 506 var ID string 507 err = json.Unmarshal(*v, &ID) 508 if err != nil { 509 return err 510 } 511 alar.ID = &ID 512 } 513 case "name": 514 if v != nil { 515 var name string 516 err = json.Unmarshal(*v, &name) 517 if err != nil { 518 return err 519 } 520 alar.Name = &name 521 } 522 case "type": 523 if v != nil { 524 var typeVar string 525 err = json.Unmarshal(*v, &typeVar) 526 if err != nil { 527 return err 528 } 529 alar.Type = &typeVar 530 } 531 case "location": 532 if v != nil { 533 var location string 534 err = json.Unmarshal(*v, &location) 535 if err != nil { 536 return err 537 } 538 alar.Location = &location 539 } 540 case "tags": 541 if v != nil { 542 var tags map[string]*string 543 err = json.Unmarshal(*v, &tags) 544 if err != nil { 545 return err 546 } 547 alar.Tags = tags 548 } 549 case "kind": 550 if v != nil { 551 var kind string 552 err = json.Unmarshal(*v, &kind) 553 if err != nil { 554 return err 555 } 556 alar.Kind = &kind 557 } 558 case "etag": 559 if v != nil { 560 var etag string 561 err = json.Unmarshal(*v, &etag) 562 if err != nil { 563 return err 564 } 565 alar.Etag = &etag 566 } 567 } 568 } 569 570 return nil 571} 572 573// AlertingAction specify action need to be taken when rule type is Alert 574type AlertingAction struct { 575 // Severity - Severity of the alert. Possible values include: 'AlertSeverityZero', 'AlertSeverityOne', 'AlertSeverityTwo', 'AlertSeverityThree', 'AlertSeverityFour' 576 Severity AlertSeverity `json:"severity,omitempty"` 577 // AznsAction - Azure action group reference. 578 AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"` 579 // ThrottlingInMin - time (in minutes) for which Alerts should be throttled or suppressed. 580 ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` 581 // Trigger - The trigger condition that results in the alert rule being. 582 Trigger *TriggerCondition `json:"trigger,omitempty"` 583 // OdataType - Possible values include: 'OdataTypeBasicActionOdataTypeAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' 584 OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` 585} 586 587// MarshalJSON is the custom marshaler for AlertingAction. 588func (aa AlertingAction) MarshalJSON() ([]byte, error) { 589 aa.OdataType = OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction 590 objectMap := make(map[string]interface{}) 591 if aa.Severity != "" { 592 objectMap["severity"] = aa.Severity 593 } 594 if aa.AznsAction != nil { 595 objectMap["aznsAction"] = aa.AznsAction 596 } 597 if aa.ThrottlingInMin != nil { 598 objectMap["throttlingInMin"] = aa.ThrottlingInMin 599 } 600 if aa.Trigger != nil { 601 objectMap["trigger"] = aa.Trigger 602 } 603 if aa.OdataType != "" { 604 objectMap["odata.type"] = aa.OdataType 605 } 606 return json.Marshal(objectMap) 607} 608 609// AsAlertingAction is the BasicAction implementation for AlertingAction. 610func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { 611 return &aa, true 612} 613 614// AsLogToMetricAction is the BasicAction implementation for AlertingAction. 615func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) { 616 return nil, false 617} 618 619// AsAction is the BasicAction implementation for AlertingAction. 620func (aa AlertingAction) AsAction() (*Action, bool) { 621 return nil, false 622} 623 624// AsBasicAction is the BasicAction implementation for AlertingAction. 625func (aa AlertingAction) AsBasicAction() (BasicAction, bool) { 626 return &aa, true 627} 628 629// AlertRule an alert rule. 630type AlertRule struct { 631 // Name - the name of the alert rule. 632 Name *string `json:"name,omitempty"` 633 // Description - the description of the alert rule that will be included in the alert email. 634 Description *string `json:"description,omitempty"` 635 // ProvisioningState - the provisioning state. 636 ProvisioningState *string `json:"provisioningState,omitempty"` 637 // IsEnabled - the flag that indicates whether the alert rule is enabled. 638 IsEnabled *bool `json:"isEnabled,omitempty"` 639 // Condition - the condition that results in the alert rule being activated. 640 Condition BasicRuleCondition `json:"condition,omitempty"` 641 // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. 642 Action BasicRuleAction `json:"action,omitempty"` 643 // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. 644 Actions *[]BasicRuleAction `json:"actions,omitempty"` 645 // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. 646 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 647} 648 649// MarshalJSON is the custom marshaler for AlertRule. 650func (ar AlertRule) MarshalJSON() ([]byte, error) { 651 objectMap := make(map[string]interface{}) 652 if ar.Name != nil { 653 objectMap["name"] = ar.Name 654 } 655 if ar.Description != nil { 656 objectMap["description"] = ar.Description 657 } 658 if ar.ProvisioningState != nil { 659 objectMap["provisioningState"] = ar.ProvisioningState 660 } 661 if ar.IsEnabled != nil { 662 objectMap["isEnabled"] = ar.IsEnabled 663 } 664 objectMap["condition"] = ar.Condition 665 objectMap["action"] = ar.Action 666 if ar.Actions != nil { 667 objectMap["actions"] = ar.Actions 668 } 669 return json.Marshal(objectMap) 670} 671 672// UnmarshalJSON is the custom unmarshaler for AlertRule struct. 673func (ar *AlertRule) UnmarshalJSON(body []byte) error { 674 var m map[string]*json.RawMessage 675 err := json.Unmarshal(body, &m) 676 if err != nil { 677 return err 678 } 679 for k, v := range m { 680 switch k { 681 case "name": 682 if v != nil { 683 var name string 684 err = json.Unmarshal(*v, &name) 685 if err != nil { 686 return err 687 } 688 ar.Name = &name 689 } 690 case "description": 691 if v != nil { 692 var description string 693 err = json.Unmarshal(*v, &description) 694 if err != nil { 695 return err 696 } 697 ar.Description = &description 698 } 699 case "provisioningState": 700 if v != nil { 701 var provisioningState string 702 err = json.Unmarshal(*v, &provisioningState) 703 if err != nil { 704 return err 705 } 706 ar.ProvisioningState = &provisioningState 707 } 708 case "isEnabled": 709 if v != nil { 710 var isEnabled bool 711 err = json.Unmarshal(*v, &isEnabled) 712 if err != nil { 713 return err 714 } 715 ar.IsEnabled = &isEnabled 716 } 717 case "condition": 718 if v != nil { 719 condition, err := unmarshalBasicRuleCondition(*v) 720 if err != nil { 721 return err 722 } 723 ar.Condition = condition 724 } 725 case "action": 726 if v != nil { 727 action, err := unmarshalBasicRuleAction(*v) 728 if err != nil { 729 return err 730 } 731 ar.Action = action 732 } 733 case "actions": 734 if v != nil { 735 actions, err := unmarshalBasicRuleActionArray(*v) 736 if err != nil { 737 return err 738 } 739 ar.Actions = &actions 740 } 741 case "lastUpdatedTime": 742 if v != nil { 743 var lastUpdatedTime date.Time 744 err = json.Unmarshal(*v, &lastUpdatedTime) 745 if err != nil { 746 return err 747 } 748 ar.LastUpdatedTime = &lastUpdatedTime 749 } 750 } 751 } 752 753 return nil 754} 755 756// AlertRuleResource the alert rule resource. 757type AlertRuleResource struct { 758 autorest.Response `json:"-"` 759 // AlertRule - The alert rule properties of the resource. 760 *AlertRule `json:"properties,omitempty"` 761 // ID - READ-ONLY; Azure resource Id 762 ID *string `json:"id,omitempty"` 763 // Name - READ-ONLY; Azure resource name 764 Name *string `json:"name,omitempty"` 765 // Type - READ-ONLY; Azure resource type 766 Type *string `json:"type,omitempty"` 767 // Location - Resource location 768 Location *string `json:"location,omitempty"` 769 // Tags - Resource tags 770 Tags map[string]*string `json:"tags"` 771 // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. 772 Kind *string `json:"kind,omitempty"` 773 // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. 774 Etag *string `json:"etag,omitempty"` 775} 776 777// MarshalJSON is the custom marshaler for AlertRuleResource. 778func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { 779 objectMap := make(map[string]interface{}) 780 if arr.AlertRule != nil { 781 objectMap["properties"] = arr.AlertRule 782 } 783 if arr.Location != nil { 784 objectMap["location"] = arr.Location 785 } 786 if arr.Tags != nil { 787 objectMap["tags"] = arr.Tags 788 } 789 return json.Marshal(objectMap) 790} 791 792// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. 793func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { 794 var m map[string]*json.RawMessage 795 err := json.Unmarshal(body, &m) 796 if err != nil { 797 return err 798 } 799 for k, v := range m { 800 switch k { 801 case "properties": 802 if v != nil { 803 var alertRule AlertRule 804 err = json.Unmarshal(*v, &alertRule) 805 if err != nil { 806 return err 807 } 808 arr.AlertRule = &alertRule 809 } 810 case "id": 811 if v != nil { 812 var ID string 813 err = json.Unmarshal(*v, &ID) 814 if err != nil { 815 return err 816 } 817 arr.ID = &ID 818 } 819 case "name": 820 if v != nil { 821 var name string 822 err = json.Unmarshal(*v, &name) 823 if err != nil { 824 return err 825 } 826 arr.Name = &name 827 } 828 case "type": 829 if v != nil { 830 var typeVar string 831 err = json.Unmarshal(*v, &typeVar) 832 if err != nil { 833 return err 834 } 835 arr.Type = &typeVar 836 } 837 case "location": 838 if v != nil { 839 var location string 840 err = json.Unmarshal(*v, &location) 841 if err != nil { 842 return err 843 } 844 arr.Location = &location 845 } 846 case "tags": 847 if v != nil { 848 var tags map[string]*string 849 err = json.Unmarshal(*v, &tags) 850 if err != nil { 851 return err 852 } 853 arr.Tags = tags 854 } 855 case "kind": 856 if v != nil { 857 var kind string 858 err = json.Unmarshal(*v, &kind) 859 if err != nil { 860 return err 861 } 862 arr.Kind = &kind 863 } 864 case "etag": 865 if v != nil { 866 var etag string 867 err = json.Unmarshal(*v, &etag) 868 if err != nil { 869 return err 870 } 871 arr.Etag = &etag 872 } 873 } 874 } 875 876 return nil 877} 878 879// AlertRuleResourceCollection represents a collection of alert rule resources. 880type AlertRuleResourceCollection struct { 881 autorest.Response `json:"-"` 882 // Value - the values for the alert rule resources. 883 Value *[]AlertRuleResource `json:"value,omitempty"` 884} 885 886// AlertRuleResourcePatch the alert rule object for patch operations. 887type AlertRuleResourcePatch struct { 888 // Tags - Resource tags 889 Tags map[string]*string `json:"tags"` 890 // AlertRule - The properties of an alert rule. 891 *AlertRule `json:"properties,omitempty"` 892} 893 894// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. 895func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { 896 objectMap := make(map[string]interface{}) 897 if arrp.Tags != nil { 898 objectMap["tags"] = arrp.Tags 899 } 900 if arrp.AlertRule != nil { 901 objectMap["properties"] = arrp.AlertRule 902 } 903 return json.Marshal(objectMap) 904} 905 906// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. 907func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error { 908 var m map[string]*json.RawMessage 909 err := json.Unmarshal(body, &m) 910 if err != nil { 911 return err 912 } 913 for k, v := range m { 914 switch k { 915 case "tags": 916 if v != nil { 917 var tags map[string]*string 918 err = json.Unmarshal(*v, &tags) 919 if err != nil { 920 return err 921 } 922 arrp.Tags = tags 923 } 924 case "properties": 925 if v != nil { 926 var alertRule AlertRule 927 err = json.Unmarshal(*v, &alertRule) 928 if err != nil { 929 return err 930 } 931 arrp.AlertRule = &alertRule 932 } 933 } 934 } 935 936 return nil 937} 938 939// ArmRoleReceiver an arm role receiver. 940type ArmRoleReceiver struct { 941 // Name - The name of the arm role receiver. Names must be unique across all receivers within an action group. 942 Name *string `json:"name,omitempty"` 943 // RoleID - The arm role id. 944 RoleID *string `json:"roleId,omitempty"` 945 // UseCommonAlertSchema - Indicates whether to use common alert schema. 946 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` 947} 948 949// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. 950type AutomationRunbookReceiver struct { 951 // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. 952 AutomationAccountID *string `json:"automationAccountId,omitempty"` 953 // RunbookName - The name for this runbook. 954 RunbookName *string `json:"runbookName,omitempty"` 955 // WebhookResourceID - The resource id for webhook linked to this runbook. 956 WebhookResourceID *string `json:"webhookResourceId,omitempty"` 957 // IsGlobalRunbook - Indicates whether this instance is global runbook. 958 IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` 959 // Name - Indicates name of the webhook. 960 Name *string `json:"name,omitempty"` 961 // ServiceURI - The URI where webhooks should be sent. 962 ServiceURI *string `json:"serviceUri,omitempty"` 963 // UseCommonAlertSchema - Indicates whether to use common alert schema. 964 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` 965} 966 967// AutoscaleNotification autoscale notification. 968type AutoscaleNotification struct { 969 // Operation - the operation associated with the notification and its value must be "scale" 970 Operation *string `json:"operation,omitempty"` 971 // Email - the email notification. 972 Email *EmailNotification `json:"email,omitempty"` 973 // Webhooks - the collection of webhook notifications. 974 Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` 975} 976 977// AutoscaleProfile autoscale profile. 978type AutoscaleProfile struct { 979 // Name - the name of the profile. 980 Name *string `json:"name,omitempty"` 981 // Capacity - the number of instances that can be used during this profile. 982 Capacity *ScaleCapacity `json:"capacity,omitempty"` 983 // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. 984 Rules *[]ScaleRule `json:"rules,omitempty"` 985 // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. 986 FixedDate *TimeWindow `json:"fixedDate,omitempty"` 987 // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. 988 Recurrence *Recurrence `json:"recurrence,omitempty"` 989} 990 991// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a 992// resource. 993type AutoscaleSetting struct { 994 // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. 995 Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` 996 // Notifications - the collection of notifications. 997 Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` 998 // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. 999 Enabled *bool `json:"enabled,omitempty"` 1000 // Name - the name of the autoscale setting. 1001 Name *string `json:"name,omitempty"` 1002 // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. 1003 TargetResourceURI *string `json:"targetResourceUri,omitempty"` 1004} 1005 1006// AutoscaleSettingResource the autoscale setting resource. 1007type AutoscaleSettingResource struct { 1008 autorest.Response `json:"-"` 1009 // AutoscaleSetting - The autoscale setting of the resource. 1010 *AutoscaleSetting `json:"properties,omitempty"` 1011 // ID - READ-ONLY; Azure resource Id 1012 ID *string `json:"id,omitempty"` 1013 // Name - READ-ONLY; Azure resource name 1014 Name *string `json:"name,omitempty"` 1015 // Type - READ-ONLY; Azure resource type 1016 Type *string `json:"type,omitempty"` 1017 // Location - Resource location 1018 Location *string `json:"location,omitempty"` 1019 // Tags - Resource tags 1020 Tags map[string]*string `json:"tags"` 1021 // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. 1022 Kind *string `json:"kind,omitempty"` 1023 // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. 1024 Etag *string `json:"etag,omitempty"` 1025} 1026 1027// MarshalJSON is the custom marshaler for AutoscaleSettingResource. 1028func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { 1029 objectMap := make(map[string]interface{}) 1030 if asr.AutoscaleSetting != nil { 1031 objectMap["properties"] = asr.AutoscaleSetting 1032 } 1033 if asr.Location != nil { 1034 objectMap["location"] = asr.Location 1035 } 1036 if asr.Tags != nil { 1037 objectMap["tags"] = asr.Tags 1038 } 1039 return json.Marshal(objectMap) 1040} 1041 1042// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. 1043func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { 1044 var m map[string]*json.RawMessage 1045 err := json.Unmarshal(body, &m) 1046 if err != nil { 1047 return err 1048 } 1049 for k, v := range m { 1050 switch k { 1051 case "properties": 1052 if v != nil { 1053 var autoscaleSetting AutoscaleSetting 1054 err = json.Unmarshal(*v, &autoscaleSetting) 1055 if err != nil { 1056 return err 1057 } 1058 asr.AutoscaleSetting = &autoscaleSetting 1059 } 1060 case "id": 1061 if v != nil { 1062 var ID string 1063 err = json.Unmarshal(*v, &ID) 1064 if err != nil { 1065 return err 1066 } 1067 asr.ID = &ID 1068 } 1069 case "name": 1070 if v != nil { 1071 var name string 1072 err = json.Unmarshal(*v, &name) 1073 if err != nil { 1074 return err 1075 } 1076 asr.Name = &name 1077 } 1078 case "type": 1079 if v != nil { 1080 var typeVar string 1081 err = json.Unmarshal(*v, &typeVar) 1082 if err != nil { 1083 return err 1084 } 1085 asr.Type = &typeVar 1086 } 1087 case "location": 1088 if v != nil { 1089 var location string 1090 err = json.Unmarshal(*v, &location) 1091 if err != nil { 1092 return err 1093 } 1094 asr.Location = &location 1095 } 1096 case "tags": 1097 if v != nil { 1098 var tags map[string]*string 1099 err = json.Unmarshal(*v, &tags) 1100 if err != nil { 1101 return err 1102 } 1103 asr.Tags = tags 1104 } 1105 case "kind": 1106 if v != nil { 1107 var kind string 1108 err = json.Unmarshal(*v, &kind) 1109 if err != nil { 1110 return err 1111 } 1112 asr.Kind = &kind 1113 } 1114 case "etag": 1115 if v != nil { 1116 var etag string 1117 err = json.Unmarshal(*v, &etag) 1118 if err != nil { 1119 return err 1120 } 1121 asr.Etag = &etag 1122 } 1123 } 1124 } 1125 1126 return nil 1127} 1128 1129// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. 1130type AutoscaleSettingResourceCollection struct { 1131 autorest.Response `json:"-"` 1132 // Value - the values for the autoscale setting resources. 1133 Value *[]AutoscaleSettingResource `json:"value,omitempty"` 1134 // NextLink - URL to get the next set of results. 1135 NextLink *string `json:"nextLink,omitempty"` 1136} 1137 1138// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of 1139// AutoscaleSettingResource values. 1140type AutoscaleSettingResourceCollectionIterator struct { 1141 i int 1142 page AutoscaleSettingResourceCollectionPage 1143} 1144 1145// NextWithContext advances to the next value. If there was an error making 1146// the request the iterator does not advance and the error is returned. 1147func (iter *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { 1148 if tracing.IsEnabled() { 1149 ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.NextWithContext") 1150 defer func() { 1151 sc := -1 1152 if iter.Response().Response.Response != nil { 1153 sc = iter.Response().Response.Response.StatusCode 1154 } 1155 tracing.EndSpan(ctx, sc, err) 1156 }() 1157 } 1158 iter.i++ 1159 if iter.i < len(iter.page.Values()) { 1160 return nil 1161 } 1162 err = iter.page.NextWithContext(ctx) 1163 if err != nil { 1164 iter.i-- 1165 return err 1166 } 1167 iter.i = 0 1168 return nil 1169} 1170 1171// Next advances to the next value. If there was an error making 1172// the request the iterator does not advance and the error is returned. 1173// Deprecated: Use NextWithContext() instead. 1174func (iter *AutoscaleSettingResourceCollectionIterator) Next() error { 1175 return iter.NextWithContext(context.Background()) 1176} 1177 1178// NotDone returns true if the enumeration should be started or is not yet complete. 1179func (iter AutoscaleSettingResourceCollectionIterator) NotDone() bool { 1180 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1181} 1182 1183// Response returns the raw server response from the last page request. 1184func (iter AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { 1185 return iter.page.Response() 1186} 1187 1188// Value returns the current value or a zero-initialized value if the 1189// iterator has advanced beyond the end of the collection. 1190func (iter AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { 1191 if !iter.page.NotDone() { 1192 return AutoscaleSettingResource{} 1193 } 1194 return iter.page.Values()[iter.i] 1195} 1196 1197// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. 1198func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { 1199 return AutoscaleSettingResourceCollectionIterator{page: page} 1200} 1201 1202// IsEmpty returns true if the ListResult contains no values. 1203func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { 1204 return asrc.Value == nil || len(*asrc.Value) == 0 1205} 1206 1207// hasNextLink returns true if the NextLink is not empty. 1208func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { 1209 return asrc.NextLink != nil && len(*asrc.NextLink) != 0 1210} 1211 1212// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. 1213// It returns nil if no more results exist. 1214func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { 1215 if !asrc.hasNextLink() { 1216 return nil, nil 1217 } 1218 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1219 autorest.AsJSON(), 1220 autorest.AsGet(), 1221 autorest.WithBaseURL(to.String(asrc.NextLink))) 1222} 1223 1224// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. 1225type AutoscaleSettingResourceCollectionPage struct { 1226 fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) 1227 asrc AutoscaleSettingResourceCollection 1228} 1229 1230// NextWithContext advances to the next page of values. If there was an error making 1231// the request the page does not advance and the error is returned. 1232func (page *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { 1233 if tracing.IsEnabled() { 1234 ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.NextWithContext") 1235 defer func() { 1236 sc := -1 1237 if page.Response().Response.Response != nil { 1238 sc = page.Response().Response.Response.StatusCode 1239 } 1240 tracing.EndSpan(ctx, sc, err) 1241 }() 1242 } 1243 for { 1244 next, err := page.fn(ctx, page.asrc) 1245 if err != nil { 1246 return err 1247 } 1248 page.asrc = next 1249 if !next.hasNextLink() || !next.IsEmpty() { 1250 break 1251 } 1252 } 1253 return nil 1254} 1255 1256// Next advances to the next page of values. If there was an error making 1257// the request the page does not advance and the error is returned. 1258// Deprecated: Use NextWithContext() instead. 1259func (page *AutoscaleSettingResourceCollectionPage) Next() error { 1260 return page.NextWithContext(context.Background()) 1261} 1262 1263// NotDone returns true if the page enumeration should be started or is not yet complete. 1264func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { 1265 return !page.asrc.IsEmpty() 1266} 1267 1268// Response returns the raw server response from the last page request. 1269func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { 1270 return page.asrc 1271} 1272 1273// Values returns the slice of values for the current page or nil if there are no values. 1274func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { 1275 if page.asrc.IsEmpty() { 1276 return nil 1277 } 1278 return *page.asrc.Value 1279} 1280 1281// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. 1282func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { 1283 return AutoscaleSettingResourceCollectionPage{ 1284 fn: getNextPage, 1285 asrc: cur, 1286 } 1287} 1288 1289// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. 1290type AutoscaleSettingResourcePatch struct { 1291 // Tags - Resource tags 1292 Tags map[string]*string `json:"tags"` 1293 // AutoscaleSetting - The autoscale setting properties of the update operation. 1294 *AutoscaleSetting `json:"properties,omitempty"` 1295} 1296 1297// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. 1298func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { 1299 objectMap := make(map[string]interface{}) 1300 if asrp.Tags != nil { 1301 objectMap["tags"] = asrp.Tags 1302 } 1303 if asrp.AutoscaleSetting != nil { 1304 objectMap["properties"] = asrp.AutoscaleSetting 1305 } 1306 return json.Marshal(objectMap) 1307} 1308 1309// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. 1310func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error { 1311 var m map[string]*json.RawMessage 1312 err := json.Unmarshal(body, &m) 1313 if err != nil { 1314 return err 1315 } 1316 for k, v := range m { 1317 switch k { 1318 case "tags": 1319 if v != nil { 1320 var tags map[string]*string 1321 err = json.Unmarshal(*v, &tags) 1322 if err != nil { 1323 return err 1324 } 1325 asrp.Tags = tags 1326 } 1327 case "properties": 1328 if v != nil { 1329 var autoscaleSetting AutoscaleSetting 1330 err = json.Unmarshal(*v, &autoscaleSetting) 1331 if err != nil { 1332 return err 1333 } 1334 asrp.AutoscaleSetting = &autoscaleSetting 1335 } 1336 } 1337 } 1338 1339 return nil 1340} 1341 1342// AzNsActionGroup azure action group 1343type AzNsActionGroup struct { 1344 // ActionGroup - Azure Action Group reference. 1345 ActionGroup *[]string `json:"actionGroup,omitempty"` 1346 // EmailSubject - Custom subject override for all email ids in Azure action group 1347 EmailSubject *string `json:"emailSubject,omitempty"` 1348 // CustomWebhookPayload - Custom payload to be sent for all webhook URI in Azure action group 1349 CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"` 1350} 1351 1352// AzureAppPushReceiver the Azure mobile App push notification receiver. 1353type AzureAppPushReceiver struct { 1354 // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. 1355 Name *string `json:"name,omitempty"` 1356 // EmailAddress - The email address registered for the Azure mobile app. 1357 EmailAddress *string `json:"emailAddress,omitempty"` 1358} 1359 1360// AzureFunctionReceiver an azure function receiver. 1361type AzureFunctionReceiver struct { 1362 // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. 1363 Name *string `json:"name,omitempty"` 1364 // FunctionAppResourceID - The azure resource id of the function app. 1365 FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` 1366 // FunctionName - The function name in the function app. 1367 FunctionName *string `json:"functionName,omitempty"` 1368 // HTTPTriggerURL - The http trigger url where http request sent to. 1369 HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` 1370 // UseCommonAlertSchema - Indicates whether to use common alert schema. 1371 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` 1372} 1373 1374// AzureMonitorMetricsDestination azure Monitor Metrics destination. 1375type AzureMonitorMetricsDestination struct { 1376 // Name - A friendly name for the destination. 1377 // This name should be unique across all destinations (regardless of type) within the data collection rule. 1378 Name *string `json:"name,omitempty"` 1379} 1380 1381// AzureMonitorPrivateLinkScope an Azure Monitor PrivateLinkScope definition. 1382type AzureMonitorPrivateLinkScope struct { 1383 autorest.Response `json:"-"` 1384 // AzureMonitorPrivateLinkScopeProperties - Properties that define a Azure Monitor PrivateLinkScope resource. 1385 *AzureMonitorPrivateLinkScopeProperties `json:"properties,omitempty"` 1386 // ID - READ-ONLY; Azure resource Id 1387 ID *string `json:"id,omitempty"` 1388 // Name - READ-ONLY; Azure resource name 1389 Name *string `json:"name,omitempty"` 1390 // Type - READ-ONLY; Azure resource type 1391 Type *string `json:"type,omitempty"` 1392 // Location - Resource location 1393 Location *string `json:"location,omitempty"` 1394 // Tags - Resource tags 1395 Tags map[string]*string `json:"tags"` 1396} 1397 1398// MarshalJSON is the custom marshaler for AzureMonitorPrivateLinkScope. 1399func (ampls AzureMonitorPrivateLinkScope) MarshalJSON() ([]byte, error) { 1400 objectMap := make(map[string]interface{}) 1401 if ampls.AzureMonitorPrivateLinkScopeProperties != nil { 1402 objectMap["properties"] = ampls.AzureMonitorPrivateLinkScopeProperties 1403 } 1404 if ampls.Location != nil { 1405 objectMap["location"] = ampls.Location 1406 } 1407 if ampls.Tags != nil { 1408 objectMap["tags"] = ampls.Tags 1409 } 1410 return json.Marshal(objectMap) 1411} 1412 1413// UnmarshalJSON is the custom unmarshaler for AzureMonitorPrivateLinkScope struct. 1414func (ampls *AzureMonitorPrivateLinkScope) UnmarshalJSON(body []byte) error { 1415 var m map[string]*json.RawMessage 1416 err := json.Unmarshal(body, &m) 1417 if err != nil { 1418 return err 1419 } 1420 for k, v := range m { 1421 switch k { 1422 case "properties": 1423 if v != nil { 1424 var azureMonitorPrivateLinkScopeProperties AzureMonitorPrivateLinkScopeProperties 1425 err = json.Unmarshal(*v, &azureMonitorPrivateLinkScopeProperties) 1426 if err != nil { 1427 return err 1428 } 1429 ampls.AzureMonitorPrivateLinkScopeProperties = &azureMonitorPrivateLinkScopeProperties 1430 } 1431 case "id": 1432 if v != nil { 1433 var ID string 1434 err = json.Unmarshal(*v, &ID) 1435 if err != nil { 1436 return err 1437 } 1438 ampls.ID = &ID 1439 } 1440 case "name": 1441 if v != nil { 1442 var name string 1443 err = json.Unmarshal(*v, &name) 1444 if err != nil { 1445 return err 1446 } 1447 ampls.Name = &name 1448 } 1449 case "type": 1450 if v != nil { 1451 var typeVar string 1452 err = json.Unmarshal(*v, &typeVar) 1453 if err != nil { 1454 return err 1455 } 1456 ampls.Type = &typeVar 1457 } 1458 case "location": 1459 if v != nil { 1460 var location string 1461 err = json.Unmarshal(*v, &location) 1462 if err != nil { 1463 return err 1464 } 1465 ampls.Location = &location 1466 } 1467 case "tags": 1468 if v != nil { 1469 var tags map[string]*string 1470 err = json.Unmarshal(*v, &tags) 1471 if err != nil { 1472 return err 1473 } 1474 ampls.Tags = tags 1475 } 1476 } 1477 } 1478 1479 return nil 1480} 1481 1482// AzureMonitorPrivateLinkScopeListResult describes the list of Azure Monitor PrivateLinkScope resources. 1483type AzureMonitorPrivateLinkScopeListResult struct { 1484 autorest.Response `json:"-"` 1485 // Value - List of Azure Monitor PrivateLinkScope definitions. 1486 Value *[]AzureMonitorPrivateLinkScope `json:"value,omitempty"` 1487 // NextLink - The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many PrivateLinkScopes where returned in the result set. 1488 NextLink *string `json:"nextLink,omitempty"` 1489} 1490 1491// AzureMonitorPrivateLinkScopeListResultIterator provides access to a complete listing of 1492// AzureMonitorPrivateLinkScope values. 1493type AzureMonitorPrivateLinkScopeListResultIterator struct { 1494 i int 1495 page AzureMonitorPrivateLinkScopeListResultPage 1496} 1497 1498// NextWithContext advances to the next value. If there was an error making 1499// the request the iterator does not advance and the error is returned. 1500func (iter *AzureMonitorPrivateLinkScopeListResultIterator) NextWithContext(ctx context.Context) (err error) { 1501 if tracing.IsEnabled() { 1502 ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultIterator.NextWithContext") 1503 defer func() { 1504 sc := -1 1505 if iter.Response().Response.Response != nil { 1506 sc = iter.Response().Response.Response.StatusCode 1507 } 1508 tracing.EndSpan(ctx, sc, err) 1509 }() 1510 } 1511 iter.i++ 1512 if iter.i < len(iter.page.Values()) { 1513 return nil 1514 } 1515 err = iter.page.NextWithContext(ctx) 1516 if err != nil { 1517 iter.i-- 1518 return err 1519 } 1520 iter.i = 0 1521 return nil 1522} 1523 1524// Next advances to the next value. If there was an error making 1525// the request the iterator does not advance and the error is returned. 1526// Deprecated: Use NextWithContext() instead. 1527func (iter *AzureMonitorPrivateLinkScopeListResultIterator) Next() error { 1528 return iter.NextWithContext(context.Background()) 1529} 1530 1531// NotDone returns true if the enumeration should be started or is not yet complete. 1532func (iter AzureMonitorPrivateLinkScopeListResultIterator) NotDone() bool { 1533 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1534} 1535 1536// Response returns the raw server response from the last page request. 1537func (iter AzureMonitorPrivateLinkScopeListResultIterator) Response() AzureMonitorPrivateLinkScopeListResult { 1538 return iter.page.Response() 1539} 1540 1541// Value returns the current value or a zero-initialized value if the 1542// iterator has advanced beyond the end of the collection. 1543func (iter AzureMonitorPrivateLinkScopeListResultIterator) Value() AzureMonitorPrivateLinkScope { 1544 if !iter.page.NotDone() { 1545 return AzureMonitorPrivateLinkScope{} 1546 } 1547 return iter.page.Values()[iter.i] 1548} 1549 1550// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultIterator type. 1551func NewAzureMonitorPrivateLinkScopeListResultIterator(page AzureMonitorPrivateLinkScopeListResultPage) AzureMonitorPrivateLinkScopeListResultIterator { 1552 return AzureMonitorPrivateLinkScopeListResultIterator{page: page} 1553} 1554 1555// IsEmpty returns true if the ListResult contains no values. 1556func (amplslr AzureMonitorPrivateLinkScopeListResult) IsEmpty() bool { 1557 return amplslr.Value == nil || len(*amplslr.Value) == 0 1558} 1559 1560// hasNextLink returns true if the NextLink is not empty. 1561func (amplslr AzureMonitorPrivateLinkScopeListResult) hasNextLink() bool { 1562 return amplslr.NextLink != nil && len(*amplslr.NextLink) != 0 1563} 1564 1565// azureMonitorPrivateLinkScopeListResultPreparer prepares a request to retrieve the next set of results. 1566// It returns nil if no more results exist. 1567func (amplslr AzureMonitorPrivateLinkScopeListResult) azureMonitorPrivateLinkScopeListResultPreparer(ctx context.Context) (*http.Request, error) { 1568 if !amplslr.hasNextLink() { 1569 return nil, nil 1570 } 1571 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1572 autorest.AsJSON(), 1573 autorest.AsGet(), 1574 autorest.WithBaseURL(to.String(amplslr.NextLink))) 1575} 1576 1577// AzureMonitorPrivateLinkScopeListResultPage contains a page of AzureMonitorPrivateLinkScope values. 1578type AzureMonitorPrivateLinkScopeListResultPage struct { 1579 fn func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error) 1580 amplslr AzureMonitorPrivateLinkScopeListResult 1581} 1582 1583// NextWithContext advances to the next page of values. If there was an error making 1584// the request the page does not advance and the error is returned. 1585func (page *AzureMonitorPrivateLinkScopeListResultPage) NextWithContext(ctx context.Context) (err error) { 1586 if tracing.IsEnabled() { 1587 ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultPage.NextWithContext") 1588 defer func() { 1589 sc := -1 1590 if page.Response().Response.Response != nil { 1591 sc = page.Response().Response.Response.StatusCode 1592 } 1593 tracing.EndSpan(ctx, sc, err) 1594 }() 1595 } 1596 for { 1597 next, err := page.fn(ctx, page.amplslr) 1598 if err != nil { 1599 return err 1600 } 1601 page.amplslr = next 1602 if !next.hasNextLink() || !next.IsEmpty() { 1603 break 1604 } 1605 } 1606 return nil 1607} 1608 1609// Next advances to the next page of values. If there was an error making 1610// the request the page does not advance and the error is returned. 1611// Deprecated: Use NextWithContext() instead. 1612func (page *AzureMonitorPrivateLinkScopeListResultPage) Next() error { 1613 return page.NextWithContext(context.Background()) 1614} 1615 1616// NotDone returns true if the page enumeration should be started or is not yet complete. 1617func (page AzureMonitorPrivateLinkScopeListResultPage) NotDone() bool { 1618 return !page.amplslr.IsEmpty() 1619} 1620 1621// Response returns the raw server response from the last page request. 1622func (page AzureMonitorPrivateLinkScopeListResultPage) Response() AzureMonitorPrivateLinkScopeListResult { 1623 return page.amplslr 1624} 1625 1626// Values returns the slice of values for the current page or nil if there are no values. 1627func (page AzureMonitorPrivateLinkScopeListResultPage) Values() []AzureMonitorPrivateLinkScope { 1628 if page.amplslr.IsEmpty() { 1629 return nil 1630 } 1631 return *page.amplslr.Value 1632} 1633 1634// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultPage type. 1635func NewAzureMonitorPrivateLinkScopeListResultPage(cur AzureMonitorPrivateLinkScopeListResult, getNextPage func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error)) AzureMonitorPrivateLinkScopeListResultPage { 1636 return AzureMonitorPrivateLinkScopeListResultPage{ 1637 fn: getNextPage, 1638 amplslr: cur, 1639 } 1640} 1641 1642// AzureMonitorPrivateLinkScopeProperties properties that define a Azure Monitor PrivateLinkScope resource. 1643type AzureMonitorPrivateLinkScopeProperties struct { 1644 // 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. 1645 ProvisioningState *string `json:"provisioningState,omitempty"` 1646 // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections. 1647 PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` 1648} 1649 1650// MarshalJSON is the custom marshaler for AzureMonitorPrivateLinkScopeProperties. 1651func (amplsp AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { 1652 objectMap := make(map[string]interface{}) 1653 return json.Marshal(objectMap) 1654} 1655 1656// AzureResource an azure resource object 1657type AzureResource struct { 1658 // ID - READ-ONLY; Azure resource Id 1659 ID *string `json:"id,omitempty"` 1660 // Name - READ-ONLY; Azure resource name 1661 Name *string `json:"name,omitempty"` 1662 // Type - READ-ONLY; Azure resource type 1663 Type *string `json:"type,omitempty"` 1664 // Kind - READ-ONLY; Azure resource kind 1665 Kind *string `json:"kind,omitempty"` 1666 // Identity - READ-ONLY; Azure resource identity 1667 Identity *string `json:"identity,omitempty"` 1668 // Location - Resource location 1669 Location *string `json:"location,omitempty"` 1670 // Tags - Resource tags 1671 Tags map[string]*string `json:"tags"` 1672} 1673 1674// MarshalJSON is the custom marshaler for AzureResource. 1675func (ar AzureResource) MarshalJSON() ([]byte, error) { 1676 objectMap := make(map[string]interface{}) 1677 if ar.Location != nil { 1678 objectMap["location"] = ar.Location 1679 } 1680 if ar.Tags != nil { 1681 objectMap["tags"] = ar.Tags 1682 } 1683 return json.Marshal(objectMap) 1684} 1685 1686// BaselineMetadata represents a baseline metadata value. 1687type BaselineMetadata struct { 1688 // Name - Name of the baseline metadata. 1689 Name *string `json:"name,omitempty"` 1690 // Value - Value of the baseline metadata. 1691 Value *string `json:"value,omitempty"` 1692} 1693 1694// ConfigurationAccessEndpointSpec definition of the endpoint used for accessing configuration. 1695type ConfigurationAccessEndpointSpec struct { 1696 // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. 1697 Endpoint *string `json:"endpoint,omitempty"` 1698} 1699 1700// MarshalJSON is the custom marshaler for ConfigurationAccessEndpointSpec. 1701func (caes ConfigurationAccessEndpointSpec) MarshalJSON() ([]byte, error) { 1702 objectMap := make(map[string]interface{}) 1703 return json.Marshal(objectMap) 1704} 1705 1706// Criteria specifies the criteria for converting log to metric. 1707type Criteria struct { 1708 // MetricName - Name of the metric 1709 MetricName *string `json:"metricName,omitempty"` 1710 // Dimensions - List of Dimensions for creating metric 1711 Dimensions *[]Dimension `json:"dimensions,omitempty"` 1712} 1713 1714// DataCollectionEndpoint definition of data collection endpoint. 1715type DataCollectionEndpoint struct { 1716 // Description - Description of the data collection endpoint. 1717 Description *string `json:"description,omitempty"` 1718 // ImmutableID - The immutable ID of this data collection endpoint resource. This property is READ-ONLY. 1719 ImmutableID *string `json:"immutableId,omitempty"` 1720 // ConfigurationAccess - The endpoint used by agents to access their configuration. 1721 ConfigurationAccess *DataCollectionEndpointConfigurationAccess `json:"configurationAccess,omitempty"` 1722 // LogsIngestion - The endpoint used by clients to ingest logs. 1723 LogsIngestion *DataCollectionEndpointLogsIngestion `json:"logsIngestion,omitempty"` 1724 // NetworkAcls - Network access control rules for the endpoints. 1725 NetworkAcls *DataCollectionEndpointNetworkAcls `json:"networkAcls,omitempty"` 1726 // ProvisioningState - READ-ONLY; The resource provisioning state. This property is READ-ONLY. Possible values include: 'KnownDataCollectionEndpointProvisioningStateCreating', 'KnownDataCollectionEndpointProvisioningStateUpdating', 'KnownDataCollectionEndpointProvisioningStateDeleting', 'KnownDataCollectionEndpointProvisioningStateSucceeded', 'KnownDataCollectionEndpointProvisioningStateFailed' 1727 ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"` 1728} 1729 1730// MarshalJSON is the custom marshaler for DataCollectionEndpoint. 1731func (dce DataCollectionEndpoint) MarshalJSON() ([]byte, error) { 1732 objectMap := make(map[string]interface{}) 1733 if dce.Description != nil { 1734 objectMap["description"] = dce.Description 1735 } 1736 if dce.ImmutableID != nil { 1737 objectMap["immutableId"] = dce.ImmutableID 1738 } 1739 if dce.ConfigurationAccess != nil { 1740 objectMap["configurationAccess"] = dce.ConfigurationAccess 1741 } 1742 if dce.LogsIngestion != nil { 1743 objectMap["logsIngestion"] = dce.LogsIngestion 1744 } 1745 if dce.NetworkAcls != nil { 1746 objectMap["networkAcls"] = dce.NetworkAcls 1747 } 1748 return json.Marshal(objectMap) 1749} 1750 1751// DataCollectionEndpointConfigurationAccess the endpoint used by agents to access their configuration. 1752type DataCollectionEndpointConfigurationAccess struct { 1753 // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. 1754 Endpoint *string `json:"endpoint,omitempty"` 1755} 1756 1757// MarshalJSON is the custom marshaler for DataCollectionEndpointConfigurationAccess. 1758func (dceA DataCollectionEndpointConfigurationAccess) MarshalJSON() ([]byte, error) { 1759 objectMap := make(map[string]interface{}) 1760 return json.Marshal(objectMap) 1761} 1762 1763// DataCollectionEndpointLogsIngestion the endpoint used by clients to ingest logs. 1764type DataCollectionEndpointLogsIngestion struct { 1765 // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. 1766 Endpoint *string `json:"endpoint,omitempty"` 1767} 1768 1769// MarshalJSON is the custom marshaler for DataCollectionEndpointLogsIngestion. 1770func (dceI DataCollectionEndpointLogsIngestion) MarshalJSON() ([]byte, error) { 1771 objectMap := make(map[string]interface{}) 1772 return json.Marshal(objectMap) 1773} 1774 1775// DataCollectionEndpointNetworkAcls network access control rules for the endpoints. 1776type DataCollectionEndpointNetworkAcls struct { 1777 // PublicNetworkAccess - The configuration to set whether network access from public internet to the endpoints are allowed. Possible values include: 'KnownPublicNetworkAccessOptionsEnabled', 'KnownPublicNetworkAccessOptionsDisabled' 1778 PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"` 1779} 1780 1781// DataCollectionEndpointResource definition of ARM tracked top level resource. 1782type DataCollectionEndpointResource struct { 1783 autorest.Response `json:"-"` 1784 // DataCollectionEndpointResourceProperties - Resource properties. 1785 *DataCollectionEndpointResourceProperties `json:"properties,omitempty"` 1786 // Location - The geo-location where the resource lives. 1787 Location *string `json:"location,omitempty"` 1788 // Tags - Resource tags. 1789 Tags map[string]*string `json:"tags"` 1790 // Kind - The kind of the resource. Possible values include: 'KnownDataCollectionEndpointResourceKindLinux', 'KnownDataCollectionEndpointResourceKindWindows' 1791 Kind KnownDataCollectionEndpointResourceKind `json:"kind,omitempty"` 1792 // ID - READ-ONLY; Fully qualified ID of the resource. 1793 ID *string `json:"id,omitempty"` 1794 // Name - READ-ONLY; The name of the resource. 1795 Name *string `json:"name,omitempty"` 1796 // Type - READ-ONLY; The type of the resource. 1797 Type *string `json:"type,omitempty"` 1798 // Etag - READ-ONLY; Resource entity tag (ETag). 1799 Etag *string `json:"etag,omitempty"` 1800 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 1801 SystemData *DataCollectionEndpointResourceSystemData `json:"systemData,omitempty"` 1802} 1803 1804// MarshalJSON is the custom marshaler for DataCollectionEndpointResource. 1805func (dcer DataCollectionEndpointResource) MarshalJSON() ([]byte, error) { 1806 objectMap := make(map[string]interface{}) 1807 if dcer.DataCollectionEndpointResourceProperties != nil { 1808 objectMap["properties"] = dcer.DataCollectionEndpointResourceProperties 1809 } 1810 if dcer.Location != nil { 1811 objectMap["location"] = dcer.Location 1812 } 1813 if dcer.Tags != nil { 1814 objectMap["tags"] = dcer.Tags 1815 } 1816 if dcer.Kind != "" { 1817 objectMap["kind"] = dcer.Kind 1818 } 1819 return json.Marshal(objectMap) 1820} 1821 1822// UnmarshalJSON is the custom unmarshaler for DataCollectionEndpointResource struct. 1823func (dcer *DataCollectionEndpointResource) UnmarshalJSON(body []byte) error { 1824 var m map[string]*json.RawMessage 1825 err := json.Unmarshal(body, &m) 1826 if err != nil { 1827 return err 1828 } 1829 for k, v := range m { 1830 switch k { 1831 case "properties": 1832 if v != nil { 1833 var dataCollectionEndpointResourceProperties DataCollectionEndpointResourceProperties 1834 err = json.Unmarshal(*v, &dataCollectionEndpointResourceProperties) 1835 if err != nil { 1836 return err 1837 } 1838 dcer.DataCollectionEndpointResourceProperties = &dataCollectionEndpointResourceProperties 1839 } 1840 case "location": 1841 if v != nil { 1842 var location string 1843 err = json.Unmarshal(*v, &location) 1844 if err != nil { 1845 return err 1846 } 1847 dcer.Location = &location 1848 } 1849 case "tags": 1850 if v != nil { 1851 var tags map[string]*string 1852 err = json.Unmarshal(*v, &tags) 1853 if err != nil { 1854 return err 1855 } 1856 dcer.Tags = tags 1857 } 1858 case "kind": 1859 if v != nil { 1860 var kind KnownDataCollectionEndpointResourceKind 1861 err = json.Unmarshal(*v, &kind) 1862 if err != nil { 1863 return err 1864 } 1865 dcer.Kind = kind 1866 } 1867 case "id": 1868 if v != nil { 1869 var ID string 1870 err = json.Unmarshal(*v, &ID) 1871 if err != nil { 1872 return err 1873 } 1874 dcer.ID = &ID 1875 } 1876 case "name": 1877 if v != nil { 1878 var name string 1879 err = json.Unmarshal(*v, &name) 1880 if err != nil { 1881 return err 1882 } 1883 dcer.Name = &name 1884 } 1885 case "type": 1886 if v != nil { 1887 var typeVar string 1888 err = json.Unmarshal(*v, &typeVar) 1889 if err != nil { 1890 return err 1891 } 1892 dcer.Type = &typeVar 1893 } 1894 case "etag": 1895 if v != nil { 1896 var etag string 1897 err = json.Unmarshal(*v, &etag) 1898 if err != nil { 1899 return err 1900 } 1901 dcer.Etag = &etag 1902 } 1903 case "systemData": 1904 if v != nil { 1905 var systemData DataCollectionEndpointResourceSystemData 1906 err = json.Unmarshal(*v, &systemData) 1907 if err != nil { 1908 return err 1909 } 1910 dcer.SystemData = &systemData 1911 } 1912 } 1913 } 1914 1915 return nil 1916} 1917 1918// DataCollectionEndpointResourceListResult a pageable list of resources. 1919type DataCollectionEndpointResourceListResult struct { 1920 autorest.Response `json:"-"` 1921 // Value - A list of resources. 1922 Value *[]DataCollectionEndpointResource `json:"value,omitempty"` 1923 // NextLink - The URL to use for getting the next set of results. 1924 NextLink *string `json:"nextLink,omitempty"` 1925} 1926 1927// DataCollectionEndpointResourceListResultIterator provides access to a complete listing of 1928// DataCollectionEndpointResource values. 1929type DataCollectionEndpointResourceListResultIterator struct { 1930 i int 1931 page DataCollectionEndpointResourceListResultPage 1932} 1933 1934// NextWithContext advances to the next value. If there was an error making 1935// the request the iterator does not advance and the error is returned. 1936func (iter *DataCollectionEndpointResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { 1937 if tracing.IsEnabled() { 1938 ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointResourceListResultIterator.NextWithContext") 1939 defer func() { 1940 sc := -1 1941 if iter.Response().Response.Response != nil { 1942 sc = iter.Response().Response.Response.StatusCode 1943 } 1944 tracing.EndSpan(ctx, sc, err) 1945 }() 1946 } 1947 iter.i++ 1948 if iter.i < len(iter.page.Values()) { 1949 return nil 1950 } 1951 err = iter.page.NextWithContext(ctx) 1952 if err != nil { 1953 iter.i-- 1954 return err 1955 } 1956 iter.i = 0 1957 return nil 1958} 1959 1960// Next advances to the next value. If there was an error making 1961// the request the iterator does not advance and the error is returned. 1962// Deprecated: Use NextWithContext() instead. 1963func (iter *DataCollectionEndpointResourceListResultIterator) Next() error { 1964 return iter.NextWithContext(context.Background()) 1965} 1966 1967// NotDone returns true if the enumeration should be started or is not yet complete. 1968func (iter DataCollectionEndpointResourceListResultIterator) NotDone() bool { 1969 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1970} 1971 1972// Response returns the raw server response from the last page request. 1973func (iter DataCollectionEndpointResourceListResultIterator) Response() DataCollectionEndpointResourceListResult { 1974 return iter.page.Response() 1975} 1976 1977// Value returns the current value or a zero-initialized value if the 1978// iterator has advanced beyond the end of the collection. 1979func (iter DataCollectionEndpointResourceListResultIterator) Value() DataCollectionEndpointResource { 1980 if !iter.page.NotDone() { 1981 return DataCollectionEndpointResource{} 1982 } 1983 return iter.page.Values()[iter.i] 1984} 1985 1986// Creates a new instance of the DataCollectionEndpointResourceListResultIterator type. 1987func NewDataCollectionEndpointResourceListResultIterator(page DataCollectionEndpointResourceListResultPage) DataCollectionEndpointResourceListResultIterator { 1988 return DataCollectionEndpointResourceListResultIterator{page: page} 1989} 1990 1991// IsEmpty returns true if the ListResult contains no values. 1992func (dcerlr DataCollectionEndpointResourceListResult) IsEmpty() bool { 1993 return dcerlr.Value == nil || len(*dcerlr.Value) == 0 1994} 1995 1996// hasNextLink returns true if the NextLink is not empty. 1997func (dcerlr DataCollectionEndpointResourceListResult) hasNextLink() bool { 1998 return dcerlr.NextLink != nil && len(*dcerlr.NextLink) != 0 1999} 2000 2001// dataCollectionEndpointResourceListResultPreparer prepares a request to retrieve the next set of results. 2002// It returns nil if no more results exist. 2003func (dcerlr DataCollectionEndpointResourceListResult) dataCollectionEndpointResourceListResultPreparer(ctx context.Context) (*http.Request, error) { 2004 if !dcerlr.hasNextLink() { 2005 return nil, nil 2006 } 2007 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2008 autorest.AsJSON(), 2009 autorest.AsGet(), 2010 autorest.WithBaseURL(to.String(dcerlr.NextLink))) 2011} 2012 2013// DataCollectionEndpointResourceListResultPage contains a page of DataCollectionEndpointResource values. 2014type DataCollectionEndpointResourceListResultPage struct { 2015 fn func(context.Context, DataCollectionEndpointResourceListResult) (DataCollectionEndpointResourceListResult, error) 2016 dcerlr DataCollectionEndpointResourceListResult 2017} 2018 2019// NextWithContext advances to the next page of values. If there was an error making 2020// the request the page does not advance and the error is returned. 2021func (page *DataCollectionEndpointResourceListResultPage) NextWithContext(ctx context.Context) (err error) { 2022 if tracing.IsEnabled() { 2023 ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointResourceListResultPage.NextWithContext") 2024 defer func() { 2025 sc := -1 2026 if page.Response().Response.Response != nil { 2027 sc = page.Response().Response.Response.StatusCode 2028 } 2029 tracing.EndSpan(ctx, sc, err) 2030 }() 2031 } 2032 for { 2033 next, err := page.fn(ctx, page.dcerlr) 2034 if err != nil { 2035 return err 2036 } 2037 page.dcerlr = next 2038 if !next.hasNextLink() || !next.IsEmpty() { 2039 break 2040 } 2041 } 2042 return nil 2043} 2044 2045// Next advances to the next page of values. If there was an error making 2046// the request the page does not advance and the error is returned. 2047// Deprecated: Use NextWithContext() instead. 2048func (page *DataCollectionEndpointResourceListResultPage) Next() error { 2049 return page.NextWithContext(context.Background()) 2050} 2051 2052// NotDone returns true if the page enumeration should be started or is not yet complete. 2053func (page DataCollectionEndpointResourceListResultPage) NotDone() bool { 2054 return !page.dcerlr.IsEmpty() 2055} 2056 2057// Response returns the raw server response from the last page request. 2058func (page DataCollectionEndpointResourceListResultPage) Response() DataCollectionEndpointResourceListResult { 2059 return page.dcerlr 2060} 2061 2062// Values returns the slice of values for the current page or nil if there are no values. 2063func (page DataCollectionEndpointResourceListResultPage) Values() []DataCollectionEndpointResource { 2064 if page.dcerlr.IsEmpty() { 2065 return nil 2066 } 2067 return *page.dcerlr.Value 2068} 2069 2070// Creates a new instance of the DataCollectionEndpointResourceListResultPage type. 2071func NewDataCollectionEndpointResourceListResultPage(cur DataCollectionEndpointResourceListResult, getNextPage func(context.Context, DataCollectionEndpointResourceListResult) (DataCollectionEndpointResourceListResult, error)) DataCollectionEndpointResourceListResultPage { 2072 return DataCollectionEndpointResourceListResultPage{ 2073 fn: getNextPage, 2074 dcerlr: cur, 2075 } 2076} 2077 2078// DataCollectionEndpointResourceProperties resource properties. 2079type DataCollectionEndpointResourceProperties struct { 2080 // Description - Description of the data collection endpoint. 2081 Description *string `json:"description,omitempty"` 2082 // ImmutableID - The immutable ID of this data collection endpoint resource. This property is READ-ONLY. 2083 ImmutableID *string `json:"immutableId,omitempty"` 2084 // ConfigurationAccess - The endpoint used by agents to access their configuration. 2085 ConfigurationAccess *DataCollectionEndpointConfigurationAccess `json:"configurationAccess,omitempty"` 2086 // LogsIngestion - The endpoint used by clients to ingest logs. 2087 LogsIngestion *DataCollectionEndpointLogsIngestion `json:"logsIngestion,omitempty"` 2088 // NetworkAcls - Network access control rules for the endpoints. 2089 NetworkAcls *DataCollectionEndpointNetworkAcls `json:"networkAcls,omitempty"` 2090 // ProvisioningState - READ-ONLY; The resource provisioning state. This property is READ-ONLY. Possible values include: 'KnownDataCollectionEndpointProvisioningStateCreating', 'KnownDataCollectionEndpointProvisioningStateUpdating', 'KnownDataCollectionEndpointProvisioningStateDeleting', 'KnownDataCollectionEndpointProvisioningStateSucceeded', 'KnownDataCollectionEndpointProvisioningStateFailed' 2091 ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"` 2092} 2093 2094// MarshalJSON is the custom marshaler for DataCollectionEndpointResourceProperties. 2095func (dcer DataCollectionEndpointResourceProperties) MarshalJSON() ([]byte, error) { 2096 objectMap := make(map[string]interface{}) 2097 if dcer.Description != nil { 2098 objectMap["description"] = dcer.Description 2099 } 2100 if dcer.ImmutableID != nil { 2101 objectMap["immutableId"] = dcer.ImmutableID 2102 } 2103 if dcer.ConfigurationAccess != nil { 2104 objectMap["configurationAccess"] = dcer.ConfigurationAccess 2105 } 2106 if dcer.LogsIngestion != nil { 2107 objectMap["logsIngestion"] = dcer.LogsIngestion 2108 } 2109 if dcer.NetworkAcls != nil { 2110 objectMap["networkAcls"] = dcer.NetworkAcls 2111 } 2112 return json.Marshal(objectMap) 2113} 2114 2115// DataCollectionEndpointResourceSystemData metadata pertaining to creation and last modification of the 2116// resource. 2117type DataCollectionEndpointResourceSystemData struct { 2118 // CreatedBy - The identity that created the resource. 2119 CreatedBy *string `json:"createdBy,omitempty"` 2120 // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' 2121 CreatedByType CreatedByType `json:"createdByType,omitempty"` 2122 // CreatedAt - The timestamp of resource creation (UTC). 2123 CreatedAt *date.Time `json:"createdAt,omitempty"` 2124 // LastModifiedBy - The identity that last modified the resource. 2125 LastModifiedBy *string `json:"lastModifiedBy,omitempty"` 2126 // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' 2127 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` 2128 // LastModifiedAt - The timestamp of resource last modification (UTC) 2129 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` 2130} 2131 2132// DataCollectionRule definition of what monitoring data to collect and where that data should be sent. 2133type DataCollectionRule struct { 2134 // Description - Description of the data collection rule. 2135 Description *string `json:"description,omitempty"` 2136 // ImmutableID - READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. 2137 ImmutableID *string `json:"immutableId,omitempty"` 2138 // DataSources - The specification of data sources. 2139 // This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. 2140 DataSources *DataCollectionRuleDataSources `json:"dataSources,omitempty"` 2141 // Destinations - The specification of destinations. 2142 Destinations *DataCollectionRuleDestinations `json:"destinations,omitempty"` 2143 // DataFlows - The specification of data flows. 2144 DataFlows *[]DataFlow `json:"dataFlows,omitempty"` 2145 // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleProvisioningStateCreating', 'KnownDataCollectionRuleProvisioningStateUpdating', 'KnownDataCollectionRuleProvisioningStateDeleting', 'KnownDataCollectionRuleProvisioningStateSucceeded', 'KnownDataCollectionRuleProvisioningStateFailed' 2146 ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"` 2147} 2148 2149// MarshalJSON is the custom marshaler for DataCollectionRule. 2150func (dcr DataCollectionRule) MarshalJSON() ([]byte, error) { 2151 objectMap := make(map[string]interface{}) 2152 if dcr.Description != nil { 2153 objectMap["description"] = dcr.Description 2154 } 2155 if dcr.DataSources != nil { 2156 objectMap["dataSources"] = dcr.DataSources 2157 } 2158 if dcr.Destinations != nil { 2159 objectMap["destinations"] = dcr.Destinations 2160 } 2161 if dcr.DataFlows != nil { 2162 objectMap["dataFlows"] = dcr.DataFlows 2163 } 2164 return json.Marshal(objectMap) 2165} 2166 2167// DataCollectionRuleAssociation definition of association of a data collection rule with a monitored Azure 2168// resource. 2169type DataCollectionRuleAssociation struct { 2170 // Description - Description of the association. 2171 Description *string `json:"description,omitempty"` 2172 // DataCollectionRuleID - The resource ID of the data collection rule that is to be associated. 2173 DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"` 2174 // DataCollectionEndpointID - The resource ID of the data collection endpoint that is to be associated. 2175 DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"` 2176 // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleAssociationProvisioningStateCreating', 'KnownDataCollectionRuleAssociationProvisioningStateUpdating', 'KnownDataCollectionRuleAssociationProvisioningStateDeleting', 'KnownDataCollectionRuleAssociationProvisioningStateSucceeded', 'KnownDataCollectionRuleAssociationProvisioningStateFailed' 2177 ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"` 2178} 2179 2180// MarshalJSON is the custom marshaler for DataCollectionRuleAssociation. 2181func (dcra DataCollectionRuleAssociation) MarshalJSON() ([]byte, error) { 2182 objectMap := make(map[string]interface{}) 2183 if dcra.Description != nil { 2184 objectMap["description"] = dcra.Description 2185 } 2186 if dcra.DataCollectionRuleID != nil { 2187 objectMap["dataCollectionRuleId"] = dcra.DataCollectionRuleID 2188 } 2189 if dcra.DataCollectionEndpointID != nil { 2190 objectMap["dataCollectionEndpointId"] = dcra.DataCollectionEndpointID 2191 } 2192 return json.Marshal(objectMap) 2193} 2194 2195// DataCollectionRuleAssociationProxyOnlyResource definition of generic ARM proxy resource. 2196type DataCollectionRuleAssociationProxyOnlyResource struct { 2197 autorest.Response `json:"-"` 2198 // DataCollectionRuleAssociationProxyOnlyResourceProperties - Resource properties. 2199 *DataCollectionRuleAssociationProxyOnlyResourceProperties `json:"properties,omitempty"` 2200 // ID - READ-ONLY; Fully qualified ID of the resource. 2201 ID *string `json:"id,omitempty"` 2202 // Name - READ-ONLY; The name of the resource. 2203 Name *string `json:"name,omitempty"` 2204 // Type - READ-ONLY; The type of the resource. 2205 Type *string `json:"type,omitempty"` 2206 // Etag - READ-ONLY; Resource entity tag (ETag). 2207 Etag *string `json:"etag,omitempty"` 2208 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 2209 SystemData *DataCollectionRuleAssociationProxyOnlyResourceSystemData `json:"systemData,omitempty"` 2210} 2211 2212// MarshalJSON is the custom marshaler for DataCollectionRuleAssociationProxyOnlyResource. 2213func (dcrapor DataCollectionRuleAssociationProxyOnlyResource) MarshalJSON() ([]byte, error) { 2214 objectMap := make(map[string]interface{}) 2215 if dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties != nil { 2216 objectMap["properties"] = dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties 2217 } 2218 return json.Marshal(objectMap) 2219} 2220 2221// UnmarshalJSON is the custom unmarshaler for DataCollectionRuleAssociationProxyOnlyResource struct. 2222func (dcrapor *DataCollectionRuleAssociationProxyOnlyResource) UnmarshalJSON(body []byte) error { 2223 var m map[string]*json.RawMessage 2224 err := json.Unmarshal(body, &m) 2225 if err != nil { 2226 return err 2227 } 2228 for k, v := range m { 2229 switch k { 2230 case "properties": 2231 if v != nil { 2232 var dataCollectionRuleAssociationProxyOnlyResourceProperties DataCollectionRuleAssociationProxyOnlyResourceProperties 2233 err = json.Unmarshal(*v, &dataCollectionRuleAssociationProxyOnlyResourceProperties) 2234 if err != nil { 2235 return err 2236 } 2237 dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties = &dataCollectionRuleAssociationProxyOnlyResourceProperties 2238 } 2239 case "id": 2240 if v != nil { 2241 var ID string 2242 err = json.Unmarshal(*v, &ID) 2243 if err != nil { 2244 return err 2245 } 2246 dcrapor.ID = &ID 2247 } 2248 case "name": 2249 if v != nil { 2250 var name string 2251 err = json.Unmarshal(*v, &name) 2252 if err != nil { 2253 return err 2254 } 2255 dcrapor.Name = &name 2256 } 2257 case "type": 2258 if v != nil { 2259 var typeVar string 2260 err = json.Unmarshal(*v, &typeVar) 2261 if err != nil { 2262 return err 2263 } 2264 dcrapor.Type = &typeVar 2265 } 2266 case "etag": 2267 if v != nil { 2268 var etag string 2269 err = json.Unmarshal(*v, &etag) 2270 if err != nil { 2271 return err 2272 } 2273 dcrapor.Etag = &etag 2274 } 2275 case "systemData": 2276 if v != nil { 2277 var systemData DataCollectionRuleAssociationProxyOnlyResourceSystemData 2278 err = json.Unmarshal(*v, &systemData) 2279 if err != nil { 2280 return err 2281 } 2282 dcrapor.SystemData = &systemData 2283 } 2284 } 2285 } 2286 2287 return nil 2288} 2289 2290// DataCollectionRuleAssociationProxyOnlyResourceListResult a pageable list of resources. 2291type DataCollectionRuleAssociationProxyOnlyResourceListResult struct { 2292 autorest.Response `json:"-"` 2293 // Value - A list of resources. 2294 Value *[]DataCollectionRuleAssociationProxyOnlyResource `json:"value,omitempty"` 2295 // NextLink - The URL to use for getting the next set of results. 2296 NextLink *string `json:"nextLink,omitempty"` 2297} 2298 2299// DataCollectionRuleAssociationProxyOnlyResourceListResultIterator provides access to a complete listing 2300// of DataCollectionRuleAssociationProxyOnlyResource values. 2301type DataCollectionRuleAssociationProxyOnlyResourceListResultIterator struct { 2302 i int 2303 page DataCollectionRuleAssociationProxyOnlyResourceListResultPage 2304} 2305 2306// NextWithContext advances to the next value. If there was an error making 2307// the request the iterator does not advance and the error is returned. 2308func (iter *DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { 2309 if tracing.IsEnabled() { 2310 ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationProxyOnlyResourceListResultIterator.NextWithContext") 2311 defer func() { 2312 sc := -1 2313 if iter.Response().Response.Response != nil { 2314 sc = iter.Response().Response.Response.StatusCode 2315 } 2316 tracing.EndSpan(ctx, sc, err) 2317 }() 2318 } 2319 iter.i++ 2320 if iter.i < len(iter.page.Values()) { 2321 return nil 2322 } 2323 err = iter.page.NextWithContext(ctx) 2324 if err != nil { 2325 iter.i-- 2326 return err 2327 } 2328 iter.i = 0 2329 return nil 2330} 2331 2332// Next advances to the next value. If there was an error making 2333// the request the iterator does not advance and the error is returned. 2334// Deprecated: Use NextWithContext() instead. 2335func (iter *DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Next() error { 2336 return iter.NextWithContext(context.Background()) 2337} 2338 2339// NotDone returns true if the enumeration should be started or is not yet complete. 2340func (iter DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) NotDone() bool { 2341 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2342} 2343 2344// Response returns the raw server response from the last page request. 2345func (iter DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Response() DataCollectionRuleAssociationProxyOnlyResourceListResult { 2346 return iter.page.Response() 2347} 2348 2349// Value returns the current value or a zero-initialized value if the 2350// iterator has advanced beyond the end of the collection. 2351func (iter DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Value() DataCollectionRuleAssociationProxyOnlyResource { 2352 if !iter.page.NotDone() { 2353 return DataCollectionRuleAssociationProxyOnlyResource{} 2354 } 2355 return iter.page.Values()[iter.i] 2356} 2357 2358// Creates a new instance of the DataCollectionRuleAssociationProxyOnlyResourceListResultIterator type. 2359func NewDataCollectionRuleAssociationProxyOnlyResourceListResultIterator(page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) DataCollectionRuleAssociationProxyOnlyResourceListResultIterator { 2360 return DataCollectionRuleAssociationProxyOnlyResourceListResultIterator{page: page} 2361} 2362 2363// IsEmpty returns true if the ListResult contains no values. 2364func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) IsEmpty() bool { 2365 return dcraporlr.Value == nil || len(*dcraporlr.Value) == 0 2366} 2367 2368// hasNextLink returns true if the NextLink is not empty. 2369func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) hasNextLink() bool { 2370 return dcraporlr.NextLink != nil && len(*dcraporlr.NextLink) != 0 2371} 2372 2373// dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer prepares a request to retrieve the next set of results. 2374// It returns nil if no more results exist. 2375func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer(ctx context.Context) (*http.Request, error) { 2376 if !dcraporlr.hasNextLink() { 2377 return nil, nil 2378 } 2379 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2380 autorest.AsJSON(), 2381 autorest.AsGet(), 2382 autorest.WithBaseURL(to.String(dcraporlr.NextLink))) 2383} 2384 2385// DataCollectionRuleAssociationProxyOnlyResourceListResultPage contains a page of 2386// DataCollectionRuleAssociationProxyOnlyResource values. 2387type DataCollectionRuleAssociationProxyOnlyResourceListResultPage struct { 2388 fn func(context.Context, DataCollectionRuleAssociationProxyOnlyResourceListResult) (DataCollectionRuleAssociationProxyOnlyResourceListResult, error) 2389 dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult 2390} 2391 2392// NextWithContext advances to the next page of values. If there was an error making 2393// the request the page does not advance and the error is returned. 2394func (page *DataCollectionRuleAssociationProxyOnlyResourceListResultPage) NextWithContext(ctx context.Context) (err error) { 2395 if tracing.IsEnabled() { 2396 ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationProxyOnlyResourceListResultPage.NextWithContext") 2397 defer func() { 2398 sc := -1 2399 if page.Response().Response.Response != nil { 2400 sc = page.Response().Response.Response.StatusCode 2401 } 2402 tracing.EndSpan(ctx, sc, err) 2403 }() 2404 } 2405 for { 2406 next, err := page.fn(ctx, page.dcraporlr) 2407 if err != nil { 2408 return err 2409 } 2410 page.dcraporlr = next 2411 if !next.hasNextLink() || !next.IsEmpty() { 2412 break 2413 } 2414 } 2415 return nil 2416} 2417 2418// Next advances to the next page of values. If there was an error making 2419// the request the page does not advance and the error is returned. 2420// Deprecated: Use NextWithContext() instead. 2421func (page *DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Next() error { 2422 return page.NextWithContext(context.Background()) 2423} 2424 2425// NotDone returns true if the page enumeration should be started or is not yet complete. 2426func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) NotDone() bool { 2427 return !page.dcraporlr.IsEmpty() 2428} 2429 2430// Response returns the raw server response from the last page request. 2431func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Response() DataCollectionRuleAssociationProxyOnlyResourceListResult { 2432 return page.dcraporlr 2433} 2434 2435// Values returns the slice of values for the current page or nil if there are no values. 2436func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Values() []DataCollectionRuleAssociationProxyOnlyResource { 2437 if page.dcraporlr.IsEmpty() { 2438 return nil 2439 } 2440 return *page.dcraporlr.Value 2441} 2442 2443// Creates a new instance of the DataCollectionRuleAssociationProxyOnlyResourceListResultPage type. 2444func NewDataCollectionRuleAssociationProxyOnlyResourceListResultPage(cur DataCollectionRuleAssociationProxyOnlyResourceListResult, getNextPage func(context.Context, DataCollectionRuleAssociationProxyOnlyResourceListResult) (DataCollectionRuleAssociationProxyOnlyResourceListResult, error)) DataCollectionRuleAssociationProxyOnlyResourceListResultPage { 2445 return DataCollectionRuleAssociationProxyOnlyResourceListResultPage{ 2446 fn: getNextPage, 2447 dcraporlr: cur, 2448 } 2449} 2450 2451// DataCollectionRuleAssociationProxyOnlyResourceProperties resource properties. 2452type DataCollectionRuleAssociationProxyOnlyResourceProperties struct { 2453 // Description - Description of the association. 2454 Description *string `json:"description,omitempty"` 2455 // DataCollectionRuleID - The resource ID of the data collection rule that is to be associated. 2456 DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"` 2457 // DataCollectionEndpointID - The resource ID of the data collection endpoint that is to be associated. 2458 DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"` 2459 // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleAssociationProvisioningStateCreating', 'KnownDataCollectionRuleAssociationProvisioningStateUpdating', 'KnownDataCollectionRuleAssociationProvisioningStateDeleting', 'KnownDataCollectionRuleAssociationProvisioningStateSucceeded', 'KnownDataCollectionRuleAssociationProvisioningStateFailed' 2460 ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"` 2461} 2462 2463// MarshalJSON is the custom marshaler for DataCollectionRuleAssociationProxyOnlyResourceProperties. 2464func (dcrapor DataCollectionRuleAssociationProxyOnlyResourceProperties) MarshalJSON() ([]byte, error) { 2465 objectMap := make(map[string]interface{}) 2466 if dcrapor.Description != nil { 2467 objectMap["description"] = dcrapor.Description 2468 } 2469 if dcrapor.DataCollectionRuleID != nil { 2470 objectMap["dataCollectionRuleId"] = dcrapor.DataCollectionRuleID 2471 } 2472 if dcrapor.DataCollectionEndpointID != nil { 2473 objectMap["dataCollectionEndpointId"] = dcrapor.DataCollectionEndpointID 2474 } 2475 return json.Marshal(objectMap) 2476} 2477 2478// DataCollectionRuleAssociationProxyOnlyResourceSystemData metadata pertaining to creation and last 2479// modification of the resource. 2480type DataCollectionRuleAssociationProxyOnlyResourceSystemData struct { 2481 // CreatedBy - The identity that created the resource. 2482 CreatedBy *string `json:"createdBy,omitempty"` 2483 // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' 2484 CreatedByType CreatedByType `json:"createdByType,omitempty"` 2485 // CreatedAt - The timestamp of resource creation (UTC). 2486 CreatedAt *date.Time `json:"createdAt,omitempty"` 2487 // LastModifiedBy - The identity that last modified the resource. 2488 LastModifiedBy *string `json:"lastModifiedBy,omitempty"` 2489 // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' 2490 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` 2491 // LastModifiedAt - The timestamp of resource last modification (UTC) 2492 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` 2493} 2494 2495// DataCollectionRuleDataSources the specification of data sources. 2496// This property is optional and can be omitted if the rule is meant to be used via direct calls to the 2497// provisioned endpoint. 2498type DataCollectionRuleDataSources struct { 2499 // PerformanceCounters - The list of performance counter data source configurations. 2500 PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"` 2501 // WindowsEventLogs - The list of Windows Event Log data source configurations. 2502 WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"` 2503 // Syslog - The list of Syslog data source configurations. 2504 Syslog *[]SyslogDataSource `json:"syslog,omitempty"` 2505 // Extensions - The list of Azure VM extension data source configurations. 2506 Extensions *[]ExtensionDataSource `json:"extensions,omitempty"` 2507} 2508 2509// DataCollectionRuleDestinations the specification of destinations. 2510type DataCollectionRuleDestinations struct { 2511 // LogAnalytics - List of Log Analytics destinations. 2512 LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"` 2513 // AzureMonitorMetrics - Azure Monitor Metrics destination. 2514 AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"` 2515} 2516 2517// DataCollectionRuleResource definition of ARM tracked top level resource. 2518type DataCollectionRuleResource struct { 2519 autorest.Response `json:"-"` 2520 // DataCollectionRuleResourceProperties - Resource properties. 2521 *DataCollectionRuleResourceProperties `json:"properties,omitempty"` 2522 // Location - The geo-location where the resource lives. 2523 Location *string `json:"location,omitempty"` 2524 // Tags - Resource tags. 2525 Tags map[string]*string `json:"tags"` 2526 // Kind - The kind of the resource. Possible values include: 'KnownDataCollectionRuleResourceKindLinux', 'KnownDataCollectionRuleResourceKindWindows' 2527 Kind KnownDataCollectionRuleResourceKind `json:"kind,omitempty"` 2528 // ID - READ-ONLY; Fully qualified ID of the resource. 2529 ID *string `json:"id,omitempty"` 2530 // Name - READ-ONLY; The name of the resource. 2531 Name *string `json:"name,omitempty"` 2532 // Type - READ-ONLY; The type of the resource. 2533 Type *string `json:"type,omitempty"` 2534 // Etag - READ-ONLY; Resource entity tag (ETag). 2535 Etag *string `json:"etag,omitempty"` 2536 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 2537 SystemData *DataCollectionRuleResourceSystemData `json:"systemData,omitempty"` 2538} 2539 2540// MarshalJSON is the custom marshaler for DataCollectionRuleResource. 2541func (dcrr DataCollectionRuleResource) MarshalJSON() ([]byte, error) { 2542 objectMap := make(map[string]interface{}) 2543 if dcrr.DataCollectionRuleResourceProperties != nil { 2544 objectMap["properties"] = dcrr.DataCollectionRuleResourceProperties 2545 } 2546 if dcrr.Location != nil { 2547 objectMap["location"] = dcrr.Location 2548 } 2549 if dcrr.Tags != nil { 2550 objectMap["tags"] = dcrr.Tags 2551 } 2552 if dcrr.Kind != "" { 2553 objectMap["kind"] = dcrr.Kind 2554 } 2555 return json.Marshal(objectMap) 2556} 2557 2558// UnmarshalJSON is the custom unmarshaler for DataCollectionRuleResource struct. 2559func (dcrr *DataCollectionRuleResource) UnmarshalJSON(body []byte) error { 2560 var m map[string]*json.RawMessage 2561 err := json.Unmarshal(body, &m) 2562 if err != nil { 2563 return err 2564 } 2565 for k, v := range m { 2566 switch k { 2567 case "properties": 2568 if v != nil { 2569 var dataCollectionRuleResourceProperties DataCollectionRuleResourceProperties 2570 err = json.Unmarshal(*v, &dataCollectionRuleResourceProperties) 2571 if err != nil { 2572 return err 2573 } 2574 dcrr.DataCollectionRuleResourceProperties = &dataCollectionRuleResourceProperties 2575 } 2576 case "location": 2577 if v != nil { 2578 var location string 2579 err = json.Unmarshal(*v, &location) 2580 if err != nil { 2581 return err 2582 } 2583 dcrr.Location = &location 2584 } 2585 case "tags": 2586 if v != nil { 2587 var tags map[string]*string 2588 err = json.Unmarshal(*v, &tags) 2589 if err != nil { 2590 return err 2591 } 2592 dcrr.Tags = tags 2593 } 2594 case "kind": 2595 if v != nil { 2596 var kind KnownDataCollectionRuleResourceKind 2597 err = json.Unmarshal(*v, &kind) 2598 if err != nil { 2599 return err 2600 } 2601 dcrr.Kind = kind 2602 } 2603 case "id": 2604 if v != nil { 2605 var ID string 2606 err = json.Unmarshal(*v, &ID) 2607 if err != nil { 2608 return err 2609 } 2610 dcrr.ID = &ID 2611 } 2612 case "name": 2613 if v != nil { 2614 var name string 2615 err = json.Unmarshal(*v, &name) 2616 if err != nil { 2617 return err 2618 } 2619 dcrr.Name = &name 2620 } 2621 case "type": 2622 if v != nil { 2623 var typeVar string 2624 err = json.Unmarshal(*v, &typeVar) 2625 if err != nil { 2626 return err 2627 } 2628 dcrr.Type = &typeVar 2629 } 2630 case "etag": 2631 if v != nil { 2632 var etag string 2633 err = json.Unmarshal(*v, &etag) 2634 if err != nil { 2635 return err 2636 } 2637 dcrr.Etag = &etag 2638 } 2639 case "systemData": 2640 if v != nil { 2641 var systemData DataCollectionRuleResourceSystemData 2642 err = json.Unmarshal(*v, &systemData) 2643 if err != nil { 2644 return err 2645 } 2646 dcrr.SystemData = &systemData 2647 } 2648 } 2649 } 2650 2651 return nil 2652} 2653 2654// DataCollectionRuleResourceListResult a pageable list of resources. 2655type DataCollectionRuleResourceListResult struct { 2656 autorest.Response `json:"-"` 2657 // Value - A list of resources. 2658 Value *[]DataCollectionRuleResource `json:"value,omitempty"` 2659 // NextLink - The URL to use for getting the next set of results. 2660 NextLink *string `json:"nextLink,omitempty"` 2661} 2662 2663// DataCollectionRuleResourceListResultIterator provides access to a complete listing of 2664// DataCollectionRuleResource values. 2665type DataCollectionRuleResourceListResultIterator struct { 2666 i int 2667 page DataCollectionRuleResourceListResultPage 2668} 2669 2670// NextWithContext advances to the next value. If there was an error making 2671// the request the iterator does not advance and the error is returned. 2672func (iter *DataCollectionRuleResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { 2673 if tracing.IsEnabled() { 2674 ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleResourceListResultIterator.NextWithContext") 2675 defer func() { 2676 sc := -1 2677 if iter.Response().Response.Response != nil { 2678 sc = iter.Response().Response.Response.StatusCode 2679 } 2680 tracing.EndSpan(ctx, sc, err) 2681 }() 2682 } 2683 iter.i++ 2684 if iter.i < len(iter.page.Values()) { 2685 return nil 2686 } 2687 err = iter.page.NextWithContext(ctx) 2688 if err != nil { 2689 iter.i-- 2690 return err 2691 } 2692 iter.i = 0 2693 return nil 2694} 2695 2696// Next advances to the next value. If there was an error making 2697// the request the iterator does not advance and the error is returned. 2698// Deprecated: Use NextWithContext() instead. 2699func (iter *DataCollectionRuleResourceListResultIterator) Next() error { 2700 return iter.NextWithContext(context.Background()) 2701} 2702 2703// NotDone returns true if the enumeration should be started or is not yet complete. 2704func (iter DataCollectionRuleResourceListResultIterator) NotDone() bool { 2705 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2706} 2707 2708// Response returns the raw server response from the last page request. 2709func (iter DataCollectionRuleResourceListResultIterator) Response() DataCollectionRuleResourceListResult { 2710 return iter.page.Response() 2711} 2712 2713// Value returns the current value or a zero-initialized value if the 2714// iterator has advanced beyond the end of the collection. 2715func (iter DataCollectionRuleResourceListResultIterator) Value() DataCollectionRuleResource { 2716 if !iter.page.NotDone() { 2717 return DataCollectionRuleResource{} 2718 } 2719 return iter.page.Values()[iter.i] 2720} 2721 2722// Creates a new instance of the DataCollectionRuleResourceListResultIterator type. 2723func NewDataCollectionRuleResourceListResultIterator(page DataCollectionRuleResourceListResultPage) DataCollectionRuleResourceListResultIterator { 2724 return DataCollectionRuleResourceListResultIterator{page: page} 2725} 2726 2727// IsEmpty returns true if the ListResult contains no values. 2728func (dcrrlr DataCollectionRuleResourceListResult) IsEmpty() bool { 2729 return dcrrlr.Value == nil || len(*dcrrlr.Value) == 0 2730} 2731 2732// hasNextLink returns true if the NextLink is not empty. 2733func (dcrrlr DataCollectionRuleResourceListResult) hasNextLink() bool { 2734 return dcrrlr.NextLink != nil && len(*dcrrlr.NextLink) != 0 2735} 2736 2737// dataCollectionRuleResourceListResultPreparer prepares a request to retrieve the next set of results. 2738// It returns nil if no more results exist. 2739func (dcrrlr DataCollectionRuleResourceListResult) dataCollectionRuleResourceListResultPreparer(ctx context.Context) (*http.Request, error) { 2740 if !dcrrlr.hasNextLink() { 2741 return nil, nil 2742 } 2743 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2744 autorest.AsJSON(), 2745 autorest.AsGet(), 2746 autorest.WithBaseURL(to.String(dcrrlr.NextLink))) 2747} 2748 2749// DataCollectionRuleResourceListResultPage contains a page of DataCollectionRuleResource values. 2750type DataCollectionRuleResourceListResultPage struct { 2751 fn func(context.Context, DataCollectionRuleResourceListResult) (DataCollectionRuleResourceListResult, error) 2752 dcrrlr DataCollectionRuleResourceListResult 2753} 2754 2755// NextWithContext advances to the next page of values. If there was an error making 2756// the request the page does not advance and the error is returned. 2757func (page *DataCollectionRuleResourceListResultPage) NextWithContext(ctx context.Context) (err error) { 2758 if tracing.IsEnabled() { 2759 ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleResourceListResultPage.NextWithContext") 2760 defer func() { 2761 sc := -1 2762 if page.Response().Response.Response != nil { 2763 sc = page.Response().Response.Response.StatusCode 2764 } 2765 tracing.EndSpan(ctx, sc, err) 2766 }() 2767 } 2768 for { 2769 next, err := page.fn(ctx, page.dcrrlr) 2770 if err != nil { 2771 return err 2772 } 2773 page.dcrrlr = next 2774 if !next.hasNextLink() || !next.IsEmpty() { 2775 break 2776 } 2777 } 2778 return nil 2779} 2780 2781// Next advances to the next page of values. If there was an error making 2782// the request the page does not advance and the error is returned. 2783// Deprecated: Use NextWithContext() instead. 2784func (page *DataCollectionRuleResourceListResultPage) Next() error { 2785 return page.NextWithContext(context.Background()) 2786} 2787 2788// NotDone returns true if the page enumeration should be started or is not yet complete. 2789func (page DataCollectionRuleResourceListResultPage) NotDone() bool { 2790 return !page.dcrrlr.IsEmpty() 2791} 2792 2793// Response returns the raw server response from the last page request. 2794func (page DataCollectionRuleResourceListResultPage) Response() DataCollectionRuleResourceListResult { 2795 return page.dcrrlr 2796} 2797 2798// Values returns the slice of values for the current page or nil if there are no values. 2799func (page DataCollectionRuleResourceListResultPage) Values() []DataCollectionRuleResource { 2800 if page.dcrrlr.IsEmpty() { 2801 return nil 2802 } 2803 return *page.dcrrlr.Value 2804} 2805 2806// Creates a new instance of the DataCollectionRuleResourceListResultPage type. 2807func NewDataCollectionRuleResourceListResultPage(cur DataCollectionRuleResourceListResult, getNextPage func(context.Context, DataCollectionRuleResourceListResult) (DataCollectionRuleResourceListResult, error)) DataCollectionRuleResourceListResultPage { 2808 return DataCollectionRuleResourceListResultPage{ 2809 fn: getNextPage, 2810 dcrrlr: cur, 2811 } 2812} 2813 2814// DataCollectionRuleResourceProperties resource properties. 2815type DataCollectionRuleResourceProperties struct { 2816 // Description - Description of the data collection rule. 2817 Description *string `json:"description,omitempty"` 2818 // ImmutableID - READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. 2819 ImmutableID *string `json:"immutableId,omitempty"` 2820 // DataSources - The specification of data sources. 2821 // This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. 2822 DataSources *DataCollectionRuleDataSources `json:"dataSources,omitempty"` 2823 // Destinations - The specification of destinations. 2824 Destinations *DataCollectionRuleDestinations `json:"destinations,omitempty"` 2825 // DataFlows - The specification of data flows. 2826 DataFlows *[]DataFlow `json:"dataFlows,omitempty"` 2827 // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleProvisioningStateCreating', 'KnownDataCollectionRuleProvisioningStateUpdating', 'KnownDataCollectionRuleProvisioningStateDeleting', 'KnownDataCollectionRuleProvisioningStateSucceeded', 'KnownDataCollectionRuleProvisioningStateFailed' 2828 ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"` 2829} 2830 2831// MarshalJSON is the custom marshaler for DataCollectionRuleResourceProperties. 2832func (dcrr DataCollectionRuleResourceProperties) MarshalJSON() ([]byte, error) { 2833 objectMap := make(map[string]interface{}) 2834 if dcrr.Description != nil { 2835 objectMap["description"] = dcrr.Description 2836 } 2837 if dcrr.DataSources != nil { 2838 objectMap["dataSources"] = dcrr.DataSources 2839 } 2840 if dcrr.Destinations != nil { 2841 objectMap["destinations"] = dcrr.Destinations 2842 } 2843 if dcrr.DataFlows != nil { 2844 objectMap["dataFlows"] = dcrr.DataFlows 2845 } 2846 return json.Marshal(objectMap) 2847} 2848 2849// DataCollectionRuleResourceSystemData metadata pertaining to creation and last modification of the 2850// resource. 2851type DataCollectionRuleResourceSystemData struct { 2852 // CreatedBy - The identity that created the resource. 2853 CreatedBy *string `json:"createdBy,omitempty"` 2854 // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' 2855 CreatedByType CreatedByType `json:"createdByType,omitempty"` 2856 // CreatedAt - The timestamp of resource creation (UTC). 2857 CreatedAt *date.Time `json:"createdAt,omitempty"` 2858 // LastModifiedBy - The identity that last modified the resource. 2859 LastModifiedBy *string `json:"lastModifiedBy,omitempty"` 2860 // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' 2861 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` 2862 // LastModifiedAt - The timestamp of resource last modification (UTC) 2863 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` 2864} 2865 2866// DataContainer information about a container with data for a given resource. 2867type DataContainer struct { 2868 // Workspace - Log Analytics workspace information. 2869 Workspace *WorkspaceInfo `json:"workspace,omitempty"` 2870} 2871 2872// DataFlow definition of which streams are sent to which destinations. 2873type DataFlow struct { 2874 // Streams - List of streams for this data flow. 2875 Streams *[]KnownDataFlowStreams `json:"streams,omitempty"` 2876 // Destinations - List of destinations for this data flow. 2877 Destinations *[]string `json:"destinations,omitempty"` 2878} 2879 2880// DataSourcesSpec specification of data sources that will be collected. 2881type DataSourcesSpec struct { 2882 // PerformanceCounters - The list of performance counter data source configurations. 2883 PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"` 2884 // WindowsEventLogs - The list of Windows Event Log data source configurations. 2885 WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"` 2886 // Syslog - The list of Syslog data source configurations. 2887 Syslog *[]SyslogDataSource `json:"syslog,omitempty"` 2888 // Extensions - The list of Azure VM extension data source configurations. 2889 Extensions *[]ExtensionDataSource `json:"extensions,omitempty"` 2890} 2891 2892// DestinationsSpec specification of destinations that can be used in data flows. 2893type DestinationsSpec struct { 2894 // LogAnalytics - List of Log Analytics destinations. 2895 LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"` 2896 // AzureMonitorMetrics - Azure Monitor Metrics destination. 2897 AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"` 2898} 2899 2900// DestinationsSpecAzureMonitorMetrics azure Monitor Metrics destination. 2901type DestinationsSpecAzureMonitorMetrics struct { 2902 // Name - A friendly name for the destination. 2903 // This name should be unique across all destinations (regardless of type) within the data collection rule. 2904 Name *string `json:"name,omitempty"` 2905} 2906 2907// DiagnosticSettings the diagnostic settings. 2908type DiagnosticSettings struct { 2909 // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. 2910 StorageAccountID *string `json:"storageAccountId,omitempty"` 2911 // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. 2912 ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` 2913 // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. 2914 EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` 2915 // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. 2916 EventHubName *string `json:"eventHubName,omitempty"` 2917 // Metrics - The list of metric settings. 2918 Metrics *[]MetricSettings `json:"metrics,omitempty"` 2919 // Logs - The list of logs settings. 2920 Logs *[]LogSettings `json:"logs,omitempty"` 2921 // 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 2922 WorkspaceID *string `json:"workspaceId,omitempty"` 2923 // 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.) 2924 LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` 2925} 2926 2927// DiagnosticSettingsCategory the diagnostic settings Category. 2928type DiagnosticSettingsCategory struct { 2929 // CategoryType - The type of the diagnostic settings category. Possible values include: 'CategoryTypeMetrics', 'CategoryTypeLogs' 2930 CategoryType CategoryType `json:"categoryType,omitempty"` 2931} 2932 2933// DiagnosticSettingsCategoryResource the diagnostic settings category resource. 2934type DiagnosticSettingsCategoryResource struct { 2935 autorest.Response `json:"-"` 2936 // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. 2937 *DiagnosticSettingsCategory `json:"properties,omitempty"` 2938 // ID - READ-ONLY; Azure resource Id 2939 ID *string `json:"id,omitempty"` 2940 // Name - READ-ONLY; Azure resource name 2941 Name *string `json:"name,omitempty"` 2942 // Type - READ-ONLY; Azure resource type 2943 Type *string `json:"type,omitempty"` 2944} 2945 2946// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. 2947func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { 2948 objectMap := make(map[string]interface{}) 2949 if dscr.DiagnosticSettingsCategory != nil { 2950 objectMap["properties"] = dscr.DiagnosticSettingsCategory 2951 } 2952 return json.Marshal(objectMap) 2953} 2954 2955// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. 2956func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error { 2957 var m map[string]*json.RawMessage 2958 err := json.Unmarshal(body, &m) 2959 if err != nil { 2960 return err 2961 } 2962 for k, v := range m { 2963 switch k { 2964 case "properties": 2965 if v != nil { 2966 var diagnosticSettingsCategory DiagnosticSettingsCategory 2967 err = json.Unmarshal(*v, &diagnosticSettingsCategory) 2968 if err != nil { 2969 return err 2970 } 2971 dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory 2972 } 2973 case "id": 2974 if v != nil { 2975 var ID string 2976 err = json.Unmarshal(*v, &ID) 2977 if err != nil { 2978 return err 2979 } 2980 dscr.ID = &ID 2981 } 2982 case "name": 2983 if v != nil { 2984 var name string 2985 err = json.Unmarshal(*v, &name) 2986 if err != nil { 2987 return err 2988 } 2989 dscr.Name = &name 2990 } 2991 case "type": 2992 if v != nil { 2993 var typeVar string 2994 err = json.Unmarshal(*v, &typeVar) 2995 if err != nil { 2996 return err 2997 } 2998 dscr.Type = &typeVar 2999 } 3000 } 3001 } 3002 3003 return nil 3004} 3005 3006// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category 3007// resources. 3008type DiagnosticSettingsCategoryResourceCollection struct { 3009 autorest.Response `json:"-"` 3010 // Value - The collection of diagnostic settings category resources. 3011 Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` 3012} 3013 3014// DiagnosticSettingsResource the diagnostic setting resource. 3015type DiagnosticSettingsResource struct { 3016 autorest.Response `json:"-"` 3017 // DiagnosticSettings - Properties of a Diagnostic Settings Resource. 3018 *DiagnosticSettings `json:"properties,omitempty"` 3019 // ID - READ-ONLY; Azure resource Id 3020 ID *string `json:"id,omitempty"` 3021 // Name - READ-ONLY; Azure resource name 3022 Name *string `json:"name,omitempty"` 3023 // Type - READ-ONLY; Azure resource type 3024 Type *string `json:"type,omitempty"` 3025} 3026 3027// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. 3028func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { 3029 objectMap := make(map[string]interface{}) 3030 if dsr.DiagnosticSettings != nil { 3031 objectMap["properties"] = dsr.DiagnosticSettings 3032 } 3033 return json.Marshal(objectMap) 3034} 3035 3036// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. 3037func (dsr *DiagnosticSettingsResource) 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 "properties": 3046 if v != nil { 3047 var diagnosticSettings DiagnosticSettings 3048 err = json.Unmarshal(*v, &diagnosticSettings) 3049 if err != nil { 3050 return err 3051 } 3052 dsr.DiagnosticSettings = &diagnosticSettings 3053 } 3054 case "id": 3055 if v != nil { 3056 var ID string 3057 err = json.Unmarshal(*v, &ID) 3058 if err != nil { 3059 return err 3060 } 3061 dsr.ID = &ID 3062 } 3063 case "name": 3064 if v != nil { 3065 var name string 3066 err = json.Unmarshal(*v, &name) 3067 if err != nil { 3068 return err 3069 } 3070 dsr.Name = &name 3071 } 3072 case "type": 3073 if v != nil { 3074 var typeVar string 3075 err = json.Unmarshal(*v, &typeVar) 3076 if err != nil { 3077 return err 3078 } 3079 dsr.Type = &typeVar 3080 } 3081 } 3082 } 3083 3084 return nil 3085} 3086 3087// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. 3088type DiagnosticSettingsResourceCollection struct { 3089 autorest.Response `json:"-"` 3090 // Value - The collection of diagnostic settings resources;. 3091 Value *[]DiagnosticSettingsResource `json:"value,omitempty"` 3092} 3093 3094// Dimension specifies the criteria for converting log to metric. 3095type Dimension struct { 3096 // Name - Name of the dimension 3097 Name *string `json:"name,omitempty"` 3098 // Operator - Operator for dimension values 3099 Operator *string `json:"operator,omitempty"` 3100 // Values - List of dimension values 3101 Values *[]string `json:"values,omitempty"` 3102} 3103 3104// DynamicMetricCriteria criterion for dynamic threshold. 3105type DynamicMetricCriteria struct { 3106 // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' 3107 Operator DynamicThresholdOperator `json:"operator,omitempty"` 3108 // 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' 3109 AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` 3110 // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. 3111 FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` 3112 // 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) 3113 IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"` 3114 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 3115 AdditionalProperties map[string]interface{} `json:""` 3116 // Name - Name of the criteria. 3117 Name *string `json:"name,omitempty"` 3118 // MetricName - Name of the metric. 3119 MetricName *string `json:"metricName,omitempty"` 3120 // MetricNamespace - Namespace of the metric. 3121 MetricNamespace *string `json:"metricNamespace,omitempty"` 3122 // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' 3123 TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` 3124 // Dimensions - List of dimension conditions. 3125 Dimensions *[]MetricDimension `json:"dimensions,omitempty"` 3126 // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. 3127 SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` 3128 // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' 3129 CriterionType CriterionType `json:"criterionType,omitempty"` 3130} 3131 3132// MarshalJSON is the custom marshaler for DynamicMetricCriteria. 3133func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { 3134 dmc.CriterionType = CriterionTypeDynamicThresholdCriterion 3135 objectMap := make(map[string]interface{}) 3136 if dmc.Operator != "" { 3137 objectMap["operator"] = dmc.Operator 3138 } 3139 if dmc.AlertSensitivity != "" { 3140 objectMap["alertSensitivity"] = dmc.AlertSensitivity 3141 } 3142 if dmc.FailingPeriods != nil { 3143 objectMap["failingPeriods"] = dmc.FailingPeriods 3144 } 3145 if dmc.IgnoreDataBefore != nil { 3146 objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore 3147 } 3148 if dmc.Name != nil { 3149 objectMap["name"] = dmc.Name 3150 } 3151 if dmc.MetricName != nil { 3152 objectMap["metricName"] = dmc.MetricName 3153 } 3154 if dmc.MetricNamespace != nil { 3155 objectMap["metricNamespace"] = dmc.MetricNamespace 3156 } 3157 if dmc.TimeAggregation != "" { 3158 objectMap["timeAggregation"] = dmc.TimeAggregation 3159 } 3160 if dmc.Dimensions != nil { 3161 objectMap["dimensions"] = dmc.Dimensions 3162 } 3163 if dmc.SkipMetricValidation != nil { 3164 objectMap["skipMetricValidation"] = dmc.SkipMetricValidation 3165 } 3166 if dmc.CriterionType != "" { 3167 objectMap["criterionType"] = dmc.CriterionType 3168 } 3169 for k, v := range dmc.AdditionalProperties { 3170 objectMap[k] = v 3171 } 3172 return json.Marshal(objectMap) 3173} 3174 3175// AsMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. 3176func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { 3177 return nil, false 3178} 3179 3180// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. 3181func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { 3182 return &dmc, true 3183} 3184 3185// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. 3186func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { 3187 return nil, false 3188} 3189 3190// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. 3191func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { 3192 return &dmc, true 3193} 3194 3195// UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct. 3196func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error { 3197 var m map[string]*json.RawMessage 3198 err := json.Unmarshal(body, &m) 3199 if err != nil { 3200 return err 3201 } 3202 for k, v := range m { 3203 switch k { 3204 case "operator": 3205 if v != nil { 3206 var operator DynamicThresholdOperator 3207 err = json.Unmarshal(*v, &operator) 3208 if err != nil { 3209 return err 3210 } 3211 dmc.Operator = operator 3212 } 3213 case "alertSensitivity": 3214 if v != nil { 3215 var alertSensitivity DynamicThresholdSensitivity 3216 err = json.Unmarshal(*v, &alertSensitivity) 3217 if err != nil { 3218 return err 3219 } 3220 dmc.AlertSensitivity = alertSensitivity 3221 } 3222 case "failingPeriods": 3223 if v != nil { 3224 var failingPeriods DynamicThresholdFailingPeriods 3225 err = json.Unmarshal(*v, &failingPeriods) 3226 if err != nil { 3227 return err 3228 } 3229 dmc.FailingPeriods = &failingPeriods 3230 } 3231 case "ignoreDataBefore": 3232 if v != nil { 3233 var ignoreDataBefore date.Time 3234 err = json.Unmarshal(*v, &ignoreDataBefore) 3235 if err != nil { 3236 return err 3237 } 3238 dmc.IgnoreDataBefore = &ignoreDataBefore 3239 } 3240 default: 3241 if v != nil { 3242 var additionalProperties interface{} 3243 err = json.Unmarshal(*v, &additionalProperties) 3244 if err != nil { 3245 return err 3246 } 3247 if dmc.AdditionalProperties == nil { 3248 dmc.AdditionalProperties = make(map[string]interface{}) 3249 } 3250 dmc.AdditionalProperties[k] = additionalProperties 3251 } 3252 case "name": 3253 if v != nil { 3254 var name string 3255 err = json.Unmarshal(*v, &name) 3256 if err != nil { 3257 return err 3258 } 3259 dmc.Name = &name 3260 } 3261 case "metricName": 3262 if v != nil { 3263 var metricName string 3264 err = json.Unmarshal(*v, &metricName) 3265 if err != nil { 3266 return err 3267 } 3268 dmc.MetricName = &metricName 3269 } 3270 case "metricNamespace": 3271 if v != nil { 3272 var metricNamespace string 3273 err = json.Unmarshal(*v, &metricNamespace) 3274 if err != nil { 3275 return err 3276 } 3277 dmc.MetricNamespace = &metricNamespace 3278 } 3279 case "timeAggregation": 3280 if v != nil { 3281 var timeAggregation AggregationTypeEnum 3282 err = json.Unmarshal(*v, &timeAggregation) 3283 if err != nil { 3284 return err 3285 } 3286 dmc.TimeAggregation = timeAggregation 3287 } 3288 case "dimensions": 3289 if v != nil { 3290 var dimensions []MetricDimension 3291 err = json.Unmarshal(*v, &dimensions) 3292 if err != nil { 3293 return err 3294 } 3295 dmc.Dimensions = &dimensions 3296 } 3297 case "skipMetricValidation": 3298 if v != nil { 3299 var skipMetricValidation bool 3300 err = json.Unmarshal(*v, &skipMetricValidation) 3301 if err != nil { 3302 return err 3303 } 3304 dmc.SkipMetricValidation = &skipMetricValidation 3305 } 3306 case "criterionType": 3307 if v != nil { 3308 var criterionType CriterionType 3309 err = json.Unmarshal(*v, &criterionType) 3310 if err != nil { 3311 return err 3312 } 3313 dmc.CriterionType = criterionType 3314 } 3315 } 3316 } 3317 3318 return nil 3319} 3320 3321// DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback 3322// time window required to raise an alert. 3323type DynamicThresholdFailingPeriods struct { 3324 // 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. 3325 NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"` 3326 // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. 3327 MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"` 3328} 3329 3330// EmailNotification email notification of an autoscale event. 3331type EmailNotification struct { 3332 // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. 3333 SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` 3334 // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. 3335 SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` 3336 // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. 3337 CustomEmails *[]string `json:"customEmails,omitempty"` 3338} 3339 3340// EmailReceiver an email receiver. 3341type EmailReceiver struct { 3342 // Name - The name of the email receiver. Names must be unique across all receivers within an action group. 3343 Name *string `json:"name,omitempty"` 3344 // EmailAddress - The email address of this receiver. 3345 EmailAddress *string `json:"emailAddress,omitempty"` 3346 // UseCommonAlertSchema - Indicates whether to use common alert schema. 3347 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` 3348 // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' 3349 Status ReceiverStatus `json:"status,omitempty"` 3350} 3351 3352// MarshalJSON is the custom marshaler for EmailReceiver. 3353func (er EmailReceiver) MarshalJSON() ([]byte, error) { 3354 objectMap := make(map[string]interface{}) 3355 if er.Name != nil { 3356 objectMap["name"] = er.Name 3357 } 3358 if er.EmailAddress != nil { 3359 objectMap["emailAddress"] = er.EmailAddress 3360 } 3361 if er.UseCommonAlertSchema != nil { 3362 objectMap["useCommonAlertSchema"] = er.UseCommonAlertSchema 3363 } 3364 return json.Marshal(objectMap) 3365} 3366 3367// EnableRequest describes a receiver that should be resubscribed. 3368type EnableRequest struct { 3369 // ReceiverName - The name of the receiver to resubscribe. 3370 ReceiverName *string `json:"receiverName,omitempty"` 3371} 3372 3373// Error error details. 3374type Error struct { 3375 // Code - Error code identifying the specific error. 3376 Code *string `json:"code,omitempty"` 3377 // Message - Error message in the caller's locale. 3378 Message *string `json:"message,omitempty"` 3379} 3380 3381// ErrorAdditionalInfo the resource management error additional info. 3382type ErrorAdditionalInfo struct { 3383 // Type - READ-ONLY; The additional info type. 3384 Type *string `json:"type,omitempty"` 3385 // Info - READ-ONLY; The additional info. 3386 Info interface{} `json:"info,omitempty"` 3387} 3388 3389// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. 3390func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { 3391 objectMap := make(map[string]interface{}) 3392 return json.Marshal(objectMap) 3393} 3394 3395// ErrorContract describes the format of Error response. 3396type ErrorContract struct { 3397 // Error - The error details. 3398 Error *ErrorResponse `json:"error,omitempty"` 3399} 3400 3401// ErrorDetail the error detail. 3402type ErrorDetail struct { 3403 // Code - READ-ONLY; The error code. 3404 Code *string `json:"code,omitempty"` 3405 // Message - READ-ONLY; The error message. 3406 Message *string `json:"message,omitempty"` 3407 // Target - READ-ONLY; The error target. 3408 Target *string `json:"target,omitempty"` 3409 // Details - READ-ONLY; The error details. 3410 Details *[]ErrorDetail `json:"details,omitempty"` 3411 // AdditionalInfo - READ-ONLY; The error additional info. 3412 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` 3413} 3414 3415// MarshalJSON is the custom marshaler for ErrorDetail. 3416func (ed ErrorDetail) MarshalJSON() ([]byte, error) { 3417 objectMap := make(map[string]interface{}) 3418 return json.Marshal(objectMap) 3419} 3420 3421// ErrorResponse describes the format of Error response. 3422type ErrorResponse struct { 3423 // Code - Error code 3424 Code *string `json:"code,omitempty"` 3425 // Message - Error message indicating why the operation failed. 3426 Message *string `json:"message,omitempty"` 3427} 3428 3429// ErrorResponseCommon the resource management error response. 3430type ErrorResponseCommon struct { 3431 // Details - READ-ONLY; The error details. 3432 Details *[]ErrorResponseCommon `json:"details,omitempty"` 3433 // AdditionalInfo - READ-ONLY; The error additional info. 3434 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` 3435 // Code - Error code 3436 Code *string `json:"code,omitempty"` 3437 // Message - Error message indicating why the operation failed. 3438 Message *string `json:"message,omitempty"` 3439} 3440 3441// MarshalJSON is the custom marshaler for ErrorResponseCommon. 3442func (erc ErrorResponseCommon) MarshalJSON() ([]byte, error) { 3443 objectMap := make(map[string]interface{}) 3444 if erc.Code != nil { 3445 objectMap["code"] = erc.Code 3446 } 3447 if erc.Message != nil { 3448 objectMap["message"] = erc.Message 3449 } 3450 return json.Marshal(objectMap) 3451} 3452 3453// ErrorResponseCommonV2 common error response for all Azure Resource Manager APIs to return error details 3454// for failed operations. (This also follows the OData error response format.). 3455type ErrorResponseCommonV2 struct { 3456 // Error - The error object. 3457 Error *ErrorDetail `json:"error,omitempty"` 3458} 3459 3460// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, 3461// Security, ServiceHealth, Alert, Recommendation, Policy. 3462type EventCategoryCollection struct { 3463 autorest.Response `json:"-"` 3464 // Value - the list that includes the Azure event categories. 3465 Value *[]LocalizableString `json:"value,omitempty"` 3466} 3467 3468// EventData the Azure event log entries are of type EventData 3469type EventData struct { 3470 // Authorization - READ-ONLY; The sender authorization information. 3471 Authorization *SenderAuthorization `json:"authorization,omitempty"` 3472 // Claims - READ-ONLY; key value pairs to identify ARM permissions. 3473 Claims map[string]*string `json:"claims"` 3474 // Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. 3475 Caller *string `json:"caller,omitempty"` 3476 // Description - READ-ONLY; the description of the event. 3477 Description *string `json:"description,omitempty"` 3478 // ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. 3479 ID *string `json:"id,omitempty"` 3480 // EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event. 3481 EventDataID *string `json:"eventDataId,omitempty"` 3482 // 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. 3483 CorrelationID *string `json:"correlationId,omitempty"` 3484 // 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. 3485 EventName *LocalizableString `json:"eventName,omitempty"` 3486 // Category - READ-ONLY; the event category. 3487 Category *LocalizableString `json:"category,omitempty"` 3488 // 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). 3489 HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` 3490 // Level - READ-ONLY; the event level. Possible values include: 'EventLevelCritical', 'EventLevelError', 'EventLevelWarning', 'EventLevelInformational', 'EventLevelVerbose' 3491 Level EventLevel `json:"level,omitempty"` 3492 // ResourceGroupName - READ-ONLY; the resource group name of the impacted resource. 3493 ResourceGroupName *string `json:"resourceGroupName,omitempty"` 3494 // ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource. 3495 ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` 3496 // ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. 3497 ResourceID *string `json:"resourceId,omitempty"` 3498 // ResourceType - READ-ONLY; the resource type 3499 ResourceType *LocalizableString `json:"resourceType,omitempty"` 3500 // OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. 3501 OperationID *string `json:"operationId,omitempty"` 3502 // OperationName - READ-ONLY; the operation name. 3503 OperationName *LocalizableString `json:"operationName,omitempty"` 3504 // Properties - READ-ONLY; the set of <Key, Value> pairs (usually a Dictionary<String, String>) that includes details about the event. 3505 Properties map[string]*string `json:"properties"` 3506 // Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. 3507 Status *LocalizableString `json:"status,omitempty"` 3508 // 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) 3509 SubStatus *LocalizableString `json:"subStatus,omitempty"` 3510 // 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. 3511 EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` 3512 // 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. 3513 SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` 3514 // SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID. 3515 SubscriptionID *string `json:"subscriptionId,omitempty"` 3516 // TenantID - READ-ONLY; the Azure tenant Id 3517 TenantID *string `json:"tenantId,omitempty"` 3518} 3519 3520// MarshalJSON is the custom marshaler for EventData. 3521func (ed EventData) MarshalJSON() ([]byte, error) { 3522 objectMap := make(map[string]interface{}) 3523 return json.Marshal(objectMap) 3524} 3525 3526// EventDataCollection represents collection of events. 3527type EventDataCollection struct { 3528 autorest.Response `json:"-"` 3529 // Value - this list that includes the Azure audit logs. 3530 Value *[]EventData `json:"value,omitempty"` 3531 // NextLink - Provides the link to retrieve the next set of events. 3532 NextLink *string `json:"nextLink,omitempty"` 3533} 3534 3535// EventDataCollectionIterator provides access to a complete listing of EventData values. 3536type EventDataCollectionIterator struct { 3537 i int 3538 page EventDataCollectionPage 3539} 3540 3541// NextWithContext advances to the next value. If there was an error making 3542// the request the iterator does not advance and the error is returned. 3543func (iter *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) { 3544 if tracing.IsEnabled() { 3545 ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.NextWithContext") 3546 defer func() { 3547 sc := -1 3548 if iter.Response().Response.Response != nil { 3549 sc = iter.Response().Response.Response.StatusCode 3550 } 3551 tracing.EndSpan(ctx, sc, err) 3552 }() 3553 } 3554 iter.i++ 3555 if iter.i < len(iter.page.Values()) { 3556 return nil 3557 } 3558 err = iter.page.NextWithContext(ctx) 3559 if err != nil { 3560 iter.i-- 3561 return err 3562 } 3563 iter.i = 0 3564 return nil 3565} 3566 3567// Next advances to the next value. If there was an error making 3568// the request the iterator does not advance and the error is returned. 3569// Deprecated: Use NextWithContext() instead. 3570func (iter *EventDataCollectionIterator) Next() error { 3571 return iter.NextWithContext(context.Background()) 3572} 3573 3574// NotDone returns true if the enumeration should be started or is not yet complete. 3575func (iter EventDataCollectionIterator) NotDone() bool { 3576 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3577} 3578 3579// Response returns the raw server response from the last page request. 3580func (iter EventDataCollectionIterator) Response() EventDataCollection { 3581 return iter.page.Response() 3582} 3583 3584// Value returns the current value or a zero-initialized value if the 3585// iterator has advanced beyond the end of the collection. 3586func (iter EventDataCollectionIterator) Value() EventData { 3587 if !iter.page.NotDone() { 3588 return EventData{} 3589 } 3590 return iter.page.Values()[iter.i] 3591} 3592 3593// Creates a new instance of the EventDataCollectionIterator type. 3594func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator { 3595 return EventDataCollectionIterator{page: page} 3596} 3597 3598// IsEmpty returns true if the ListResult contains no values. 3599func (edc EventDataCollection) IsEmpty() bool { 3600 return edc.Value == nil || len(*edc.Value) == 0 3601} 3602 3603// hasNextLink returns true if the NextLink is not empty. 3604func (edc EventDataCollection) hasNextLink() bool { 3605 return edc.NextLink != nil && len(*edc.NextLink) != 0 3606} 3607 3608// eventDataCollectionPreparer prepares a request to retrieve the next set of results. 3609// It returns nil if no more results exist. 3610func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) { 3611 if !edc.hasNextLink() { 3612 return nil, nil 3613 } 3614 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3615 autorest.AsJSON(), 3616 autorest.AsGet(), 3617 autorest.WithBaseURL(to.String(edc.NextLink))) 3618} 3619 3620// EventDataCollectionPage contains a page of EventData values. 3621type EventDataCollectionPage struct { 3622 fn func(context.Context, EventDataCollection) (EventDataCollection, error) 3623 edc EventDataCollection 3624} 3625 3626// NextWithContext advances to the next page of values. If there was an error making 3627// the request the page does not advance and the error is returned. 3628func (page *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) { 3629 if tracing.IsEnabled() { 3630 ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.NextWithContext") 3631 defer func() { 3632 sc := -1 3633 if page.Response().Response.Response != nil { 3634 sc = page.Response().Response.Response.StatusCode 3635 } 3636 tracing.EndSpan(ctx, sc, err) 3637 }() 3638 } 3639 for { 3640 next, err := page.fn(ctx, page.edc) 3641 if err != nil { 3642 return err 3643 } 3644 page.edc = next 3645 if !next.hasNextLink() || !next.IsEmpty() { 3646 break 3647 } 3648 } 3649 return nil 3650} 3651 3652// Next advances to the next page of values. If there was an error making 3653// the request the page does not advance and the error is returned. 3654// Deprecated: Use NextWithContext() instead. 3655func (page *EventDataCollectionPage) Next() error { 3656 return page.NextWithContext(context.Background()) 3657} 3658 3659// NotDone returns true if the page enumeration should be started or is not yet complete. 3660func (page EventDataCollectionPage) NotDone() bool { 3661 return !page.edc.IsEmpty() 3662} 3663 3664// Response returns the raw server response from the last page request. 3665func (page EventDataCollectionPage) Response() EventDataCollection { 3666 return page.edc 3667} 3668 3669// Values returns the slice of values for the current page or nil if there are no values. 3670func (page EventDataCollectionPage) Values() []EventData { 3671 if page.edc.IsEmpty() { 3672 return nil 3673 } 3674 return *page.edc.Value 3675} 3676 3677// Creates a new instance of the EventDataCollectionPage type. 3678func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage { 3679 return EventDataCollectionPage{ 3680 fn: getNextPage, 3681 edc: cur, 3682 } 3683} 3684 3685// ExtensionDataSource definition of which data will be collected from a separate VM extension that 3686// integrates with the Azure Monitor Agent. 3687// Collected from either Windows and Linux machines, depending on which extension is defined. 3688type ExtensionDataSource struct { 3689 // Streams - List of streams that this data source will be sent to. 3690 // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. 3691 Streams *[]KnownExtensionDataSourceStreams `json:"streams,omitempty"` 3692 // ExtensionName - The name of the VM extension. 3693 ExtensionName *string `json:"extensionName,omitempty"` 3694 // ExtensionSettings - The extension settings. The format is specific for particular extension. 3695 ExtensionSettings interface{} `json:"extensionSettings,omitempty"` 3696 // InputDataSources - The list of data sources this extension needs data from. 3697 InputDataSources *[]string `json:"inputDataSources,omitempty"` 3698 // Name - A friendly name for the data source. 3699 // This name should be unique across all data sources (regardless of type) within the data collection rule. 3700 Name *string `json:"name,omitempty"` 3701} 3702 3703// HTTPRequestInfo the Http request info. 3704type HTTPRequestInfo struct { 3705 // ClientRequestID - the client request id. 3706 ClientRequestID *string `json:"clientRequestId,omitempty"` 3707 // ClientIPAddress - the client Ip Address 3708 ClientIPAddress *string `json:"clientIpAddress,omitempty"` 3709 // Method - the Http request method. 3710 Method *string `json:"method,omitempty"` 3711 // URI - the Uri. 3712 URI *string `json:"uri,omitempty"` 3713} 3714 3715// Incident an alert incident indicates the activation status of an alert rule. 3716type Incident struct { 3717 autorest.Response `json:"-"` 3718 // Name - READ-ONLY; Incident name. 3719 Name *string `json:"name,omitempty"` 3720 // RuleName - READ-ONLY; Rule name that is associated with the incident. 3721 RuleName *string `json:"ruleName,omitempty"` 3722 // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. 3723 IsActive *bool `json:"isActive,omitempty"` 3724 // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. 3725 ActivatedTime *date.Time `json:"activatedTime,omitempty"` 3726 // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. 3727 ResolvedTime *date.Time `json:"resolvedTime,omitempty"` 3728} 3729 3730// MarshalJSON is the custom marshaler for Incident. 3731func (i Incident) MarshalJSON() ([]byte, error) { 3732 objectMap := make(map[string]interface{}) 3733 return json.Marshal(objectMap) 3734} 3735 3736// IncidentListResult the List incidents operation response. 3737type IncidentListResult struct { 3738 autorest.Response `json:"-"` 3739 // Value - the incident collection. 3740 Value *[]Incident `json:"value,omitempty"` 3741} 3742 3743// ItsmReceiver an Itsm receiver. 3744type ItsmReceiver struct { 3745 // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. 3746 Name *string `json:"name,omitempty"` 3747 // WorkspaceID - OMS LA instance identifier. 3748 WorkspaceID *string `json:"workspaceId,omitempty"` 3749 // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. 3750 ConnectionID *string `json:"connectionId,omitempty"` 3751 // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. 3752 TicketConfiguration *string `json:"ticketConfiguration,omitempty"` 3753 // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' 3754 Region *string `json:"region,omitempty"` 3755} 3756 3757// LocalizableString the localizable string class. 3758type LocalizableString struct { 3759 // Value - the invariant value. 3760 Value *string `json:"value,omitempty"` 3761 // LocalizedValue - the locale specific value. 3762 LocalizedValue *string `json:"localizedValue,omitempty"` 3763} 3764 3765// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. 3766type LocationThresholdRuleCondition struct { 3767 // 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. 3768 WindowSize *string `json:"windowSize,omitempty"` 3769 // FailedLocationCount - the number of locations that must fail to activate the alert. 3770 FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` 3771 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 3772 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 3773 // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 3774 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 3775} 3776 3777// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. 3778func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { 3779 ltrc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition 3780 objectMap := make(map[string]interface{}) 3781 if ltrc.WindowSize != nil { 3782 objectMap["windowSize"] = ltrc.WindowSize 3783 } 3784 if ltrc.FailedLocationCount != nil { 3785 objectMap["failedLocationCount"] = ltrc.FailedLocationCount 3786 } 3787 objectMap["dataSource"] = ltrc.DataSource 3788 if ltrc.OdataType != "" { 3789 objectMap["odata.type"] = ltrc.OdataType 3790 } 3791 return json.Marshal(objectMap) 3792} 3793 3794// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 3795func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 3796 return nil, false 3797} 3798 3799// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 3800func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 3801 return <rc, true 3802} 3803 3804// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 3805func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 3806 return nil, false 3807} 3808 3809// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 3810func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { 3811 return nil, false 3812} 3813 3814// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. 3815func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 3816 return <rc, true 3817} 3818 3819// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. 3820func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error { 3821 var m map[string]*json.RawMessage 3822 err := json.Unmarshal(body, &m) 3823 if err != nil { 3824 return err 3825 } 3826 for k, v := range m { 3827 switch k { 3828 case "windowSize": 3829 if v != nil { 3830 var windowSize string 3831 err = json.Unmarshal(*v, &windowSize) 3832 if err != nil { 3833 return err 3834 } 3835 ltrc.WindowSize = &windowSize 3836 } 3837 case "failedLocationCount": 3838 if v != nil { 3839 var failedLocationCount int32 3840 err = json.Unmarshal(*v, &failedLocationCount) 3841 if err != nil { 3842 return err 3843 } 3844 ltrc.FailedLocationCount = &failedLocationCount 3845 } 3846 case "dataSource": 3847 if v != nil { 3848 dataSource, err := unmarshalBasicRuleDataSource(*v) 3849 if err != nil { 3850 return err 3851 } 3852 ltrc.DataSource = dataSource 3853 } 3854 case "odata.type": 3855 if v != nil { 3856 var odataType OdataTypeBasicRuleCondition 3857 err = json.Unmarshal(*v, &odataType) 3858 if err != nil { 3859 return err 3860 } 3861 ltrc.OdataType = odataType 3862 } 3863 } 3864 } 3865 3866 return nil 3867} 3868 3869// LogAnalyticsDestination log Analytics destination. 3870type LogAnalyticsDestination struct { 3871 // WorkspaceResourceID - The resource ID of the Log Analytics workspace. 3872 WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` 3873 // WorkspaceID - READ-ONLY; The Customer ID of the Log Analytics workspace. 3874 WorkspaceID *string `json:"workspaceId,omitempty"` 3875 // Name - A friendly name for the destination. 3876 // This name should be unique across all destinations (regardless of type) within the data collection rule. 3877 Name *string `json:"name,omitempty"` 3878} 3879 3880// MarshalJSON is the custom marshaler for LogAnalyticsDestination. 3881func (lad LogAnalyticsDestination) MarshalJSON() ([]byte, error) { 3882 objectMap := make(map[string]interface{}) 3883 if lad.WorkspaceResourceID != nil { 3884 objectMap["workspaceResourceId"] = lad.WorkspaceResourceID 3885 } 3886 if lad.Name != nil { 3887 objectMap["name"] = lad.Name 3888 } 3889 return json.Marshal(objectMap) 3890} 3891 3892// LogicAppReceiver a logic app receiver. 3893type LogicAppReceiver struct { 3894 // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. 3895 Name *string `json:"name,omitempty"` 3896 // ResourceID - The azure resource id of the logic app receiver. 3897 ResourceID *string `json:"resourceId,omitempty"` 3898 // CallbackURL - The callback url where http request sent to. 3899 CallbackURL *string `json:"callbackUrl,omitempty"` 3900 // UseCommonAlertSchema - Indicates whether to use common alert schema. 3901 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` 3902} 3903 3904// LogMetricTrigger a log metrics trigger descriptor. 3905type LogMetricTrigger struct { 3906 // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' 3907 ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` 3908 // Threshold - The threshold of the metric trigger. 3909 Threshold *float64 `json:"threshold,omitempty"` 3910 // MetricTriggerType - Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'MetricTriggerTypeConsecutive', 'MetricTriggerTypeTotal' 3911 MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"` 3912 // MetricColumn - Evaluation of metric on a particular column 3913 MetricColumn *string `json:"metricColumn,omitempty"` 3914} 3915 3916// LogProfileCollection represents a collection of log profiles. 3917type LogProfileCollection struct { 3918 autorest.Response `json:"-"` 3919 // Value - the values of the log profiles. 3920 Value *[]LogProfileResource `json:"value,omitempty"` 3921} 3922 3923// LogProfileProperties the log profile properties. 3924type LogProfileProperties struct { 3925 // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. 3926 StorageAccountID *string `json:"storageAccountId,omitempty"` 3927 // 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}'. 3928 ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` 3929 // 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. 3930 Locations *[]string `json:"locations,omitempty"` 3931 // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' 3932 Categories *[]string `json:"categories,omitempty"` 3933 // RetentionPolicy - the retention policy for the events in the log. 3934 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 3935} 3936 3937// LogProfileResource the log profile resource. 3938type LogProfileResource struct { 3939 autorest.Response `json:"-"` 3940 // LogProfileProperties - The log profile properties of the resource. 3941 *LogProfileProperties `json:"properties,omitempty"` 3942 // ID - READ-ONLY; Azure resource Id 3943 ID *string `json:"id,omitempty"` 3944 // Name - READ-ONLY; Azure resource name 3945 Name *string `json:"name,omitempty"` 3946 // Type - READ-ONLY; Azure resource type 3947 Type *string `json:"type,omitempty"` 3948 // Location - Resource location 3949 Location *string `json:"location,omitempty"` 3950 // Tags - Resource tags 3951 Tags map[string]*string `json:"tags"` 3952 // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. 3953 Kind *string `json:"kind,omitempty"` 3954 // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. 3955 Etag *string `json:"etag,omitempty"` 3956} 3957 3958// MarshalJSON is the custom marshaler for LogProfileResource. 3959func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { 3960 objectMap := make(map[string]interface{}) 3961 if lpr.LogProfileProperties != nil { 3962 objectMap["properties"] = lpr.LogProfileProperties 3963 } 3964 if lpr.Location != nil { 3965 objectMap["location"] = lpr.Location 3966 } 3967 if lpr.Tags != nil { 3968 objectMap["tags"] = lpr.Tags 3969 } 3970 return json.Marshal(objectMap) 3971} 3972 3973// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. 3974func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { 3975 var m map[string]*json.RawMessage 3976 err := json.Unmarshal(body, &m) 3977 if err != nil { 3978 return err 3979 } 3980 for k, v := range m { 3981 switch k { 3982 case "properties": 3983 if v != nil { 3984 var logProfileProperties LogProfileProperties 3985 err = json.Unmarshal(*v, &logProfileProperties) 3986 if err != nil { 3987 return err 3988 } 3989 lpr.LogProfileProperties = &logProfileProperties 3990 } 3991 case "id": 3992 if v != nil { 3993 var ID string 3994 err = json.Unmarshal(*v, &ID) 3995 if err != nil { 3996 return err 3997 } 3998 lpr.ID = &ID 3999 } 4000 case "name": 4001 if v != nil { 4002 var name string 4003 err = json.Unmarshal(*v, &name) 4004 if err != nil { 4005 return err 4006 } 4007 lpr.Name = &name 4008 } 4009 case "type": 4010 if v != nil { 4011 var typeVar string 4012 err = json.Unmarshal(*v, &typeVar) 4013 if err != nil { 4014 return err 4015 } 4016 lpr.Type = &typeVar 4017 } 4018 case "location": 4019 if v != nil { 4020 var location string 4021 err = json.Unmarshal(*v, &location) 4022 if err != nil { 4023 return err 4024 } 4025 lpr.Location = &location 4026 } 4027 case "tags": 4028 if v != nil { 4029 var tags map[string]*string 4030 err = json.Unmarshal(*v, &tags) 4031 if err != nil { 4032 return err 4033 } 4034 lpr.Tags = tags 4035 } 4036 case "kind": 4037 if v != nil { 4038 var kind string 4039 err = json.Unmarshal(*v, &kind) 4040 if err != nil { 4041 return err 4042 } 4043 lpr.Kind = &kind 4044 } 4045 case "etag": 4046 if v != nil { 4047 var etag string 4048 err = json.Unmarshal(*v, &etag) 4049 if err != nil { 4050 return err 4051 } 4052 lpr.Etag = &etag 4053 } 4054 } 4055 } 4056 4057 return nil 4058} 4059 4060// LogProfileResourcePatch the log profile resource for patch operations. 4061type LogProfileResourcePatch struct { 4062 // Tags - Resource tags 4063 Tags map[string]*string `json:"tags"` 4064 // LogProfileProperties - The log profile properties for an update operation. 4065 *LogProfileProperties `json:"properties,omitempty"` 4066} 4067 4068// MarshalJSON is the custom marshaler for LogProfileResourcePatch. 4069func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { 4070 objectMap := make(map[string]interface{}) 4071 if lprp.Tags != nil { 4072 objectMap["tags"] = lprp.Tags 4073 } 4074 if lprp.LogProfileProperties != nil { 4075 objectMap["properties"] = lprp.LogProfileProperties 4076 } 4077 return json.Marshal(objectMap) 4078} 4079 4080// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. 4081func (lprp *LogProfileResourcePatch) 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 "tags": 4090 if v != nil { 4091 var tags map[string]*string 4092 err = json.Unmarshal(*v, &tags) 4093 if err != nil { 4094 return err 4095 } 4096 lprp.Tags = tags 4097 } 4098 case "properties": 4099 if v != nil { 4100 var logProfileProperties LogProfileProperties 4101 err = json.Unmarshal(*v, &logProfileProperties) 4102 if err != nil { 4103 return err 4104 } 4105 lprp.LogProfileProperties = &logProfileProperties 4106 } 4107 } 4108 } 4109 4110 return nil 4111} 4112 4113// LogSearchRule log Search Rule Definition 4114type LogSearchRule struct { 4115 // CreatedWithAPIVersion - READ-ONLY; The api-version used when creating this alert rule 4116 CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty"` 4117 // IsLegacyLogAnalyticsRule - READ-ONLY; True if alert rule is legacy Log Analytic rule 4118 IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` 4119 // Description - The description of the Log Search rule. 4120 Description *string `json:"description,omitempty"` 4121 // DisplayName - The display name of the alert rule 4122 DisplayName *string `json:"displayName,omitempty"` 4123 // AutoMitigate - The flag that indicates whether the alert should be automatically resolved or not. The default is false. 4124 AutoMitigate *bool `json:"autoMitigate,omitempty"` 4125 // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'EnabledTrue', 'EnabledFalse' 4126 Enabled Enabled `json:"enabled,omitempty"` 4127 // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. 4128 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 4129 // ProvisioningState - READ-ONLY; Provisioning state of the scheduled query rule. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateDeploying', 'ProvisioningStateCanceled', 'ProvisioningStateFailed' 4130 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 4131 // Source - Data Source against which rule will Query Data 4132 Source *Source `json:"source,omitempty"` 4133 // Schedule - Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction 4134 Schedule *Schedule `json:"schedule,omitempty"` 4135 // Action - Action needs to be taken on rule execution. 4136 Action BasicAction `json:"action,omitempty"` 4137} 4138 4139// MarshalJSON is the custom marshaler for LogSearchRule. 4140func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { 4141 objectMap := make(map[string]interface{}) 4142 if lsr.Description != nil { 4143 objectMap["description"] = lsr.Description 4144 } 4145 if lsr.DisplayName != nil { 4146 objectMap["displayName"] = lsr.DisplayName 4147 } 4148 if lsr.AutoMitigate != nil { 4149 objectMap["autoMitigate"] = lsr.AutoMitigate 4150 } 4151 if lsr.Enabled != "" { 4152 objectMap["enabled"] = lsr.Enabled 4153 } 4154 if lsr.Source != nil { 4155 objectMap["source"] = lsr.Source 4156 } 4157 if lsr.Schedule != nil { 4158 objectMap["schedule"] = lsr.Schedule 4159 } 4160 objectMap["action"] = lsr.Action 4161 return json.Marshal(objectMap) 4162} 4163 4164// UnmarshalJSON is the custom unmarshaler for LogSearchRule struct. 4165func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { 4166 var m map[string]*json.RawMessage 4167 err := json.Unmarshal(body, &m) 4168 if err != nil { 4169 return err 4170 } 4171 for k, v := range m { 4172 switch k { 4173 case "createdWithApiVersion": 4174 if v != nil { 4175 var createdWithAPIVersion string 4176 err = json.Unmarshal(*v, &createdWithAPIVersion) 4177 if err != nil { 4178 return err 4179 } 4180 lsr.CreatedWithAPIVersion = &createdWithAPIVersion 4181 } 4182 case "isLegacyLogAnalyticsRule": 4183 if v != nil { 4184 var isLegacyLogAnalyticsRule bool 4185 err = json.Unmarshal(*v, &isLegacyLogAnalyticsRule) 4186 if err != nil { 4187 return err 4188 } 4189 lsr.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule 4190 } 4191 case "description": 4192 if v != nil { 4193 var description string 4194 err = json.Unmarshal(*v, &description) 4195 if err != nil { 4196 return err 4197 } 4198 lsr.Description = &description 4199 } 4200 case "displayName": 4201 if v != nil { 4202 var displayName string 4203 err = json.Unmarshal(*v, &displayName) 4204 if err != nil { 4205 return err 4206 } 4207 lsr.DisplayName = &displayName 4208 } 4209 case "autoMitigate": 4210 if v != nil { 4211 var autoMitigate bool 4212 err = json.Unmarshal(*v, &autoMitigate) 4213 if err != nil { 4214 return err 4215 } 4216 lsr.AutoMitigate = &autoMitigate 4217 } 4218 case "enabled": 4219 if v != nil { 4220 var enabled Enabled 4221 err = json.Unmarshal(*v, &enabled) 4222 if err != nil { 4223 return err 4224 } 4225 lsr.Enabled = enabled 4226 } 4227 case "lastUpdatedTime": 4228 if v != nil { 4229 var lastUpdatedTime date.Time 4230 err = json.Unmarshal(*v, &lastUpdatedTime) 4231 if err != nil { 4232 return err 4233 } 4234 lsr.LastUpdatedTime = &lastUpdatedTime 4235 } 4236 case "provisioningState": 4237 if v != nil { 4238 var provisioningState ProvisioningState 4239 err = json.Unmarshal(*v, &provisioningState) 4240 if err != nil { 4241 return err 4242 } 4243 lsr.ProvisioningState = provisioningState 4244 } 4245 case "source": 4246 if v != nil { 4247 var source Source 4248 err = json.Unmarshal(*v, &source) 4249 if err != nil { 4250 return err 4251 } 4252 lsr.Source = &source 4253 } 4254 case "schedule": 4255 if v != nil { 4256 var schedule Schedule 4257 err = json.Unmarshal(*v, &schedule) 4258 if err != nil { 4259 return err 4260 } 4261 lsr.Schedule = &schedule 4262 } 4263 case "action": 4264 if v != nil { 4265 action, err := unmarshalBasicAction(*v) 4266 if err != nil { 4267 return err 4268 } 4269 lsr.Action = action 4270 } 4271 } 4272 } 4273 4274 return nil 4275} 4276 4277// LogSearchRulePatch log Search Rule Definition for Patching 4278type LogSearchRulePatch struct { 4279 // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'EnabledTrue', 'EnabledFalse' 4280 Enabled Enabled `json:"enabled,omitempty"` 4281} 4282 4283// LogSearchRuleResource the Log Search Rule resource. 4284type LogSearchRuleResource struct { 4285 autorest.Response `json:"-"` 4286 // LogSearchRule - The rule properties of the resource. 4287 *LogSearchRule `json:"properties,omitempty"` 4288 // ID - READ-ONLY; Azure resource Id 4289 ID *string `json:"id,omitempty"` 4290 // Name - READ-ONLY; Azure resource name 4291 Name *string `json:"name,omitempty"` 4292 // Type - READ-ONLY; Azure resource type 4293 Type *string `json:"type,omitempty"` 4294 // Location - Resource location 4295 Location *string `json:"location,omitempty"` 4296 // Tags - Resource tags 4297 Tags map[string]*string `json:"tags"` 4298 // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. 4299 Kind *string `json:"kind,omitempty"` 4300 // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. 4301 Etag *string `json:"etag,omitempty"` 4302} 4303 4304// MarshalJSON is the custom marshaler for LogSearchRuleResource. 4305func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) { 4306 objectMap := make(map[string]interface{}) 4307 if lsrr.LogSearchRule != nil { 4308 objectMap["properties"] = lsrr.LogSearchRule 4309 } 4310 if lsrr.Location != nil { 4311 objectMap["location"] = lsrr.Location 4312 } 4313 if lsrr.Tags != nil { 4314 objectMap["tags"] = lsrr.Tags 4315 } 4316 return json.Marshal(objectMap) 4317} 4318 4319// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResource struct. 4320func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error { 4321 var m map[string]*json.RawMessage 4322 err := json.Unmarshal(body, &m) 4323 if err != nil { 4324 return err 4325 } 4326 for k, v := range m { 4327 switch k { 4328 case "properties": 4329 if v != nil { 4330 var logSearchRule LogSearchRule 4331 err = json.Unmarshal(*v, &logSearchRule) 4332 if err != nil { 4333 return err 4334 } 4335 lsrr.LogSearchRule = &logSearchRule 4336 } 4337 case "id": 4338 if v != nil { 4339 var ID string 4340 err = json.Unmarshal(*v, &ID) 4341 if err != nil { 4342 return err 4343 } 4344 lsrr.ID = &ID 4345 } 4346 case "name": 4347 if v != nil { 4348 var name string 4349 err = json.Unmarshal(*v, &name) 4350 if err != nil { 4351 return err 4352 } 4353 lsrr.Name = &name 4354 } 4355 case "type": 4356 if v != nil { 4357 var typeVar string 4358 err = json.Unmarshal(*v, &typeVar) 4359 if err != nil { 4360 return err 4361 } 4362 lsrr.Type = &typeVar 4363 } 4364 case "location": 4365 if v != nil { 4366 var location string 4367 err = json.Unmarshal(*v, &location) 4368 if err != nil { 4369 return err 4370 } 4371 lsrr.Location = &location 4372 } 4373 case "tags": 4374 if v != nil { 4375 var tags map[string]*string 4376 err = json.Unmarshal(*v, &tags) 4377 if err != nil { 4378 return err 4379 } 4380 lsrr.Tags = tags 4381 } 4382 case "kind": 4383 if v != nil { 4384 var kind string 4385 err = json.Unmarshal(*v, &kind) 4386 if err != nil { 4387 return err 4388 } 4389 lsrr.Kind = &kind 4390 } 4391 case "etag": 4392 if v != nil { 4393 var etag string 4394 err = json.Unmarshal(*v, &etag) 4395 if err != nil { 4396 return err 4397 } 4398 lsrr.Etag = &etag 4399 } 4400 } 4401 } 4402 4403 return nil 4404} 4405 4406// LogSearchRuleResourceCollection represents a collection of Log Search rule resources. 4407type LogSearchRuleResourceCollection struct { 4408 autorest.Response `json:"-"` 4409 // Value - The values for the Log Search Rule resources. 4410 Value *[]LogSearchRuleResource `json:"value,omitempty"` 4411} 4412 4413// LogSearchRuleResourcePatch the log search rule resource for patch operations. 4414type LogSearchRuleResourcePatch struct { 4415 // Tags - Resource tags 4416 Tags map[string]*string `json:"tags"` 4417 // LogSearchRulePatch - The log search rule properties of the resource. 4418 *LogSearchRulePatch `json:"properties,omitempty"` 4419} 4420 4421// MarshalJSON is the custom marshaler for LogSearchRuleResourcePatch. 4422func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) { 4423 objectMap := make(map[string]interface{}) 4424 if lsrrp.Tags != nil { 4425 objectMap["tags"] = lsrrp.Tags 4426 } 4427 if lsrrp.LogSearchRulePatch != nil { 4428 objectMap["properties"] = lsrrp.LogSearchRulePatch 4429 } 4430 return json.Marshal(objectMap) 4431} 4432 4433// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResourcePatch struct. 4434func (lsrrp *LogSearchRuleResourcePatch) UnmarshalJSON(body []byte) error { 4435 var m map[string]*json.RawMessage 4436 err := json.Unmarshal(body, &m) 4437 if err != nil { 4438 return err 4439 } 4440 for k, v := range m { 4441 switch k { 4442 case "tags": 4443 if v != nil { 4444 var tags map[string]*string 4445 err = json.Unmarshal(*v, &tags) 4446 if err != nil { 4447 return err 4448 } 4449 lsrrp.Tags = tags 4450 } 4451 case "properties": 4452 if v != nil { 4453 var logSearchRulePatch LogSearchRulePatch 4454 err = json.Unmarshal(*v, &logSearchRulePatch) 4455 if err != nil { 4456 return err 4457 } 4458 lsrrp.LogSearchRulePatch = &logSearchRulePatch 4459 } 4460 } 4461 } 4462 4463 return nil 4464} 4465 4466// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. 4467type LogSettings struct { 4468 // 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. 4469 Category *string `json:"category,omitempty"` 4470 // Enabled - a value indicating whether this log is enabled. 4471 Enabled *bool `json:"enabled,omitempty"` 4472 // RetentionPolicy - the retention policy for this log. 4473 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 4474} 4475 4476// LogsIngestionEndpointSpec definition of the endpoint used for ingesting logs. 4477type LogsIngestionEndpointSpec struct { 4478 // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. 4479 Endpoint *string `json:"endpoint,omitempty"` 4480} 4481 4482// MarshalJSON is the custom marshaler for LogsIngestionEndpointSpec. 4483func (lies LogsIngestionEndpointSpec) MarshalJSON() ([]byte, error) { 4484 objectMap := make(map[string]interface{}) 4485 return json.Marshal(objectMap) 4486} 4487 4488// LogToMetricAction specify action need to be taken when rule type is converting log to metric 4489type LogToMetricAction struct { 4490 // Criteria - Criteria of Metric 4491 Criteria *[]Criteria `json:"criteria,omitempty"` 4492 // OdataType - Possible values include: 'OdataTypeBasicActionOdataTypeAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' 4493 OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` 4494} 4495 4496// MarshalJSON is the custom marshaler for LogToMetricAction. 4497func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) { 4498 ltma.OdataType = OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction 4499 objectMap := make(map[string]interface{}) 4500 if ltma.Criteria != nil { 4501 objectMap["criteria"] = ltma.Criteria 4502 } 4503 if ltma.OdataType != "" { 4504 objectMap["odata.type"] = ltma.OdataType 4505 } 4506 return json.Marshal(objectMap) 4507} 4508 4509// AsAlertingAction is the BasicAction implementation for LogToMetricAction. 4510func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) { 4511 return nil, false 4512} 4513 4514// AsLogToMetricAction is the BasicAction implementation for LogToMetricAction. 4515func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) { 4516 return <ma, true 4517} 4518 4519// AsAction is the BasicAction implementation for LogToMetricAction. 4520func (ltma LogToMetricAction) AsAction() (*Action, bool) { 4521 return nil, false 4522} 4523 4524// AsBasicAction is the BasicAction implementation for LogToMetricAction. 4525func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) { 4526 return <ma, true 4527} 4528 4529// ManagementEventAggregationCondition how the data that is collected should be combined over time. 4530type ManagementEventAggregationCondition struct { 4531 // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' 4532 Operator ConditionOperator `json:"operator,omitempty"` 4533 // Threshold - The threshold value that activates the alert. 4534 Threshold *float64 `json:"threshold,omitempty"` 4535 // 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. 4536 WindowSize *string `json:"windowSize,omitempty"` 4537} 4538 4539// ManagementEventRuleCondition a management event rule condition. 4540type ManagementEventRuleCondition struct { 4541 // 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. 4542 Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` 4543 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 4544 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 4545 // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 4546 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 4547} 4548 4549// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. 4550func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { 4551 merc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition 4552 objectMap := make(map[string]interface{}) 4553 if merc.Aggregation != nil { 4554 objectMap["aggregation"] = merc.Aggregation 4555 } 4556 objectMap["dataSource"] = merc.DataSource 4557 if merc.OdataType != "" { 4558 objectMap["odata.type"] = merc.OdataType 4559 } 4560 return json.Marshal(objectMap) 4561} 4562 4563// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 4564func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 4565 return nil, false 4566} 4567 4568// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 4569func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 4570 return nil, false 4571} 4572 4573// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 4574func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 4575 return &merc, true 4576} 4577 4578// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 4579func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { 4580 return nil, false 4581} 4582 4583// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. 4584func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 4585 return &merc, true 4586} 4587 4588// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. 4589func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error { 4590 var m map[string]*json.RawMessage 4591 err := json.Unmarshal(body, &m) 4592 if err != nil { 4593 return err 4594 } 4595 for k, v := range m { 4596 switch k { 4597 case "aggregation": 4598 if v != nil { 4599 var aggregation ManagementEventAggregationCondition 4600 err = json.Unmarshal(*v, &aggregation) 4601 if err != nil { 4602 return err 4603 } 4604 merc.Aggregation = &aggregation 4605 } 4606 case "dataSource": 4607 if v != nil { 4608 dataSource, err := unmarshalBasicRuleDataSource(*v) 4609 if err != nil { 4610 return err 4611 } 4612 merc.DataSource = dataSource 4613 } 4614 case "odata.type": 4615 if v != nil { 4616 var odataType OdataTypeBasicRuleCondition 4617 err = json.Unmarshal(*v, &odataType) 4618 if err != nil { 4619 return err 4620 } 4621 merc.OdataType = odataType 4622 } 4623 } 4624 } 4625 4626 return nil 4627} 4628 4629// MetadataValue represents a metric metadata value. 4630type MetadataValue struct { 4631 // Name - the name of the metadata. 4632 Name *LocalizableString `json:"name,omitempty"` 4633 // Value - the value of the metadata. 4634 Value *string `json:"value,omitempty"` 4635} 4636 4637// Metric the result data of a query. 4638type Metric struct { 4639 // ID - the metric Id. 4640 ID *string `json:"id,omitempty"` 4641 // Type - the resource type of the metric resource. 4642 Type *string `json:"type,omitempty"` 4643 // Name - the name and the display name of the metric, i.e. it is localizable string. 4644 Name *LocalizableString `json:"name,omitempty"` 4645 // DisplayDescription - Detailed description of this metric. 4646 DisplayDescription *string `json:"displayDescription,omitempty"` 4647 // ErrorCode - 'Success' or the error details on query failures for this metric. 4648 ErrorCode *string `json:"errorCode,omitempty"` 4649 // ErrorMessage - Error message encountered querying this specific metric. 4650 ErrorMessage *string `json:"errorMessage,omitempty"` 4651 // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' 4652 Unit MetricUnit `json:"unit,omitempty"` 4653 // Timeseries - the time series returned when a data query is performed. 4654 Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` 4655} 4656 4657// MetricAlertAction an alert action. 4658type MetricAlertAction struct { 4659 // ActionGroupID - the id of the action group to use. 4660 ActionGroupID *string `json:"actionGroupId,omitempty"` 4661 // WebHookProperties - This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. 4662 WebHookProperties map[string]*string `json:"webHookProperties"` 4663} 4664 4665// MarshalJSON is the custom marshaler for MetricAlertAction. 4666func (maa MetricAlertAction) MarshalJSON() ([]byte, error) { 4667 objectMap := make(map[string]interface{}) 4668 if maa.ActionGroupID != nil { 4669 objectMap["actionGroupId"] = maa.ActionGroupID 4670 } 4671 if maa.WebHookProperties != nil { 4672 objectMap["webHookProperties"] = maa.WebHookProperties 4673 } 4674 return json.Marshal(objectMap) 4675} 4676 4677// BasicMetricAlertCriteria the rule criteria that defines the conditions of the alert rule. 4678type BasicMetricAlertCriteria interface { 4679 AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) 4680 AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) 4681 AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) 4682 AsMetricAlertCriteria() (*MetricAlertCriteria, bool) 4683} 4684 4685// MetricAlertCriteria the rule criteria that defines the conditions of the alert rule. 4686type MetricAlertCriteria struct { 4687 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 4688 AdditionalProperties map[string]interface{} `json:""` 4689 // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' 4690 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` 4691} 4692 4693func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) { 4694 var m map[string]interface{} 4695 err := json.Unmarshal(body, &m) 4696 if err != nil { 4697 return nil, err 4698 } 4699 4700 switch m["odata.type"] { 4701 case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): 4702 var masrmmc MetricAlertSingleResourceMultipleMetricCriteria 4703 err := json.Unmarshal(body, &masrmmc) 4704 return masrmmc, err 4705 case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): 4706 var wlac WebtestLocationAvailabilityCriteria 4707 err := json.Unmarshal(body, &wlac) 4708 return wlac, err 4709 case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): 4710 var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria 4711 err := json.Unmarshal(body, &mamrmmc) 4712 return mamrmmc, err 4713 default: 4714 var mac MetricAlertCriteria 4715 err := json.Unmarshal(body, &mac) 4716 return mac, err 4717 } 4718} 4719func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) { 4720 var rawMessages []*json.RawMessage 4721 err := json.Unmarshal(body, &rawMessages) 4722 if err != nil { 4723 return nil, err 4724 } 4725 4726 macArray := make([]BasicMetricAlertCriteria, len(rawMessages)) 4727 4728 for index, rawMessage := range rawMessages { 4729 mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage) 4730 if err != nil { 4731 return nil, err 4732 } 4733 macArray[index] = mac 4734 } 4735 return macArray, nil 4736} 4737 4738// MarshalJSON is the custom marshaler for MetricAlertCriteria. 4739func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) { 4740 mac.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria 4741 objectMap := make(map[string]interface{}) 4742 if mac.OdataType != "" { 4743 objectMap["odata.type"] = mac.OdataType 4744 } 4745 for k, v := range mac.AdditionalProperties { 4746 objectMap[k] = v 4747 } 4748 return json.Marshal(objectMap) 4749} 4750 4751// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. 4752func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { 4753 return nil, false 4754} 4755 4756// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. 4757func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { 4758 return nil, false 4759} 4760 4761// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. 4762func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { 4763 return nil, false 4764} 4765 4766// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. 4767func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { 4768 return &mac, true 4769} 4770 4771// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. 4772func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { 4773 return &mac, true 4774} 4775 4776// UnmarshalJSON is the custom unmarshaler for MetricAlertCriteria struct. 4777func (mac *MetricAlertCriteria) UnmarshalJSON(body []byte) error { 4778 var m map[string]*json.RawMessage 4779 err := json.Unmarshal(body, &m) 4780 if err != nil { 4781 return err 4782 } 4783 for k, v := range m { 4784 switch k { 4785 default: 4786 if v != nil { 4787 var additionalProperties interface{} 4788 err = json.Unmarshal(*v, &additionalProperties) 4789 if err != nil { 4790 return err 4791 } 4792 if mac.AdditionalProperties == nil { 4793 mac.AdditionalProperties = make(map[string]interface{}) 4794 } 4795 mac.AdditionalProperties[k] = additionalProperties 4796 } 4797 case "odata.type": 4798 if v != nil { 4799 var odataType OdataTypeBasicMetricAlertCriteria 4800 err = json.Unmarshal(*v, &odataType) 4801 if err != nil { 4802 return err 4803 } 4804 mac.OdataType = odataType 4805 } 4806 } 4807 } 4808 4809 return nil 4810} 4811 4812// MetricAlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple 4813// resource that has multiple metric criteria. 4814type MetricAlertMultipleResourceMultipleMetricCriteria struct { 4815 // AllOf - the list of multiple metric criteria for this 'all of' operation. 4816 AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"` 4817 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 4818 AdditionalProperties map[string]interface{} `json:""` 4819 // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' 4820 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` 4821} 4822 4823// MarshalJSON is the custom marshaler for MetricAlertMultipleResourceMultipleMetricCriteria. 4824func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { 4825 mamrmmc.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria 4826 objectMap := make(map[string]interface{}) 4827 if mamrmmc.AllOf != nil { 4828 objectMap["allOf"] = mamrmmc.AllOf 4829 } 4830 if mamrmmc.OdataType != "" { 4831 objectMap["odata.type"] = mamrmmc.OdataType 4832 } 4833 for k, v := range mamrmmc.AdditionalProperties { 4834 objectMap[k] = v 4835 } 4836 return json.Marshal(objectMap) 4837} 4838 4839// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. 4840func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { 4841 return nil, false 4842} 4843 4844// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. 4845func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { 4846 return nil, false 4847} 4848 4849// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. 4850func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { 4851 return &mamrmmc, true 4852} 4853 4854// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. 4855func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { 4856 return nil, false 4857} 4858 4859// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. 4860func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { 4861 return &mamrmmc, true 4862} 4863 4864// UnmarshalJSON is the custom unmarshaler for MetricAlertMultipleResourceMultipleMetricCriteria struct. 4865func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error { 4866 var m map[string]*json.RawMessage 4867 err := json.Unmarshal(body, &m) 4868 if err != nil { 4869 return err 4870 } 4871 for k, v := range m { 4872 switch k { 4873 case "allOf": 4874 if v != nil { 4875 allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v) 4876 if err != nil { 4877 return err 4878 } 4879 mamrmmc.AllOf = &allOf 4880 } 4881 default: 4882 if v != nil { 4883 var additionalProperties interface{} 4884 err = json.Unmarshal(*v, &additionalProperties) 4885 if err != nil { 4886 return err 4887 } 4888 if mamrmmc.AdditionalProperties == nil { 4889 mamrmmc.AdditionalProperties = make(map[string]interface{}) 4890 } 4891 mamrmmc.AdditionalProperties[k] = additionalProperties 4892 } 4893 case "odata.type": 4894 if v != nil { 4895 var odataType OdataTypeBasicMetricAlertCriteria 4896 err = json.Unmarshal(*v, &odataType) 4897 if err != nil { 4898 return err 4899 } 4900 mamrmmc.OdataType = odataType 4901 } 4902 } 4903 } 4904 4905 return nil 4906} 4907 4908// MetricAlertProperties an alert rule. 4909type MetricAlertProperties struct { 4910 // Description - the description of the metric alert that will be included in the alert email. 4911 Description *string `json:"description,omitempty"` 4912 // Severity - Alert severity {0, 1, 2, 3, 4} 4913 Severity *int32 `json:"severity,omitempty"` 4914 // Enabled - the flag that indicates whether the metric alert is enabled. 4915 Enabled *bool `json:"enabled,omitempty"` 4916 // Scopes - the list of resource id's that this metric alert is scoped to. 4917 Scopes *[]string `json:"scopes,omitempty"` 4918 // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. 4919 EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` 4920 // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. 4921 WindowSize *string `json:"windowSize,omitempty"` 4922 // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. 4923 TargetResourceType *string `json:"targetResourceType,omitempty"` 4924 // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. 4925 TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` 4926 // Criteria - defines the specific alert criteria information. 4927 Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` 4928 // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. 4929 AutoMitigate *bool `json:"autoMitigate,omitempty"` 4930 // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. 4931 Actions *[]MetricAlertAction `json:"actions,omitempty"` 4932 // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. 4933 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 4934 // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. 4935 IsMigrated *bool `json:"isMigrated,omitempty"` 4936} 4937 4938// MarshalJSON is the custom marshaler for MetricAlertProperties. 4939func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) { 4940 objectMap := make(map[string]interface{}) 4941 if mapVar.Description != nil { 4942 objectMap["description"] = mapVar.Description 4943 } 4944 if mapVar.Severity != nil { 4945 objectMap["severity"] = mapVar.Severity 4946 } 4947 if mapVar.Enabled != nil { 4948 objectMap["enabled"] = mapVar.Enabled 4949 } 4950 if mapVar.Scopes != nil { 4951 objectMap["scopes"] = mapVar.Scopes 4952 } 4953 if mapVar.EvaluationFrequency != nil { 4954 objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency 4955 } 4956 if mapVar.WindowSize != nil { 4957 objectMap["windowSize"] = mapVar.WindowSize 4958 } 4959 if mapVar.TargetResourceType != nil { 4960 objectMap["targetResourceType"] = mapVar.TargetResourceType 4961 } 4962 if mapVar.TargetResourceRegion != nil { 4963 objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion 4964 } 4965 objectMap["criteria"] = mapVar.Criteria 4966 if mapVar.AutoMitigate != nil { 4967 objectMap["autoMitigate"] = mapVar.AutoMitigate 4968 } 4969 if mapVar.Actions != nil { 4970 objectMap["actions"] = mapVar.Actions 4971 } 4972 return json.Marshal(objectMap) 4973} 4974 4975// UnmarshalJSON is the custom unmarshaler for MetricAlertProperties struct. 4976func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error { 4977 var m map[string]*json.RawMessage 4978 err := json.Unmarshal(body, &m) 4979 if err != nil { 4980 return err 4981 } 4982 for k, v := range m { 4983 switch k { 4984 case "description": 4985 if v != nil { 4986 var description string 4987 err = json.Unmarshal(*v, &description) 4988 if err != nil { 4989 return err 4990 } 4991 mapVar.Description = &description 4992 } 4993 case "severity": 4994 if v != nil { 4995 var severity int32 4996 err = json.Unmarshal(*v, &severity) 4997 if err != nil { 4998 return err 4999 } 5000 mapVar.Severity = &severity 5001 } 5002 case "enabled": 5003 if v != nil { 5004 var enabled bool 5005 err = json.Unmarshal(*v, &enabled) 5006 if err != nil { 5007 return err 5008 } 5009 mapVar.Enabled = &enabled 5010 } 5011 case "scopes": 5012 if v != nil { 5013 var scopes []string 5014 err = json.Unmarshal(*v, &scopes) 5015 if err != nil { 5016 return err 5017 } 5018 mapVar.Scopes = &scopes 5019 } 5020 case "evaluationFrequency": 5021 if v != nil { 5022 var evaluationFrequency string 5023 err = json.Unmarshal(*v, &evaluationFrequency) 5024 if err != nil { 5025 return err 5026 } 5027 mapVar.EvaluationFrequency = &evaluationFrequency 5028 } 5029 case "windowSize": 5030 if v != nil { 5031 var windowSize string 5032 err = json.Unmarshal(*v, &windowSize) 5033 if err != nil { 5034 return err 5035 } 5036 mapVar.WindowSize = &windowSize 5037 } 5038 case "targetResourceType": 5039 if v != nil { 5040 var targetResourceType string 5041 err = json.Unmarshal(*v, &targetResourceType) 5042 if err != nil { 5043 return err 5044 } 5045 mapVar.TargetResourceType = &targetResourceType 5046 } 5047 case "targetResourceRegion": 5048 if v != nil { 5049 var targetResourceRegion string 5050 err = json.Unmarshal(*v, &targetResourceRegion) 5051 if err != nil { 5052 return err 5053 } 5054 mapVar.TargetResourceRegion = &targetResourceRegion 5055 } 5056 case "criteria": 5057 if v != nil { 5058 criteria, err := unmarshalBasicMetricAlertCriteria(*v) 5059 if err != nil { 5060 return err 5061 } 5062 mapVar.Criteria = criteria 5063 } 5064 case "autoMitigate": 5065 if v != nil { 5066 var autoMitigate bool 5067 err = json.Unmarshal(*v, &autoMitigate) 5068 if err != nil { 5069 return err 5070 } 5071 mapVar.AutoMitigate = &autoMitigate 5072 } 5073 case "actions": 5074 if v != nil { 5075 var actions []MetricAlertAction 5076 err = json.Unmarshal(*v, &actions) 5077 if err != nil { 5078 return err 5079 } 5080 mapVar.Actions = &actions 5081 } 5082 case "lastUpdatedTime": 5083 if v != nil { 5084 var lastUpdatedTime date.Time 5085 err = json.Unmarshal(*v, &lastUpdatedTime) 5086 if err != nil { 5087 return err 5088 } 5089 mapVar.LastUpdatedTime = &lastUpdatedTime 5090 } 5091 case "isMigrated": 5092 if v != nil { 5093 var isMigrated bool 5094 err = json.Unmarshal(*v, &isMigrated) 5095 if err != nil { 5096 return err 5097 } 5098 mapVar.IsMigrated = &isMigrated 5099 } 5100 } 5101 } 5102 5103 return nil 5104} 5105 5106// MetricAlertPropertiesPatch an alert rule properties for patch. 5107type MetricAlertPropertiesPatch struct { 5108 // Description - the description of the metric alert that will be included in the alert email. 5109 Description *string `json:"description,omitempty"` 5110 // Severity - Alert severity {0, 1, 2, 3, 4} 5111 Severity *int32 `json:"severity,omitempty"` 5112 // Enabled - the flag that indicates whether the metric alert is enabled. 5113 Enabled *bool `json:"enabled,omitempty"` 5114 // Scopes - the list of resource id's that this metric alert is scoped to. 5115 Scopes *[]string `json:"scopes,omitempty"` 5116 // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. 5117 EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` 5118 // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. 5119 WindowSize *string `json:"windowSize,omitempty"` 5120 // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. 5121 TargetResourceType *string `json:"targetResourceType,omitempty"` 5122 // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. 5123 TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` 5124 // Criteria - defines the specific alert criteria information. 5125 Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` 5126 // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. 5127 AutoMitigate *bool `json:"autoMitigate,omitempty"` 5128 // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. 5129 Actions *[]MetricAlertAction `json:"actions,omitempty"` 5130 // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. 5131 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 5132 // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. 5133 IsMigrated *bool `json:"isMigrated,omitempty"` 5134} 5135 5136// MarshalJSON is the custom marshaler for MetricAlertPropertiesPatch. 5137func (mapp MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { 5138 objectMap := make(map[string]interface{}) 5139 if mapp.Description != nil { 5140 objectMap["description"] = mapp.Description 5141 } 5142 if mapp.Severity != nil { 5143 objectMap["severity"] = mapp.Severity 5144 } 5145 if mapp.Enabled != nil { 5146 objectMap["enabled"] = mapp.Enabled 5147 } 5148 if mapp.Scopes != nil { 5149 objectMap["scopes"] = mapp.Scopes 5150 } 5151 if mapp.EvaluationFrequency != nil { 5152 objectMap["evaluationFrequency"] = mapp.EvaluationFrequency 5153 } 5154 if mapp.WindowSize != nil { 5155 objectMap["windowSize"] = mapp.WindowSize 5156 } 5157 if mapp.TargetResourceType != nil { 5158 objectMap["targetResourceType"] = mapp.TargetResourceType 5159 } 5160 if mapp.TargetResourceRegion != nil { 5161 objectMap["targetResourceRegion"] = mapp.TargetResourceRegion 5162 } 5163 objectMap["criteria"] = mapp.Criteria 5164 if mapp.AutoMitigate != nil { 5165 objectMap["autoMitigate"] = mapp.AutoMitigate 5166 } 5167 if mapp.Actions != nil { 5168 objectMap["actions"] = mapp.Actions 5169 } 5170 return json.Marshal(objectMap) 5171} 5172 5173// UnmarshalJSON is the custom unmarshaler for MetricAlertPropertiesPatch struct. 5174func (mapp *MetricAlertPropertiesPatch) UnmarshalJSON(body []byte) error { 5175 var m map[string]*json.RawMessage 5176 err := json.Unmarshal(body, &m) 5177 if err != nil { 5178 return err 5179 } 5180 for k, v := range m { 5181 switch k { 5182 case "description": 5183 if v != nil { 5184 var description string 5185 err = json.Unmarshal(*v, &description) 5186 if err != nil { 5187 return err 5188 } 5189 mapp.Description = &description 5190 } 5191 case "severity": 5192 if v != nil { 5193 var severity int32 5194 err = json.Unmarshal(*v, &severity) 5195 if err != nil { 5196 return err 5197 } 5198 mapp.Severity = &severity 5199 } 5200 case "enabled": 5201 if v != nil { 5202 var enabled bool 5203 err = json.Unmarshal(*v, &enabled) 5204 if err != nil { 5205 return err 5206 } 5207 mapp.Enabled = &enabled 5208 } 5209 case "scopes": 5210 if v != nil { 5211 var scopes []string 5212 err = json.Unmarshal(*v, &scopes) 5213 if err != nil { 5214 return err 5215 } 5216 mapp.Scopes = &scopes 5217 } 5218 case "evaluationFrequency": 5219 if v != nil { 5220 var evaluationFrequency string 5221 err = json.Unmarshal(*v, &evaluationFrequency) 5222 if err != nil { 5223 return err 5224 } 5225 mapp.EvaluationFrequency = &evaluationFrequency 5226 } 5227 case "windowSize": 5228 if v != nil { 5229 var windowSize string 5230 err = json.Unmarshal(*v, &windowSize) 5231 if err != nil { 5232 return err 5233 } 5234 mapp.WindowSize = &windowSize 5235 } 5236 case "targetResourceType": 5237 if v != nil { 5238 var targetResourceType string 5239 err = json.Unmarshal(*v, &targetResourceType) 5240 if err != nil { 5241 return err 5242 } 5243 mapp.TargetResourceType = &targetResourceType 5244 } 5245 case "targetResourceRegion": 5246 if v != nil { 5247 var targetResourceRegion string 5248 err = json.Unmarshal(*v, &targetResourceRegion) 5249 if err != nil { 5250 return err 5251 } 5252 mapp.TargetResourceRegion = &targetResourceRegion 5253 } 5254 case "criteria": 5255 if v != nil { 5256 criteria, err := unmarshalBasicMetricAlertCriteria(*v) 5257 if err != nil { 5258 return err 5259 } 5260 mapp.Criteria = criteria 5261 } 5262 case "autoMitigate": 5263 if v != nil { 5264 var autoMitigate bool 5265 err = json.Unmarshal(*v, &autoMitigate) 5266 if err != nil { 5267 return err 5268 } 5269 mapp.AutoMitigate = &autoMitigate 5270 } 5271 case "actions": 5272 if v != nil { 5273 var actions []MetricAlertAction 5274 err = json.Unmarshal(*v, &actions) 5275 if err != nil { 5276 return err 5277 } 5278 mapp.Actions = &actions 5279 } 5280 case "lastUpdatedTime": 5281 if v != nil { 5282 var lastUpdatedTime date.Time 5283 err = json.Unmarshal(*v, &lastUpdatedTime) 5284 if err != nil { 5285 return err 5286 } 5287 mapp.LastUpdatedTime = &lastUpdatedTime 5288 } 5289 case "isMigrated": 5290 if v != nil { 5291 var isMigrated bool 5292 err = json.Unmarshal(*v, &isMigrated) 5293 if err != nil { 5294 return err 5295 } 5296 mapp.IsMigrated = &isMigrated 5297 } 5298 } 5299 } 5300 5301 return nil 5302} 5303 5304// MetricAlertResource the metric alert resource. 5305type MetricAlertResource struct { 5306 autorest.Response `json:"-"` 5307 // MetricAlertProperties - The alert rule properties of the resource. 5308 *MetricAlertProperties `json:"properties,omitempty"` 5309 // ID - READ-ONLY; Azure resource Id 5310 ID *string `json:"id,omitempty"` 5311 // Name - READ-ONLY; Azure resource name 5312 Name *string `json:"name,omitempty"` 5313 // Type - READ-ONLY; Azure resource type 5314 Type *string `json:"type,omitempty"` 5315 // Location - Resource location 5316 Location *string `json:"location,omitempty"` 5317 // Tags - Resource tags 5318 Tags map[string]*string `json:"tags"` 5319 // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. 5320 Kind *string `json:"kind,omitempty"` 5321 // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. 5322 Etag *string `json:"etag,omitempty"` 5323} 5324 5325// MarshalJSON is the custom marshaler for MetricAlertResource. 5326func (mar MetricAlertResource) MarshalJSON() ([]byte, error) { 5327 objectMap := make(map[string]interface{}) 5328 if mar.MetricAlertProperties != nil { 5329 objectMap["properties"] = mar.MetricAlertProperties 5330 } 5331 if mar.Location != nil { 5332 objectMap["location"] = mar.Location 5333 } 5334 if mar.Tags != nil { 5335 objectMap["tags"] = mar.Tags 5336 } 5337 return json.Marshal(objectMap) 5338} 5339 5340// UnmarshalJSON is the custom unmarshaler for MetricAlertResource struct. 5341func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error { 5342 var m map[string]*json.RawMessage 5343 err := json.Unmarshal(body, &m) 5344 if err != nil { 5345 return err 5346 } 5347 for k, v := range m { 5348 switch k { 5349 case "properties": 5350 if v != nil { 5351 var metricAlertProperties MetricAlertProperties 5352 err = json.Unmarshal(*v, &metricAlertProperties) 5353 if err != nil { 5354 return err 5355 } 5356 mar.MetricAlertProperties = &metricAlertProperties 5357 } 5358 case "id": 5359 if v != nil { 5360 var ID string 5361 err = json.Unmarshal(*v, &ID) 5362 if err != nil { 5363 return err 5364 } 5365 mar.ID = &ID 5366 } 5367 case "name": 5368 if v != nil { 5369 var name string 5370 err = json.Unmarshal(*v, &name) 5371 if err != nil { 5372 return err 5373 } 5374 mar.Name = &name 5375 } 5376 case "type": 5377 if v != nil { 5378 var typeVar string 5379 err = json.Unmarshal(*v, &typeVar) 5380 if err != nil { 5381 return err 5382 } 5383 mar.Type = &typeVar 5384 } 5385 case "location": 5386 if v != nil { 5387 var location string 5388 err = json.Unmarshal(*v, &location) 5389 if err != nil { 5390 return err 5391 } 5392 mar.Location = &location 5393 } 5394 case "tags": 5395 if v != nil { 5396 var tags map[string]*string 5397 err = json.Unmarshal(*v, &tags) 5398 if err != nil { 5399 return err 5400 } 5401 mar.Tags = tags 5402 } 5403 case "kind": 5404 if v != nil { 5405 var kind string 5406 err = json.Unmarshal(*v, &kind) 5407 if err != nil { 5408 return err 5409 } 5410 mar.Kind = &kind 5411 } 5412 case "etag": 5413 if v != nil { 5414 var etag string 5415 err = json.Unmarshal(*v, &etag) 5416 if err != nil { 5417 return err 5418 } 5419 mar.Etag = &etag 5420 } 5421 } 5422 } 5423 5424 return nil 5425} 5426 5427// MetricAlertResourceCollection represents a collection of alert rule resources. 5428type MetricAlertResourceCollection struct { 5429 autorest.Response `json:"-"` 5430 // Value - the values for the alert rule resources. 5431 Value *[]MetricAlertResource `json:"value,omitempty"` 5432} 5433 5434// MetricAlertResourcePatch the metric alert resource for patch operations. 5435type MetricAlertResourcePatch struct { 5436 // Tags - Resource tags 5437 Tags map[string]*string `json:"tags"` 5438 // MetricAlertPropertiesPatch - The alert rule properties of the resource. 5439 *MetricAlertPropertiesPatch `json:"properties,omitempty"` 5440} 5441 5442// MarshalJSON is the custom marshaler for MetricAlertResourcePatch. 5443func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { 5444 objectMap := make(map[string]interface{}) 5445 if marp.Tags != nil { 5446 objectMap["tags"] = marp.Tags 5447 } 5448 if marp.MetricAlertPropertiesPatch != nil { 5449 objectMap["properties"] = marp.MetricAlertPropertiesPatch 5450 } 5451 return json.Marshal(objectMap) 5452} 5453 5454// UnmarshalJSON is the custom unmarshaler for MetricAlertResourcePatch struct. 5455func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error { 5456 var m map[string]*json.RawMessage 5457 err := json.Unmarshal(body, &m) 5458 if err != nil { 5459 return err 5460 } 5461 for k, v := range m { 5462 switch k { 5463 case "tags": 5464 if v != nil { 5465 var tags map[string]*string 5466 err = json.Unmarshal(*v, &tags) 5467 if err != nil { 5468 return err 5469 } 5470 marp.Tags = tags 5471 } 5472 case "properties": 5473 if v != nil { 5474 var metricAlertPropertiesPatch MetricAlertPropertiesPatch 5475 err = json.Unmarshal(*v, &metricAlertPropertiesPatch) 5476 if err != nil { 5477 return err 5478 } 5479 marp.MetricAlertPropertiesPatch = &metricAlertPropertiesPatch 5480 } 5481 } 5482 } 5483 5484 return nil 5485} 5486 5487// MetricAlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single 5488// resource that has multiple metric criteria. 5489type MetricAlertSingleResourceMultipleMetricCriteria struct { 5490 // AllOf - The list of metric criteria for this 'all of' operation. 5491 AllOf *[]MetricCriteria `json:"allOf,omitempty"` 5492 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 5493 AdditionalProperties map[string]interface{} `json:""` 5494 // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' 5495 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` 5496} 5497 5498// MarshalJSON is the custom marshaler for MetricAlertSingleResourceMultipleMetricCriteria. 5499func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { 5500 masrmmc.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria 5501 objectMap := make(map[string]interface{}) 5502 if masrmmc.AllOf != nil { 5503 objectMap["allOf"] = masrmmc.AllOf 5504 } 5505 if masrmmc.OdataType != "" { 5506 objectMap["odata.type"] = masrmmc.OdataType 5507 } 5508 for k, v := range masrmmc.AdditionalProperties { 5509 objectMap[k] = v 5510 } 5511 return json.Marshal(objectMap) 5512} 5513 5514// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. 5515func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { 5516 return &masrmmc, true 5517} 5518 5519// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. 5520func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { 5521 return nil, false 5522} 5523 5524// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. 5525func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { 5526 return nil, false 5527} 5528 5529// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. 5530func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { 5531 return nil, false 5532} 5533 5534// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. 5535func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { 5536 return &masrmmc, true 5537} 5538 5539// UnmarshalJSON is the custom unmarshaler for MetricAlertSingleResourceMultipleMetricCriteria struct. 5540func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error { 5541 var m map[string]*json.RawMessage 5542 err := json.Unmarshal(body, &m) 5543 if err != nil { 5544 return err 5545 } 5546 for k, v := range m { 5547 switch k { 5548 case "allOf": 5549 if v != nil { 5550 var allOf []MetricCriteria 5551 err = json.Unmarshal(*v, &allOf) 5552 if err != nil { 5553 return err 5554 } 5555 masrmmc.AllOf = &allOf 5556 } 5557 default: 5558 if v != nil { 5559 var additionalProperties interface{} 5560 err = json.Unmarshal(*v, &additionalProperties) 5561 if err != nil { 5562 return err 5563 } 5564 if masrmmc.AdditionalProperties == nil { 5565 masrmmc.AdditionalProperties = make(map[string]interface{}) 5566 } 5567 masrmmc.AdditionalProperties[k] = additionalProperties 5568 } 5569 case "odata.type": 5570 if v != nil { 5571 var odataType OdataTypeBasicMetricAlertCriteria 5572 err = json.Unmarshal(*v, &odataType) 5573 if err != nil { 5574 return err 5575 } 5576 masrmmc.OdataType = odataType 5577 } 5578 } 5579 } 5580 5581 return nil 5582} 5583 5584// MetricAlertStatus an alert status. 5585type MetricAlertStatus struct { 5586 // Name - The status name. 5587 Name *string `json:"name,omitempty"` 5588 // ID - The alert rule arm id. 5589 ID *string `json:"id,omitempty"` 5590 // Type - The extended resource type name. 5591 Type *string `json:"type,omitempty"` 5592 // Properties - The alert status properties of the metric alert status. 5593 Properties *MetricAlertStatusProperties `json:"properties,omitempty"` 5594} 5595 5596// MetricAlertStatusCollection represents a collection of alert rule resources. 5597type MetricAlertStatusCollection struct { 5598 autorest.Response `json:"-"` 5599 // Value - the values for the alert rule resources. 5600 Value *[]MetricAlertStatus `json:"value,omitempty"` 5601} 5602 5603// MetricAlertStatusProperties an alert status properties. 5604type MetricAlertStatusProperties struct { 5605 // Dimensions - An object describing the type of the dimensions. 5606 Dimensions map[string]*string `json:"dimensions"` 5607 // Status - status value 5608 Status *string `json:"status,omitempty"` 5609 // Timestamp - UTC time when the status was checked. 5610 Timestamp *date.Time `json:"timestamp,omitempty"` 5611} 5612 5613// MarshalJSON is the custom marshaler for MetricAlertStatusProperties. 5614func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { 5615 objectMap := make(map[string]interface{}) 5616 if masp.Dimensions != nil { 5617 objectMap["dimensions"] = masp.Dimensions 5618 } 5619 if masp.Status != nil { 5620 objectMap["status"] = masp.Status 5621 } 5622 if masp.Timestamp != nil { 5623 objectMap["timestamp"] = masp.Timestamp 5624 } 5625 return json.Marshal(objectMap) 5626} 5627 5628// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and 5629// the retention period for that time grain. 5630type MetricAvailability struct { 5631 // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. 5632 TimeGrain *string `json:"timeGrain,omitempty"` 5633 // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. 5634 Retention *string `json:"retention,omitempty"` 5635} 5636 5637// MetricBaselinesProperties the response to a metric baselines query. 5638type MetricBaselinesProperties struct { 5639 // 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. 5640 Timespan *string `json:"timespan,omitempty"` 5641 // 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. 5642 Interval *string `json:"interval,omitempty"` 5643 // Namespace - The namespace of the metrics been queried. 5644 Namespace *string `json:"namespace,omitempty"` 5645 // Baselines - The baseline for each time series that was queried. 5646 Baselines *[]TimeSeriesBaseline `json:"baselines,omitempty"` 5647} 5648 5649// MetricBaselinesResponse a list of metric baselines. 5650type MetricBaselinesResponse struct { 5651 autorest.Response `json:"-"` 5652 // Value - The list of metric baselines. 5653 Value *[]SingleMetricBaseline `json:"value,omitempty"` 5654} 5655 5656// MetricCriteria criterion to filter metrics. 5657type MetricCriteria struct { 5658 // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' 5659 Operator Operator `json:"operator,omitempty"` 5660 // Threshold - the criteria threshold value that activates the alert. 5661 Threshold *float64 `json:"threshold,omitempty"` 5662 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 5663 AdditionalProperties map[string]interface{} `json:""` 5664 // Name - Name of the criteria. 5665 Name *string `json:"name,omitempty"` 5666 // MetricName - Name of the metric. 5667 MetricName *string `json:"metricName,omitempty"` 5668 // MetricNamespace - Namespace of the metric. 5669 MetricNamespace *string `json:"metricNamespace,omitempty"` 5670 // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' 5671 TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` 5672 // Dimensions - List of dimension conditions. 5673 Dimensions *[]MetricDimension `json:"dimensions,omitempty"` 5674 // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. 5675 SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` 5676 // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' 5677 CriterionType CriterionType `json:"criterionType,omitempty"` 5678} 5679 5680// MarshalJSON is the custom marshaler for MetricCriteria. 5681func (mc MetricCriteria) MarshalJSON() ([]byte, error) { 5682 mc.CriterionType = CriterionTypeStaticThresholdCriterion 5683 objectMap := make(map[string]interface{}) 5684 if mc.Operator != "" { 5685 objectMap["operator"] = mc.Operator 5686 } 5687 if mc.Threshold != nil { 5688 objectMap["threshold"] = mc.Threshold 5689 } 5690 if mc.Name != nil { 5691 objectMap["name"] = mc.Name 5692 } 5693 if mc.MetricName != nil { 5694 objectMap["metricName"] = mc.MetricName 5695 } 5696 if mc.MetricNamespace != nil { 5697 objectMap["metricNamespace"] = mc.MetricNamespace 5698 } 5699 if mc.TimeAggregation != "" { 5700 objectMap["timeAggregation"] = mc.TimeAggregation 5701 } 5702 if mc.Dimensions != nil { 5703 objectMap["dimensions"] = mc.Dimensions 5704 } 5705 if mc.SkipMetricValidation != nil { 5706 objectMap["skipMetricValidation"] = mc.SkipMetricValidation 5707 } 5708 if mc.CriterionType != "" { 5709 objectMap["criterionType"] = mc.CriterionType 5710 } 5711 for k, v := range mc.AdditionalProperties { 5712 objectMap[k] = v 5713 } 5714 return json.Marshal(objectMap) 5715} 5716 5717// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. 5718func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { 5719 return &mc, true 5720} 5721 5722// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. 5723func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { 5724 return nil, false 5725} 5726 5727// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. 5728func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { 5729 return nil, false 5730} 5731 5732// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. 5733func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { 5734 return &mc, true 5735} 5736 5737// UnmarshalJSON is the custom unmarshaler for MetricCriteria struct. 5738func (mc *MetricCriteria) UnmarshalJSON(body []byte) error { 5739 var m map[string]*json.RawMessage 5740 err := json.Unmarshal(body, &m) 5741 if err != nil { 5742 return err 5743 } 5744 for k, v := range m { 5745 switch k { 5746 case "operator": 5747 if v != nil { 5748 var operator Operator 5749 err = json.Unmarshal(*v, &operator) 5750 if err != nil { 5751 return err 5752 } 5753 mc.Operator = operator 5754 } 5755 case "threshold": 5756 if v != nil { 5757 var threshold float64 5758 err = json.Unmarshal(*v, &threshold) 5759 if err != nil { 5760 return err 5761 } 5762 mc.Threshold = &threshold 5763 } 5764 default: 5765 if v != nil { 5766 var additionalProperties interface{} 5767 err = json.Unmarshal(*v, &additionalProperties) 5768 if err != nil { 5769 return err 5770 } 5771 if mc.AdditionalProperties == nil { 5772 mc.AdditionalProperties = make(map[string]interface{}) 5773 } 5774 mc.AdditionalProperties[k] = additionalProperties 5775 } 5776 case "name": 5777 if v != nil { 5778 var name string 5779 err = json.Unmarshal(*v, &name) 5780 if err != nil { 5781 return err 5782 } 5783 mc.Name = &name 5784 } 5785 case "metricName": 5786 if v != nil { 5787 var metricName string 5788 err = json.Unmarshal(*v, &metricName) 5789 if err != nil { 5790 return err 5791 } 5792 mc.MetricName = &metricName 5793 } 5794 case "metricNamespace": 5795 if v != nil { 5796 var metricNamespace string 5797 err = json.Unmarshal(*v, &metricNamespace) 5798 if err != nil { 5799 return err 5800 } 5801 mc.MetricNamespace = &metricNamespace 5802 } 5803 case "timeAggregation": 5804 if v != nil { 5805 var timeAggregation AggregationTypeEnum 5806 err = json.Unmarshal(*v, &timeAggregation) 5807 if err != nil { 5808 return err 5809 } 5810 mc.TimeAggregation = timeAggregation 5811 } 5812 case "dimensions": 5813 if v != nil { 5814 var dimensions []MetricDimension 5815 err = json.Unmarshal(*v, &dimensions) 5816 if err != nil { 5817 return err 5818 } 5819 mc.Dimensions = &dimensions 5820 } 5821 case "skipMetricValidation": 5822 if v != nil { 5823 var skipMetricValidation bool 5824 err = json.Unmarshal(*v, &skipMetricValidation) 5825 if err != nil { 5826 return err 5827 } 5828 mc.SkipMetricValidation = &skipMetricValidation 5829 } 5830 case "criterionType": 5831 if v != nil { 5832 var criterionType CriterionType 5833 err = json.Unmarshal(*v, &criterionType) 5834 if err != nil { 5835 return err 5836 } 5837 mc.CriterionType = criterionType 5838 } 5839 } 5840 } 5841 5842 return nil 5843} 5844 5845// MetricDefinition metric definition class specifies the metadata for a metric. 5846type MetricDefinition struct { 5847 // IsDimensionRequired - Flag to indicate whether the dimension is required. 5848 IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` 5849 // ResourceID - the resource identifier of the resource that emitted the metric. 5850 ResourceID *string `json:"resourceId,omitempty"` 5851 // Namespace - the namespace the metric belongs to. 5852 Namespace *string `json:"namespace,omitempty"` 5853 // Name - the name and the display name of the metric, i.e. it is a localizable string. 5854 Name *LocalizableString `json:"name,omitempty"` 5855 // DisplayDescription - Detailed description of this metric. 5856 DisplayDescription *string `json:"displayDescription,omitempty"` 5857 // Category - Custom category name for this metric. 5858 Category *string `json:"category,omitempty"` 5859 // MetricClass - The class of the metric. Possible values include: 'MetricClassAvailability', 'MetricClassTransactions', 'MetricClassErrors', 'MetricClassLatency', 'MetricClassSaturation' 5860 MetricClass MetricClass `json:"metricClass,omitempty"` 5861 // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' 5862 Unit MetricUnit `json:"unit,omitempty"` 5863 // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'AggregationTypeNone', 'AggregationTypeAverage', 'AggregationTypeCount', 'AggregationTypeMinimum', 'AggregationTypeMaximum', 'AggregationTypeTotal' 5864 PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` 5865 // SupportedAggregationTypes - the collection of what aggregation types are supported. 5866 SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` 5867 // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. 5868 MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` 5869 // ID - the resource identifier of the metric definition. 5870 ID *string `json:"id,omitempty"` 5871 // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. 5872 Dimensions *[]LocalizableString `json:"dimensions,omitempty"` 5873} 5874 5875// MetricDefinitionCollection represents collection of metric definitions. 5876type MetricDefinitionCollection struct { 5877 autorest.Response `json:"-"` 5878 // Value - the values for the metric definitions. 5879 Value *[]MetricDefinition `json:"value,omitempty"` 5880} 5881 5882// MetricDimension specifies a metric dimension. 5883type MetricDimension struct { 5884 // Name - Name of the dimension. 5885 Name *string `json:"name,omitempty"` 5886 // Operator - the dimension operator. Only 'Include' and 'Exclude' are supported 5887 Operator *string `json:"operator,omitempty"` 5888 // Values - list of dimension values. 5889 Values *[]string `json:"values,omitempty"` 5890} 5891 5892// MetricNamespace metric namespace class specifies the metadata for a metric namespace. 5893type MetricNamespace struct { 5894 // ID - The ID of the metric namespace. 5895 ID *string `json:"id,omitempty"` 5896 // Type - The type of the namespace. 5897 Type *string `json:"type,omitempty"` 5898 // Name - The escaped name of the namespace. 5899 Name *string `json:"name,omitempty"` 5900 // Classification - Kind of namespace. Possible values include: 'NamespaceClassificationPlatform', 'NamespaceClassificationCustom', 'NamespaceClassificationQos' 5901 Classification NamespaceClassification `json:"classification,omitempty"` 5902 // Properties - Properties which include the fully qualified namespace name. 5903 Properties *MetricNamespaceName `json:"properties,omitempty"` 5904} 5905 5906// MetricNamespaceCollection represents collection of metric namespaces. 5907type MetricNamespaceCollection struct { 5908 autorest.Response `json:"-"` 5909 // Value - The values for the metric namespaces. 5910 Value *[]MetricNamespace `json:"value,omitempty"` 5911} 5912 5913// MetricNamespaceName the fully qualified metric namespace name. 5914type MetricNamespaceName struct { 5915 // MetricNamespaceName - The metric namespace name. 5916 MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` 5917} 5918 5919// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. 5920type MetricSettings struct { 5921 // TimeGrain - the timegrain of the metric in ISO8601 format. 5922 TimeGrain *string `json:"timeGrain,omitempty"` 5923 // 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. 5924 Category *string `json:"category,omitempty"` 5925 // Enabled - a value indicating whether this category is enabled. 5926 Enabled *bool `json:"enabled,omitempty"` 5927 // RetentionPolicy - the retention policy for this category. 5928 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 5929} 5930 5931// MetricSingleDimension the metric dimension name and value. 5932type MetricSingleDimension struct { 5933 // Name - Name of the dimension. 5934 Name *string `json:"name,omitempty"` 5935 // Value - Value of the dimension. 5936 Value *string `json:"value,omitempty"` 5937} 5938 5939// MetricTrigger the trigger that results in a scaling action. 5940type MetricTrigger struct { 5941 // MetricName - the name of the metric that defines what the rule monitors. 5942 MetricName *string `json:"metricName,omitempty"` 5943 // MetricNamespace - the namespace of the metric that defines what the rule monitors. 5944 MetricNamespace *string `json:"metricNamespace,omitempty"` 5945 // MetricResourceURI - the resource identifier of the resource the rule monitors. 5946 MetricResourceURI *string `json:"metricResourceUri,omitempty"` 5947 // 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. 5948 TimeGrain *string `json:"timeGrain,omitempty"` 5949 // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' 5950 Statistic MetricStatisticType `json:"statistic,omitempty"` 5951 // 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. 5952 TimeWindow *string `json:"timeWindow,omitempty"` 5953 // 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' 5954 TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` 5955 // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'ComparisonOperationTypeEquals', 'ComparisonOperationTypeNotEquals', 'ComparisonOperationTypeGreaterThan', 'ComparisonOperationTypeGreaterThanOrEqual', 'ComparisonOperationTypeLessThan', 'ComparisonOperationTypeLessThanOrEqual' 5956 Operator ComparisonOperationType `json:"operator,omitempty"` 5957 // Threshold - the threshold of the metric that triggers the scale action. 5958 Threshold *float64 `json:"threshold,omitempty"` 5959 // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. 5960 Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` 5961 // DividePerInstance - a value indicating whether metric should divide per instance. 5962 DividePerInstance *bool `json:"dividePerInstance,omitempty"` 5963} 5964 5965// MetricValue represents a metric value. 5966type MetricValue struct { 5967 // TimeStamp - the timestamp for the metric value in ISO 8601 format. 5968 TimeStamp *date.Time `json:"timeStamp,omitempty"` 5969 // Average - the average value in the time range. 5970 Average *float64 `json:"average,omitempty"` 5971 // Minimum - the least value in the time range. 5972 Minimum *float64 `json:"minimum,omitempty"` 5973 // Maximum - the greatest value in the time range. 5974 Maximum *float64 `json:"maximum,omitempty"` 5975 // Total - the sum of all of the values in the time range. 5976 Total *float64 `json:"total,omitempty"` 5977 // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. 5978 Count *float64 `json:"count,omitempty"` 5979} 5980 5981// BasicMultiMetricCriteria the types of conditions for a multi resource alert. 5982type BasicMultiMetricCriteria interface { 5983 AsMetricCriteria() (*MetricCriteria, bool) 5984 AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) 5985 AsMultiMetricCriteria() (*MultiMetricCriteria, bool) 5986} 5987 5988// MultiMetricCriteria the types of conditions for a multi resource alert. 5989type MultiMetricCriteria struct { 5990 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 5991 AdditionalProperties map[string]interface{} `json:""` 5992 // Name - Name of the criteria. 5993 Name *string `json:"name,omitempty"` 5994 // MetricName - Name of the metric. 5995 MetricName *string `json:"metricName,omitempty"` 5996 // MetricNamespace - Namespace of the metric. 5997 MetricNamespace *string `json:"metricNamespace,omitempty"` 5998 // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' 5999 TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` 6000 // Dimensions - List of dimension conditions. 6001 Dimensions *[]MetricDimension `json:"dimensions,omitempty"` 6002 // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. 6003 SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` 6004 // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' 6005 CriterionType CriterionType `json:"criterionType,omitempty"` 6006} 6007 6008func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) { 6009 var m map[string]interface{} 6010 err := json.Unmarshal(body, &m) 6011 if err != nil { 6012 return nil, err 6013 } 6014 6015 switch m["criterionType"] { 6016 case string(CriterionTypeStaticThresholdCriterion): 6017 var mc MetricCriteria 6018 err := json.Unmarshal(body, &mc) 6019 return mc, err 6020 case string(CriterionTypeDynamicThresholdCriterion): 6021 var dmc DynamicMetricCriteria 6022 err := json.Unmarshal(body, &dmc) 6023 return dmc, err 6024 default: 6025 var mmc MultiMetricCriteria 6026 err := json.Unmarshal(body, &mmc) 6027 return mmc, err 6028 } 6029} 6030func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) { 6031 var rawMessages []*json.RawMessage 6032 err := json.Unmarshal(body, &rawMessages) 6033 if err != nil { 6034 return nil, err 6035 } 6036 6037 mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages)) 6038 6039 for index, rawMessage := range rawMessages { 6040 mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage) 6041 if err != nil { 6042 return nil, err 6043 } 6044 mmcArray[index] = mmc 6045 } 6046 return mmcArray, nil 6047} 6048 6049// MarshalJSON is the custom marshaler for MultiMetricCriteria. 6050func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { 6051 mmc.CriterionType = CriterionTypeMultiMetricCriteria 6052 objectMap := make(map[string]interface{}) 6053 if mmc.Name != nil { 6054 objectMap["name"] = mmc.Name 6055 } 6056 if mmc.MetricName != nil { 6057 objectMap["metricName"] = mmc.MetricName 6058 } 6059 if mmc.MetricNamespace != nil { 6060 objectMap["metricNamespace"] = mmc.MetricNamespace 6061 } 6062 if mmc.TimeAggregation != "" { 6063 objectMap["timeAggregation"] = mmc.TimeAggregation 6064 } 6065 if mmc.Dimensions != nil { 6066 objectMap["dimensions"] = mmc.Dimensions 6067 } 6068 if mmc.SkipMetricValidation != nil { 6069 objectMap["skipMetricValidation"] = mmc.SkipMetricValidation 6070 } 6071 if mmc.CriterionType != "" { 6072 objectMap["criterionType"] = mmc.CriterionType 6073 } 6074 for k, v := range mmc.AdditionalProperties { 6075 objectMap[k] = v 6076 } 6077 return json.Marshal(objectMap) 6078} 6079 6080// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. 6081func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { 6082 return nil, false 6083} 6084 6085// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. 6086func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { 6087 return nil, false 6088} 6089 6090// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. 6091func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { 6092 return &mmc, true 6093} 6094 6095// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. 6096func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { 6097 return &mmc, true 6098} 6099 6100// UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct. 6101func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error { 6102 var m map[string]*json.RawMessage 6103 err := json.Unmarshal(body, &m) 6104 if err != nil { 6105 return err 6106 } 6107 for k, v := range m { 6108 switch k { 6109 default: 6110 if v != nil { 6111 var additionalProperties interface{} 6112 err = json.Unmarshal(*v, &additionalProperties) 6113 if err != nil { 6114 return err 6115 } 6116 if mmc.AdditionalProperties == nil { 6117 mmc.AdditionalProperties = make(map[string]interface{}) 6118 } 6119 mmc.AdditionalProperties[k] = additionalProperties 6120 } 6121 case "name": 6122 if v != nil { 6123 var name string 6124 err = json.Unmarshal(*v, &name) 6125 if err != nil { 6126 return err 6127 } 6128 mmc.Name = &name 6129 } 6130 case "metricName": 6131 if v != nil { 6132 var metricName string 6133 err = json.Unmarshal(*v, &metricName) 6134 if err != nil { 6135 return err 6136 } 6137 mmc.MetricName = &metricName 6138 } 6139 case "metricNamespace": 6140 if v != nil { 6141 var metricNamespace string 6142 err = json.Unmarshal(*v, &metricNamespace) 6143 if err != nil { 6144 return err 6145 } 6146 mmc.MetricNamespace = &metricNamespace 6147 } 6148 case "timeAggregation": 6149 if v != nil { 6150 var timeAggregation AggregationTypeEnum 6151 err = json.Unmarshal(*v, &timeAggregation) 6152 if err != nil { 6153 return err 6154 } 6155 mmc.TimeAggregation = timeAggregation 6156 } 6157 case "dimensions": 6158 if v != nil { 6159 var dimensions []MetricDimension 6160 err = json.Unmarshal(*v, &dimensions) 6161 if err != nil { 6162 return err 6163 } 6164 mmc.Dimensions = &dimensions 6165 } 6166 case "skipMetricValidation": 6167 if v != nil { 6168 var skipMetricValidation bool 6169 err = json.Unmarshal(*v, &skipMetricValidation) 6170 if err != nil { 6171 return err 6172 } 6173 mmc.SkipMetricValidation = &skipMetricValidation 6174 } 6175 case "criterionType": 6176 if v != nil { 6177 var criterionType CriterionType 6178 err = json.Unmarshal(*v, &criterionType) 6179 if err != nil { 6180 return err 6181 } 6182 mmc.CriterionType = criterionType 6183 } 6184 } 6185 } 6186 6187 return nil 6188} 6189 6190// NetworkRuleSet definition of the network rules. 6191type NetworkRuleSet struct { 6192 // PublicNetworkAccess - The configuration to set whether network access from public internet to the endpoints are allowed. Possible values include: 'KnownPublicNetworkAccessOptionsEnabled', 'KnownPublicNetworkAccessOptionsDisabled' 6193 PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"` 6194} 6195 6196// Operation microsoft Insights API operation definition. 6197type Operation struct { 6198 // Name - Operation name: {provider}/{resource}/{operation} 6199 Name *string `json:"name,omitempty"` 6200 // Display - Display metadata associated with the operation. 6201 Display *OperationDisplay `json:"display,omitempty"` 6202} 6203 6204// OperationDisplay display metadata associated with the operation. 6205type OperationDisplay struct { 6206 // Provider - Service provider: Microsoft.Insights 6207 Provider *string `json:"provider,omitempty"` 6208 // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. 6209 Resource *string `json:"resource,omitempty"` 6210 // Operation - Operation type: Read, write, delete, etc. 6211 Operation *string `json:"operation,omitempty"` 6212} 6213 6214// OperationListResult result of the request to list Microsoft.Insights operations. It contains a list of 6215// operations and a URL link to get the next set of results. 6216type OperationListResult struct { 6217 autorest.Response `json:"-"` 6218 // Value - List of operations supported by the Microsoft.Insights provider. 6219 Value *[]Operation `json:"value,omitempty"` 6220 // NextLink - URL to get the next set of operation list results if there are any. 6221 NextLink *string `json:"nextLink,omitempty"` 6222} 6223 6224// OperationStatus the status of operation. 6225type OperationStatus struct { 6226 autorest.Response `json:"-"` 6227 // ID - The operation Id. 6228 ID *string `json:"id,omitempty"` 6229 // Name - The operation name. 6230 Name *string `json:"name,omitempty"` 6231 // StartTime - Start time of the job in standard ISO8601 format. 6232 StartTime *date.Time `json:"startTime,omitempty"` 6233 // EndTime - End time of the job in standard ISO8601 format. 6234 EndTime *date.Time `json:"endTime,omitempty"` 6235 // Status - The status of the operation. 6236 Status *string `json:"status,omitempty"` 6237 // Error - The error detail of the operation if any. 6238 Error *ErrorResponseCommon `json:"error,omitempty"` 6239} 6240 6241// PerfCounterDataSource definition of which performance counters will be collected and how they will be 6242// collected by this data collection rule. 6243// Collected from both Windows and Linux machines where the counter is present. 6244type PerfCounterDataSource struct { 6245 // Streams - List of streams that this data source will be sent to. 6246 // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. 6247 Streams *[]KnownPerfCounterDataSourceStreams `json:"streams,omitempty"` 6248 // SamplingFrequencyInSeconds - The number of seconds between consecutive counter measurements (samples). 6249 SamplingFrequencyInSeconds *int32 `json:"samplingFrequencyInSeconds,omitempty"` 6250 // CounterSpecifiers - A list of specifier names of the performance counters you want to collect. 6251 // Use a wildcard (*) to collect a counter for all instances. 6252 // To get a list of performance counters on Windows, run the command 'typeperf'. 6253 CounterSpecifiers *[]string `json:"counterSpecifiers,omitempty"` 6254 // Name - A friendly name for the data source. 6255 // This name should be unique across all data sources (regardless of type) within the data collection rule. 6256 Name *string `json:"name,omitempty"` 6257} 6258 6259// PrivateEndpointConnection a private endpoint connection 6260type PrivateEndpointConnection struct { 6261 autorest.Response `json:"-"` 6262 // PrivateEndpointConnectionProperties - Resource properties. 6263 *PrivateEndpointConnectionProperties `json:"properties,omitempty"` 6264 // ID - READ-ONLY; Azure resource Id 6265 ID *string `json:"id,omitempty"` 6266 // Name - READ-ONLY; Azure resource name 6267 Name *string `json:"name,omitempty"` 6268 // Type - READ-ONLY; Azure resource type 6269 Type *string `json:"type,omitempty"` 6270} 6271 6272// MarshalJSON is the custom marshaler for PrivateEndpointConnection. 6273func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { 6274 objectMap := make(map[string]interface{}) 6275 if pec.PrivateEndpointConnectionProperties != nil { 6276 objectMap["properties"] = pec.PrivateEndpointConnectionProperties 6277 } 6278 return json.Marshal(objectMap) 6279} 6280 6281// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. 6282func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { 6283 var m map[string]*json.RawMessage 6284 err := json.Unmarshal(body, &m) 6285 if err != nil { 6286 return err 6287 } 6288 for k, v := range m { 6289 switch k { 6290 case "properties": 6291 if v != nil { 6292 var privateEndpointConnectionProperties PrivateEndpointConnectionProperties 6293 err = json.Unmarshal(*v, &privateEndpointConnectionProperties) 6294 if err != nil { 6295 return err 6296 } 6297 pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties 6298 } 6299 case "id": 6300 if v != nil { 6301 var ID string 6302 err = json.Unmarshal(*v, &ID) 6303 if err != nil { 6304 return err 6305 } 6306 pec.ID = &ID 6307 } 6308 case "name": 6309 if v != nil { 6310 var name string 6311 err = json.Unmarshal(*v, &name) 6312 if err != nil { 6313 return err 6314 } 6315 pec.Name = &name 6316 } 6317 case "type": 6318 if v != nil { 6319 var typeVar string 6320 err = json.Unmarshal(*v, &typeVar) 6321 if err != nil { 6322 return err 6323 } 6324 pec.Type = &typeVar 6325 } 6326 } 6327 } 6328 6329 return nil 6330} 6331 6332// PrivateEndpointConnectionListResult a list of private endpoint connections. 6333type PrivateEndpointConnectionListResult struct { 6334 autorest.Response `json:"-"` 6335 // Value - READ-ONLY; Array of results. 6336 Value *[]PrivateEndpointConnection `json:"value,omitempty"` 6337 // NextLink - READ-ONLY; Link to retrieve next page of results. 6338 NextLink *string `json:"nextLink,omitempty"` 6339} 6340 6341// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. 6342func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { 6343 objectMap := make(map[string]interface{}) 6344 return json.Marshal(objectMap) 6345} 6346 6347// PrivateEndpointConnectionListResultIterator provides access to a complete listing of 6348// PrivateEndpointConnection values. 6349type PrivateEndpointConnectionListResultIterator struct { 6350 i int 6351 page PrivateEndpointConnectionListResultPage 6352} 6353 6354// NextWithContext advances to the next value. If there was an error making 6355// the request the iterator does not advance and the error is returned. 6356func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { 6357 if tracing.IsEnabled() { 6358 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") 6359 defer func() { 6360 sc := -1 6361 if iter.Response().Response.Response != nil { 6362 sc = iter.Response().Response.Response.StatusCode 6363 } 6364 tracing.EndSpan(ctx, sc, err) 6365 }() 6366 } 6367 iter.i++ 6368 if iter.i < len(iter.page.Values()) { 6369 return nil 6370 } 6371 err = iter.page.NextWithContext(ctx) 6372 if err != nil { 6373 iter.i-- 6374 return err 6375 } 6376 iter.i = 0 6377 return nil 6378} 6379 6380// Next advances to the next value. If there was an error making 6381// the request the iterator does not advance and the error is returned. 6382// Deprecated: Use NextWithContext() instead. 6383func (iter *PrivateEndpointConnectionListResultIterator) Next() error { 6384 return iter.NextWithContext(context.Background()) 6385} 6386 6387// NotDone returns true if the enumeration should be started or is not yet complete. 6388func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { 6389 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6390} 6391 6392// Response returns the raw server response from the last page request. 6393func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { 6394 return iter.page.Response() 6395} 6396 6397// Value returns the current value or a zero-initialized value if the 6398// iterator has advanced beyond the end of the collection. 6399func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { 6400 if !iter.page.NotDone() { 6401 return PrivateEndpointConnection{} 6402 } 6403 return iter.page.Values()[iter.i] 6404} 6405 6406// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. 6407func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { 6408 return PrivateEndpointConnectionListResultIterator{page: page} 6409} 6410 6411// IsEmpty returns true if the ListResult contains no values. 6412func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { 6413 return peclr.Value == nil || len(*peclr.Value) == 0 6414} 6415 6416// hasNextLink returns true if the NextLink is not empty. 6417func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { 6418 return peclr.NextLink != nil && len(*peclr.NextLink) != 0 6419} 6420 6421// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. 6422// It returns nil if no more results exist. 6423func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { 6424 if !peclr.hasNextLink() { 6425 return nil, nil 6426 } 6427 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6428 autorest.AsJSON(), 6429 autorest.AsGet(), 6430 autorest.WithBaseURL(to.String(peclr.NextLink))) 6431} 6432 6433// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. 6434type PrivateEndpointConnectionListResultPage struct { 6435 fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) 6436 peclr PrivateEndpointConnectionListResult 6437} 6438 6439// NextWithContext advances to the next page of values. If there was an error making 6440// the request the page does not advance and the error is returned. 6441func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { 6442 if tracing.IsEnabled() { 6443 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") 6444 defer func() { 6445 sc := -1 6446 if page.Response().Response.Response != nil { 6447 sc = page.Response().Response.Response.StatusCode 6448 } 6449 tracing.EndSpan(ctx, sc, err) 6450 }() 6451 } 6452 for { 6453 next, err := page.fn(ctx, page.peclr) 6454 if err != nil { 6455 return err 6456 } 6457 page.peclr = next 6458 if !next.hasNextLink() || !next.IsEmpty() { 6459 break 6460 } 6461 } 6462 return nil 6463} 6464 6465// Next advances to the next page of values. If there was an error making 6466// the request the page does not advance and the error is returned. 6467// Deprecated: Use NextWithContext() instead. 6468func (page *PrivateEndpointConnectionListResultPage) Next() error { 6469 return page.NextWithContext(context.Background()) 6470} 6471 6472// NotDone returns true if the page enumeration should be started or is not yet complete. 6473func (page PrivateEndpointConnectionListResultPage) NotDone() bool { 6474 return !page.peclr.IsEmpty() 6475} 6476 6477// Response returns the raw server response from the last page request. 6478func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { 6479 return page.peclr 6480} 6481 6482// Values returns the slice of values for the current page or nil if there are no values. 6483func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { 6484 if page.peclr.IsEmpty() { 6485 return nil 6486 } 6487 return *page.peclr.Value 6488} 6489 6490// Creates a new instance of the PrivateEndpointConnectionListResultPage type. 6491func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { 6492 return PrivateEndpointConnectionListResultPage{ 6493 fn: getNextPage, 6494 peclr: cur, 6495 } 6496} 6497 6498// PrivateEndpointConnectionProperties properties of a private endpoint connection. 6499type PrivateEndpointConnectionProperties struct { 6500 // PrivateEndpoint - Private endpoint which the connection belongs to. 6501 PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` 6502 // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. 6503 PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` 6504 // ProvisioningState - READ-ONLY; State of the private endpoint connection. 6505 ProvisioningState *string `json:"provisioningState,omitempty"` 6506} 6507 6508// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. 6509func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { 6510 objectMap := make(map[string]interface{}) 6511 if pecp.PrivateEndpoint != nil { 6512 objectMap["privateEndpoint"] = pecp.PrivateEndpoint 6513 } 6514 if pecp.PrivateLinkServiceConnectionState != nil { 6515 objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState 6516 } 6517 return json.Marshal(objectMap) 6518} 6519 6520// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results 6521// of a long-running operation. 6522type PrivateEndpointConnectionsCreateOrUpdateFuture struct { 6523 azure.FutureAPI 6524 // Result returns the result of the asynchronous operation. 6525 // If the operation has not completed it will return an error. 6526 Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) 6527} 6528 6529// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6530func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 6531 var azFuture azure.Future 6532 if err := json.Unmarshal(body, &azFuture); err != nil { 6533 return err 6534 } 6535 future.FutureAPI = &azFuture 6536 future.Result = future.result 6537 return nil 6538} 6539 6540// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. 6541func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { 6542 var done bool 6543 done, err = future.DoneWithContext(context.Background(), client) 6544 if err != nil { 6545 err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 6546 return 6547 } 6548 if !done { 6549 pec.Response.Response = future.Response() 6550 err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsCreateOrUpdateFuture") 6551 return 6552 } 6553 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6554 if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { 6555 pec, err = client.CreateOrUpdateResponder(pec.Response.Response) 6556 if err != nil { 6557 err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") 6558 } 6559 } 6560 return 6561} 6562 6563// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a 6564// long-running operation. 6565type PrivateEndpointConnectionsDeleteFuture struct { 6566 azure.FutureAPI 6567 // Result returns the result of the asynchronous operation. 6568 // If the operation has not completed it will return an error. 6569 Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) 6570} 6571 6572// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6573func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { 6574 var azFuture azure.Future 6575 if err := json.Unmarshal(body, &azFuture); err != nil { 6576 return err 6577 } 6578 future.FutureAPI = &azFuture 6579 future.Result = future.result 6580 return nil 6581} 6582 6583// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. 6584func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { 6585 var done bool 6586 done, err = future.DoneWithContext(context.Background(), client) 6587 if err != nil { 6588 err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") 6589 return 6590 } 6591 if !done { 6592 ar.Response = future.Response() 6593 err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsDeleteFuture") 6594 return 6595 } 6596 ar.Response = future.Response() 6597 return 6598} 6599 6600// PrivateEndpointProperty private endpoint which the connection belongs to. 6601type PrivateEndpointProperty struct { 6602 // ID - Resource id of the private endpoint. 6603 ID *string `json:"id,omitempty"` 6604} 6605 6606// PrivateLinkResource a private link resource 6607type PrivateLinkResource struct { 6608 autorest.Response `json:"-"` 6609 // PrivateLinkResourceProperties - Resource properties. 6610 *PrivateLinkResourceProperties `json:"properties,omitempty"` 6611 // ID - READ-ONLY; Azure resource Id 6612 ID *string `json:"id,omitempty"` 6613 // Name - READ-ONLY; Azure resource name 6614 Name *string `json:"name,omitempty"` 6615 // Type - READ-ONLY; Azure resource type 6616 Type *string `json:"type,omitempty"` 6617} 6618 6619// MarshalJSON is the custom marshaler for PrivateLinkResource. 6620func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { 6621 objectMap := make(map[string]interface{}) 6622 if plr.PrivateLinkResourceProperties != nil { 6623 objectMap["properties"] = plr.PrivateLinkResourceProperties 6624 } 6625 return json.Marshal(objectMap) 6626} 6627 6628// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. 6629func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { 6630 var m map[string]*json.RawMessage 6631 err := json.Unmarshal(body, &m) 6632 if err != nil { 6633 return err 6634 } 6635 for k, v := range m { 6636 switch k { 6637 case "properties": 6638 if v != nil { 6639 var privateLinkResourceProperties PrivateLinkResourceProperties 6640 err = json.Unmarshal(*v, &privateLinkResourceProperties) 6641 if err != nil { 6642 return err 6643 } 6644 plr.PrivateLinkResourceProperties = &privateLinkResourceProperties 6645 } 6646 case "id": 6647 if v != nil { 6648 var ID string 6649 err = json.Unmarshal(*v, &ID) 6650 if err != nil { 6651 return err 6652 } 6653 plr.ID = &ID 6654 } 6655 case "name": 6656 if v != nil { 6657 var name string 6658 err = json.Unmarshal(*v, &name) 6659 if err != nil { 6660 return err 6661 } 6662 plr.Name = &name 6663 } 6664 case "type": 6665 if v != nil { 6666 var typeVar string 6667 err = json.Unmarshal(*v, &typeVar) 6668 if err != nil { 6669 return err 6670 } 6671 plr.Type = &typeVar 6672 } 6673 } 6674 } 6675 6676 return nil 6677} 6678 6679// PrivateLinkResourceListResult a list of private link resources 6680type PrivateLinkResourceListResult struct { 6681 autorest.Response `json:"-"` 6682 // Value - READ-ONLY; Array of results. 6683 Value *[]PrivateLinkResource `json:"value,omitempty"` 6684 // NextLink - READ-ONLY; Link to retrieve next page of results. 6685 NextLink *string `json:"nextLink,omitempty"` 6686} 6687 6688// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. 6689func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { 6690 objectMap := make(map[string]interface{}) 6691 return json.Marshal(objectMap) 6692} 6693 6694// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource 6695// values. 6696type PrivateLinkResourceListResultIterator struct { 6697 i int 6698 page PrivateLinkResourceListResultPage 6699} 6700 6701// NextWithContext advances to the next value. If there was an error making 6702// the request the iterator does not advance and the error is returned. 6703func (iter *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { 6704 if tracing.IsEnabled() { 6705 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.NextWithContext") 6706 defer func() { 6707 sc := -1 6708 if iter.Response().Response.Response != nil { 6709 sc = iter.Response().Response.Response.StatusCode 6710 } 6711 tracing.EndSpan(ctx, sc, err) 6712 }() 6713 } 6714 iter.i++ 6715 if iter.i < len(iter.page.Values()) { 6716 return nil 6717 } 6718 err = iter.page.NextWithContext(ctx) 6719 if err != nil { 6720 iter.i-- 6721 return err 6722 } 6723 iter.i = 0 6724 return nil 6725} 6726 6727// Next advances to the next value. If there was an error making 6728// the request the iterator does not advance and the error is returned. 6729// Deprecated: Use NextWithContext() instead. 6730func (iter *PrivateLinkResourceListResultIterator) Next() error { 6731 return iter.NextWithContext(context.Background()) 6732} 6733 6734// NotDone returns true if the enumeration should be started or is not yet complete. 6735func (iter PrivateLinkResourceListResultIterator) NotDone() bool { 6736 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6737} 6738 6739// Response returns the raw server response from the last page request. 6740func (iter PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { 6741 return iter.page.Response() 6742} 6743 6744// Value returns the current value or a zero-initialized value if the 6745// iterator has advanced beyond the end of the collection. 6746func (iter PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { 6747 if !iter.page.NotDone() { 6748 return PrivateLinkResource{} 6749 } 6750 return iter.page.Values()[iter.i] 6751} 6752 6753// Creates a new instance of the PrivateLinkResourceListResultIterator type. 6754func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { 6755 return PrivateLinkResourceListResultIterator{page: page} 6756} 6757 6758// IsEmpty returns true if the ListResult contains no values. 6759func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { 6760 return plrlr.Value == nil || len(*plrlr.Value) == 0 6761} 6762 6763// hasNextLink returns true if the NextLink is not empty. 6764func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { 6765 return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 6766} 6767 6768// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. 6769// It returns nil if no more results exist. 6770func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { 6771 if !plrlr.hasNextLink() { 6772 return nil, nil 6773 } 6774 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6775 autorest.AsJSON(), 6776 autorest.AsGet(), 6777 autorest.WithBaseURL(to.String(plrlr.NextLink))) 6778} 6779 6780// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. 6781type PrivateLinkResourceListResultPage struct { 6782 fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) 6783 plrlr PrivateLinkResourceListResult 6784} 6785 6786// NextWithContext advances to the next page of values. If there was an error making 6787// the request the page does not advance and the error is returned. 6788func (page *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { 6789 if tracing.IsEnabled() { 6790 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.NextWithContext") 6791 defer func() { 6792 sc := -1 6793 if page.Response().Response.Response != nil { 6794 sc = page.Response().Response.Response.StatusCode 6795 } 6796 tracing.EndSpan(ctx, sc, err) 6797 }() 6798 } 6799 for { 6800 next, err := page.fn(ctx, page.plrlr) 6801 if err != nil { 6802 return err 6803 } 6804 page.plrlr = next 6805 if !next.hasNextLink() || !next.IsEmpty() { 6806 break 6807 } 6808 } 6809 return nil 6810} 6811 6812// Next advances to the next page of values. If there was an error making 6813// the request the page does not advance and the error is returned. 6814// Deprecated: Use NextWithContext() instead. 6815func (page *PrivateLinkResourceListResultPage) Next() error { 6816 return page.NextWithContext(context.Background()) 6817} 6818 6819// NotDone returns true if the page enumeration should be started or is not yet complete. 6820func (page PrivateLinkResourceListResultPage) NotDone() bool { 6821 return !page.plrlr.IsEmpty() 6822} 6823 6824// Response returns the raw server response from the last page request. 6825func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { 6826 return page.plrlr 6827} 6828 6829// Values returns the slice of values for the current page or nil if there are no values. 6830func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { 6831 if page.plrlr.IsEmpty() { 6832 return nil 6833 } 6834 return *page.plrlr.Value 6835} 6836 6837// Creates a new instance of the PrivateLinkResourceListResultPage type. 6838func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { 6839 return PrivateLinkResourceListResultPage{ 6840 fn: getNextPage, 6841 plrlr: cur, 6842 } 6843} 6844 6845// PrivateLinkResourceProperties properties of a private link resource. 6846type PrivateLinkResourceProperties struct { 6847 // GroupID - READ-ONLY; The private link resource group id. 6848 GroupID *string `json:"groupId,omitempty"` 6849 // RequiredMembers - READ-ONLY; The private link resource required member names. 6850 RequiredMembers *[]string `json:"requiredMembers,omitempty"` 6851} 6852 6853// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. 6854func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { 6855 objectMap := make(map[string]interface{}) 6856 return json.Marshal(objectMap) 6857} 6858 6859// PrivateLinkScopedResourcesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results 6860// of a long-running operation. 6861type PrivateLinkScopedResourcesCreateOrUpdateFuture struct { 6862 azure.FutureAPI 6863 // Result returns the result of the asynchronous operation. 6864 // If the operation has not completed it will return an error. 6865 Result func(PrivateLinkScopedResourcesClient) (ScopedResource, error) 6866} 6867 6868// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6869func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 6870 var azFuture azure.Future 6871 if err := json.Unmarshal(body, &azFuture); err != nil { 6872 return err 6873 } 6874 future.FutureAPI = &azFuture 6875 future.Result = future.result 6876 return nil 6877} 6878 6879// result is the default implementation for PrivateLinkScopedResourcesCreateOrUpdateFuture.Result. 6880func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) result(client PrivateLinkScopedResourcesClient) (sr ScopedResource, err error) { 6881 var done bool 6882 done, err = future.DoneWithContext(context.Background(), client) 6883 if err != nil { 6884 err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 6885 return 6886 } 6887 if !done { 6888 sr.Response.Response = future.Response() 6889 err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesCreateOrUpdateFuture") 6890 return 6891 } 6892 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6893 if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { 6894 sr, err = client.CreateOrUpdateResponder(sr.Response.Response) 6895 if err != nil { 6896 err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") 6897 } 6898 } 6899 return 6900} 6901 6902// PrivateLinkScopedResourcesDeleteFuture an abstraction for monitoring and retrieving the results of a 6903// long-running operation. 6904type PrivateLinkScopedResourcesDeleteFuture struct { 6905 azure.FutureAPI 6906 // Result returns the result of the asynchronous operation. 6907 // If the operation has not completed it will return an error. 6908 Result func(PrivateLinkScopedResourcesClient) (autorest.Response, error) 6909} 6910 6911// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6912func (future *PrivateLinkScopedResourcesDeleteFuture) UnmarshalJSON(body []byte) error { 6913 var azFuture azure.Future 6914 if err := json.Unmarshal(body, &azFuture); err != nil { 6915 return err 6916 } 6917 future.FutureAPI = &azFuture 6918 future.Result = future.result 6919 return nil 6920} 6921 6922// result is the default implementation for PrivateLinkScopedResourcesDeleteFuture.Result. 6923func (future *PrivateLinkScopedResourcesDeleteFuture) result(client PrivateLinkScopedResourcesClient) (ar autorest.Response, err error) { 6924 var done bool 6925 done, err = future.DoneWithContext(context.Background(), client) 6926 if err != nil { 6927 err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesDeleteFuture", "Result", future.Response(), "Polling failure") 6928 return 6929 } 6930 if !done { 6931 ar.Response = future.Response() 6932 err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesDeleteFuture") 6933 return 6934 } 6935 ar.Response = future.Response() 6936 return 6937} 6938 6939// PrivateLinkScopesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 6940// operation. 6941type PrivateLinkScopesDeleteFuture struct { 6942 azure.FutureAPI 6943 // Result returns the result of the asynchronous operation. 6944 // If the operation has not completed it will return an error. 6945 Result func(PrivateLinkScopesClient) (autorest.Response, error) 6946} 6947 6948// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6949func (future *PrivateLinkScopesDeleteFuture) UnmarshalJSON(body []byte) error { 6950 var azFuture azure.Future 6951 if err := json.Unmarshal(body, &azFuture); err != nil { 6952 return err 6953 } 6954 future.FutureAPI = &azFuture 6955 future.Result = future.result 6956 return nil 6957} 6958 6959// result is the default implementation for PrivateLinkScopesDeleteFuture.Result. 6960func (future *PrivateLinkScopesDeleteFuture) result(client PrivateLinkScopesClient) (ar autorest.Response, err error) { 6961 var done bool 6962 done, err = future.DoneWithContext(context.Background(), client) 6963 if err != nil { 6964 err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesDeleteFuture", "Result", future.Response(), "Polling failure") 6965 return 6966 } 6967 if !done { 6968 ar.Response = future.Response() 6969 err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopesDeleteFuture") 6970 return 6971 } 6972 ar.Response = future.Response() 6973 return 6974} 6975 6976// PrivateLinkScopesResource an azure resource object 6977type PrivateLinkScopesResource struct { 6978 // ID - READ-ONLY; Azure resource Id 6979 ID *string `json:"id,omitempty"` 6980 // Name - READ-ONLY; Azure resource name 6981 Name *string `json:"name,omitempty"` 6982 // Type - READ-ONLY; Azure resource type 6983 Type *string `json:"type,omitempty"` 6984 // Location - Resource location 6985 Location *string `json:"location,omitempty"` 6986 // Tags - Resource tags 6987 Tags map[string]*string `json:"tags"` 6988} 6989 6990// MarshalJSON is the custom marshaler for PrivateLinkScopesResource. 6991func (plsr PrivateLinkScopesResource) MarshalJSON() ([]byte, error) { 6992 objectMap := make(map[string]interface{}) 6993 if plsr.Location != nil { 6994 objectMap["location"] = plsr.Location 6995 } 6996 if plsr.Tags != nil { 6997 objectMap["tags"] = plsr.Tags 6998 } 6999 return json.Marshal(objectMap) 7000} 7001 7002// PrivateLinkServiceConnectionStateProperty state of the private endpoint connection. 7003type PrivateLinkServiceConnectionStateProperty struct { 7004 // Status - The private link service connection status. 7005 Status *string `json:"status,omitempty"` 7006 // Description - The private link service connection description. 7007 Description *string `json:"description,omitempty"` 7008 // ActionsRequired - READ-ONLY; The actions required for private link service connection. 7009 ActionsRequired *string `json:"actionsRequired,omitempty"` 7010} 7011 7012// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. 7013func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { 7014 objectMap := make(map[string]interface{}) 7015 if plscsp.Status != nil { 7016 objectMap["status"] = plscsp.Status 7017 } 7018 if plscsp.Description != nil { 7019 objectMap["description"] = plscsp.Description 7020 } 7021 return json.Marshal(objectMap) 7022} 7023 7024// ProxyOnlyResource a proxy only azure resource object 7025type ProxyOnlyResource struct { 7026 // ID - READ-ONLY; Azure resource Id 7027 ID *string `json:"id,omitempty"` 7028 // Name - READ-ONLY; Azure resource name 7029 Name *string `json:"name,omitempty"` 7030 // Type - READ-ONLY; Azure resource type 7031 Type *string `json:"type,omitempty"` 7032} 7033 7034// MarshalJSON is the custom marshaler for ProxyOnlyResource. 7035func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) { 7036 objectMap := make(map[string]interface{}) 7037 return json.Marshal(objectMap) 7038} 7039 7040// ProxyResource an azure resource object 7041type ProxyResource struct { 7042 // ID - READ-ONLY; Azure resource Id 7043 ID *string `json:"id,omitempty"` 7044 // Name - READ-ONLY; Azure resource name 7045 Name *string `json:"name,omitempty"` 7046 // Type - READ-ONLY; Azure resource type 7047 Type *string `json:"type,omitempty"` 7048} 7049 7050// MarshalJSON is the custom marshaler for ProxyResource. 7051func (pr ProxyResource) MarshalJSON() ([]byte, error) { 7052 objectMap := make(map[string]interface{}) 7053 return json.Marshal(objectMap) 7054} 7055 7056// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate 7057// element is used. 7058type Recurrence struct { 7059 // 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' 7060 Frequency RecurrenceFrequency `json:"frequency,omitempty"` 7061 // Schedule - the scheduling constraints for when the profile begins. 7062 Schedule *RecurrentSchedule `json:"schedule,omitempty"` 7063} 7064 7065// RecurrentSchedule the scheduling constraints for when the profile begins. 7066type RecurrentSchedule struct { 7067 // 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 7068 TimeZone *string `json:"timeZone,omitempty"` 7069 // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. 7070 Days *[]string `json:"days,omitempty"` 7071 // 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). 7072 Hours *[]int32 `json:"hours,omitempty"` 7073 // Minutes - A collection of minutes at which the profile takes effect at. 7074 Minutes *[]int32 `json:"minutes,omitempty"` 7075} 7076 7077// Resource an azure resource object 7078type Resource struct { 7079 // ID - READ-ONLY; Azure resource Id 7080 ID *string `json:"id,omitempty"` 7081 // Name - READ-ONLY; Azure resource name 7082 Name *string `json:"name,omitempty"` 7083 // Type - READ-ONLY; Azure resource type 7084 Type *string `json:"type,omitempty"` 7085 // Location - Resource location 7086 Location *string `json:"location,omitempty"` 7087 // Tags - Resource tags 7088 Tags map[string]*string `json:"tags"` 7089 // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. 7090 Kind *string `json:"kind,omitempty"` 7091 // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. 7092 Etag *string `json:"etag,omitempty"` 7093} 7094 7095// MarshalJSON is the custom marshaler for Resource. 7096func (r Resource) MarshalJSON() ([]byte, error) { 7097 objectMap := make(map[string]interface{}) 7098 if r.Location != nil { 7099 objectMap["location"] = r.Location 7100 } 7101 if r.Tags != nil { 7102 objectMap["tags"] = r.Tags 7103 } 7104 return json.Marshal(objectMap) 7105} 7106 7107// ResourceForUpdate definition of ARM tracked top level resource properties for update operation. 7108type ResourceForUpdate struct { 7109 // Tags - Resource tags. 7110 Tags map[string]*string `json:"tags"` 7111} 7112 7113// MarshalJSON is the custom marshaler for ResourceForUpdate. 7114func (rfu ResourceForUpdate) MarshalJSON() ([]byte, error) { 7115 objectMap := make(map[string]interface{}) 7116 if rfu.Tags != nil { 7117 objectMap["tags"] = rfu.Tags 7118 } 7119 return json.Marshal(objectMap) 7120} 7121 7122// Response the response to a metrics query. 7123type Response struct { 7124 autorest.Response `json:"-"` 7125 // Cost - The integer value representing the relative cost of the query. 7126 Cost *float64 `json:"cost,omitempty"` 7127 // 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. 7128 Timespan *string `json:"timespan,omitempty"` 7129 // 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. 7130 Interval *string `json:"interval,omitempty"` 7131 // Namespace - The namespace of the metrics being queried 7132 Namespace *string `json:"namespace,omitempty"` 7133 // Resourceregion - The region of the resource being queried for metrics. 7134 Resourceregion *string `json:"resourceregion,omitempty"` 7135 // Value - the value of the collection. 7136 Value *[]Metric `json:"value,omitempty"` 7137} 7138 7139// ResponseWithError an error response from the API. 7140type ResponseWithError struct { 7141 // Error - Error information. 7142 Error *Error `json:"error,omitempty"` 7143} 7144 7145// RetentionPolicy specifies the retention policy for the log. 7146type RetentionPolicy struct { 7147 // Enabled - a value indicating whether the retention policy is enabled. 7148 Enabled *bool `json:"enabled,omitempty"` 7149 // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. 7150 Days *int32 `json:"days,omitempty"` 7151} 7152 7153// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is 7154// resolved. 7155type BasicRuleAction interface { 7156 AsRuleEmailAction() (*RuleEmailAction, bool) 7157 AsRuleWebhookAction() (*RuleWebhookAction, bool) 7158 AsRuleAction() (*RuleAction, bool) 7159} 7160 7161// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is 7162// resolved. 7163type RuleAction struct { 7164 // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' 7165 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` 7166} 7167 7168func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { 7169 var m map[string]interface{} 7170 err := json.Unmarshal(body, &m) 7171 if err != nil { 7172 return nil, err 7173 } 7174 7175 switch m["odata.type"] { 7176 case string(OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): 7177 var rea RuleEmailAction 7178 err := json.Unmarshal(body, &rea) 7179 return rea, err 7180 case string(OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): 7181 var rwa RuleWebhookAction 7182 err := json.Unmarshal(body, &rwa) 7183 return rwa, err 7184 default: 7185 var ra RuleAction 7186 err := json.Unmarshal(body, &ra) 7187 return ra, err 7188 } 7189} 7190func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { 7191 var rawMessages []*json.RawMessage 7192 err := json.Unmarshal(body, &rawMessages) 7193 if err != nil { 7194 return nil, err 7195 } 7196 7197 raArray := make([]BasicRuleAction, len(rawMessages)) 7198 7199 for index, rawMessage := range rawMessages { 7200 ra, err := unmarshalBasicRuleAction(*rawMessage) 7201 if err != nil { 7202 return nil, err 7203 } 7204 raArray[index] = ra 7205 } 7206 return raArray, nil 7207} 7208 7209// MarshalJSON is the custom marshaler for RuleAction. 7210func (ra RuleAction) MarshalJSON() ([]byte, error) { 7211 ra.OdataType = OdataTypeBasicRuleActionOdataTypeRuleAction 7212 objectMap := make(map[string]interface{}) 7213 if ra.OdataType != "" { 7214 objectMap["odata.type"] = ra.OdataType 7215 } 7216 return json.Marshal(objectMap) 7217} 7218 7219// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. 7220func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { 7221 return nil, false 7222} 7223 7224// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. 7225func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { 7226 return nil, false 7227} 7228 7229// AsRuleAction is the BasicRuleAction implementation for RuleAction. 7230func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { 7231 return &ra, true 7232} 7233 7234// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. 7235func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { 7236 return &ra, true 7237} 7238 7239// BasicRuleCondition the condition that results in the alert rule being activated. 7240type BasicRuleCondition interface { 7241 AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) 7242 AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) 7243 AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) 7244 AsRuleCondition() (*RuleCondition, bool) 7245} 7246 7247// RuleCondition the condition that results in the alert rule being activated. 7248type RuleCondition struct { 7249 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 7250 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 7251 // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 7252 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 7253} 7254 7255func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { 7256 var m map[string]interface{} 7257 err := json.Unmarshal(body, &m) 7258 if err != nil { 7259 return nil, err 7260 } 7261 7262 switch m["odata.type"] { 7263 case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): 7264 var trc ThresholdRuleCondition 7265 err := json.Unmarshal(body, &trc) 7266 return trc, err 7267 case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): 7268 var ltrc LocationThresholdRuleCondition 7269 err := json.Unmarshal(body, <rc) 7270 return ltrc, err 7271 case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): 7272 var merc ManagementEventRuleCondition 7273 err := json.Unmarshal(body, &merc) 7274 return merc, err 7275 default: 7276 var rc RuleCondition 7277 err := json.Unmarshal(body, &rc) 7278 return rc, err 7279 } 7280} 7281func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { 7282 var rawMessages []*json.RawMessage 7283 err := json.Unmarshal(body, &rawMessages) 7284 if err != nil { 7285 return nil, err 7286 } 7287 7288 rcArray := make([]BasicRuleCondition, len(rawMessages)) 7289 7290 for index, rawMessage := range rawMessages { 7291 rc, err := unmarshalBasicRuleCondition(*rawMessage) 7292 if err != nil { 7293 return nil, err 7294 } 7295 rcArray[index] = rc 7296 } 7297 return rcArray, nil 7298} 7299 7300// MarshalJSON is the custom marshaler for RuleCondition. 7301func (rc RuleCondition) MarshalJSON() ([]byte, error) { 7302 rc.OdataType = OdataTypeBasicRuleConditionOdataTypeRuleCondition 7303 objectMap := make(map[string]interface{}) 7304 objectMap["dataSource"] = rc.DataSource 7305 if rc.OdataType != "" { 7306 objectMap["odata.type"] = rc.OdataType 7307 } 7308 return json.Marshal(objectMap) 7309} 7310 7311// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. 7312func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 7313 return nil, false 7314} 7315 7316// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. 7317func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 7318 return nil, false 7319} 7320 7321// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. 7322func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 7323 return nil, false 7324} 7325 7326// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. 7327func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { 7328 return &rc, true 7329} 7330 7331// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. 7332func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 7333 return &rc, true 7334} 7335 7336// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. 7337func (rc *RuleCondition) UnmarshalJSON(body []byte) error { 7338 var m map[string]*json.RawMessage 7339 err := json.Unmarshal(body, &m) 7340 if err != nil { 7341 return err 7342 } 7343 for k, v := range m { 7344 switch k { 7345 case "dataSource": 7346 if v != nil { 7347 dataSource, err := unmarshalBasicRuleDataSource(*v) 7348 if err != nil { 7349 return err 7350 } 7351 rc.DataSource = dataSource 7352 } 7353 case "odata.type": 7354 if v != nil { 7355 var odataType OdataTypeBasicRuleCondition 7356 err = json.Unmarshal(*v, &odataType) 7357 if err != nil { 7358 return err 7359 } 7360 rc.OdataType = odataType 7361 } 7362 } 7363 } 7364 7365 return nil 7366} 7367 7368// BasicRuleDataSource the resource from which the rule collects its data. 7369type BasicRuleDataSource interface { 7370 AsRuleMetricDataSource() (*RuleMetricDataSource, bool) 7371 AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) 7372 AsRuleDataSource() (*RuleDataSource, bool) 7373} 7374 7375// RuleDataSource the resource from which the rule collects its data. 7376type RuleDataSource struct { 7377 // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 7378 ResourceURI *string `json:"resourceUri,omitempty"` 7379 // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 7380 LegacyResourceID *string `json:"legacyResourceId,omitempty"` 7381 // ResourceLocation - the location of the resource. 7382 ResourceLocation *string `json:"resourceLocation,omitempty"` 7383 // MetricNamespace - the namespace of the metric. 7384 MetricNamespace *string `json:"metricNamespace,omitempty"` 7385 // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' 7386 OdataType OdataType `json:"odata.type,omitempty"` 7387} 7388 7389func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { 7390 var m map[string]interface{} 7391 err := json.Unmarshal(body, &m) 7392 if err != nil { 7393 return nil, err 7394 } 7395 7396 switch m["odata.type"] { 7397 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): 7398 var rmds RuleMetricDataSource 7399 err := json.Unmarshal(body, &rmds) 7400 return rmds, err 7401 case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): 7402 var rmeds RuleManagementEventDataSource 7403 err := json.Unmarshal(body, &rmeds) 7404 return rmeds, err 7405 default: 7406 var rds RuleDataSource 7407 err := json.Unmarshal(body, &rds) 7408 return rds, err 7409 } 7410} 7411func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { 7412 var rawMessages []*json.RawMessage 7413 err := json.Unmarshal(body, &rawMessages) 7414 if err != nil { 7415 return nil, err 7416 } 7417 7418 rdsArray := make([]BasicRuleDataSource, len(rawMessages)) 7419 7420 for index, rawMessage := range rawMessages { 7421 rds, err := unmarshalBasicRuleDataSource(*rawMessage) 7422 if err != nil { 7423 return nil, err 7424 } 7425 rdsArray[index] = rds 7426 } 7427 return rdsArray, nil 7428} 7429 7430// MarshalJSON is the custom marshaler for RuleDataSource. 7431func (rds RuleDataSource) MarshalJSON() ([]byte, error) { 7432 rds.OdataType = OdataTypeRuleDataSource 7433 objectMap := make(map[string]interface{}) 7434 if rds.ResourceURI != nil { 7435 objectMap["resourceUri"] = rds.ResourceURI 7436 } 7437 if rds.LegacyResourceID != nil { 7438 objectMap["legacyResourceId"] = rds.LegacyResourceID 7439 } 7440 if rds.ResourceLocation != nil { 7441 objectMap["resourceLocation"] = rds.ResourceLocation 7442 } 7443 if rds.MetricNamespace != nil { 7444 objectMap["metricNamespace"] = rds.MetricNamespace 7445 } 7446 if rds.OdataType != "" { 7447 objectMap["odata.type"] = rds.OdataType 7448 } 7449 return json.Marshal(objectMap) 7450} 7451 7452// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. 7453func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { 7454 return nil, false 7455} 7456 7457// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. 7458func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { 7459 return nil, false 7460} 7461 7462// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. 7463func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { 7464 return &rds, true 7465} 7466 7467// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. 7468func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { 7469 return &rds, true 7470} 7471 7472// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The 7473// discriminator is always RuleEmailAction in this case. 7474type RuleEmailAction struct { 7475 // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. 7476 SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` 7477 // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. 7478 CustomEmails *[]string `json:"customEmails,omitempty"` 7479 // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' 7480 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` 7481} 7482 7483// MarshalJSON is the custom marshaler for RuleEmailAction. 7484func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { 7485 rea.OdataType = OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction 7486 objectMap := make(map[string]interface{}) 7487 if rea.SendToServiceOwners != nil { 7488 objectMap["sendToServiceOwners"] = rea.SendToServiceOwners 7489 } 7490 if rea.CustomEmails != nil { 7491 objectMap["customEmails"] = rea.CustomEmails 7492 } 7493 if rea.OdataType != "" { 7494 objectMap["odata.type"] = rea.OdataType 7495 } 7496 return json.Marshal(objectMap) 7497} 7498 7499// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. 7500func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { 7501 return &rea, true 7502} 7503 7504// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. 7505func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { 7506 return nil, false 7507} 7508 7509// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. 7510func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { 7511 return nil, false 7512} 7513 7514// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. 7515func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { 7516 return &rea, true 7517} 7518 7519// RuleManagementEventClaimsDataSource the claims for a rule management event data source. 7520type RuleManagementEventClaimsDataSource struct { 7521 // EmailAddress - the email address. 7522 EmailAddress *string `json:"emailAddress,omitempty"` 7523} 7524 7525// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always 7526// RuleManagementEventDataSource in this case. 7527type RuleManagementEventDataSource struct { 7528 // EventName - the event name. 7529 EventName *string `json:"eventName,omitempty"` 7530 // EventSource - the event source. 7531 EventSource *string `json:"eventSource,omitempty"` 7532 // Level - the level. 7533 Level *string `json:"level,omitempty"` 7534 // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. 7535 OperationName *string `json:"operationName,omitempty"` 7536 // ResourceGroupName - the resource group name. 7537 ResourceGroupName *string `json:"resourceGroupName,omitempty"` 7538 // ResourceProviderName - the resource provider name. 7539 ResourceProviderName *string `json:"resourceProviderName,omitempty"` 7540 // Status - The status of the operation that should be checked for. If no status is provided, any status will match. 7541 Status *string `json:"status,omitempty"` 7542 // SubStatus - the substatus. 7543 SubStatus *string `json:"subStatus,omitempty"` 7544 // Claims - the claims. 7545 Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` 7546 // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 7547 ResourceURI *string `json:"resourceUri,omitempty"` 7548 // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 7549 LegacyResourceID *string `json:"legacyResourceId,omitempty"` 7550 // ResourceLocation - the location of the resource. 7551 ResourceLocation *string `json:"resourceLocation,omitempty"` 7552 // MetricNamespace - the namespace of the metric. 7553 MetricNamespace *string `json:"metricNamespace,omitempty"` 7554 // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' 7555 OdataType OdataType `json:"odata.type,omitempty"` 7556} 7557 7558// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. 7559func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { 7560 rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource 7561 objectMap := make(map[string]interface{}) 7562 if rmeds.EventName != nil { 7563 objectMap["eventName"] = rmeds.EventName 7564 } 7565 if rmeds.EventSource != nil { 7566 objectMap["eventSource"] = rmeds.EventSource 7567 } 7568 if rmeds.Level != nil { 7569 objectMap["level"] = rmeds.Level 7570 } 7571 if rmeds.OperationName != nil { 7572 objectMap["operationName"] = rmeds.OperationName 7573 } 7574 if rmeds.ResourceGroupName != nil { 7575 objectMap["resourceGroupName"] = rmeds.ResourceGroupName 7576 } 7577 if rmeds.ResourceProviderName != nil { 7578 objectMap["resourceProviderName"] = rmeds.ResourceProviderName 7579 } 7580 if rmeds.Status != nil { 7581 objectMap["status"] = rmeds.Status 7582 } 7583 if rmeds.SubStatus != nil { 7584 objectMap["subStatus"] = rmeds.SubStatus 7585 } 7586 if rmeds.Claims != nil { 7587 objectMap["claims"] = rmeds.Claims 7588 } 7589 if rmeds.ResourceURI != nil { 7590 objectMap["resourceUri"] = rmeds.ResourceURI 7591 } 7592 if rmeds.LegacyResourceID != nil { 7593 objectMap["legacyResourceId"] = rmeds.LegacyResourceID 7594 } 7595 if rmeds.ResourceLocation != nil { 7596 objectMap["resourceLocation"] = rmeds.ResourceLocation 7597 } 7598 if rmeds.MetricNamespace != nil { 7599 objectMap["metricNamespace"] = rmeds.MetricNamespace 7600 } 7601 if rmeds.OdataType != "" { 7602 objectMap["odata.type"] = rmeds.OdataType 7603 } 7604 return json.Marshal(objectMap) 7605} 7606 7607// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 7608func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { 7609 return nil, false 7610} 7611 7612// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 7613func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { 7614 return &rmeds, true 7615} 7616 7617// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 7618func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { 7619 return nil, false 7620} 7621 7622// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. 7623func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { 7624 return &rmeds, true 7625} 7626 7627// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource 7628// in this case. 7629type RuleMetricDataSource struct { 7630 // MetricName - the name of the metric that defines what the rule monitors. 7631 MetricName *string `json:"metricName,omitempty"` 7632 // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 7633 ResourceURI *string `json:"resourceUri,omitempty"` 7634 // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. 7635 LegacyResourceID *string `json:"legacyResourceId,omitempty"` 7636 // ResourceLocation - the location of the resource. 7637 ResourceLocation *string `json:"resourceLocation,omitempty"` 7638 // MetricNamespace - the namespace of the metric. 7639 MetricNamespace *string `json:"metricNamespace,omitempty"` 7640 // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' 7641 OdataType OdataType `json:"odata.type,omitempty"` 7642} 7643 7644// MarshalJSON is the custom marshaler for RuleMetricDataSource. 7645func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { 7646 rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource 7647 objectMap := make(map[string]interface{}) 7648 if rmds.MetricName != nil { 7649 objectMap["metricName"] = rmds.MetricName 7650 } 7651 if rmds.ResourceURI != nil { 7652 objectMap["resourceUri"] = rmds.ResourceURI 7653 } 7654 if rmds.LegacyResourceID != nil { 7655 objectMap["legacyResourceId"] = rmds.LegacyResourceID 7656 } 7657 if rmds.ResourceLocation != nil { 7658 objectMap["resourceLocation"] = rmds.ResourceLocation 7659 } 7660 if rmds.MetricNamespace != nil { 7661 objectMap["metricNamespace"] = rmds.MetricNamespace 7662 } 7663 if rmds.OdataType != "" { 7664 objectMap["odata.type"] = rmds.OdataType 7665 } 7666 return json.Marshal(objectMap) 7667} 7668 7669// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 7670func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { 7671 return &rmds, true 7672} 7673 7674// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 7675func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { 7676 return nil, false 7677} 7678 7679// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 7680func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { 7681 return nil, false 7682} 7683 7684// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. 7685func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { 7686 return &rmds, true 7687} 7688 7689// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The 7690// discriminator is always RuleWebhookAction in this case. 7691type RuleWebhookAction struct { 7692 // ServiceURI - the service uri to Post the notification when the alert activates or resolves. 7693 ServiceURI *string `json:"serviceUri,omitempty"` 7694 // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. 7695 Properties map[string]*string `json:"properties"` 7696 // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' 7697 OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` 7698} 7699 7700// MarshalJSON is the custom marshaler for RuleWebhookAction. 7701func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { 7702 rwa.OdataType = OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction 7703 objectMap := make(map[string]interface{}) 7704 if rwa.ServiceURI != nil { 7705 objectMap["serviceUri"] = rwa.ServiceURI 7706 } 7707 if rwa.Properties != nil { 7708 objectMap["properties"] = rwa.Properties 7709 } 7710 if rwa.OdataType != "" { 7711 objectMap["odata.type"] = rwa.OdataType 7712 } 7713 return json.Marshal(objectMap) 7714} 7715 7716// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. 7717func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { 7718 return nil, false 7719} 7720 7721// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. 7722func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { 7723 return &rwa, true 7724} 7725 7726// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. 7727func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { 7728 return nil, false 7729} 7730 7731// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. 7732func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { 7733 return &rwa, true 7734} 7735 7736// ScaleAction the parameters for the scaling action. 7737type ScaleAction struct { 7738 // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' 7739 Direction ScaleDirection `json:"direction,omitempty"` 7740 // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ScaleTypeChangeCount', 'ScaleTypePercentChangeCount', 'ScaleTypeExactCount' 7741 Type ScaleType `json:"type,omitempty"` 7742 // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. 7743 Value *string `json:"value,omitempty"` 7744 // 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. 7745 Cooldown *string `json:"cooldown,omitempty"` 7746} 7747 7748// ScaleCapacity the number of instances that can be used during this profile. 7749type ScaleCapacity struct { 7750 // Minimum - the minimum number of instances for the resource. 7751 Minimum *string `json:"minimum,omitempty"` 7752 // 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. 7753 Maximum *string `json:"maximum,omitempty"` 7754 // 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. 7755 Default *string `json:"default,omitempty"` 7756} 7757 7758// ScaleRule a rule that provide the triggers and parameters for the scaling action. 7759type ScaleRule struct { 7760 // MetricTrigger - the trigger that results in a scaling action. 7761 MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` 7762 // ScaleAction - the parameters for the scaling action. 7763 ScaleAction *ScaleAction `json:"scaleAction,omitempty"` 7764} 7765 7766// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. 7767type ScaleRuleMetricDimension struct { 7768 // DimensionName - Name of the dimension. 7769 DimensionName *string `json:"DimensionName,omitempty"` 7770 // 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' 7771 Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` 7772 // Values - list of dimension values. For example: ["App1","App2"]. 7773 Values *[]string `json:"Values,omitempty"` 7774} 7775 7776// Schedule defines how often to run the search and the time interval. 7777type Schedule struct { 7778 // FrequencyInMinutes - frequency (in minutes) at which rule condition should be evaluated. 7779 FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"` 7780 // TimeWindowInMinutes - Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). 7781 TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"` 7782} 7783 7784// ScopedResource a private link scoped resource 7785type ScopedResource struct { 7786 autorest.Response `json:"-"` 7787 // ScopedResourceProperties - Resource properties. 7788 *ScopedResourceProperties `json:"properties,omitempty"` 7789 // ID - READ-ONLY; Azure resource Id 7790 ID *string `json:"id,omitempty"` 7791 // Name - READ-ONLY; Azure resource name 7792 Name *string `json:"name,omitempty"` 7793 // Type - READ-ONLY; Azure resource type 7794 Type *string `json:"type,omitempty"` 7795} 7796 7797// MarshalJSON is the custom marshaler for ScopedResource. 7798func (sr ScopedResource) MarshalJSON() ([]byte, error) { 7799 objectMap := make(map[string]interface{}) 7800 if sr.ScopedResourceProperties != nil { 7801 objectMap["properties"] = sr.ScopedResourceProperties 7802 } 7803 return json.Marshal(objectMap) 7804} 7805 7806// UnmarshalJSON is the custom unmarshaler for ScopedResource struct. 7807func (sr *ScopedResource) UnmarshalJSON(body []byte) error { 7808 var m map[string]*json.RawMessage 7809 err := json.Unmarshal(body, &m) 7810 if err != nil { 7811 return err 7812 } 7813 for k, v := range m { 7814 switch k { 7815 case "properties": 7816 if v != nil { 7817 var scopedResourceProperties ScopedResourceProperties 7818 err = json.Unmarshal(*v, &scopedResourceProperties) 7819 if err != nil { 7820 return err 7821 } 7822 sr.ScopedResourceProperties = &scopedResourceProperties 7823 } 7824 case "id": 7825 if v != nil { 7826 var ID string 7827 err = json.Unmarshal(*v, &ID) 7828 if err != nil { 7829 return err 7830 } 7831 sr.ID = &ID 7832 } 7833 case "name": 7834 if v != nil { 7835 var name string 7836 err = json.Unmarshal(*v, &name) 7837 if err != nil { 7838 return err 7839 } 7840 sr.Name = &name 7841 } 7842 case "type": 7843 if v != nil { 7844 var typeVar string 7845 err = json.Unmarshal(*v, &typeVar) 7846 if err != nil { 7847 return err 7848 } 7849 sr.Type = &typeVar 7850 } 7851 } 7852 } 7853 7854 return nil 7855} 7856 7857// ScopedResourceListResult a list of scoped resources in a private link scope. 7858type ScopedResourceListResult struct { 7859 autorest.Response `json:"-"` 7860 // Value - READ-ONLY; Array of results. 7861 Value *[]ScopedResource `json:"value,omitempty"` 7862 // NextLink - READ-ONLY; Link to retrieve next page of results. 7863 NextLink *string `json:"nextLink,omitempty"` 7864} 7865 7866// MarshalJSON is the custom marshaler for ScopedResourceListResult. 7867func (srlr ScopedResourceListResult) MarshalJSON() ([]byte, error) { 7868 objectMap := make(map[string]interface{}) 7869 return json.Marshal(objectMap) 7870} 7871 7872// ScopedResourceListResultIterator provides access to a complete listing of ScopedResource values. 7873type ScopedResourceListResultIterator struct { 7874 i int 7875 page ScopedResourceListResultPage 7876} 7877 7878// NextWithContext advances to the next value. If there was an error making 7879// the request the iterator does not advance and the error is returned. 7880func (iter *ScopedResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { 7881 if tracing.IsEnabled() { 7882 ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultIterator.NextWithContext") 7883 defer func() { 7884 sc := -1 7885 if iter.Response().Response.Response != nil { 7886 sc = iter.Response().Response.Response.StatusCode 7887 } 7888 tracing.EndSpan(ctx, sc, err) 7889 }() 7890 } 7891 iter.i++ 7892 if iter.i < len(iter.page.Values()) { 7893 return nil 7894 } 7895 err = iter.page.NextWithContext(ctx) 7896 if err != nil { 7897 iter.i-- 7898 return err 7899 } 7900 iter.i = 0 7901 return nil 7902} 7903 7904// Next advances to the next value. If there was an error making 7905// the request the iterator does not advance and the error is returned. 7906// Deprecated: Use NextWithContext() instead. 7907func (iter *ScopedResourceListResultIterator) Next() error { 7908 return iter.NextWithContext(context.Background()) 7909} 7910 7911// NotDone returns true if the enumeration should be started or is not yet complete. 7912func (iter ScopedResourceListResultIterator) NotDone() bool { 7913 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 7914} 7915 7916// Response returns the raw server response from the last page request. 7917func (iter ScopedResourceListResultIterator) Response() ScopedResourceListResult { 7918 return iter.page.Response() 7919} 7920 7921// Value returns the current value or a zero-initialized value if the 7922// iterator has advanced beyond the end of the collection. 7923func (iter ScopedResourceListResultIterator) Value() ScopedResource { 7924 if !iter.page.NotDone() { 7925 return ScopedResource{} 7926 } 7927 return iter.page.Values()[iter.i] 7928} 7929 7930// Creates a new instance of the ScopedResourceListResultIterator type. 7931func NewScopedResourceListResultIterator(page ScopedResourceListResultPage) ScopedResourceListResultIterator { 7932 return ScopedResourceListResultIterator{page: page} 7933} 7934 7935// IsEmpty returns true if the ListResult contains no values. 7936func (srlr ScopedResourceListResult) IsEmpty() bool { 7937 return srlr.Value == nil || len(*srlr.Value) == 0 7938} 7939 7940// hasNextLink returns true if the NextLink is not empty. 7941func (srlr ScopedResourceListResult) hasNextLink() bool { 7942 return srlr.NextLink != nil && len(*srlr.NextLink) != 0 7943} 7944 7945// scopedResourceListResultPreparer prepares a request to retrieve the next set of results. 7946// It returns nil if no more results exist. 7947func (srlr ScopedResourceListResult) scopedResourceListResultPreparer(ctx context.Context) (*http.Request, error) { 7948 if !srlr.hasNextLink() { 7949 return nil, nil 7950 } 7951 return autorest.Prepare((&http.Request{}).WithContext(ctx), 7952 autorest.AsJSON(), 7953 autorest.AsGet(), 7954 autorest.WithBaseURL(to.String(srlr.NextLink))) 7955} 7956 7957// ScopedResourceListResultPage contains a page of ScopedResource values. 7958type ScopedResourceListResultPage struct { 7959 fn func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error) 7960 srlr ScopedResourceListResult 7961} 7962 7963// NextWithContext advances to the next page of values. If there was an error making 7964// the request the page does not advance and the error is returned. 7965func (page *ScopedResourceListResultPage) NextWithContext(ctx context.Context) (err error) { 7966 if tracing.IsEnabled() { 7967 ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultPage.NextWithContext") 7968 defer func() { 7969 sc := -1 7970 if page.Response().Response.Response != nil { 7971 sc = page.Response().Response.Response.StatusCode 7972 } 7973 tracing.EndSpan(ctx, sc, err) 7974 }() 7975 } 7976 for { 7977 next, err := page.fn(ctx, page.srlr) 7978 if err != nil { 7979 return err 7980 } 7981 page.srlr = next 7982 if !next.hasNextLink() || !next.IsEmpty() { 7983 break 7984 } 7985 } 7986 return nil 7987} 7988 7989// Next advances to the next page of values. If there was an error making 7990// the request the page does not advance and the error is returned. 7991// Deprecated: Use NextWithContext() instead. 7992func (page *ScopedResourceListResultPage) Next() error { 7993 return page.NextWithContext(context.Background()) 7994} 7995 7996// NotDone returns true if the page enumeration should be started or is not yet complete. 7997func (page ScopedResourceListResultPage) NotDone() bool { 7998 return !page.srlr.IsEmpty() 7999} 8000 8001// Response returns the raw server response from the last page request. 8002func (page ScopedResourceListResultPage) Response() ScopedResourceListResult { 8003 return page.srlr 8004} 8005 8006// Values returns the slice of values for the current page or nil if there are no values. 8007func (page ScopedResourceListResultPage) Values() []ScopedResource { 8008 if page.srlr.IsEmpty() { 8009 return nil 8010 } 8011 return *page.srlr.Value 8012} 8013 8014// Creates a new instance of the ScopedResourceListResultPage type. 8015func NewScopedResourceListResultPage(cur ScopedResourceListResult, getNextPage func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error)) ScopedResourceListResultPage { 8016 return ScopedResourceListResultPage{ 8017 fn: getNextPage, 8018 srlr: cur, 8019 } 8020} 8021 8022// ScopedResourceProperties properties of a private link scoped resource. 8023type ScopedResourceProperties struct { 8024 // LinkedResourceID - The resource id of the scoped Azure monitor resource. 8025 LinkedResourceID *string `json:"linkedResourceId,omitempty"` 8026 // ProvisioningState - READ-ONLY; State of the private endpoint connection. 8027 ProvisioningState *string `json:"provisioningState,omitempty"` 8028} 8029 8030// MarshalJSON is the custom marshaler for ScopedResourceProperties. 8031func (srp ScopedResourceProperties) MarshalJSON() ([]byte, error) { 8032 objectMap := make(map[string]interface{}) 8033 if srp.LinkedResourceID != nil { 8034 objectMap["linkedResourceId"] = srp.LinkedResourceID 8035 } 8036 return json.Marshal(objectMap) 8037} 8038 8039// SenderAuthorization the authorization used by the user who has performed the operation that led to this 8040// event. This captures the RBAC properties of the event. These usually include the 'action', 'role' and 8041// the 'scope' 8042type SenderAuthorization struct { 8043 // Action - the permissible actions. For instance: microsoft.support/supporttickets/write 8044 Action *string `json:"action,omitempty"` 8045 // Role - the role of the user. For instance: Subscription Admin 8046 Role *string `json:"role,omitempty"` 8047 // Scope - the scope. 8048 Scope *string `json:"scope,omitempty"` 8049} 8050 8051// SingleBaseline the baseline values for a single sensitivity value. 8052type SingleBaseline struct { 8053 // Sensitivity - the sensitivity of the baseline. Possible values include: 'BaselineSensitivityLow', 'BaselineSensitivityMedium', 'BaselineSensitivityHigh' 8054 Sensitivity BaselineSensitivity `json:"sensitivity,omitempty"` 8055 // LowThresholds - The low thresholds of the baseline. 8056 LowThresholds *[]float64 `json:"lowThresholds,omitempty"` 8057 // HighThresholds - The high thresholds of the baseline. 8058 HighThresholds *[]float64 `json:"highThresholds,omitempty"` 8059} 8060 8061// SingleMetricBaseline the baseline results of a single metric. 8062type SingleMetricBaseline struct { 8063 // ID - The metric baseline Id. 8064 ID *string `json:"id,omitempty"` 8065 // Type - The resource type of the metric baseline resource. 8066 Type *string `json:"type,omitempty"` 8067 // Name - The name of the metric for which the baselines were retrieved. 8068 Name *string `json:"name,omitempty"` 8069 // MetricBaselinesProperties - The metric baseline properties of the metric. 8070 *MetricBaselinesProperties `json:"properties,omitempty"` 8071} 8072 8073// MarshalJSON is the custom marshaler for SingleMetricBaseline. 8074func (smb SingleMetricBaseline) MarshalJSON() ([]byte, error) { 8075 objectMap := make(map[string]interface{}) 8076 if smb.ID != nil { 8077 objectMap["id"] = smb.ID 8078 } 8079 if smb.Type != nil { 8080 objectMap["type"] = smb.Type 8081 } 8082 if smb.Name != nil { 8083 objectMap["name"] = smb.Name 8084 } 8085 if smb.MetricBaselinesProperties != nil { 8086 objectMap["properties"] = smb.MetricBaselinesProperties 8087 } 8088 return json.Marshal(objectMap) 8089} 8090 8091// UnmarshalJSON is the custom unmarshaler for SingleMetricBaseline struct. 8092func (smb *SingleMetricBaseline) UnmarshalJSON(body []byte) error { 8093 var m map[string]*json.RawMessage 8094 err := json.Unmarshal(body, &m) 8095 if err != nil { 8096 return err 8097 } 8098 for k, v := range m { 8099 switch k { 8100 case "id": 8101 if v != nil { 8102 var ID string 8103 err = json.Unmarshal(*v, &ID) 8104 if err != nil { 8105 return err 8106 } 8107 smb.ID = &ID 8108 } 8109 case "type": 8110 if v != nil { 8111 var typeVar string 8112 err = json.Unmarshal(*v, &typeVar) 8113 if err != nil { 8114 return err 8115 } 8116 smb.Type = &typeVar 8117 } 8118 case "name": 8119 if v != nil { 8120 var name string 8121 err = json.Unmarshal(*v, &name) 8122 if err != nil { 8123 return err 8124 } 8125 smb.Name = &name 8126 } 8127 case "properties": 8128 if v != nil { 8129 var metricBaselinesProperties MetricBaselinesProperties 8130 err = json.Unmarshal(*v, &metricBaselinesProperties) 8131 if err != nil { 8132 return err 8133 } 8134 smb.MetricBaselinesProperties = &metricBaselinesProperties 8135 } 8136 } 8137 } 8138 8139 return nil 8140} 8141 8142// SmsReceiver an SMS receiver. 8143type SmsReceiver struct { 8144 // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. 8145 Name *string `json:"name,omitempty"` 8146 // CountryCode - The country code of the SMS receiver. 8147 CountryCode *string `json:"countryCode,omitempty"` 8148 // PhoneNumber - The phone number of the SMS receiver. 8149 PhoneNumber *string `json:"phoneNumber,omitempty"` 8150 // Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' 8151 Status ReceiverStatus `json:"status,omitempty"` 8152} 8153 8154// MarshalJSON is the custom marshaler for SmsReceiver. 8155func (sr SmsReceiver) MarshalJSON() ([]byte, error) { 8156 objectMap := make(map[string]interface{}) 8157 if sr.Name != nil { 8158 objectMap["name"] = sr.Name 8159 } 8160 if sr.CountryCode != nil { 8161 objectMap["countryCode"] = sr.CountryCode 8162 } 8163 if sr.PhoneNumber != nil { 8164 objectMap["phoneNumber"] = sr.PhoneNumber 8165 } 8166 return json.Marshal(objectMap) 8167} 8168 8169// Source specifies the log search query. 8170type Source struct { 8171 // Query - Log search query. Required for action type - AlertingAction 8172 Query *string `json:"query,omitempty"` 8173 // AuthorizedResources - List of Resource referred into query 8174 AuthorizedResources *[]string `json:"authorizedResources,omitempty"` 8175 // DataSourceID - The resource uri over which log search query is to be run. 8176 DataSourceID *string `json:"dataSourceId,omitempty"` 8177 // QueryType - Set value to 'ResultCount'. Possible values include: 'QueryTypeResultCount' 8178 QueryType QueryType `json:"queryType,omitempty"` 8179} 8180 8181// SyslogDataSource definition of which syslog data will be collected and how it will be collected. 8182// Only collected from Linux machines. 8183type SyslogDataSource struct { 8184 // Streams - List of streams that this data source will be sent to. 8185 // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. 8186 Streams *[]KnownSyslogDataSourceStreams `json:"streams,omitempty"` 8187 // FacilityNames - The list of facility names. 8188 FacilityNames *[]KnownSyslogDataSourceFacilityNames `json:"facilityNames,omitempty"` 8189 // LogLevels - The log levels to collect. 8190 LogLevels *[]KnownSyslogDataSourceLogLevels `json:"logLevels,omitempty"` 8191 // Name - A friendly name for the data source. 8192 // This name should be unique across all data sources (regardless of type) within the data collection rule. 8193 Name *string `json:"name,omitempty"` 8194} 8195 8196// SystemData metadata pertaining to creation and last modification of the resource. 8197type SystemData struct { 8198 // CreatedBy - The identity that created the resource. 8199 CreatedBy *string `json:"createdBy,omitempty"` 8200 // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' 8201 CreatedByType CreatedByType `json:"createdByType,omitempty"` 8202 // CreatedAt - The timestamp of resource creation (UTC). 8203 CreatedAt *date.Time `json:"createdAt,omitempty"` 8204 // LastModifiedBy - The identity that last modified the resource. 8205 LastModifiedBy *string `json:"lastModifiedBy,omitempty"` 8206 // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' 8207 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` 8208 // LastModifiedAt - The timestamp of resource last modification (UTC) 8209 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` 8210} 8211 8212// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on a 8213// PrivateLinkScope instance. 8214type TagsResource struct { 8215 // Tags - Resource tags 8216 Tags map[string]*string `json:"tags"` 8217} 8218 8219// MarshalJSON is the custom marshaler for TagsResource. 8220func (tr TagsResource) MarshalJSON() ([]byte, error) { 8221 objectMap := make(map[string]interface{}) 8222 if tr.Tags != nil { 8223 objectMap["tags"] = tr.Tags 8224 } 8225 return json.Marshal(objectMap) 8226} 8227 8228// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. 8229type ThresholdRuleCondition struct { 8230 // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' 8231 Operator ConditionOperator `json:"operator,omitempty"` 8232 // Threshold - the threshold value that activates the alert. 8233 Threshold *float64 `json:"threshold,omitempty"` 8234 // 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. 8235 WindowSize *string `json:"windowSize,omitempty"` 8236 // 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' 8237 TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` 8238 // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. 8239 DataSource BasicRuleDataSource `json:"dataSource,omitempty"` 8240 // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' 8241 OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` 8242} 8243 8244// MarshalJSON is the custom marshaler for ThresholdRuleCondition. 8245func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { 8246 trc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition 8247 objectMap := make(map[string]interface{}) 8248 if trc.Operator != "" { 8249 objectMap["operator"] = trc.Operator 8250 } 8251 if trc.Threshold != nil { 8252 objectMap["threshold"] = trc.Threshold 8253 } 8254 if trc.WindowSize != nil { 8255 objectMap["windowSize"] = trc.WindowSize 8256 } 8257 if trc.TimeAggregation != "" { 8258 objectMap["timeAggregation"] = trc.TimeAggregation 8259 } 8260 objectMap["dataSource"] = trc.DataSource 8261 if trc.OdataType != "" { 8262 objectMap["odata.type"] = trc.OdataType 8263 } 8264 return json.Marshal(objectMap) 8265} 8266 8267// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 8268func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { 8269 return &trc, true 8270} 8271 8272// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 8273func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { 8274 return nil, false 8275} 8276 8277// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 8278func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { 8279 return nil, false 8280} 8281 8282// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 8283func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { 8284 return nil, false 8285} 8286 8287// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. 8288func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { 8289 return &trc, true 8290} 8291 8292// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. 8293func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error { 8294 var m map[string]*json.RawMessage 8295 err := json.Unmarshal(body, &m) 8296 if err != nil { 8297 return err 8298 } 8299 for k, v := range m { 8300 switch k { 8301 case "operator": 8302 if v != nil { 8303 var operator ConditionOperator 8304 err = json.Unmarshal(*v, &operator) 8305 if err != nil { 8306 return err 8307 } 8308 trc.Operator = operator 8309 } 8310 case "threshold": 8311 if v != nil { 8312 var threshold float64 8313 err = json.Unmarshal(*v, &threshold) 8314 if err != nil { 8315 return err 8316 } 8317 trc.Threshold = &threshold 8318 } 8319 case "windowSize": 8320 if v != nil { 8321 var windowSize string 8322 err = json.Unmarshal(*v, &windowSize) 8323 if err != nil { 8324 return err 8325 } 8326 trc.WindowSize = &windowSize 8327 } 8328 case "timeAggregation": 8329 if v != nil { 8330 var timeAggregation TimeAggregationOperator 8331 err = json.Unmarshal(*v, &timeAggregation) 8332 if err != nil { 8333 return err 8334 } 8335 trc.TimeAggregation = timeAggregation 8336 } 8337 case "dataSource": 8338 if v != nil { 8339 dataSource, err := unmarshalBasicRuleDataSource(*v) 8340 if err != nil { 8341 return err 8342 } 8343 trc.DataSource = dataSource 8344 } 8345 case "odata.type": 8346 if v != nil { 8347 var odataType OdataTypeBasicRuleCondition 8348 err = json.Unmarshal(*v, &odataType) 8349 if err != nil { 8350 return err 8351 } 8352 trc.OdataType = odataType 8353 } 8354 } 8355 } 8356 8357 return nil 8358} 8359 8360// TimeSeriesBaseline the baseline values for a single time series. 8361type TimeSeriesBaseline struct { 8362 // Aggregation - The aggregation type of the metric. 8363 Aggregation *string `json:"aggregation,omitempty"` 8364 // Dimensions - The dimensions of this time series. 8365 Dimensions *[]MetricSingleDimension `json:"dimensions,omitempty"` 8366 // Timestamps - The list of timestamps of the baselines. 8367 Timestamps *[]date.Time `json:"timestamps,omitempty"` 8368 // Data - The baseline values for each sensitivity. 8369 Data *[]SingleBaseline `json:"data,omitempty"` 8370 // MetadataValues - The baseline metadata values. 8371 MetadataValues *[]BaselineMetadata `json:"metadataValues,omitempty"` 8372} 8373 8374// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. 8375type TimeSeriesElement struct { 8376 // Metadatavalues - the metadata values returned if $filter was specified in the call. 8377 Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` 8378 // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. 8379 Data *[]MetricValue `json:"data,omitempty"` 8380} 8381 8382// TimeWindow a specific date-time for the profile. 8383type TimeWindow struct { 8384 // 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 8385 TimeZone *string `json:"timeZone,omitempty"` 8386 // Start - the start time for the profile in ISO 8601 format. 8387 Start *date.Time `json:"start,omitempty"` 8388 // End - the end time for the profile in ISO 8601 format. 8389 End *date.Time `json:"end,omitempty"` 8390} 8391 8392// TriggerCondition the condition that results in the Log Search rule. 8393type TriggerCondition struct { 8394 // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' 8395 ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` 8396 // Threshold - Result or count threshold based on which rule should be triggered. 8397 Threshold *float64 `json:"threshold,omitempty"` 8398 // MetricTrigger - Trigger condition for metric query rule 8399 MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"` 8400} 8401 8402// VMInsightsOnboardingStatus VM Insights onboarding status for a resource. 8403type VMInsightsOnboardingStatus struct { 8404 autorest.Response `json:"-"` 8405 // VMInsightsOnboardingStatusProperties - Resource properties. 8406 *VMInsightsOnboardingStatusProperties `json:"properties,omitempty"` 8407 // ID - READ-ONLY; Azure resource Id 8408 ID *string `json:"id,omitempty"` 8409 // Name - READ-ONLY; Azure resource name 8410 Name *string `json:"name,omitempty"` 8411 // Type - READ-ONLY; Azure resource type 8412 Type *string `json:"type,omitempty"` 8413} 8414 8415// MarshalJSON is the custom marshaler for VMInsightsOnboardingStatus. 8416func (vios VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { 8417 objectMap := make(map[string]interface{}) 8418 if vios.VMInsightsOnboardingStatusProperties != nil { 8419 objectMap["properties"] = vios.VMInsightsOnboardingStatusProperties 8420 } 8421 return json.Marshal(objectMap) 8422} 8423 8424// UnmarshalJSON is the custom unmarshaler for VMInsightsOnboardingStatus struct. 8425func (vios *VMInsightsOnboardingStatus) UnmarshalJSON(body []byte) error { 8426 var m map[string]*json.RawMessage 8427 err := json.Unmarshal(body, &m) 8428 if err != nil { 8429 return err 8430 } 8431 for k, v := range m { 8432 switch k { 8433 case "properties": 8434 if v != nil { 8435 var VMInsightsOnboardingStatusProperties VMInsightsOnboardingStatusProperties 8436 err = json.Unmarshal(*v, &VMInsightsOnboardingStatusProperties) 8437 if err != nil { 8438 return err 8439 } 8440 vios.VMInsightsOnboardingStatusProperties = &VMInsightsOnboardingStatusProperties 8441 } 8442 case "id": 8443 if v != nil { 8444 var ID string 8445 err = json.Unmarshal(*v, &ID) 8446 if err != nil { 8447 return err 8448 } 8449 vios.ID = &ID 8450 } 8451 case "name": 8452 if v != nil { 8453 var name string 8454 err = json.Unmarshal(*v, &name) 8455 if err != nil { 8456 return err 8457 } 8458 vios.Name = &name 8459 } 8460 case "type": 8461 if v != nil { 8462 var typeVar string 8463 err = json.Unmarshal(*v, &typeVar) 8464 if err != nil { 8465 return err 8466 } 8467 vios.Type = &typeVar 8468 } 8469 } 8470 } 8471 8472 return nil 8473} 8474 8475// VMInsightsOnboardingStatusProperties resource properties. 8476type VMInsightsOnboardingStatusProperties struct { 8477 // ResourceID - Azure Resource Manager identifier of the resource whose onboarding status is being represented. 8478 ResourceID *string `json:"resourceId,omitempty"` 8479 // 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: 'OnboardingStatusOnboarded', 'OnboardingStatusNotOnboarded', 'OnboardingStatusUnknown' 8480 OnboardingStatus OnboardingStatus `json:"onboardingStatus,omitempty"` 8481 // 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: 'DataStatusPresent', 'DataStatusNotPresent' 8482 DataStatus DataStatus `json:"dataStatus,omitempty"` 8483 // Data - Containers that currently store VM Insights data for the specified resource. 8484 Data *[]DataContainer `json:"data,omitempty"` 8485} 8486 8487// VoiceReceiver a voice receiver. 8488type VoiceReceiver struct { 8489 // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. 8490 Name *string `json:"name,omitempty"` 8491 // CountryCode - The country code of the voice receiver. 8492 CountryCode *string `json:"countryCode,omitempty"` 8493 // PhoneNumber - The phone number of the voice receiver. 8494 PhoneNumber *string `json:"phoneNumber,omitempty"` 8495} 8496 8497// WebhookNotification webhook notification of an autoscale event. 8498type WebhookNotification struct { 8499 // ServiceURI - the service address to receive the notification. 8500 ServiceURI *string `json:"serviceUri,omitempty"` 8501 // Properties - a property bag of settings. This value can be empty. 8502 Properties map[string]*string `json:"properties"` 8503} 8504 8505// MarshalJSON is the custom marshaler for WebhookNotification. 8506func (wn WebhookNotification) MarshalJSON() ([]byte, error) { 8507 objectMap := make(map[string]interface{}) 8508 if wn.ServiceURI != nil { 8509 objectMap["serviceUri"] = wn.ServiceURI 8510 } 8511 if wn.Properties != nil { 8512 objectMap["properties"] = wn.Properties 8513 } 8514 return json.Marshal(objectMap) 8515} 8516 8517// WebhookReceiver a webhook receiver. 8518type WebhookReceiver struct { 8519 // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. 8520 Name *string `json:"name,omitempty"` 8521 // ServiceURI - The URI where webhooks should be sent. 8522 ServiceURI *string `json:"serviceUri,omitempty"` 8523 // UseCommonAlertSchema - Indicates whether to use common alert schema. 8524 UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` 8525 // UseAadAuth - Indicates whether or not use AAD authentication. 8526 UseAadAuth *bool `json:"useAadAuth,omitempty"` 8527 // ObjectID - Indicates the webhook app object Id for aad auth. 8528 ObjectID *string `json:"objectId,omitempty"` 8529 // IdentifierURI - Indicates the identifier uri for aad auth. 8530 IdentifierURI *string `json:"identifierUri,omitempty"` 8531 // TenantID - Indicates the tenant id for aad auth. 8532 TenantID *string `json:"tenantId,omitempty"` 8533} 8534 8535// WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource. 8536type WebtestLocationAvailabilityCriteria struct { 8537 // WebTestID - The Application Insights web test Id. 8538 WebTestID *string `json:"webTestId,omitempty"` 8539 // ComponentID - The Application Insights resource Id. 8540 ComponentID *string `json:"componentId,omitempty"` 8541 // FailedLocationCount - The number of failed locations. 8542 FailedLocationCount *float64 `json:"failedLocationCount,omitempty"` 8543 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 8544 AdditionalProperties map[string]interface{} `json:""` 8545 // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' 8546 OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` 8547} 8548 8549// MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria. 8550func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { 8551 wlac.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria 8552 objectMap := make(map[string]interface{}) 8553 if wlac.WebTestID != nil { 8554 objectMap["webTestId"] = wlac.WebTestID 8555 } 8556 if wlac.ComponentID != nil { 8557 objectMap["componentId"] = wlac.ComponentID 8558 } 8559 if wlac.FailedLocationCount != nil { 8560 objectMap["failedLocationCount"] = wlac.FailedLocationCount 8561 } 8562 if wlac.OdataType != "" { 8563 objectMap["odata.type"] = wlac.OdataType 8564 } 8565 for k, v := range wlac.AdditionalProperties { 8566 objectMap[k] = v 8567 } 8568 return json.Marshal(objectMap) 8569} 8570 8571// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. 8572func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { 8573 return nil, false 8574} 8575 8576// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. 8577func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { 8578 return &wlac, true 8579} 8580 8581// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. 8582func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { 8583 return nil, false 8584} 8585 8586// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. 8587func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { 8588 return nil, false 8589} 8590 8591// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. 8592func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { 8593 return &wlac, true 8594} 8595 8596// UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct. 8597func (wlac *WebtestLocationAvailabilityCriteria) UnmarshalJSON(body []byte) error { 8598 var m map[string]*json.RawMessage 8599 err := json.Unmarshal(body, &m) 8600 if err != nil { 8601 return err 8602 } 8603 for k, v := range m { 8604 switch k { 8605 case "webTestId": 8606 if v != nil { 8607 var webTestID string 8608 err = json.Unmarshal(*v, &webTestID) 8609 if err != nil { 8610 return err 8611 } 8612 wlac.WebTestID = &webTestID 8613 } 8614 case "componentId": 8615 if v != nil { 8616 var componentID string 8617 err = json.Unmarshal(*v, &componentID) 8618 if err != nil { 8619 return err 8620 } 8621 wlac.ComponentID = &componentID 8622 } 8623 case "failedLocationCount": 8624 if v != nil { 8625 var failedLocationCount float64 8626 err = json.Unmarshal(*v, &failedLocationCount) 8627 if err != nil { 8628 return err 8629 } 8630 wlac.FailedLocationCount = &failedLocationCount 8631 } 8632 default: 8633 if v != nil { 8634 var additionalProperties interface{} 8635 err = json.Unmarshal(*v, &additionalProperties) 8636 if err != nil { 8637 return err 8638 } 8639 if wlac.AdditionalProperties == nil { 8640 wlac.AdditionalProperties = make(map[string]interface{}) 8641 } 8642 wlac.AdditionalProperties[k] = additionalProperties 8643 } 8644 case "odata.type": 8645 if v != nil { 8646 var odataType OdataTypeBasicMetricAlertCriteria 8647 err = json.Unmarshal(*v, &odataType) 8648 if err != nil { 8649 return err 8650 } 8651 wlac.OdataType = odataType 8652 } 8653 } 8654 } 8655 8656 return nil 8657} 8658 8659// WindowsEventLogDataSource definition of which Windows Event Log events will be collected and how they 8660// will be collected. 8661// Only collected from Windows machines. 8662type WindowsEventLogDataSource struct { 8663 // Streams - List of streams that this data source will be sent to. 8664 // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. 8665 Streams *[]KnownWindowsEventLogDataSourceStreams `json:"streams,omitempty"` 8666 // XPathQueries - A list of Windows Event Log queries in XPATH format. 8667 XPathQueries *[]string `json:"xPathQueries,omitempty"` 8668 // Name - A friendly name for the data source. 8669 // This name should be unique across all data sources (regardless of type) within the data collection rule. 8670 Name *string `json:"name,omitempty"` 8671} 8672 8673// WorkspaceInfo information about a Log Analytics Workspace. 8674type WorkspaceInfo struct { 8675 // ID - Azure Resource Manager identifier of the Log Analytics Workspace. 8676 ID *string `json:"id,omitempty"` 8677 // Location - Location of the Log Analytics workspace. 8678 Location *string `json:"location,omitempty"` 8679 // WorkspaceInfoProperties - Resource properties. 8680 *WorkspaceInfoProperties `json:"properties,omitempty"` 8681} 8682 8683// MarshalJSON is the custom marshaler for WorkspaceInfo. 8684func (wi WorkspaceInfo) MarshalJSON() ([]byte, error) { 8685 objectMap := make(map[string]interface{}) 8686 if wi.ID != nil { 8687 objectMap["id"] = wi.ID 8688 } 8689 if wi.Location != nil { 8690 objectMap["location"] = wi.Location 8691 } 8692 if wi.WorkspaceInfoProperties != nil { 8693 objectMap["properties"] = wi.WorkspaceInfoProperties 8694 } 8695 return json.Marshal(objectMap) 8696} 8697 8698// UnmarshalJSON is the custom unmarshaler for WorkspaceInfo struct. 8699func (wi *WorkspaceInfo) UnmarshalJSON(body []byte) error { 8700 var m map[string]*json.RawMessage 8701 err := json.Unmarshal(body, &m) 8702 if err != nil { 8703 return err 8704 } 8705 for k, v := range m { 8706 switch k { 8707 case "id": 8708 if v != nil { 8709 var ID string 8710 err = json.Unmarshal(*v, &ID) 8711 if err != nil { 8712 return err 8713 } 8714 wi.ID = &ID 8715 } 8716 case "location": 8717 if v != nil { 8718 var location string 8719 err = json.Unmarshal(*v, &location) 8720 if err != nil { 8721 return err 8722 } 8723 wi.Location = &location 8724 } 8725 case "properties": 8726 if v != nil { 8727 var workspaceInfoProperties WorkspaceInfoProperties 8728 err = json.Unmarshal(*v, &workspaceInfoProperties) 8729 if err != nil { 8730 return err 8731 } 8732 wi.WorkspaceInfoProperties = &workspaceInfoProperties 8733 } 8734 } 8735 } 8736 8737 return nil 8738} 8739 8740// WorkspaceInfoProperties resource properties. 8741type WorkspaceInfoProperties struct { 8742 // CustomerID - Log Analytics workspace identifier. 8743 CustomerID *string `json:"customerId,omitempty"` 8744} 8745